Class: Barcode

Barcode()

Functions to handle and control compatible barcode scanners attached to the device.

QBrowser automatically sends barcodes to the function, specified in app settings (barcodeFunction). The format of this function is: function BarcodeData(barcode, type, typeText)

Parameters: - barcode(string) - barcode data - type(integer) - barcode type number, as returned by the barcode engine (i.e. 13 - refer to QBrowser.BarcodeScanType for complete listing) - typeText(string) - barcode type converted to string for easy display (i.e. "EAN-13")

Constructor

new Barcode()

Source:

Methods

(static) this.monitorStatus(scannerStatus)

Sets a callback function to receive updates on the scanner's status
Parameters:
Name Type Description
scannerStatus function Callback function that updates the scanner status in realtime. Parameters:

info(object) - info.connected(boolean) - indicates if supported reader is connected - info.name(string) - reader name - info.version(string) - reader firmware version
Source:
Example
// Example callback function
function BarcodeStatus(info)
{
    if (info.connected)
        document.body.innerHTML += "Connected barcode reader <b>" + info.name + " " + info.version + "</b>";
    else
        document.body.innerHTML += "Barcode reader disconnected<br/>";
}

(static) this.simulate(barcode, type)

Helper function to simulate a barcode scan for testing purposes. The simulated barcode is sent just like normal a scanned one will be.
Parameters:
Name Type Description
barcode string Optional barcode string, you can pass null for default one
type number Optional barcode type or null for EAN-13
Source:

(static) this.startScan()

Starts the hardware scanner
Source:

(static) this.stopScan()

Stops the hardware scanner
Source: