0 Replies Latest reply on Sep 5, 2013 2:53 AM by Karun Krishnan

    Callback function after Barcode Scanning

    Karun Krishnan

      Hi

       

      I have implemented a barcode scanning application. I have enabled the scanner and after the barcode is scanned, i am expecting it to come to the callback function. But for some reasons it is not invoking the callback function.

       

      Here is the code to set the callback function.

       

      asl.events.subscribe(asl.events.types.loaded, function() {

         scanner.enable();

         scanner.decodeEvent = 'decodeEvent(%json)';

                 

                  asl.options([

                      {

                          title: 'About',

                          callback: function(t){ alert('This is sample scanner using application.'); }

                      },

                      {

                          title: 'More',

                          callback: function(t){ alert('It uses InvokeMETAFunction.'); }

                      },

                      {

                          title: 'Quit',

                          callback: exit

                      }

                  ]);

              });

       

      The callback function is below

       

      function decodeEvent(jsonObject) {

         alert("decode event  " +jsonObject );

         switch(jsonObject.type){

          case '0x3c': // 128 Code

           store = jsonObject.data;

           break;

         

          case '0x37': // Code 3 of 9

           order = jsonObject.data;

           break;

         }

      }

       

      Anyone who has implemented this functionality, can you tell what could be the reason or the error.

       

      Thanks

      Karun