models/QRCode.js
/* 
    read qrcode image as binary data
    decode qrcode image to corresponding data as string
    
    */
read qrcode image as binary data
decode qrcode image to corresponding data as string
read qrcode image as binary data decode qrcode image to corresponding data as string
static parseQRCode(binaryData)
    {
        var ZXing = require('nativescript-zxing');
        var zx = new ZXing();
        var options = {tryHarder: true, formats: [ZXing.QR_CODE]};
        var results = zx.decodeBarcode(binaryData, options);
        if (!results) {
            console.log("Unable to decode barcode");
            return "";
        }
        else 
        {
            console.log("Barcode format", results.format);
            console.log("Barcode value", results.barcode);
            return(results.barcode);
        }
    }
static parseQRCode ( binaryData ) { var ZXing = require ( 'nativescript-zxing' ) ; var zx = new ZXing ( ) ; var options = { tryHarder : true , formats : [ ZXing . QR_CODE ] } ; var results = zx . decodeBarcode ( binaryData , options ) ; if ( ! results ) { console . log ( "Unable to decode barcode" ) ; return "" ; } else { console . log ( "Barcode format" , results . format ) ; console . log ( "Barcode value" , results . barcode ) ; return ( results . barcode ) ; } }
read qrcode image as binary data
decode qrcode image to corresponding data as string
read qrcode image as binary data decode qrcode image to corresponding data as string
//TODO: currently load nativescript library. change to javascript, for desktop app? //try to read code from binary image data