blob: 7ea6ae83241ef0db99804b648bebc3ae33c8b0f1 [file] [log] [blame]
//------------------------------------------------------------------------------
//
// 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.
//
// ImageScanner.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 ImageScanner
extends BaseJposControl
implements ImageScannerControl114, JposConst
{
//--------------------------------------------------------------------------
// Variables
//--------------------------------------------------------------------------
protected ImageScannerService111 service111;
protected ImageScannerService112 service112;
protected ImageScannerService113 service113;
protected ImageScannerService114 service114;
protected Vector dataListeners;
protected Vector directIOListeners;
protected Vector errorListeners;
protected Vector statusUpdateListeners;
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
public ImageScanner()
{
// Initialize base class instance data
deviceControlDescription = "JavaPOS ImageScanner Device Control";
deviceControlVersion = deviceVersion114;
// Initialize instance data. Initializations are commented out for
// efficiency if the Java default is correct.
//service111 = null;
//service112 = null;
//service113 = null;
//service114 = null;
dataListeners = new Vector();
directIOListeners = new Vector();
errorListeners = new Vector();
statusUpdateListeners = new Vector();
}
//--------------------------------------------------------------------------
// Capabilities
//--------------------------------------------------------------------------
public boolean getCapAim()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapAim();
}
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");
}
// Perform the operation
try
{
return service111.getCapCompareFirmwareVersion();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapDecodeData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapDecodeData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapHostTriggered()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapHostTriggered();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapIlluminate()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapIlluminate();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapImageData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapImageData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapImageQuality()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapImageQuality();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
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 service111.getCapPowerReporting();
}
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");
}
// Perform the operation
try
{
return service111.getCapStatisticsReporting();
}
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");
}
// Perform the operation
try
{
return service111.getCapUpdateFirmware();
}
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");
}
// Perform the operation
try
{
return service111.getCapUpdateStatistics();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapVideoData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getCapVideoData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
//--------------------------------------------------------------------------
// Properties
//--------------------------------------------------------------------------
public boolean getAimMode()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getAimMode();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setAimMode(boolean aimMode)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setAimMode(aimMode);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getAutoDisable()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getAutoDisable();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setAutoDisable(boolean autoDisable)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setAutoDisable(autoDisable);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getBitsPerPixel()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getBitsPerPixel();
}
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 service111.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 service111.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
{
service111.setDataEventEnabled(dataEventEnabled);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getFrameData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getFrameData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getFrameType()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getFrameType();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getIlluminateMode()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getIlluminateMode();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setIlluminateMode(boolean illuminateMode)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setIlluminateMode(illuminateMode);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getImageHeight()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getImageHeight();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getImageLength()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getImageLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getImageMode()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getImageMode();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setImageMode(int imageMode)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setImageMode(imageMode);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getImageQuality()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getImageQuality();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setImageQuality(int imageQuality)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setImageQuality(imageQuality);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getImageType()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getImageType();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getImageWidth()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getImageWidth();
}
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 service111.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
{
service111.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 service111.getPowerState();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getVideoCount()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getVideoCount();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setVideoCount(int videoCount)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setVideoCount(videoCount);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getVideoRate()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service111.getVideoRate();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setVideoRate(int videoRate)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.setVideoRate(videoRate);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
//--------------------------------------------------------------------------
// Methods
//--------------------------------------------------------------------------
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
{
service111.clearInput();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void clearInputProperties()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.clearInputProperties();
}
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");
}
// Perform the operation
try
{
service111.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 resetStatistics(String statisticsBuffer)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.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");
}
// Perform the operation
try
{
service111.retrieveStatistics(statisticsBuffer);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void startSession()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.startSession();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void stopSession()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service111.stopSession();
}
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");
}
// Perform the operation
try
{
service111.updateFirmware(firmwareFileName);
}
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");
}
// Perform the operation
try
{
service111.updateStatistics(statisticsBuffer);
}
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 ImageScannerCallbacks();
}
// 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)
{
service111 = null;
service112 = null;
service113 = null;
service114 = null;
}
else
{
// Make sure that the service actually conforms to the interfaces it
// claims to.
if(serviceVersion >= deviceVersion111)
{
try
{
service111 = (ImageScannerService111)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement ImageScannerService111 interface",
e);
}
}
if(serviceVersion >= deviceVersion112)
{
try
{
service112 = (ImageScannerService112)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement ImageScannerService112 interface",
e);
}
}
if(serviceVersion >= deviceVersion113)
{
try
{
service113 = (ImageScannerService113)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement ImageScannerService113 interface",
e);
}
}
if(serviceVersion >= deviceVersion114)
{
try
{
service114 = (ImageScannerService114)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement ImageScannerService114 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 addStatusUpdateListener(StatusUpdateListener l)
{
synchronized(statusUpdateListeners)
{
statusUpdateListeners.addElement(l);
}
}
public void removeStatusUpdateListener(StatusUpdateListener l)
{
synchronized(statusUpdateListeners)
{
statusUpdateListeners.removeElement(l);
}
}
//--------------------------------------------------------------------------
// EventCallbacks inner class
//--------------------------------------------------------------------------
protected class ImageScannerCallbacks
implements EventCallbacks
{
public BaseControl getEventSource()
{
return (BaseControl)ImageScanner.this;
}
public void fireDataEvent(DataEvent e)
{
synchronized(ImageScanner.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(ImageScanner.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(ImageScanner.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)
{
}
public void fireStatusUpdateEvent(StatusUpdateEvent e)
{
synchronized(ImageScanner.this.statusUpdateListeners)
{
// deliver the event to all registered listeners
for(int x = 0; x < statusUpdateListeners.size(); x++)
{
((StatusUpdateListener)statusUpdateListeners.elementAt(x)).statusUpdateOccurred(e);
}
}
}
}
}