Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Completes merge of BB10 implementation into phonegap API
Browse files Browse the repository at this point in the history
  • Loading branch information
timwindsor committed Jul 17, 2015
1 parent 02c5ba8 commit 52b5adb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -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 ##

Expand Down
26 changes: 12 additions & 14 deletions src/blackberry10/index.js
Expand Up @@ -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) {

}
};

Expand Down Expand Up @@ -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",
Expand All @@ -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") {
Expand Down

0 comments on commit 52b5adb

Please sign in to comment.