Interface scanner


public interface scanner

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

BUTTON_ADD

public static final int BUTTON_ADD
Constant returned to indicate the add button

See Also:
Constant Field Values

BUTTON_REMOVE

public static final int BUTTON_REMOVE
Constant returned to indicate the remove button

See Also:
Constant Field Values

BUTTON_UNKNOWN

public static final int BUTTON_UNKNOWN
Constant returned to indicate an unknown button

See Also:
Constant Field Values

EVENT_SCAN

public static final java.lang.String EVENT_SCAN
The event constant used to register for the onScan event

See Also:
basic.registerForEvent(String), Constant Field Values

DECODE_SYMBOLOGY_UPCA

public static final int DECODE_SYMBOLOGY_UPCA
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCE

public static final int DECODE_SYMBOLOGY_UPCE
See Also:
Constant Field Values

DECODE_SYMBOLOGY_JAN8

public static final int DECODE_SYMBOLOGY_JAN8
See Also:
Constant Field Values

DECODE_SYMBOLOGY_EAN8

public static final int DECODE_SYMBOLOGY_EAN8
See Also:
Constant Field Values

DECODE_SYMBOLOGY_JAN13

public static final int DECODE_SYMBOLOGY_JAN13
See Also:
Constant Field Values

DECODE_SYMBOLOGY_EAN13

public static final int DECODE_SYMBOLOGY_EAN13
See Also:
Constant Field Values

DECODE_SYMBOLOGY_TF

public static final int DECODE_SYMBOLOGY_TF
See Also:
Constant Field Values

DECODE_SYMBOLOGY_ITF

public static final int DECODE_SYMBOLOGY_ITF
See Also:
Constant Field Values

DECODE_SYMBOLOGY_CODABAR

public static final int DECODE_SYMBOLOGY_CODABAR
See Also:
Constant Field Values

DECODE_SYMBOLOGY_CODE39

public static final int DECODE_SYMBOLOGY_CODE39
See Also:
Constant Field Values

DECODE_SYMBOLOGY_CODE93

public static final int DECODE_SYMBOLOGY_CODE93
See Also:
Constant Field Values

DECODE_SYMBOLOGY_CODE128

public static final int DECODE_SYMBOLOGY_CODE128
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCA_S

public static final int DECODE_SYMBOLOGY_UPCA_S
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCE_S

public static final int DECODE_SYMBOLOGY_UPCE_S
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCD1

public static final int DECODE_SYMBOLOGY_UPCD1
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCD2

public static final int DECODE_SYMBOLOGY_UPCD2
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCD3

public static final int DECODE_SYMBOLOGY_UPCD3
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCD4

public static final int DECODE_SYMBOLOGY_UPCD4
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UPCD5

public static final int DECODE_SYMBOLOGY_UPCD5
See Also:
Constant Field Values

DECODE_SYMBOLOGY_EAN8_S

public static final int DECODE_SYMBOLOGY_EAN8_S
See Also:
Constant Field Values

DECODE_SYMBOLOGY_EAN13_S

public static final int DECODE_SYMBOLOGY_EAN13_S
See Also:
Constant Field Values

DECODE_SYMBOLOGY_EAN128

public static final int DECODE_SYMBOLOGY_EAN128
See Also:
Constant Field Values

DECODE_SYMBOLOGY_OCRA

public static final int DECODE_SYMBOLOGY_OCRA
See Also:
Constant Field Values

DECODE_SYMBOLOGY_OCRB

public static final int DECODE_SYMBOLOGY_OCRB
See Also:
Constant Field Values

DECODE_SYMBOLOGY_PDF417

public static final int DECODE_SYMBOLOGY_PDF417
See Also:
Constant Field Values

DECODE_SYMBOLOGY_MAXICODE

public static final int DECODE_SYMBOLOGY_MAXICODE
See Also:
Constant Field Values

DECODE_SYMBOLOGY_OTHER

public static final int DECODE_SYMBOLOGY_OTHER
See Also:
Constant Field Values

DECODE_SYMBOLOGY_UNKNOWN

public static final int DECODE_SYMBOLOGY_UNKNOWN
See Also:
Constant Field Values

EVENT_SCANNER_HOLSTER_CHANGE

public static final java.lang.String EVENT_SCANNER_HOLSTER_CHANGE
The event constant used to register for the onScannerHolsterChange event

See Also:
basic.registerForEvent(String), Constant Field Values

CONNECTION_NONE

public static final int CONNECTION_NONE
No Bluetooth connection

See Also:
Constant Field Values

CONNECTION_RELIABLE

public static final int CONNECTION_RELIABLE
Bluetooth connection is reliable

See Also:
Constant Field Values

EVENT_SCANNER_CONNECTION_CHANGE

public static final java.lang.String EVENT_SCANNER_CONNECTION_CHANGE
The event constant used to register for the onScannerConnectionChange event

See Also:
basic.registerForEvent(String), Constant Field Values

EVENT_SCANNER_ERROR

public static final java.lang.String EVENT_SCANNER_ERROR
The event constant used to register for the onScannerError event

See Also:
basic.registerForEvent(String), Constant Field Values

EVENT_SCANNER_CHARGE_CHANGE

public static final java.lang.String EVENT_SCANNER_CHARGE_CHANGE
The event constant used to register for the onScannerChargeChange event

See Also:
basic.registerForEvent(String), Constant Field Values

SCANNER_LED_COLOR_GREEN

public static final int SCANNER_LED_COLOR_GREEN
Specify the green scanner LED

See Also:
defineScannerLED(int, int, int, int), Constant Field Values

SCANNER_LED_COLOR_ORANGE

public static final int SCANNER_LED_COLOR_ORANGE
Specify the orange scanner LED

See Also:
defineScannerLED(int, int, int, int), Constant Field Values
Method Detail

onScan

public void onScan(int buttonDown,
                   java.lang.String data,
                   int symbology)
This is the prototype for an event. It is not actually implemented in this file. Fired when a scanning event occurs. If it is supported, a scanner LED timeout will also fire this event with the data: 1111111111111111

Parameters:
buttonDown - The button that was depressed during the scan
data - The plain text barcode data received by the scanner
symbology - A integer constant in the DECODE_SYMBOLOGY family indicating which type of barcode was decoded
See Also:
EVENT_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
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

onScannerHolsterChange

public void onScannerHolsterChange(java.lang.String scannerId)
This is the prototype for an event. It is not actually implemented in this file. Event fired whenever the tablet detects that a scanner has entered or exited its holster

Parameters:
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.
See Also:
EVENT_SCANNER_HOLSTER_CHANGE
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet
FlowA 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.

onConnectionChange

public void onConnectionChange(int state)
This is the prototype for an event. It is not actually implemented in this file. Indicates a change in the Bluetooth connection state of the scanner.

Parameters:
state - The state of the Bluetooth connection
See Also:
EVENT_SCANNER_CONNECTION_CHANGE, CONNECTION_NONE, CONNECTION_RELIABLE
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet
FlowTBD

onScannerError

public void onScannerError(java.lang.String description,
                           int code0,
                           int code1,
                           int code2,
                           int code3,
                           int code4)
This is the prototype for an event. It is not actually implemented in this file. Indicates an error event during scanner operation The parameters indicate details about the error.

See Also:
EVENT_SCANNER_ERROR
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

onScannerChargeChange

public void onScannerChargeChange(int percent)
This is the prototype for an event. It is not actually implemented in this file. Reports a battery level change greater than the threshold

Parameters:
percent - The current battery charge percentage
See Also:
EVENT_SCANNER_CHARGE_CHANGE
WATA Integration
Host ApplicationJavaPOSHostApplication
Host Applet(TBD)
FlowA 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.

resetScanner

public boolean resetScanner()
Resets the scanner to a set of defaults

Returns:
Returns whether the operation succeeded
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

setScannerEnable

public boolean setScannerEnable(boolean enable)
Enables or disables the scanner

Parameters:
enable - Specifies whether the scanner should be enabled (true) or disabled (false)
Returns:
Returns whether the operation was successful
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

getScannerEnable

public boolean getScannerEnable()
Obtains whether the scanner is enabled or disabled

Returns:
Returns whether the scanner is enabled
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

getScannedData

public java.lang.String getScannedData()
Obtains the last data scanned

Returns:
Returns the last data delivered by the "onScan" . Returns empty string if no events have been fired.
See Also:
onScan(int,String,int)
WATA Integration
Host ApplicationN/A
Host AppletJavaPOSHostApplet
FlowThe last onScan event data is buffered at the Applet level

getScannedSymbology

public int getScannedSymbology()
Obtains the symbology information of the last data scanned

Returns:
Returns an identifier representing the symbology of the last decoded data
See Also:
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
WATA Integration
Host ApplicationN/A
Host AppletJavaPOSHostApplet
FlowThe last onScan event symbology is buffered at the Applet level

getScannerButtonDown

public int getScannerButtonDown()
Obtains the button that was pressed during the last scanned data event

Returns:
Returns the last button state delivered by the onScan event
See Also:
onScan(int,String,int)
WATA Integration
Host ApplicationN/A
Host AppletJavaPOSHostApplet
FlowThe last onScan event button data is buffered at the Applet level

getHolsteredScanner

public java.lang.String getHolsteredScanner()
Obtains information about the currently holstered scanner

Returns:
Returns the Bluetooth identifier of the currently holstered scanner. If no scanner is holstered, this method returns an empty string.
WATA Integration
Host ApplicationN/A
Host AppletJavaPOSHostApplet
FlowThe last onScannerHolsterChange event data is buffered at the Applet level

getAssociatedScanner

public java.lang.String getAssociatedScanner()
Obtains information about the tablet's currently associated scanner

Returns:
Returns the Bluetooth identifier of the currently associated scanner (not necessarily holstered or communicating). An empty string is returned if no scanner is associated.
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

getScannerConnectionState

public int getScannerConnectionState()
Obtains the connection state of the Bluetooth scanner

Returns:
Returns the current connection state of the scanner (see onConnectionChange)
See Also:
onConnectionChange(int)
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet
FlowTBD

getScannerCharge

public int getScannerCharge()
Obtains the battery charge of the scanner

Returns:
Returns the current battery charge percent of the scanner. Returns -1 if the operation fails.
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

setScannerChargeChangeThreshold

public boolean setScannerChargeChangeThreshold(int threshold)
Sets the charge change threshold

Parameters:
threshold - The delta threshold at which to report battery percentage changes
Returns:
Returns whether the operation was successful
WATA Integration
Host ApplicationN/A
Host AppletJavaPOSHostApplet
FlowThe host applet stores the value and delivers threshold events accordingly. This value is not persistent between power cycles.

getScannerChargeChangeThreshold

public int getScannerChargeChangeThreshold()
Obtains the charge change threshold

Returns:
Returns the current charge change threshold of the scanner. Returns -1 if the operation fails.
WATA Integration
Host ApplicationN/A
Host AppletJavaPOSHostApplet
FlowThe host applet stores the value and delivers threshold events accordingly. This value is not persistent between power cycles.

defineScannerTone

public boolean defineScannerTone(int index,
                                 int pitch,
                                 int volume,
                                 int duration)
Define a scanner tone

Parameters:
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.
Returns:
Returns true if the tone was successfully defined
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

playScannerToneAsync

public void playScannerToneAsync(int index,
                                 int delay,
                                 int repeat)
Plays a previously defined tone.

Parameters:
index - The index of the tone to play
delay - 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 tone
See Also:
defineScannerTone(int,int,int,int)
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

playScannerTonesAsync

public void playScannerTonesAsync(int index,
                                  int delay,
                                  int index2,
                                  int delay2,
                                  int repeat)
Plays (mixes) two previously defined tones

Parameters:
index - The index of the first tone to play
delay - 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 play
delay2 - 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 tones
See Also:
defineScannerTone(int,int,int,int)
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

defineScannerLED

public boolean defineScannerLED(int index,
                                int color,
                                int brightness,
                                int duration)
Defines a scanner LED sequence

Parameters:
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 on
duration - 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.
Returns:
Returns true if the LED sequence was successfully defined
See Also:
SCANNER_LED_COLOR_GREEN, SCANNER_LED_COLOR_ORANGE
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

playScannerLEDAsync

public void playScannerLEDAsync(int index,
                                int delay,
                                int repeat)
Plays a previously defined LED sequence.

Parameters:
index - The index of the LED sequence to play
delay - 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 sequence
See Also:
defineScannerLED(int,int,int,int)
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet

playScannerLEDsAsync

public void playScannerLEDsAsync(int index,
                                 int delay,
                                 int index2,
                                 int delay2,
                                 int repeat)
Plays (mixes) two previously defined LED sequences

Parameters:
index - The index of the first sequence to play
delay - 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 play
delay2 - 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 sequence
See Also:
defineScannerTone(int,int,int,int)
WATA Integration
Host ApplicationJavaPOSHostApplication
Host AppletJavaPOSHostApplet