cordova-appivo-sibo-nfc
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"_from": "cordova-appivo-sibo-nfc", | ||
"_id": "cordova-appivo-sibo-nfc@1.0.8", | ||
"_id": "cordova-appivo-sibo-nfc@1.0.9", | ||
"_inBundle": false, | ||
@@ -57,3 +57,3 @@ "_integrity": "sha512-wEWLPpEskmV+NmF+5EArECfly/kFoodpE5hF9zqGC80ZjYUe8sejBvE2I9zyTPfvxbulICNsoasi7Jz45q8Vxw==", | ||
}, | ||
"version": "1.0.8" | ||
"version": "1.0.9" | ||
} |
@@ -1,2 +0,2 @@ | ||
# cordova-appivo-sibo-nfc | ||
# Fork of cordova-appivo-acr122 | ||
@@ -11,3 +11,3 @@ A Cordova plugin that enables reading NFC tags using RFID/NFC Reader for Sibo Tablet. | ||
- cancel the currently registered listener/reader : | ||
cancel(callback,errorCallBack) | ||
cancel() | ||
@@ -18,6 +18,6 @@ - write to a block : | ||
- turn on LED : | ||
turnOnLED(callback,errorCallBack,dataObject) | ||
turnOnLED(dataObject) | ||
- turn off LED : | ||
turnOffLED(callback,errorCallBack) | ||
turnOffLED() | ||
@@ -41,5 +41,5 @@ | ||
// provide the data to be written onto the tag. If less than 16 characters 0's will be added at the end. | ||
// BlockToWrite is the block number onto which the data will be written | ||
Data:["newID"], | ||
BlockToWrite:5 | ||
// 'block' is the block number onto which the data will be written | ||
data:["newID"], | ||
block:5 | ||
}); | ||
@@ -58,45 +58,42 @@ | ||
{ | ||
// If ReadOnce is false it will keep the listener running until 'cancel' is called | ||
// If AutoReadFromBlock is true it will read data from block as well | ||
// BlockToRead is block number to read | ||
ReadOnce:false, | ||
AutoReadFromBlock:true, | ||
BlockToRead:5 | ||
// If readOnce is false it will keep the listener running until 'cancel' is called | ||
// If autoReadFromBlock is true it will read data from block as well | ||
// block is block number to read | ||
readOnce:false, | ||
autoReadFromBlock:true, | ||
block:5 | ||
}); | ||
// Stop reading tags | ||
nfc.cancel(function(event) { | ||
if (event.state == 'Success') { | ||
alert("Scanned stopped"); | ||
nfc.cancel().then( | ||
function(result) { | ||
alert(JSON.stringify(result)); | ||
}, | ||
function (error) { | ||
alert(error); | ||
} | ||
}, | ||
function(error){ | ||
alert(error); | ||
}); | ||
); | ||
// Turn on LED | ||
nfc.turnOnLED(function(event) { | ||
if(event.state == 'Success') { | ||
alert("LED turned ON..."); | ||
nfc.ledOn({ | ||
// color can be 'red', 'green' or 'blue' | ||
color:red | ||
}).then( | ||
function(result) { | ||
alert(JSON.stringify(result)); | ||
}, | ||
function (error) { | ||
alert(error); | ||
} | ||
}, | ||
function(error){ | ||
alert(error); | ||
}, | ||
{ | ||
// True to turn on the LED with the resp. color. Only one of the colors can be selected. | ||
Red:true, | ||
Green:false, | ||
Blue:false | ||
}); | ||
); | ||
// Turn off LED | ||
nfc.turnOffLED(function(event) { | ||
if (event.state == 'Success') { | ||
alert("LED turned OFF..."); | ||
nfc.ledOff().then( | ||
function(result) { | ||
alert(JSON.stringify(result)); | ||
}, | ||
function (error) { | ||
alert(error); | ||
} | ||
}, | ||
function(error){ | ||
alert(error); | ||
}); | ||
); | ||
``` |
@@ -13,23 +13,32 @@ // Empty constructor | ||
NFC.prototype.turnOnLED = function(successCallback, errorCallback, options) { | ||
NFC.prototype.ledOn = function(options) { | ||
return (new Promise(function(resolve,reject){ | ||
cordova.exec(function(str) { | ||
var json = JSON.parse(str); | ||
successCallback(json); | ||
}, errorCallback, 'NFCPlugin', 'turnOnLED', [options]); | ||
resolve(json); | ||
}, function(err) { | ||
reject(err); | ||
}, 'NFCPlugin', 'ledOn', [options]);})); | ||
} | ||
NFC.prototype.turnOffLED = function(successCallback, errorCallback) { | ||
NFC.prototype.ledOff = function() { | ||
var options = {}; | ||
return (new Promise(function(resolve,reject){ | ||
cordova.exec(function(str) { | ||
var json = JSON.parse(str); | ||
successCallback(json); | ||
}, errorCallback, 'NFCPlugin', 'turnOffLED', [options]); | ||
resolve(json); | ||
}, function(err) { | ||
reject(err); | ||
}, 'NFCPlugin', 'ledOff', [options]);})); | ||
} | ||
NFC.prototype.cancel = function(successCallback, errorCallback) { | ||
NFC.prototype.cancel = function() { | ||
var options = {}; | ||
return (new Promise(function(resolve,reject){ | ||
cordova.exec(function(str) { | ||
var json = JSON.parse(str); | ||
successCallback(json); | ||
}, errorCallback, 'NFCPlugin', 'cancel', [options]); | ||
resolve(json); | ||
}, function(err) { | ||
reject(err); | ||
}, 'NFCPlugin', 'cancel', [options]);})); | ||
} | ||
@@ -36,0 +45,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53
59030
95