Skip to content

Commit

Permalink
feat: add enableQRCode api
Browse files Browse the repository at this point in the history
  • Loading branch information
diogoqueiros committed May 28, 2019
1 parent 557c5c6 commit 4f790cf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,19 @@ Disable the trigger button.
```js
window.cordova.plugins.honeywell.disableTrigger(() => console.info('trigger disabled'));
```

### enableQRCode

Enable or disable QR Code scans. QR Code is enable by default

Param: `enable`: boolean

- To enable:
```js
window.cordova.plugins.honeywell.enableQRCode(true, () => console.info('QR Code enabled'), (err) => console.info(err));
```

- To disable:
```js
window.cordova.plugins.honeywell.enableQRCode(false, () => console.info('QR Code disabled'), (err) => console.info(err));
```
15 changes: 15 additions & 0 deletions src/android/Aidc.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ public boolean execute(String action, JSONArray args, final CallbackContext call
callbackContext.success();
}

return true;
} else if ("enableQRCode".equals(action)) {
if (barcodeReader == null) {
callbackContext.error("no barcode reader initalized");
} else {
try {
barcodeReader.setProperty(BarcodeReader.PROPERTY_QR_CODE_ENABLED, args.isNull(0) || args.getBoolean(0));
callbackContext.success();
} catch (UnsupportedPropertyException e) {
callbackContext.error(e.getMessage());
}

callbackContext.success();
}

return true;
} else if ("listConnectedBarcodeDevices".equals(action)) {
// Return the list of connected barcode Devices
Expand Down
4 changes: 4 additions & 0 deletions www/aidc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ var Aidc = function () {
exec(success_cb, error_cb, "HoneywellAidc", "disableTrigger", []);
};

this.enableQRCode = function (enable, success_cb, error_cb) {
exec(success_cb, error_cb, "HoneywellAidc", "enableQRCode", [enable]);
};

this.listConnectedBarcodeDevices = function (success_cb, error_cb) {
exec(success_cb, error_cb, "HoneywellAidc", "listConnectedBarcodeDevices", []);
}
Expand Down

0 comments on commit 4f790cf

Please sign in to comment.