2014-09-11 15:52:59 +08:00
|
|
|
var argscheck = require('cordova/argscheck'),
|
|
|
|
exec = require('cordova/exec');
|
|
|
|
|
|
|
|
function ZBar () {};
|
|
|
|
|
|
|
|
ZBar.prototype = {
|
|
|
|
|
|
|
|
scan: function (params, success, failure)
|
|
|
|
{
|
|
|
|
argscheck.checkArgs('*fF', 'CsZBar.scan', arguments);
|
2014-12-06 15:40:17 +08:00
|
|
|
|
|
|
|
params = params || {};
|
|
|
|
if(params.text_title === undefined) params.text_title = "Scan QR Code";
|
|
|
|
if(params.text_instructions === undefined) params.text_instructions = "Please point your camera at the QR code.";
|
2014-12-06 16:38:00 +08:00
|
|
|
if(params.camera != "front") params.camera = "back";
|
2014-12-06 16:58:46 +08:00
|
|
|
if(params.flash != "on" && params.flash != "off") params.flash = "auto";
|
2014-12-06 15:40:17 +08:00
|
|
|
|
2014-09-11 15:52:59 +08:00
|
|
|
exec(success, failure, 'CsZBar', 'scan', [params]);
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = new ZBar;
|