jpos.PointCardRW Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javapos-controls Show documentation
Show all versions of javapos-controls Show documentation
JavaPOS Device Controls Library
//////////////////////////////////////////////////////////////////////
//
// The JavaPOS library source code is now under the CPL license, which
// is an OSS Apache-like license. The complete license is located at:
// http://www.ibm.com/developerworks/library/os-cpl.html
//
//////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------------
//
// 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.
//
// PointCardRW.java - A JavaPOS 1.6.0 device control
//
//------------------------------------------------------------------------------
package jpos;
import jpos.events.*;
import jpos.services.*;
import java.util.Vector;
import jpos.loader.*;
public class PointCardRW
implements PointCardRWControl16, JposConst
{
//--------------------------------------------------------------------------
// Variables
//--------------------------------------------------------------------------
// Static Data
protected static final String deviceControlDescription =
"JavaPOS PointCardRW Device Control";
protected static final int deviceControlVersion = 1006000; // 1.6.0
protected static final int deviceVersion15 = 1005000; // 1.5.0
protected static final int deviceVersion16 = 1006000; // 1.6.0
// Instance Data
protected JposServiceConnection serviceConnection;
protected int serviceVersion;
protected PointCardRWService15 service15;
protected PointCardRWService16 service16;
protected Vector dataListeners;
protected Vector directIOListeners;
protected Vector errorListeners;
protected Vector outputCompleteListeners;
protected Vector statusUpdateListeners;
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
public PointCardRW()
{
serviceConnection = null;
service15 = null;
service16 = null;
dataListeners = new Vector();
directIOListeners = new Vector();
errorListeners = new Vector();
outputCompleteListeners = new Vector();
statusUpdateListeners = new Vector();
}
//--------------------------------------------------------------------------
// Capabilities
//--------------------------------------------------------------------------
public boolean getCapBold()
throws JposException
{
try
{
return service15.getCapBold();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getCapCardEntranceSensor()
throws JposException
{
try
{
return service15.getCapCardEntranceSensor();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getCapCharacterSet()
throws JposException
{
try
{
return service15.getCapCharacterSet();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapCleanCard()
throws JposException
{
try
{
return service15.getCapCleanCard();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapClearPrint()
throws JposException
{
try
{
return service15.getCapClearPrint();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapDhigh()
throws JposException
{
try
{
return service15.getCapDhigh();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapDwide()
throws JposException
{
try
{
return service15.getCapDwide();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapDwideDhigh()
throws JposException
{
try
{
return service15.getCapDwideDhigh();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapItalic()
throws JposException
{
try
{
return service15.getCapItalic();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapLeft90()
throws JposException
{
try
{
return service15.getCapLeft90();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getCapPowerReporting()
throws JposException
{
try
{
return service15.getCapPowerReporting();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapPrint()
throws JposException
{
try
{
return service15.getCapPrint();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapPrintMode()
throws JposException
{
try
{
return service15.getCapPrintMode();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapRight90()
throws JposException
{
try
{
return service15.getCapRight90();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getCapRotate180()
throws JposException
{
try
{
return service15.getCapRotate180();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getCapTracksToRead()
throws JposException
{
try
{
return service15.getCapTracksToRead();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getCapTracksToWrite()
throws JposException
{
try
{
return service15.getCapTracksToWrite();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
//--------------------------------------------------------------------------
// Properties
//--------------------------------------------------------------------------
public String getCheckHealthText()
throws JposException
{
try
{
return service15.getCheckHealthText();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getClaimed()
throws JposException
{
try
{
return service15.getClaimed();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getDeviceControlDescription()
{
return deviceControlDescription;
}
public int getDeviceControlVersion()
{
return deviceControlVersion;
}
public boolean getDeviceEnabled()
throws JposException
{
try
{
return service15.getDeviceEnabled();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setDeviceEnabled(boolean deviceEnabled)
throws JposException
{
try
{
service15.setDeviceEnabled(deviceEnabled);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getDeviceServiceDescription()
throws JposException
{
try
{
return service15.getDeviceServiceDescription();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getDeviceServiceVersion()
throws JposException
{
try
{
return service15.getDeviceServiceVersion();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getFreezeEvents()
throws JposException
{
try
{
return service15.getFreezeEvents();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setFreezeEvents(boolean freezeEvents)
throws JposException
{
try
{
service15.setFreezeEvents(freezeEvents);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getPhysicalDeviceDescription()
throws JposException
{
try
{
return service15.getPhysicalDeviceDescription();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getPhysicalDeviceName()
throws JposException
{
try
{
return service15.getPhysicalDeviceName();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getState()
{
try
{
return service15.getState();
}
catch(Exception e)
{
return JPOS_S_CLOSED;
}
}
public int getCardState()
throws JposException
{
try
{
return service15.getCardState();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getCharacterSet()
throws JposException
{
try
{
return service15.getCharacterSet();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setCharacterSet(int charSet)
throws JposException
{
try
{
service15.setCharacterSet(charSet);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getCharacterSetList()
throws JposException
{
try
{
return service15.getCharacterSetList();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getDataCount()
throws JposException
{
try
{
return service15.getDataCount();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public boolean getDataEventEnabled()
throws JposException
{
try
{
return service15.getDataEventEnabled();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setDataEventEnabled(boolean dataEventEnabled)
throws JposException
{
try
{
service15.setDataEventEnabled(dataEventEnabled);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getFontTypeFaceList()
throws JposException
{
try
{
return service15.getFontTypeFaceList();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getLineChars()
throws JposException
{
try
{
return service15.getLineChars();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setLineChars(int lineChars)
throws JposException
{
try
{
service15.setLineChars(lineChars);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getLineCharsList()
throws JposException
{
try
{
return service15.getLineCharsList();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getLineHeight()
throws JposException
{
try
{
return service15.getLineHeight();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setLineHeight(int lineHeight)
throws JposException
{
try
{
service15.setLineHeight(lineHeight);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getLineSpacing()
throws JposException
{
try
{
return service15.getLineSpacing();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setLineSpacing(int lineSpacing)
throws JposException
{
try
{
service15.setLineSpacing(lineSpacing);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getLineWidth()
throws JposException
{
try
{
return service15.getLineWidth();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getMapMode()
throws JposException
{
try
{
return service15.getMapMode();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setMapMode(int mapMode)
throws JposException
{
try
{
service15.setMapMode(mapMode);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getMaxLines()
throws JposException
{
try
{
return service15.getMaxLines();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getOutputID()
throws JposException
{
try
{
return service15.getOutputID();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getPowerNotify()
throws JposException
{
try
{
return service15.getPowerNotify();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setPowerNotify(int powerNotify)
throws JposException
{
try
{
service15.setPowerNotify(powerNotify);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getPowerState()
throws JposException
{
try
{
return service15.getPowerState();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getPrintHeight()
throws JposException
{
try
{
return service15.getPrintHeight();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getReadState1()
throws JposException
{
try
{
return service15.getReadState1();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getReadState2()
throws JposException
{
try
{
return service15.getReadState2();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getRecvLength1()
throws JposException
{
try
{
return service15.getRecvLength1();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getRecvLength2()
throws JposException
{
try
{
return service15.getRecvLength2();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getSidewaysMaxChars()
throws JposException
{
try
{
return service15.getSidewaysMaxChars();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getSidewaysMaxLines()
throws JposException
{
try
{
return service15.getSidewaysMaxLines();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getTracksToRead()
throws JposException
{
try
{
return service15.getTracksToRead();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setTracksToRead(int tracksToRead)
throws JposException
{
try
{
service15.setTracksToRead(tracksToRead);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getTracksToWrite()
throws JposException
{
try
{
return service15.getTracksToWrite();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setTracksToWrite(int tracksToWrite)
throws JposException
{
try
{
service15.setTracksToWrite(tracksToWrite);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getTrack1Data()
throws JposException
{
try
{
return service15.getTrack1Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getTrack2Data()
throws JposException
{
try
{
return service15.getTrack2Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getTrack3Data()
throws JposException
{
try
{
return service15.getTrack3Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getTrack4Data()
throws JposException
{
try
{
return service15.getTrack4Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getTrack5Data()
throws JposException
{
try
{
return service15.getTrack5Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getTrack6Data()
throws JposException
{
try
{
return service15.getTrack6Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getWriteState1()
throws JposException
{
try
{
return service15.getWriteState1();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public int getWriteState2()
throws JposException
{
try
{
return service15.getWriteState2();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getWrite1Data()
throws JposException
{
try
{
return service15.getWrite1Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setWrite1Data(String data)
throws JposException
{
try
{
service15.setWrite1Data(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getWrite2Data()
throws JposException
{
try
{
return service15.getWrite2Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setWrite2Data(String data)
throws JposException
{
try
{
service15.setWrite2Data(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getWrite3Data()
throws JposException
{
try
{
return service15.getWrite3Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setWrite3Data(String data)
throws JposException
{
try
{
service15.setWrite3Data(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getWrite4Data()
throws JposException
{
try
{
return service15.getWrite4Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setWrite4Data(String data)
throws JposException
{
try
{
service15.setWrite4Data(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getWrite5Data()
throws JposException
{
try
{
return service15.getWrite5Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setWrite5Data(String data)
throws JposException
{
try
{
service15.setWrite5Data(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public String getWrite6Data()
throws JposException
{
try
{
return service15.getWrite6Data();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void setWrite6Data(String data)
throws JposException
{
try
{
service15.setWrite6Data(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
//--------------------------------------------------------------------------
// Methods
//--------------------------------------------------------------------------
public void claim(int timeout)
throws JposException
{
try
{
service15.claim(timeout);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public synchronized void close()
throws JposException
{
try
{
service15.close();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED,
"Service not open",
e);
}
try
{
serviceConnection.disconnect();
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Unable to free service connection",
e);
}
finally
{
service15 = null;
service16 = null;
}
}
public void checkHealth(int level)
throws JposException
{
try
{
service15.checkHealth(level);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void directIO(int command, int[] data, Object object)
throws JposException
{
try
{
service15.directIO(command, data, object);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public synchronized void open(String logicalDeviceName)
throws JposException
{
// Make sure the control is not already open
if(service15 != null)
{
throw new JposException(JPOS_E_ILLEGAL,
"Device control already open");
}
// Use JCL to get a connection to the device service
try
{
serviceConnection = JposServiceLoader.findService(logicalDeviceName);
serviceConnection.connect();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Could not connect to service",
e);
}
// Get an instance of the minimum service level supported
try
{
service15 = (PointCardRWService15)serviceConnection.getService();
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Could not get service instance",
e);
}
// Get service version
try
{
serviceVersion = service15.getDeviceServiceVersion();
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Could not get service version information",
e);
}
// Make sure that the service actually conforms to the interfaces it
// claims to.
if(serviceVersion >= deviceVersion16)
{
try
{
service16 = (PointCardRWService16)service15;
}
catch(Exception e)
{
throw new JposException(JPOS_E_NOSERVICE,
"Service does not fully implement PointCardRWDevice16 interface",
e);
}
}
// Create callback subclass and attach it to the device service
PointCardRWCallbacks callbacks = this.new PointCardRWCallbacks();
service15.open(logicalDeviceName, callbacks);
}
public void release()
throws JposException
{
try
{
service15.release();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void beginInsertion(int timeout)
throws JposException
{
try
{
service15.beginInsertion(timeout);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void beginRemoval(int timeout)
throws JposException
{
try
{
service15.beginRemoval(timeout);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void cleanCard()
throws JposException
{
try
{
service15.cleanCard();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void clearInput()
throws JposException
{
try
{
service15.clearInput();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void clearOutput()
throws JposException
{
try
{
service15.clearOutput();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void clearPrintWrite(int kind, int hPosition, int vPosition, int width, int height)
throws JposException
{
try
{
service15.clearPrintWrite(kind, hPosition, vPosition, width, height);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void endInsertion()
throws JposException
{
try
{
service15.endInsertion();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void endRemoval()
throws JposException
{
try
{
service15.endRemoval();
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void printWrite(int kind, int hPosition, int vPosition, String data)
throws JposException
{
try
{
service15.printWrite(kind, hPosition, vPosition, data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void rotatePrint(int rotation)
throws JposException
{
try
{
service15.rotatePrint(rotation);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", e);
}
}
public void validateData(String data)
throws JposException
{
try
{
service15.validateData(data);
}
catch(JposException je)
{
throw je;
}
catch(Exception e)
{
throw new JposException(JPOS_E_CLOSED, "Control not opened", 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 PointCardRWCallbacks implements EventCallbacks
{
public BaseControl getEventSource()
{
return (BaseControl)PointCardRW.this;
}
public void fireDataEvent(DataEvent e)
{
synchronized(PointCardRW.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(PointCardRW.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(PointCardRW.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(PointCardRW.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(PointCardRW.this.statusUpdateListeners)
{
// deliver the event to all registered listeners
for(int x = 0; x < statusUpdateListeners.size(); x++)
{
((StatusUpdateListener)statusUpdateListeners.elementAt(x)).statusUpdateOccurred(e);
}
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy