|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sap.ip.me.api.pios.connection.Connection
com.sap.ip.me.api.pios.scanner.ScannerConnection
ScannerConnection defines a connection (session) with a specific scanner. Scanner readings are executed and results are returned within the context of a connection. It includes methods to be called to activate the scanner laser programmatically or to activate the scanner and wait for a trigger to be pulled and read some data.
Example: Reading barcodes using WEDGE mode.Description: Set scanner parameters, open a scanner connection and start reading via wedge mode.
Connector connector = Connector.getInstance();
DriverInfo[] scanners = connector.listDrivers(ConnectionType.SCANNER);
ScannerParameters parameters = new ScannerParameters(scanners[0]);
parameters.setMode(ScannerParameters.WEDGE);
ScannerConnection scanner = (ScannerConnection) connector.open(parameters);
scanner.addSymbology(new Code39(Code39.FULLASCII));
scanner.startRead(); //This will start wedge mode scanning
//Add some code here to keep scanning until needed.
scanner.endRead(); //This will stop wedge mode scanning
scanner.close();
To determine if a required scanner functionality is provided by a driver use a DriverInfo instance provided by the connector.
Example: Determine is a scanner supports wedge mode.
Connector connector = Connector.getInstance();
DriverInfo[] scanners = connector.listDrivers(ConnectionType.SCANNER);
if (scanners[0].isAttributeSupported(ScannerConnection.Attributes.WEDGE_MODE)) {
//Add some code here
}
Connection
,
PIOSException
,
ScannerListener
,
ScannerException
Nested Class Summary | |
static interface |
ScannerConnection.Attributes
Contains all possible attribute names for the scanner. |
Field Summary | |
static long |
BEEP_OFF
Constant to indicate beep off option. |
static long |
BEEP_ON_FAIL
Constant to indicate beep on fail option. |
static long |
BEEP_ON_READ
Constant to indicate beep on read option. |
static long |
UPC_EAN_ADDON_DIGITS_REQUIRED
Constant to indicate that add-on digits are required for UPC/EAN symbologies. |
static long |
UPC_EAN_FIVE_DIGIT_ADDON
Constant to indicate the five digit addon option for UPC/EAN symbologies. |
static long |
UPC_EAN_TWO_DIGIT_ADDON
Constant to indicate the two digit addon option for UPC/EAN symbologies. |
Fields inherited from class com.sap.ip.me.api.pios.connection.Connection |
attributesFileName, cfgFile, opened, parameters |
Constructor Summary | |
protected |
ScannerConnection()
Constructs a new scanner connection. |
Method Summary | |
abstract void |
addSymbology(Symbology symbology)
Adds a symbology (and its options/preferences) to be read by the scanner. |
abstract void |
endRead()
Cancels a previous StartRead request. |
abstract long |
getOptions()
Returns the scanner options mask. |
abstract byte[] |
getPostamble()
Returns the scanner postamble. |
abstract byte[] |
getPreamble()
Returns the scanner preamble. |
abstract java.util.Enumeration |
getSymbologies()
Returns an enumeration of the symbologies added. |
abstract void |
removeSymbology(int symbologyType)
Removes a symbology type from the list of symbologies to be read by the scanner. |
abstract void |
setEventListener(ScannerListener listener)
Sets an event listener for the scanner. |
abstract void |
setOptions(long options)
Sets the scanner options mask. |
abstract void |
setPostamble(byte[] postamble)
Sets the scanner postamble. |
abstract void |
setPreamble(byte[] preamble)
Sets the scanner preamble. |
abstract void |
setSoftTrigger(boolean enabled)
Sets the scan engine laser beam to an On/Off position. |
abstract void |
startRead()
Enables the scanner to read barcodes. |
Methods inherited from class com.sap.ip.me.api.pios.connection.Connection |
close, getParameters, isOpen, open |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long BEEP_ON_READ
public static final long BEEP_ON_FAIL
public static final long BEEP_OFF
public static final long UPC_EAN_TWO_DIGIT_ADDON
public static final long UPC_EAN_FIVE_DIGIT_ADDON
public static final long UPC_EAN_ADDON_DIGITS_REQUIRED
Constructor Detail |
protected ScannerConnection() throws PIOSException
PIOSException
- thrown if an error is detected while creating/
opening the scanner connection.Method Detail |
public abstract void setEventListener(ScannerListener listener) throws ScannerException
listener
- the scanner listener
ScannerException
- thrown if scanner wedge mode option was
selected for this connection or if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent calls
to the endRead method were made.public abstract void setSoftTrigger(boolean enabled) throws UnsupportedException, ScannerException
enabled
- value of scanner laser beam (true
if On, false
otherwise)
UnsupportedException
- thrown if enabling or disabling the laser bean is not supported
by the scanner driver
ScannerException
- thrown if a successful startRead call do not
occur before using this function or if an error occurs while communicating
with the scanner.public abstract void startRead() throws ScannerException
ScannerException
- thrown if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent calls
to the endRead method were made. Also if an error occurs while configuring
the scanner symbologies or options. If no event listener has been set
when the connection mode is scan aware an exception will be thrown.
If an error occurs while communicating with the scanner an exception
will be thrown.public abstract void endRead() throws ScannerException
ScannerException
- thrown if an error occurs while communicating
with the scanner.public abstract void addSymbology(Symbology symbology) throws ScannerException, UnsupportedException
symbology
- the symbology to be read by the scanner
ScannerException
- thrown if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent
calls to the endRead method were made or if the symbology has been previously added.
UnsupportedException
- thrown if the symbology (or its options)
are unsupported by the scanner.Symbology
public abstract void removeSymbology(int symbologyType) throws ScannerException
symbologyType
- the symbology type to remove
ScannerException
- thrown if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent calls
to the endRead method were made or if the symbology has not been previously added.Symbology
public abstract java.util.Enumeration getSymbologies() throws ScannerException
ScannerException
- thrown if an error occurs while communicating
with the scanner.Enumeration
public abstract byte[] getPreamble() throws ScannerException
ScannerException
- thrown if an error occurs while communicating
with the scanner.public abstract byte[] getPostamble() throws ScannerException
ScannerException
- thrown if an error occurs while communicating
with the scanner.public abstract void setPreamble(byte[] preamble) throws ScannerException
preamble
- the byte array containing the preamble value to configure
ScannerException
- thrown if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent calls
to the endRead method were made .public abstract void setPostamble(byte[] postamble) throws ScannerException
postamble
- the byte array containing the postamble value to configure
ScannerException
- thrown if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent calls
to the endRead method were made.public abstract long getOptions() throws ScannerException
ScannerException
- thrown if an error occurs while communicating
with the scanner.public abstract void setOptions(long options) throws ScannerException, UnsupportedException
options
- the scanner options mask
ScannerException
- thrown if a callback function is being processed
due to a successful non-blocking call to startRead and no subsequent calls
to the endRead method were made.
UnsupportedException
- thrown if the scanner options are
unsupported by the scanner.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |