To use Samsung B2B API,
<script type="text/javascript" src="$B2BAPIS/b2bapis/b2bapis.js"></script>
Should be loaded in index.html
readonly attribute B2BBarCodeManager b2bbarcode
DOMString getVersion()
This interface provides methods to get b2bbarcode module version.
var Version = null;
try {
Version = b2bapis.b2bbarcode.getVersion();
} catch (e) {
console.log("[getVersion] call syncFunction exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
if(null !== Version){
console.log("[getVersion] call syncFunction type: " + Version);
}
void setScanTimeOut(unsigned long scanTimeOut)
Interface to set timeout of scan barcode.
var scanTimeOut = 90;
try
{
b2bapis.b2bbarcode.setScanTimeOut(scanTimeOut);
}
catch(e)
{
console.log("[setScanTimeOut] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}
void startScanBarcode( B2BBarCodeListener onlistener)
Interface to set callback for reading barcode data.
function onlistener(barCodeData)
{
console.log("Barcode data is " + barCodeData.data);
}
try
{
b2bapis.b2bbarcode.startScanBarcode(onlistener);
}
catch(e)
{
console.log("[startScanBarcode] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}
void stopScanBarcode()
This method remove the async event listener to the module for Barcode callback.
function stopScanBarcode() {
try {
b2bapis.b2bbarcode.stopScanBarcode();
} catch (e) {
console.log("stopScanBarcode exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
}
void onlistener( b2bResult data)
Interface to set callback for reading barcode data.
function onlistener(barCodeData)
{
console.log("Barcode data is " + barCodeData.data);
}
try
{
b2bapis.b2bbarcode.startScanBarcode(onlistener);
}
catch(e)
{
console.log("[startScanBarcode] call syncFunction exception " + e.code + " " + e.errorName + " " + e.errorMessage);
}