From 52b5adb8d40e6116c20df2416cf1a78ec24f4b7e Mon Sep 17 00:00:00 2001 From: Tim Windsor Date: Fri, 17 Jul 2015 17:05:02 -0400 Subject: [PATCH] Completes merge of BB10 implementation into phonegap API --- README.md | 7 ++++--- src/blackberry10/index.js | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 54f5aa96..7dfcf3b4 100644 --- a/README.md +++ b/README.md @@ -156,13 +156,14 @@ A full example could be: ``` ## Windows8 quirks ## -Windows 8 implenemtation currently doesn't support encode functionality. +Windows 8 implementation currently doesn't support encode functionality. ## Windows Phone 8 quirks ## -Windows Phone 8 implenemtation currently doesn't support encode functionality. +Windows Phone 8 implementation currently doesn't support encode functionality. ## BlackBerry 10 quirks -BlackBerry 10 implenematation currently doesn't support encode functionality. +BlackBerry 10 implementation currently doesn't support encode functionality. +Cancelling a scan on BlackBerry 10 is done by touching the screen. ## Thanks on Github ## diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js index 3ded7d6d..0696e7b5 100644 --- a/src/blackberry10/index.js +++ b/src/blackberry10/index.js @@ -38,21 +38,15 @@ module.exports = { } if (handle !== null) { var values = { group: group, handle: handle }; - result.ok(barcodescanner.getInstance().startRead(result.callbackId, values), true); + barcodescanner.getInstance().startRead(result.callbackId, values); + // result.noResult(true); // calls the error handler for some reason } else { result.error("Failed to find window handle", false); } }, - stopRead: function (success, fail, args, env) { - var result = new PluginResult(args, env); - resultObjs[result.callbackId] = result; - result.ok(barcodescanner.getInstance().stopRead(result.callbackId), true); - }, - add: function (success, fail) { - console.log('Frame Available event listening'); - }, - remove: function (success, fail) { - console.log('End listening to frames'); + + encode: function (success, fail, args, env) { + } }; @@ -89,7 +83,7 @@ JNEXT.BarcodeScanner = function () { var arData = strData.split(" "), callbackId = arData[0], receivedEvent = arData[1], - data = receivedEvent + " " + arData[2], + data = arData[2], result = resultObjs[callbackId], events = ["community.barcodescanner.codefound.native", "community.barcodescanner.errorfound.native", @@ -105,15 +99,19 @@ JNEXT.BarcodeScanner = function () { } if (receivedEvent == "community.barcodescanner.codefound.native") { + if (result) { + result.callbackOk(data, false); + } this.stopRead(callbackId); - result.callbackOk(data, true); } if (receivedEvent == "community.barcodescanner.started.native") { console.log("Scanning started successfully"); } if (receivedEvent == "community.barcodescanner.errorfound.native") { - result.callbackError(data, false); + if (result) { + result.callbackError(data, false); + } } if(receivedEvent == "community.barcodescanner.ended.native" || receivedEvent == "community.barcodescanner.errorfound.native") {