Namespace ScannerDevice
ScannerDevice
Defined in: ScannerLib-Linea-2.0.0.js.
Constructor Attributes | Constructor Name and Description |
---|---|
ScannerDevice library to listen and set options to the Linea device.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
ScannerDevice.allowedCallbacks
Deligate functions device will automatically execute when an event happens.
|
<static> |
ScannerDevice.allowedFunctions
Allowed functions that scanner accepts.
|
<static> |
ScannerDevice.CONSTANTS
Usefull constants.
|
<static> |
ScannerDevice.lastSettings
This object contains info on the current state of device.
|
Method Attributes | Method Name and Description |
---|---|
barcodeEnginePowerControl(enabled)
You can turn the barcode engine off with this function.
|
|
barcodeType2Text(type, callback)
Helper function to get the name of barcodes by their code.
|
|
destroy()
|
|
enableBarcode(Integer, enabled)
Enables or Disables a single barcode by it's ID.
|
|
getBarcodeConstName(barcode_id)
Helper function to return the constant name of a barcode by it's ID.
|
|
getBarcodeTypeMode(callback, callback)
Gets the mode barcodes will be scanned in.
|
|
getBatteryCapacity(callback)
Retrieves the battery capacity in percent of Linea device.
|
|
getBatteryVoltage(callback)
Gets the voltage of the battery.
|
|
getCharging(callback)
Checks if device is charging.
|
|
getConnectionState(callback)
Gets the connection state of the device.
|
|
getMSCardDataMode(callback)
Gets the mode cards are received in.
|
|
getSyncButtonMode(callback)
Retreives the sync button mode (Very little documentation is given on this, so I am not even sure what it does.
|
|
isBarcodeEnabled(callback, barcode)
Check weather barcode is enabled or not.
|
|
isBarcodeSupported(callback, barcode)
Checks if barcode is supported.
|
|
msProcessFinancialCard(callback, track1, track2, track3)
Tries to process credit card info from a swipped card.
|
|
playSound(sounds)
Plays a sound from the linea device.
|
|
<static> |
ScannerDevice.registerListener(obj)
Registers a listener to device.
|
sendCommand(command, args, callback, errorCallback)
Sends a command though cordova to the Linea Device.
|
|
setBarcodeTypeMode(type)
Sets the mode to receive the barcodes in.
|
|
setCharging(enabled)
Set if you wish to charge iphone/ipod/ipad.
|
|
setMSCardDataMode(Mode)
Sets the mode for the card swipper.
|
|
setScanBeep(enabled, See)
Sets the beep for when a barcode is scanned.
|
|
setScanButtonMode(enabled)
Sets if the button is enabled or disabled on the scanner.
|
|
setScanMode(mode)
Sets if the scanner will remain active after scanning barcode.
|
|
Starts the scanner on device.
|
|
stopScan()
Stops the scanner on device.
|
|
<static> |
ScannerDevice.unregisterListener(obj)
Unregisters a listener to device.
|
Namespace Detail
ScannerDevice
ScannerDevice library to listen and set options to the Linea device. Note that you must then register the object after it's been
constructed or no events will be passed to function.
DeviceObject = new ScannerDevice({ barcodeData: function (data, bar_type){ alert('Barcode scanned with with data: '+data+' and of type: '+bar_type); }, magneticCardData: function (track1, track2, track3){ alert('Card read with following data: '+track1+'\n'+track2+'\n'+track3); }, magneticCardRawData: function (data){ alert('Raw data read from card reader: '+data); }, buttonPressed: function (button){ // Currently device only registers 1 button. alert('Button was pressed'); }, buttonReleased: function (button){ // Currently device only registers 1 button. alert('Button was released'); }, connectionState: function (state){ alert('Scanner is now in state: '+state); } }); ScannerDevice.registerListener(Device);
- Parameters:
- {Object} mappings
- If you wish to set listeners, you do it here by passing the listener function here.
Field Detail
<static>
ScannerDevice.allowedCallbacks
Deligate functions device will automatically execute when an event happens.
<static>
ScannerDevice.allowedFunctions
Allowed functions that scanner accepts.
<static>
ScannerDevice.CONSTANTS
Usefull constants.
<static>
ScannerDevice.lastSettings
This object contains info on the current state of device. These variables will change based on when functions
are executed out of library. Also when device disconnects and re-connects it will auto re-assign all options
you already set.
Method Detail
barcodeEnginePowerControl(enabled)
You can turn the barcode engine off with this function. When the engine is turned back on it may take up to 2 seconds for device to be
responsive again. (Don't play with this unless you know what you are doing.)
- Parameters:
- {Boolean} enabled
- Weather to enable or disable engine.
barcodeType2Text(type, callback)
Helper function to get the name of barcodes by their code.
- Parameters:
- {Int} type
- Barcode type to get name. See: ScannerDeice.CONSTANTS.BAR_TYPES.* for available barcodes.
- callback
destroy()
- See:
- ScannerDevice#unregisterListener
enableBarcode(Integer, enabled)
Enables or Disables a single barcode by it's ID.
- Parameters:
- {Int} Integer
- of barcode enableing/disableing (see ScannerDevice.CONSTANTS.BAR_TYPES for mappings).
- {Boolean} enabled
- To enable or disable barcode.
{String|Null}
getBarcodeConstName(barcode_id)
Helper function to return the constant name of a barcode by it's ID.
*Note this function only works for non extended barcodes.
- Parameters:
- {Int} barcode_id
- Barcode ID.
- Returns:
- {String|Null} Constant name of barcode if exists.
getBarcodeTypeMode(callback, callback)
Gets the mode barcodes will be scanned in. See: ScannerDevice.CONSTANTS.BARCODE_TYPE_*
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var bar_type_mode = params[0]; }
- callback
getBatteryCapacity(callback)
Retrieves the battery capacity in percent of Linea device.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var percent = params[0]; }
getBatteryVoltage(callback)
Gets the voltage of the battery.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var voltage = params[0]; }
getCharging(callback)
Checks if device is charging.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var charging = params[0]; }
getConnectionState(callback)
Gets the connection state of the device.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var state = params[0]; } // See ScannerDevice.CONSTANTS.CONN_*
getMSCardDataMode(callback)
Gets the mode cards are received in. See: ScannerDevice.CONSTANTS.MS_* for more info.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var mode = params[0]; }
getSyncButtonMode(callback)
Retreives the sync button mode (Very little documentation is given on this, so I am not even sure what it does.)
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var sync_mode = params[0]; }
isBarcodeEnabled(callback, barcode)
Check weather barcode is enabled or not.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var enabled = params[0]; }
- {Int} barcode
- Barcode to check if enabled. See ScannerDevice.CONSTANTS.BAR_TYPES.* for available values.
isBarcodeSupported(callback, barcode)
Checks if barcode is supported.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var supported = params[0]; }
- {Int} barcode
- Barcode to check if supported. See ScannerDevice.CONSTANTS.BAR_TYPES.* for available values.
msProcessFinancialCard(callback, track1, track2, track3)
Tries to process credit card info from a swipped card.
- Parameters:
- {Function} callback
- Callback to execute after info is received. Example: function (params) { var accountNumber = params[0].accountNumber, cardholderName = params[0].cardholderName, discretionaryData = params[0].discretionaryData, exirationMonth = params[0].exirationMonth, exirationYear = params[0].exirationYear, firstName = params[0].firstName, lastName = params[0].lastName, serviceCode = params[0].serviceCode; }
- {String} track1
- Data from track1.
- {String} track2
- Data from track2.
- {String} track3
- Data from track3.
playSound(sounds)
Plays a sound from the linea device.
- Parameters:
- {Array} sounds
- Sound to play. This can be in the following formats: [frequency,duration,frequency,duration,...] or [[frequency,duration], [frequency,duration], ...] or [{frequency: xxx, duration: xxx}, {frequency: xxx, duration: xxx}, ...] Note: This argument cannot exceed 5 sounds at a time (10 array elements).
<static>
ScannerDevice.registerListener(obj)
Registers a listener to device.
- Parameters:
- {ScannerDevice} obj
- ScannerDevice object to listen to device on.
sendCommand(command, args, callback, errorCallback)
Sends a command though cordova to the Linea Device. See each individual functions
for available commands
- Parameters:
- {String} command
- Command to send to device.
- {Array} args
- Arguments to send along with command.
- {Function} callback
- Success callback function. Callback contains 1 arguments containing an array of arguments.
- {Function} errorCallback
- Error callback function. Callback contains 1 arguments containing an array of arguments.
setBarcodeTypeMode(type)
Sets the mode to receive the barcodes in.
- Parameters:
- {Int} type
- The mode to receive the barcodes in. See: ScannerDevice.CONSTANTS.BARCODE_TYPE_*
setCharging(enabled)
Set if you wish to charge iphone/ipod/ipad.
- Parameters:
- {Boolean} enabled
- Weather to enable or disable charging.
setMSCardDataMode(Mode)
Sets the mode for the card swipper.
- Parameters:
- {Int} Mode
- to put the swipper in. See: ScannerDevice.CONSTANTS.MS_* for availale options.
setScanBeep(enabled, See)
Sets the beep for when a barcode is scanned.@argument
- Parameters:
- {Boolean} enabled
- Weather scanner beep is enabled or not.
- {Array} See
- ScannerLibrary#playSound for more info.
setScanButtonMode(enabled)
Sets if the button is enabled or disabled on the scanner.
- Parameters:
- {Boolean} enabled
- Weather to enable or disable the button.
setScanMode(mode)
Sets if the scanner will remain active after scanning barcode.
- Parameters:
- {Int} mode
- Mode to scan in. See: ScannerDevice.CONSTANTS.MODE_*
startScan()
Starts the scanner on device.
stopScan()
Stops the scanner on device. (if scanning)
<static>
ScannerDevice.unregisterListener(obj)
Unregisters a listener to device.
- Parameters:
- {ScannerDevice} obj
- ScannerDevice object to unregister with library.