KeyboardBarcode
Last updated
Last updated
JourneyApps supports the use of certain devices that use keyboard emulation to scan barcodes.
Version and device compatibility
Available from version 4.49.0 of the JourneyApps Container.
We have tested on Cino FuzzyScan devices, but any device that uses keyboard emulation should work.
To scan data from a device, a callback is registered using the KeyboardBarcode object:
Parameter | Type | Description |
---|---|---|
The options
object can have the following properties:
Property | Type | Description |
---|---|---|
Since the device registers as a keyboard, it may interfere with normal keyboard inputs. It will only interfere if the user types the start
character. Thus, setup the device to use something that a user isn't likely to type if both scanning and text input is required to happen simultaneously. That is why the default value is a caret (^
).
When a callback is registered, the user can scan multiple barcodes, and each will trigger the callback specified in the register device. For example, the user can scan multiple barcodes without interacting with the tablet or computer, and scanned barcodes can update the user's view as they are scanned.
If you want to stop scanning, you can deregister the listener by calling:
When leaving a view, the KeyboardBarcode
is automatically deregistered. Thus, if you want to scan across multiple views, you have to register it again on that view.
The hardware device has to be correctly configured to be used. Please see your hardware manufacturer's documentation on how to setup the device you are using.
A few important settings:
It has to be set up in keyboard emulation mode (a.k.a. HID mode)
It has to be configured with a preamble of a single character, used as start
in the register function options above.
It has to be configured with a delimiter character, used as end
in the register function options above.
It has to be paired with Bluetooth or physically connected according to the manufacturer's instructions.
The Cino FuzzyScan devices uses their own barcodes to scan to configure the device.
callback
Function
Function that receives a single scanned barcode. Required
options
Object
Object that can be used to configure the scan listener. Optional
start
String
Character used to indicate that the keyboard should capture the next characters until it reaches the end delimiter.
Default: '^'
Optional
end
String
Character used to indicate that the scanned barcode is complete.
Default: ' '
(space).
Optional
timeout
Number
Time in milliseconds that the listener allows to scan when it reaches the start
character until it gets the end
character.
If a scan isn't completed in that time, no data will be returned.
Default: 1000
(1 second)
Optional