Giter Site home page Giter Site logo

Comments (5)

blakebyrnes avatar blakebyrnes commented on August 21, 2024

The example in the readme should be all you need. Let me know if you've seen those and still aren't sure what to do.

from cordova-plugin-honeywell-captuvo.

TheRobBrennan avatar TheRobBrennan commented on August 21, 2024

Hi Blake,

Thanks for your prompt reply! The part I’m confused on is this example:

document.addEventListener("deviceready", function(){
...
captuvo.registerScannerCallback(function(barcode){

       console.log("Barcode scanned: " + barcode);

       //TODO: handle barcode/label type
   });
   //This function will send the first readable track
   captuvo.registerMagstripeCallback(function(track){
        //track 1 uses carets as dividers (NOTE: won't work if track 2 is read)
        if (track.indexOf("%B") == 0) {
          track = track.split('^');

          var cc = {
             number : track[0].substr(2), //strip leading %B
             name : track[1].trim(),
             expr : '20' + track[2].substr(0,2) + '-' + track[2].substr(2,2)
          };
        } else {
          //handle track 2
        }

   });

Where does the device itself - captuvo - get defined/initialized? I’m curious where that part of the code is.

On Jan 26, 2015, at 7:34 PM, Blake Byrnes [email protected] wrote:

The example in the readme should be all you need. Let me know if you've seen those and still aren't sure what to do.


Reply to this email directly or view it on GitHub #1 (comment).

from cordova-plugin-honeywell-captuvo.

blakebyrnes avatar blakebyrnes commented on August 21, 2024

Hi Rob,
When you call captivo.registerScannerCallback, it will activate the hardware under the covers. You should not need to do anything else. Hope that answers your question!
Blake

Sent from my iPhone

On Jan 26, 2015, at 8:36 PTheRobBrennan [email protected] wrote:

Hi Blake,

Thanks for your prompt reply! The part I’m confused on is this example:

document.addEventListener("deviceready", function(){
...
captuvo.registerScannerCallback(function(barcode){

console.log("Barcode scanned: " + barcode);

//TODO: handle barcode/label type
});
//This function will send the first readable track
captuvo.registerMagstripeCallback(function(track){
//track 1 uses carets as dividers (NOTE: won't work if track 2 is read)
if (track.indexOf("%B") == 0) {
track = track.split('^');

var cc = {
number : track[0].substr(2), //strip leading %B
name : track[1].trim(),
expr : '20' + track[2].substr(0,2) + '-' + track[2].substr(2,2)
};
} else {
//handle track 2
}

});
Where does the device itself - captuvo - get defined/initialized? I’m curious where that part of the code is.

Rob Brennan | [email protected]
Phone (360) 531-3830
Skype The.Rob.Brennan
Web http://www.therobbrennan.com

On Jan 26, 2015, at 7:34 PM, Blake Byrnes [email protected] wrote:

The example in the readme should be all you need. Let me know if you've seen those and still aren't sure what to do.


Reply to this email directly or view it on GitHub #1 (comment).


Reply to this email directly or view it on GitHub.

from cordova-plugin-honeywell-captuvo.

TheRobBrennan avatar TheRobBrennan commented on August 21, 2024

Oh yeah. For some reason I was thinking that there was an initialization phase that had to occur.

One final question (I promise) - were you able to get the callback to fire more than once? In a very simple app, I was able to get the callback to fire once, but it failed to run on subsequent scans of the same barcode. Any idea what I might be missing perhaps?

I really do appreciate your time on this. I love the plug-in; just want to make sure I'm using it correctly =)


document.addEventListener("deviceready", init, false);
var resultDiv;
function init() {
    resultDiv = document.querySelector("#results");
    // Honeywell SL42 scanner
    captuvo.registerScannerCallback(function(barcode){
        //console.log("Barcode scanned: " + barcode);
        resultDiv.innerHTML = "Barcode scanned: " + barcode;
        //TODO: handle barcode/label type
    });
}

from cordova-plugin-honeywell-captuvo.

TheRobBrennan avatar TheRobBrennan commented on August 21, 2024

Solved! Figured it was best to just create a function and have it re-register for the callback:


document.addEventListener("deviceready", init, false);
var resultDiv;
var counter = 0;
function init() {
    resultDiv = document.querySelector("#results");
    prepareScannerToReceiveBarcodeData();
}
// Honeywell SL42
function prepareScannerToReceiveBarcodeData(){
    captuvo.registerScannerCallback(function(barcode){
        resultDiv.innerHTML = "Barcode scanned [" + counter + "]: " + barcode;
        counter++;    // ...just to prove that we're successfully calling back our function multiple times
        
        // TODO: handle barcode/label type
        /* Super secret processing */
        // Add the callback handler again
        prepareScannerToReceiveBarcodeData();
    }); 
}

from cordova-plugin-honeywell-captuvo.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.