scanner.js contains the methods necessary to interact with the scanner device. It also contains the event constants necessary to register for scanner events
Field Summary | |
static int |
BUTTON_ADD
Constant returned to indicate the add button |
static int |
BUTTON_REMOVE
Constant returned to indicate the remove button |
static int |
BUTTON_UNKNOWN
Constant returned to indicate an unknown button |
static int |
CONNECTION_NONE
No Bluetooth connection |
static int |
CONNECTION_RELIABLE
Bluetooth connection is reliable |
static int |
DECODE_SYMBOLOGY_CODABAR
|
static int |
DECODE_SYMBOLOGY_CODE128
|
static int |
DECODE_SYMBOLOGY_CODE39
|
static int |
DECODE_SYMBOLOGY_CODE93
|
static int |
DECODE_SYMBOLOGY_EAN128
|
static int |
DECODE_SYMBOLOGY_EAN13
|
static int |
DECODE_SYMBOLOGY_EAN13_S
|
static int |
DECODE_SYMBOLOGY_EAN8
|
static int |
DECODE_SYMBOLOGY_EAN8_S
|
static int |
DECODE_SYMBOLOGY_ITF
|
static int |
DECODE_SYMBOLOGY_JAN13
|
static int |
DECODE_SYMBOLOGY_JAN8
|
static int |
DECODE_SYMBOLOGY_MAXICODE
|
static int |
DECODE_SYMBOLOGY_OCRA
|
static int |
DECODE_SYMBOLOGY_OCRB
|
static int |
DECODE_SYMBOLOGY_OTHER
|
static int |
DECODE_SYMBOLOGY_PDF417
|
static int |
DECODE_SYMBOLOGY_TF
|
static int |
DECODE_SYMBOLOGY_UNKNOWN
|
static int |
DECODE_SYMBOLOGY_UPCA
|
static int |
DECODE_SYMBOLOGY_UPCA_S
|
static int |
DECODE_SYMBOLOGY_UPCD1
|
static int |
DECODE_SYMBOLOGY_UPCD2
|
static int |
DECODE_SYMBOLOGY_UPCD3
|
static int |
DECODE_SYMBOLOGY_UPCD4
|
static int |
DECODE_SYMBOLOGY_UPCD5
|
static int |
DECODE_SYMBOLOGY_UPCE
|
static int |
DECODE_SYMBOLOGY_UPCE_S
|
static java.lang.String |
EVENT_SCAN
The event constant used to register for the onScan event |
static java.lang.String |
EVENT_SCANNER_CHARGE_CHANGE
The event constant used to register for the onScannerChargeChange event |
static java.lang.String |
EVENT_SCANNER_CONNECTION_CHANGE
The event constant used to register for the onScannerConnectionChange event |
static java.lang.String |
EVENT_SCANNER_ERROR
The event constant used to register for the onScannerError event |
static java.lang.String |
EVENT_SCANNER_HOLSTER_CHANGE
The event constant used to register for the onScannerHolsterChange event |
static int |
SCANNER_LED_COLOR_GREEN
Specify the green scanner LED |
static int |
SCANNER_LED_COLOR_ORANGE
Specify the orange scanner LED |
Method Summary | |
boolean |
defineScannerLED(int index,
int color,
int brightness,
int duration)
Defines a scanner LED sequence |
boolean |
defineScannerTone(int index,
int pitch,
int volume,
int duration)
Define a scanner tone |
java.lang.String |
getAssociatedScanner()
Obtains information about the tablet's currently associated scanner |
java.lang.String |
getHolsteredScanner()
Obtains information about the currently holstered scanner |
java.lang.String |
getScannedData()
Obtains the last data scanned |
int |
getScannedSymbology()
Obtains the symbology information of the last data scanned |
int |
getScannerButtonDown()
Obtains the button that was pressed during the last scanned data event |
int |
getScannerCharge()
Obtains the battery charge of the scanner |
int |
getScannerChargeChangeThreshold()
Obtains the charge change threshold |
int |
getScannerConnectionState()
Obtains the connection state of the Bluetooth scanner |
boolean |
getScannerEnable()
Obtains whether the scanner is enabled or disabled |
void |
onConnectionChange(int state)
This is the prototype for an event. |
void |
onScan(int buttonDown,
java.lang.String data,
int symbology)
This is the prototype for an event. |
void |
onScannerChargeChange(int percent)
This is the prototype for an event. |
void |
onScannerError(java.lang.String description,
int code0,
int code1,
int code2,
int code3,
int code4)
This is the prototype for an event. |
void |
onScannerHolsterChange(java.lang.String scannerId)
This is the prototype for an event. |
void |
playScannerLEDAsync(int index,
int delay,
int repeat)
Plays a previously defined LED sequence. |
void |
playScannerLEDsAsync(int index,
int delay,
int index2,
int delay2,
int repeat)
Plays (mixes) two previously defined LED sequences |
void |
playScannerToneAsync(int index,
int delay,
int repeat)
Plays a previously defined tone. |
void |
playScannerTonesAsync(int index,
int delay,
int index2,
int delay2,
int repeat)
Plays (mixes) two previously defined tones |
boolean |
resetScanner()
Resets the scanner to a set of defaults |
boolean |
setScannerChargeChangeThreshold(int threshold)
Sets the charge change threshold |
boolean |
setScannerEnable(boolean enable)
Enables or disables the scanner |
Field Detail |
public static final int BUTTON_ADD
public static final int BUTTON_REMOVE
public static final int BUTTON_UNKNOWN
public static final java.lang.String EVENT_SCAN
basic.registerForEvent(String)
,
Constant Field Valuespublic static final int DECODE_SYMBOLOGY_UPCA
public static final int DECODE_SYMBOLOGY_UPCE
public static final int DECODE_SYMBOLOGY_JAN8
public static final int DECODE_SYMBOLOGY_EAN8
public static final int DECODE_SYMBOLOGY_JAN13
public static final int DECODE_SYMBOLOGY_EAN13
public static final int DECODE_SYMBOLOGY_TF
public static final int DECODE_SYMBOLOGY_ITF
public static final int DECODE_SYMBOLOGY_CODABAR
public static final int DECODE_SYMBOLOGY_CODE39
public static final int DECODE_SYMBOLOGY_CODE93
public static final int DECODE_SYMBOLOGY_CODE128
public static final int DECODE_SYMBOLOGY_UPCA_S
public static final int DECODE_SYMBOLOGY_UPCE_S
public static final int DECODE_SYMBOLOGY_UPCD1
public static final int DECODE_SYMBOLOGY_UPCD2
public static final int DECODE_SYMBOLOGY_UPCD3
public static final int DECODE_SYMBOLOGY_UPCD4
public static final int DECODE_SYMBOLOGY_UPCD5
public static final int DECODE_SYMBOLOGY_EAN8_S
public static final int DECODE_SYMBOLOGY_EAN13_S
public static final int DECODE_SYMBOLOGY_EAN128
public static final int DECODE_SYMBOLOGY_OCRA
public static final int DECODE_SYMBOLOGY_OCRB
public static final int DECODE_SYMBOLOGY_PDF417
public static final int DECODE_SYMBOLOGY_MAXICODE
public static final int DECODE_SYMBOLOGY_OTHER
public static final int DECODE_SYMBOLOGY_UNKNOWN
public static final java.lang.String EVENT_SCANNER_HOLSTER_CHANGE
basic.registerForEvent(String)
,
Constant Field Valuespublic static final int CONNECTION_NONE
public static final int CONNECTION_RELIABLE
public static final java.lang.String EVENT_SCANNER_CONNECTION_CHANGE
basic.registerForEvent(String)
,
Constant Field Valuespublic static final java.lang.String EVENT_SCANNER_ERROR
basic.registerForEvent(String)
,
Constant Field Valuespublic static final java.lang.String EVENT_SCANNER_CHARGE_CHANGE
basic.registerForEvent(String)
,
Constant Field Valuespublic static final int SCANNER_LED_COLOR_GREEN
defineScannerLED(int, int, int, int)
,
Constant Field Valuespublic static final int SCANNER_LED_COLOR_ORANGE
defineScannerLED(int, int, int, int)
,
Constant Field ValuesMethod Detail |
public void onScan(int buttonDown, java.lang.String data, int symbology)
buttonDown
- The button that was depressed during the scandata
- The plain text barcode data received by the scannersymbology
- A integer constant in the DECODE_SYMBOLOGY family indicating which type of barcode was decodedEVENT_SCAN
,
BUTTON_ADD
,
BUTTON_REMOVE
,
BUTTON_UNKNOWN
,
DECODE_SYMBOLOGY_UPCA
,
DECODE_SYMBOLOGY_UPCE
,
DECODE_SYMBOLOGY_JAN8
,
DECODE_SYMBOLOGY_EAN8
,
DECODE_SYMBOLOGY_JAN13
,
DECODE_SYMBOLOGY_EAN13
,
DECODE_SYMBOLOGY_TF
,
DECODE_SYMBOLOGY_ITF
,
DECODE_SYMBOLOGY_CODABAR
,
DECODE_SYMBOLOGY_CODE39
,
DECODE_SYMBOLOGY_CODE93
,
DECODE_SYMBOLOGY_CODE128
,
DECODE_SYMBOLOGY_UPCA_S
,
DECODE_SYMBOLOGY_UPCE_S
,
DECODE_SYMBOLOGY_UPCD1
,
DECODE_SYMBOLOGY_UPCD2
,
DECODE_SYMBOLOGY_UPCD3
,
DECODE_SYMBOLOGY_UPCD4
,
DECODE_SYMBOLOGY_UPCD5
,
DECODE_SYMBOLOGY_EAN8_S
,
DECODE_SYMBOLOGY_EAN13_S
,
DECODE_SYMBOLOGY_EAN128
,
DECODE_SYMBOLOGY_OCRA
,
DECODE_SYMBOLOGY_OCRB
,
DECODE_SYMBOLOGY_PDF417
,
DECODE_SYMBOLOGY_MAXICODE
,
DECODE_SYMBOLOGY_OTHER
,
DECODE_SYMBOLOGY_UNKNOWN
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public void onScannerHolsterChange(java.lang.String scannerId)
scannerId
- If the scanner is entering the holster, this string contains the Bluetooth scanner identification. If the scanner is exiting the holster, this is an empty string.EVENT_SCANNER_HOLSTER_CHANGE
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
Flow | A kernel mode driver will recieve a hardware interrupt and alert the JavaPOS Host Application of the event. The event will then be raised to the Host Applet. |
public void onConnectionChange(int state)
state
- The state of the Bluetooth connectionEVENT_SCANNER_CONNECTION_CHANGE
,
CONNECTION_NONE
,
CONNECTION_RELIABLE
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
Flow | TBD |
public void onScannerError(java.lang.String description, int code0, int code1, int code2, int code3, int code4)
EVENT_SCANNER_ERROR
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public void onScannerChargeChange(int percent)
percent
- The current battery charge percentageEVENT_SCANNER_CHARGE_CHANGE
Host Application | JavaPOSHostApplication |
Host Applet | (TBD) |
Flow | A host applet will query the battery status of the scanner at regular intervals (e.g. once per minute). When the threshold is crossed, this event will be fired. |
public boolean resetScanner()
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public boolean setScannerEnable(boolean enable)
enable
- Specifies whether the scanner should be enabled (true) or disabled (false)
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public boolean getScannerEnable()
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public java.lang.String getScannedData()
onScan(int,String,int)
Host Application | N/A |
Host Applet | JavaPOSHostApplet |
Flow | The last onScan event data is buffered at the Applet level |
public int getScannedSymbology()
onScan(int, String, int)
,
DECODE_SYMBOLOGY_UPCA
,
DECODE_SYMBOLOGY_UPCE
,
DECODE_SYMBOLOGY_JAN8
,
DECODE_SYMBOLOGY_EAN8
,
DECODE_SYMBOLOGY_JAN13
,
DECODE_SYMBOLOGY_EAN13
,
DECODE_SYMBOLOGY_TF
,
DECODE_SYMBOLOGY_ITF
,
DECODE_SYMBOLOGY_CODABAR
,
DECODE_SYMBOLOGY_CODE39
,
DECODE_SYMBOLOGY_CODE93
,
DECODE_SYMBOLOGY_CODE128
,
DECODE_SYMBOLOGY_UPCA_S
,
DECODE_SYMBOLOGY_UPCE_S
,
DECODE_SYMBOLOGY_UPCD1
,
DECODE_SYMBOLOGY_UPCD2
,
DECODE_SYMBOLOGY_UPCD3
,
DECODE_SYMBOLOGY_UPCD4
,
DECODE_SYMBOLOGY_UPCD5
,
DECODE_SYMBOLOGY_EAN8_S
,
DECODE_SYMBOLOGY_EAN13_S
,
DECODE_SYMBOLOGY_EAN128
,
DECODE_SYMBOLOGY_OCRA
,
DECODE_SYMBOLOGY_OCRB
,
DECODE_SYMBOLOGY_PDF417
,
DECODE_SYMBOLOGY_MAXICODE
,
DECODE_SYMBOLOGY_OTHER
,
DECODE_SYMBOLOGY_UNKNOWN
Host Application | N/A |
Host Applet | JavaPOSHostApplet |
Flow | The last onScan event symbology is buffered at the Applet level |
public int getScannerButtonDown()
onScan(int,String,int)
Host Application | N/A |
Host Applet | JavaPOSHostApplet |
Flow | The last onScan event button data is buffered at the Applet level |
public java.lang.String getHolsteredScanner()
Host Application | N/A |
Host Applet | JavaPOSHostApplet |
Flow | The last onScannerHolsterChange event data is buffered at the Applet level |
public java.lang.String getAssociatedScanner()
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public int getScannerConnectionState()
onConnectionChange(int)
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
Flow | TBD |
public int getScannerCharge()
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public boolean setScannerChargeChangeThreshold(int threshold)
threshold
- The delta threshold at which to report battery percentage changes
Host Application | N/A |
Host Applet | JavaPOSHostApplet |
Flow | The host applet stores the value and delivers threshold events accordingly. This value is not persistent between power cycles. |
public int getScannerChargeChangeThreshold()
Host Application | N/A |
Host Applet | JavaPOSHostApplet |
Flow | The host applet stores the value and delivers threshold events accordingly. This value is not persistent between power cycles. |
public boolean defineScannerTone(int index, int pitch, int volume, int duration)
index
- The index of the tone to define (1 through 10)pitch
- The pitch at which this tone will sound during play (0-10000).
The actual pitch generated will depend on the hardware support.
When possible, the value should represent hz. Otherwise,
10000 represents the highest available pitch.volume
- The percent volume of the tone (0-100).duration
- The duration of the tone's play in ms. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public void playScannerToneAsync(int index, int delay, int repeat)
index
- The index of the tone to playdelay
- The number of ms to delay after the tone. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.repeat
- The number of times to repeat the tonedefineScannerTone(int,int,int,int)
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public void playScannerTonesAsync(int index, int delay, int index2, int delay2, int repeat)
index
- The index of the first tone to playdelay
- The number of ms to delay after the frist tone. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.index2
- The index of the second tone to playdelay2
- The number of ms to delay after the second tone. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.repeat
- The number of times to repeat the tonesdefineScannerTone(int,int,int,int)
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public boolean defineScannerLED(int index, int color, int brightness, int duration)
index
- The index of the LED sequence to define (1 through 10)color
- The color to display when the LED lights. Color constants are
provided to specify this attribute. Hardware support of the
color is required. If the color is not supported, a
substiture color will be displayed.brightness
- The percent brightness to display (0-100). Requires hardware
support. At minimum 0==total off >0==total onduration
- The duration of the LED light in ms. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.
SCANNER_LED_COLOR_GREEN
,
SCANNER_LED_COLOR_ORANGE
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public void playScannerLEDAsync(int index, int delay, int repeat)
index
- The index of the LED sequence to playdelay
- The number of ms to delay after the LED's sequence. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.repeat
- The number of times to repeat the sequencedefineScannerLED(int,int,int,int)
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |
public void playScannerLEDsAsync(int index, int delay, int index2, int delay2, int repeat)
index
- The index of the first sequence to playdelay
- The number of ms to delay after the first LED's sequence. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.index2
- The index of the second sequence to playdelay2
- The number of ms to delay after the second LED's sequence. The duration will be
approximated as closely as possible. The granularity of the timer
and the maximum duration is hardware dependent.repeat
- The number of times to repeat the sequencedefineScannerTone(int,int,int,int)
Host Application | JavaPOSHostApplication |
Host Applet | JavaPOSHostApplet |