| //------------------------------------------------------------------------------ |
| // |
| // This software is provided "AS IS". The JavaPOS working group (including |
| // each of the Corporate members, contributors and individuals) MAKES NO |
| // REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, |
| // EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED |
| // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| // NON-INFRINGEMENT. The JavaPOS working group shall not be liable for |
| // any damages suffered as a result of using, modifying or distributing this |
| // software or its derivatives.Permission to use, copy, modify, and distribute |
| // the software and its documentation for any purpose is hereby granted. |
| // |
| // BumpBar.java - A JavaPOS 1.14.0 device control |
| // |
| //------------------------------------------------------------------------------ |
| |
| package jpos; |
| |
| import jpos.events.*; |
| import jpos.services.*; |
| import java.util.Vector; |
| import jpos.loader.*; |
| |
| public class BumpBar |
| extends BaseJposControl |
| implements BumpBarControl114, JposConst |
| { |
| //-------------------------------------------------------------------------- |
| // Variables |
| //-------------------------------------------------------------------------- |
| |
| protected BumpBarService13 service13; |
| protected BumpBarService14 service14; |
| protected BumpBarService15 service15; |
| protected BumpBarService16 service16; |
| protected BumpBarService17 service17; |
| protected BumpBarService18 service18; |
| protected BumpBarService19 service19; |
| protected BumpBarService110 service110; |
| protected BumpBarService111 service111; |
| protected BumpBarService112 service112; |
| protected BumpBarService113 service113; |
| protected BumpBarService114 service114; |
| protected Vector dataListeners; |
| protected Vector directIOListeners; |
| protected Vector errorListeners; |
| protected Vector outputCompleteListeners; |
| protected Vector statusUpdateListeners; |
| |
| |
| //-------------------------------------------------------------------------- |
| // Constructor |
| //-------------------------------------------------------------------------- |
| |
| public BumpBar() |
| { |
| // Initialize base class instance data |
| deviceControlDescription = "JavaPOS BumpBar Device Control"; |
| deviceControlVersion = deviceVersion114; |
| |
| // Initialize instance data. Initializations are commented out for |
| // efficiency if the Java default is correct. |
| //service13 = null; |
| //service14 = null; |
| //service15 = null; |
| //service16 = null; |
| //service17 = null; |
| //service18 = null; |
| //service19 = null; |
| //service110 = null; |
| //service111 = null; |
| //service112 = null; |
| //service113 = null; |
| //service114 = null; |
| dataListeners = new Vector(); |
| directIOListeners = new Vector(); |
| errorListeners = new Vector(); |
| outputCompleteListeners = new Vector(); |
| statusUpdateListeners = new Vector(); |
| } |
| |
| |
| //-------------------------------------------------------------------------- |
| // Capabilities |
| //-------------------------------------------------------------------------- |
| |
| public int getCapPowerReporting() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getCapPowerReporting(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public boolean getCapTone() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getCapTone(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public boolean getCapStatisticsReporting() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.8.0 |
| if(serviceVersion < deviceVersion18) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.8.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service18.getCapStatisticsReporting(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public boolean getCapUpdateStatistics() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.8.0 |
| if(serviceVersion < deviceVersion18) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.8.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service18.getCapUpdateStatistics(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public boolean getCapCompareFirmwareVersion() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.9.0 |
| if(serviceVersion < deviceVersion19) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.9.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service19.getCapCompareFirmwareVersion(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public boolean getCapUpdateFirmware() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.9.0 |
| if(serviceVersion < deviceVersion19) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.9.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service19.getCapUpdateFirmware(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| |
| //-------------------------------------------------------------------------- |
| // Properties |
| //-------------------------------------------------------------------------- |
| |
| public boolean getAsyncMode() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getAsyncMode(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setAsyncMode(boolean asyncMode) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setAsyncMode(asyncMode); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getAutoToneDuration() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getAutoToneDuration(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setAutoToneDuration(int autoToneDuration) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setAutoToneDuration(autoToneDuration); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getAutoToneFrequency() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getAutoToneFrequency(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setAutoToneFrequency(int autoToneFrequency) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setAutoToneFrequency(autoToneFrequency); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getBumpBarDataCount() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getBumpBarDataCount(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getCurrentUnitID() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getCurrentUnitID(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setCurrentUnitID(int currentUnitID) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setCurrentUnitID(currentUnitID); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getDataCount() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getDataCount(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public boolean getDataEventEnabled() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getDataEventEnabled(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setDataEventEnabled(boolean dataEventEnabled) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setDataEventEnabled(dataEventEnabled); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public String getErrorString() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getErrorString(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getErrorUnits() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getErrorUnits(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public String getEventString() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getEventString(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getEventUnitID() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getEventUnitID(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getEventUnits() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getEventUnits(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getKeys() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getKeys(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getOutputID() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getOutputID(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getPowerNotify() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getPowerNotify(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setPowerNotify(int powerNotify) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setPowerNotify(powerNotify); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getPowerState() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getPowerState(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getTimeout() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getTimeout(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setTimeout(int timeout) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setTimeout(timeout); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public int getUnitsOnline() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| return service13.getUnitsOnline(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| |
| //-------------------------------------------------------------------------- |
| // Methods |
| //-------------------------------------------------------------------------- |
| |
| public void bumpBarSound(int units, int frequency, int duration, int numberOfCycles, int interSoundWait) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.bumpBarSound(units, frequency, duration, numberOfCycles, interSoundWait); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void clearInput() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.clearInput(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void clearOutput() |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.clearOutput(); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void setKeyTranslation(int units, int scanCode, int logicalKey) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service13.setKeyTranslation(units, scanCode, logicalKey); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void resetStatistics(String statisticsBuffer) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.8.0 |
| if(serviceVersion < deviceVersion18) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.8.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service18.resetStatistics(statisticsBuffer); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void retrieveStatistics(String[] statisticsBuffer) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.8.0 |
| if(serviceVersion < deviceVersion18) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.8.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service18.retrieveStatistics(statisticsBuffer); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void updateStatistics(String statisticsBuffer) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.8.0 |
| if(serviceVersion < deviceVersion18) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.8.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service18.updateStatistics(statisticsBuffer); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void compareFirmwareVersion(String firmwareFileName, int[] result) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.9.0 |
| if(serviceVersion < deviceVersion19) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.9.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service19.compareFirmwareVersion(firmwareFileName, result); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| public void updateFirmware(String firmwareFileName) |
| throws JposException |
| { |
| // Make sure control is opened |
| if(!bOpen) |
| { |
| throw new JposException(JPOS_E_CLOSED, "Control not opened"); |
| } |
| |
| // Make sure service supports at least version 1.9.0 |
| if(serviceVersion < deviceVersion19) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Device Service is not 1.9.0 compliant."); |
| } |
| |
| // Perform the operation |
| try |
| { |
| service19.updateFirmware(firmwareFileName); |
| } |
| catch(JposException je) |
| { |
| throw je; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_FAILURE, |
| "Unhandled exception from Device Service", e); |
| } |
| } |
| |
| |
| //-------------------------------------------------------------------------- |
| // Framework Methods |
| //-------------------------------------------------------------------------- |
| |
| // Create an EventCallbacks interface implementation object for this Control |
| protected EventCallbacks createEventCallbacks() |
| { |
| return new BumpBarCallbacks(); |
| } |
| |
| // Store the reference to the Device Service |
| protected void setDeviceService(BaseService service, int nServiceVersion) |
| throws JposException |
| { |
| // Special case: service == null to free references |
| if(service == null) |
| { |
| |
| service13 = null; |
| service14 = null; |
| service15 = null; |
| service16 = null; |
| service17 = null; |
| service18 = null; |
| service19 = null; |
| service110 = null; |
| service111 = null; |
| service112 = null; |
| service113 = null; |
| service114 = null; |
| } |
| else |
| { |
| // Make sure that the service actually conforms to the interfaces it |
| // claims to. |
| if(serviceVersion >= deviceVersion13) |
| { |
| try |
| { |
| service13 = (BumpBarService13)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService13 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion14) |
| { |
| try |
| { |
| service14 = (BumpBarService14)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService14 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion15) |
| { |
| try |
| { |
| service15 = (BumpBarService15)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService15 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion16) |
| { |
| try |
| { |
| service16 = (BumpBarService16)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService16 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion17) |
| { |
| try |
| { |
| service17 = (BumpBarService17)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService17 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion18) |
| { |
| try |
| { |
| service18 = (BumpBarService18)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService18 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion19) |
| { |
| try |
| { |
| service19 = (BumpBarService19)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService19 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion110) |
| { |
| try |
| { |
| service110 = (BumpBarService110)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService110 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion111) |
| { |
| try |
| { |
| service111 = (BumpBarService111)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService111 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion112) |
| { |
| try |
| { |
| service112 = (BumpBarService112)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService112 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion113) |
| { |
| try |
| { |
| service113 = (BumpBarService113)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService113 interface", |
| e); |
| } |
| } |
| |
| if(serviceVersion >= deviceVersion114) |
| { |
| try |
| { |
| service114 = (BumpBarService114)service; |
| } |
| catch(Exception e) |
| { |
| throw new JposException(JPOS_E_NOSERVICE, |
| "Service does not fully implement BumpBarService114 interface", |
| e); |
| } |
| } |
| |
| } |
| } |
| |
| |
| //-------------------------------------------------------------------------- |
| // Event Listener Methods |
| //-------------------------------------------------------------------------- |
| |
| public void addDataListener(DataListener l) |
| { |
| synchronized(dataListeners) |
| { |
| dataListeners.addElement(l); |
| } |
| } |
| |
| public void removeDataListener(DataListener l) |
| { |
| synchronized(dataListeners) |
| { |
| dataListeners.removeElement(l); |
| } |
| } |
| |
| public void addDirectIOListener(DirectIOListener l) |
| { |
| synchronized(directIOListeners) |
| { |
| directIOListeners.addElement(l); |
| } |
| } |
| |
| public void removeDirectIOListener(DirectIOListener l) |
| { |
| synchronized(directIOListeners) |
| { |
| directIOListeners.removeElement(l); |
| } |
| } |
| |
| public void addErrorListener(ErrorListener l) |
| { |
| synchronized(errorListeners) |
| { |
| errorListeners.addElement(l); |
| } |
| } |
| |
| public void removeErrorListener(ErrorListener l) |
| { |
| synchronized(errorListeners) |
| { |
| errorListeners.removeElement(l); |
| } |
| } |
| |
| public void addOutputCompleteListener(OutputCompleteListener l) |
| { |
| synchronized(outputCompleteListeners) |
| { |
| outputCompleteListeners.addElement(l); |
| } |
| } |
| |
| public void removeOutputCompleteListener(OutputCompleteListener l) |
| { |
| synchronized(outputCompleteListeners) |
| { |
| outputCompleteListeners.removeElement(l); |
| } |
| } |
| |
| public void addStatusUpdateListener(StatusUpdateListener l) |
| { |
| synchronized(statusUpdateListeners) |
| { |
| statusUpdateListeners.addElement(l); |
| } |
| } |
| |
| public void removeStatusUpdateListener(StatusUpdateListener l) |
| { |
| synchronized(statusUpdateListeners) |
| { |
| statusUpdateListeners.removeElement(l); |
| } |
| } |
| |
| |
| //-------------------------------------------------------------------------- |
| // EventCallbacks inner class |
| //-------------------------------------------------------------------------- |
| |
| protected class BumpBarCallbacks |
| implements EventCallbacks |
| { |
| public BaseControl getEventSource() |
| { |
| return (BaseControl)BumpBar.this; |
| } |
| |
| public void fireDataEvent(DataEvent e) |
| { |
| synchronized(BumpBar.this.dataListeners) |
| { |
| // deliver the event to all registered listeners |
| for(int x = 0; x < dataListeners.size(); x++) |
| { |
| ((DataListener)dataListeners.elementAt(x)).dataOccurred(e); |
| } |
| } |
| } |
| |
| public void fireDirectIOEvent(DirectIOEvent e) |
| { |
| synchronized(BumpBar.this.directIOListeners) |
| { |
| // deliver the event to all registered listeners |
| for(int x = 0; x < directIOListeners.size(); x++) |
| { |
| ((DirectIOListener)directIOListeners.elementAt(x)).directIOOccurred(e); |
| } |
| } |
| } |
| |
| public void fireErrorEvent(ErrorEvent e) |
| { |
| synchronized(BumpBar.this.errorListeners) |
| { |
| // deliver the event to all registered listeners |
| for(int x = 0; x < errorListeners.size(); x++) |
| { |
| ((ErrorListener)errorListeners.elementAt(x)).errorOccurred(e); |
| } |
| } |
| } |
| |
| public void fireOutputCompleteEvent(OutputCompleteEvent e) |
| { |
| synchronized(BumpBar.this.outputCompleteListeners) |
| { |
| // deliver the event to all registered listeners |
| for(int x = 0; x < outputCompleteListeners.size(); x++) |
| { |
| ((OutputCompleteListener)outputCompleteListeners.elementAt(x)).outputCompleteOccurred(e); |
| } |
| } |
| } |
| |
| public void fireStatusUpdateEvent(StatusUpdateEvent e) |
| { |
| synchronized(BumpBar.this.statusUpdateListeners) |
| { |
| // deliver the event to all registered listeners |
| for(int x = 0; x < statusUpdateListeners.size(); x++) |
| { |
| ((StatusUpdateListener)statusUpdateListeners.elementAt(x)).statusUpdateOccurred(e); |
| } |
| } |
| } |
| } |
| } |