blob: 9fa3a87796d248b627420afe1c581b66c33bb344 [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.
//
// MSR.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 MSR
extends BaseJposControl
implements MSRControl114, JposConst
{
//--------------------------------------------------------------------------
// Variables
//--------------------------------------------------------------------------
protected MSRService12 service12;
protected MSRService13 service13;
protected MSRService14 service14;
protected MSRService15 service15;
protected MSRService16 service16;
protected MSRService17 service17;
protected MSRService18 service18;
protected MSRService19 service19;
protected MSRService110 service110;
protected MSRService111 service111;
protected MSRService112 service112;
protected MSRService113 service113;
protected MSRService114 service114;
protected Vector dataListeners;
protected Vector directIOListeners;
protected Vector errorListeners;
protected Vector statusUpdateListeners;
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
public MSR()
{
// Initialize base class instance data
deviceControlDescription = "JavaPOS MSR Device Control";
deviceControlVersion = deviceVersion114;
// Initialize instance data. Initializations are commented out for
// efficiency if the Java default is correct.
//service12 = 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;
dataListeners = new Vector();
directIOListeners = new Vector();
errorListeners = new Vector();
statusUpdateListeners = new Vector();
}
//--------------------------------------------------------------------------
// Capabilities
//--------------------------------------------------------------------------
public boolean getCapISO()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getCapISO();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapJISOne()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getCapJISOne();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapJISTwo()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getCapJISTwo();
}
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");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// 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 getCapTransmitSentinels()
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.5.0
if(serviceVersion < deviceVersion15)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.5.0 compliant.");
}
// Perform the operation
try
{
return service15.getCapTransmitSentinels();
}
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);
}
}
public int getCapWritableTracks()
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.10.0
if(serviceVersion < deviceVersion110)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.10.0 compliant.");
}
// Perform the operation
try
{
return service110.getCapWritableTracks();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getCapCardAuthentication()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCapCardAuthentication();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getCapDataEncryption()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCapDataEncryption();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getCapDeviceAuthentication()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCapDeviceAuthentication();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getCapTrackDataMasking()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCapTrackDataMasking();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
//--------------------------------------------------------------------------
// Properties
//--------------------------------------------------------------------------
public String getAccountNumber()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getAccountNumber();
}
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 service12.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
{
service12.setAutoDisable(autoDisable);
}
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 service12.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 service12.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
{
service12.setDataEventEnabled(dataEventEnabled);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getDecodeData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getDecodeData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setDecodeData(boolean decodeData)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.setDecodeData(decodeData);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getErrorReportingType()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getErrorReportingType();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setErrorReportingType(int errorReportingType)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.setErrorReportingType(errorReportingType);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getExpirationDate()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getExpirationDate();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getFirstName()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getFirstName();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getMiddleInitial()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getMiddleInitial();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getParseDecodeData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getParseDecodeData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setParseDecodeData(boolean parseDecodeData)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.setParseDecodeData(parseDecodeData);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getServiceCode()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getServiceCode();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getSuffix()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getSuffix();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getSurname()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getSurname();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getTitle()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTitle();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack1Data()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTrack1Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack1DiscretionaryData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTrack1DiscretionaryData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack2Data()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTrack2Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack2DiscretionaryData()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTrack2DiscretionaryData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack3Data()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTrack3Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTracksToRead()
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
return service12.getTracksToRead();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setTracksToRead(int tracksToRead)
throws JposException
{
// Make sure control is opened
if(!bOpen)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened");
}
// Perform the operation
try
{
service12.setTracksToRead(tracksToRead);
}
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");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// 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");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// 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");
}
// Make sure service supports at least version 1.3.0
if(serviceVersion < deviceVersion13)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.3.0 compliant.");
}
// 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 byte[] getTrack4Data()
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.5.0
if(serviceVersion < deviceVersion15)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.5.0 compliant.");
}
// Perform the operation
try
{
return service15.getTrack4Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getTransmitSentinels()
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.5.0
if(serviceVersion < deviceVersion15)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.5.0 compliant.");
}
// Perform the operation
try
{
return service15.getTransmitSentinels();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setTransmitSentinels(boolean transmitSentinels)
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.5.0
if(serviceVersion < deviceVersion15)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.5.0 compliant.");
}
// Perform the operation
try
{
service15.setTransmitSentinels(transmitSentinels);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getEncodingMaxLength()
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.10.0
if(serviceVersion < deviceVersion110)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.10.0 compliant.");
}
// Perform the operation
try
{
return service110.getEncodingMaxLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTracksToWrite()
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.10.0
if(serviceVersion < deviceVersion110)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.10.0 compliant.");
}
// Perform the operation
try
{
return service110.getTracksToWrite();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setTracksToWrite(int tracks)
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.10.0
if(serviceVersion < deviceVersion110)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.10.0 compliant.");
}
// Perform the operation
try
{
service110.setTracksToWrite(tracks);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getAdditionalSecurityInformation()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getAdditionalSecurityInformation();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getCardAuthenticationData()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCardAuthenticationData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getCardAuthenticationDataLength()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCardAuthenticationDataLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getCardPropertyList()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCardPropertyList();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getCardType()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCardType();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getCardTypeList()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getCardTypeList();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getDataEncryptionAlgorithm()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getDataEncryptionAlgorithm();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setDataEncryptionAlgorithm(int encryptAlgorithm)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.setDataEncryptionAlgorithm(encryptAlgorithm);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public boolean getDeviceAuthenticated()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getDeviceAuthenticated();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getDeviceAuthenticationProtocol()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getDeviceAuthenticationProtocol();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack1EncryptedData()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack1EncryptedData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTrack1EncryptedDataLength()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack1EncryptedDataLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack2EncryptedData()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack2EncryptedData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTrack2EncryptedDataLength()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack2EncryptedDataLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack3EncryptedData()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack3EncryptedData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTrack3EncryptedDataLength()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack3EncryptedDataLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public byte[] getTrack4EncryptedData()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack4EncryptedData();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public int getTrack4EncryptedDataLength()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getTrack4EncryptedDataLength();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public String getWriteCardType()
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
return service112.getWriteCardType();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void setWriteCardType(String cardType)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.setWriteCardType(cardType);
}
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
{
service12.clearInput();
}
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);
}
}
public void clearInputProperties()
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.10.0
if(serviceVersion < deviceVersion110)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.10.0 compliant.");
}
// Perform the operation
try
{
service110.clearInputProperties();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void writeTracks(byte[][] data, int timeout)
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.10.0
if(serviceVersion < deviceVersion110)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.10.0 compliant.");
}
// Perform the operation
try
{
service110.writeTracks(data, timeout);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void authenticateDevice(byte[] response)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.authenticateDevice(response);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void deauthenticateDevice(byte[] response)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.deauthenticateDevice(response);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void retrieveCardProperty(String name, String[] value)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.retrieveCardProperty(name, value);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void retrieveDeviceAuthenticationData(byte[] challenge)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.retrieveDeviceAuthenticationData(challenge);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void updateKey(String key, String keyName)
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.12.0
if(serviceVersion < deviceVersion112)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.12.0 compliant.");
}
// Perform the operation
try
{
service112.updateKey(key, keyName);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_FAILURE,
"Unhandled exception from Device Service", e);
}
}
public void retrieveDeviceAuthenticationData(byte[][] challenge)
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.13.0
if(serviceVersion < deviceVersion113)
{
throw new JposException(JPOS_E_NOSERVICE,
"Device Service is not 1.13.0 compliant.");
}
// Perform the operation
try
{
service113.retrieveDeviceAuthenticationData(challenge);
}
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 MSRCallbacks();
}
// 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)
{
service12 = 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 >= deviceVersion12)
{
try
{
service12 = (MSRService12)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService12 interface",
e);
}
}
if(serviceVersion >= deviceVersion13)
{
try
{
service13 = (MSRService13)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService13 interface",
e);
}
}
if(serviceVersion >= deviceVersion14)
{
try
{
service14 = (MSRService14)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService14 interface",
e);
}
}
if(serviceVersion >= deviceVersion15)
{
try
{
service15 = (MSRService15)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService15 interface",
e);
}
}
if(serviceVersion >= deviceVersion16)
{
try
{
service16 = (MSRService16)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService16 interface",
e);
}
}
if(serviceVersion >= deviceVersion17)
{
try
{
service17 = (MSRService17)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService17 interface",
e);
}
}
if(serviceVersion >= deviceVersion18)
{
try
{
service18 = (MSRService18)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService18 interface",
e);
}
}
if(serviceVersion >= deviceVersion19)
{
try
{
service19 = (MSRService19)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService19 interface",
e);
}
}
if(serviceVersion >= deviceVersion110)
{
try
{
service110 = (MSRService110)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService110 interface",
e);
}
}
if(serviceVersion >= deviceVersion111)
{
try
{
service111 = (MSRService111)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService111 interface",
e);
}
}
if(serviceVersion >= deviceVersion112)
{
try
{
service112 = (MSRService112)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService112 interface",
e);
}
}
if(serviceVersion >= deviceVersion113)
{
try
{
service113 = (MSRService113)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService113 interface",
e);
}
}
if(serviceVersion >= deviceVersion114)
{
try
{
service114 = (MSRService114)service;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement MSRService114 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 MSRCallbacks
implements EventCallbacks
{
public BaseControl getEventSource()
{
return (BaseControl)MSR.this;
}
public void fireDataEvent(DataEvent e)
{
synchronized(MSR.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(MSR.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(MSR.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(MSR.this.statusUpdateListeners)
{
// deliver the event to all registered listeners
for(int x = 0; x < statusUpdateListeners.size(); x++)
{
((StatusUpdateListener)statusUpdateListeners.elementAt(x)).statusUpdateOccurred(e);
}
}
}
}
}