|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--superwaba.ext.xplat.io.scanner.Scanner
Scanner accesses the Symbol barcode scanner.
Scanner access is only available when running under a native SuperWaba VM, it is not supported when running under Java.
Since there is only one scanner per device, the scanner class is static. Activating the scanner causes the physical scanner to be powered, and enables the trigger. Deactivating the scanner removes power from the scanner and prevents scans from taking place. The scanner should always be deactivated at the end of processing to prevent excessive battery drain.
When the scanner is activated, scan events will appear in the MainWindow's onEvent method. The scan events will contain a String describing either the item scanned or a battery error. Deactivating the scanner prevents scan events from being delivered.
You can change this behaviour by calling setContinuousScanning(false), which will cause each call to activate() to only allow a single scan.
Since barcodes can have many formats, this class includes a method to register the barcode types with the scanner. These types must each be individually set as parameters to the scanner. After all the parameter types have been set, the commitBarcodeParams method must be called to register the parameters with the scanner. Once this is done the scanner is able to decode the specified barcode types.
A typical processing sequence is given below:
if (!Scanner.active()) return; if (!Scanner.setBarcodeParam(Scanner.BARCODABAR, true)) return; if (!Scanner.setBarcodeParam(Scanner.BARBOOKLAND_EAN, true)) return; if (!Scanner.commitBarcodeParams()) return; ... if (!Scanner.deactivate()) return;
Field Summary | |
static int |
BARBOOKLAND_EAN
To be used in the setBarcodeParam method |
static int |
BARCODABAR
To be used in the setBarcodeParam method |
static int |
BARCODE128
To be used in the setBarcodeParam method |
static int |
BARCODE39
To be used in the setBarcodeParam method |
static int |
BARCODE93
To be used in the setBarcodeParam method |
static int |
BARD2OF5
To be used in the setBarcodeParam method |
static int |
BAREAN13
To be used in the setBarcodeParam method |
static int |
BAREAN8
To be used in the setBarcodeParam method |
static int |
BARI2OF5
To be used in the setBarcodeParam method |
static int |
BARISBT128
To be used in the setBarcodeParam method |
static int |
BARMSI_PLESSEY
To be used in the setBarcodeParam method |
static int |
BARTRIOPTICCODE39
To be used in the setBarcodeParam method |
static int |
BARUCC_EAN128
To be used in the setBarcodeParam method |
static int |
BARUPCA
To be used in the setBarcodeParam method |
static int |
BARUPCE
To be used in the setBarcodeParam method |
static int |
BARUPCE1
To be used in the setBarcodeParam method |
static int |
BARUPCEANCOUPONCODE
To be used in the setBarcodeParam method |
static boolean |
isActive
|
static int |
LINEAR_SECURITY_LEVEL_PARAM
To be used in the setParam method |
static Control |
listener
|
static int |
MSI_PLESSEY_ALGORITHMS_PARAM
To be used in the setParam method |
static int |
MSI_PLESSEY_CHECKDIGIT_PARAM
To be used in the setParam method |
static int |
MSI_PLESSEY_OPTIONS_PARAM
To be used in the setParam method |
static int |
PREAMBLE_PARAM
To be used in the setParam method. |
static int |
SCAN_ANGLE_PARAM
To be used in the setParam method |
static int |
SCAN_DATA_TRANSMISSION_PARAM
To be used in the setParam method |
static int |
SUPPLEMENTALS_PARAM
To be used in the setParam method |
static int |
TRANSMIT_CHECKDIGIT_PARAM
To be used in the setParam method. |
static int |
TRANSMIT_CODEID_PARAM
To be used in the setParam method |
static int |
TRIGGERING_PARAM
To be used in the setParam method |
Constructor Summary | |
Scanner()
|
Method Summary | |
protected static void |
_onEvent(int type)
Dispatch the event to the current listener (associated through the listener public member. |
static boolean |
activate()
Activate the scanner. |
static boolean |
commitBarcodeParams()
Commit the barcode parameters to the scanner. |
static boolean |
deactivate()
Deactivate the scanner. |
static String |
getData()
Get the decoded string of what has been scanned. |
static String |
getScanManagerVersion()
Get the scan manager version as a String. |
static String |
getScanPortDriverVersion()
Get the Scanner Port Driver version as a String. |
static boolean |
setBarcodeLength(int barcodeType,
int lengthType,
int length1,
int length2)
Set the length of a barcode. |
static boolean |
setBarcodeParam(int barcodeType,
boolean enable)
Set a scanner parameter defining whether a barcode format will be used in scanning. |
static void |
setContinuousScanning(boolean continuous)
Set whether activate() will continuously scan (the default), or stop after a single scan. |
static boolean |
setParam(int type,
int barcodeType,
int value)
Set a parameter for the barcode. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
public static final int BARCODE39
public static final int BARUPCA
public static final int BARUPCE
public static final int BAREAN13
public static final int BAREAN8
public static final int BARD2OF5
public static final int BARI2OF5
public static final int BARCODABAR
public static final int BARCODE128
public static final int BARCODE93
public static final int BARMSI_PLESSEY
public static final int BARUPCE1
public static final int BARTRIOPTICCODE39
public static final int BARUCC_EAN128
public static final int BARBOOKLAND_EAN
public static final int BARISBT128
public static final int BARUPCEANCOUPONCODE
public static final int TRIGGERING_PARAM
public static final int LINEAR_SECURITY_LEVEL_PARAM
public static final int SUPPLEMENTALS_PARAM
public static final int TRANSMIT_CHECKDIGIT_PARAM
public static final int PREAMBLE_PARAM
public static final int MSI_PLESSEY_CHECKDIGIT_PARAM
public static final int MSI_PLESSEY_OPTIONS_PARAM
public static final int MSI_PLESSEY_ALGORITHMS_PARAM
public static final int TRANSMIT_CODEID_PARAM
public static final int SCAN_DATA_TRANSMISSION_PARAM
public static final int SCAN_ANGLE_PARAM
public static boolean isActive
public static Control listener
Constructor Detail |
public Scanner()
Method Detail |
public static boolean activate()
public static boolean setBarcodeParam(int barcodeType, boolean enable)
barcodeType
- the type of barcode under considerationenable
- a flag to enable or disable decoding barcodes of this type.public static void setContinuousScanning(boolean continuous)
continuous
- true if activate() continuously scans, false if it will
only schedule a single scanpublic static boolean setParam(int type, int barcodeType, int value)
// triggering modes #define LEVEL 0x00 #define PULSE 0x02 #define HOST 0x08 // Linear code type security #define SECURITY_LEVEL0 0x00 #define SECURITY_LEVEL1 0x01 #define SECURITY_LEVEL2 0x02 #define SECURITY_LEVEL3 0x03 #define SECURITY_LEVEL4 0x04 // UPC/EAN Supplementals #define IGNORE_SUPPLEMENTALS 0x00 #define DECODE_SUPPLEMENTALS 0x01 #define AUTODISCRIMINATE_SUPPLEMENTALS 0x02 // Transmit Check Digit options #define DO_NOT_TRANSMIT_CHECK_DIGIT 0x00 #define TRANSMIT_CHECK_DIGIT 0x01 // Preamble options #define NO_PREAMBLE 0x00 #define SYSTEM_CHARACTER 0x01 #define SYSTEM_CHARACTER_COUNTRY_CODE 0x02 // CheckDigit verification options #define DISABLE_CHECK_DIGIT 0x00 #define USS_CHECK_DIGIT 0x01 #define OPCC_CHECK_DIGIT 0x02 // MSI Plessey checkdigit options #define ONE_CHECK_DIGIT 0x00 #define TWO_CHECK_DIGITS 0x01 // MSI Plessey check digit algorithms #define MOD10_MOD11 0x00 #define MOD10_MOD10 0x01 // Transmit Code ID Character options #define AIM_CODE_ID_CHARACTER 0x01 #define SYMBOL_CODE_ID_CHARACTER 0x02 // Scan data transmission formats #define DATA_AS_IS 0x00 #define DATA_SUFFIX1 0x01 #define DATA_SUFFIX2 0x02 #define DATA_SUFFIX1_SUFFIX2 0x03 #define PREFIX_DATA 0x04 #define PREFIX_DATA_SUFFIX1 0x05 #define PREFIX_DATA_SUFFIX2 0x06 #define PREFIX_DATA_SUFFIX1_SUFFIX2 0x07 // Scan angle options #define SCAN_ANGLE_WIDE 0xB6 #define SCAN_ANGLE_NARROW 0xB5
public static boolean commitBarcodeParams()
public static boolean setBarcodeLength(int barcodeType, int lengthType, int length1, int length2)
// Length types for the barcode SetLengths calls #define ANY_LENGTH 0x00 #define ONE_DISCRETE_LENGTH 0x01 #define TWO_DISCRETE_LENGTHS 0x02 #define LENGTH_WITHIN_RANGE 0x03
public static String getData()
public static String getScanManagerVersion()
public static String getScanPortDriverVersion()
public static boolean deactivate()
protected static void _onEvent(int type)
listener
public member. Called from the native library.
If there are no assigned listeners, the event is sent to the top most window,
and the window is validated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |