1 Reply Latest reply on Nov 19, 2015 9:51 AM by Bill Hecox

    Cannot read again when no barcode was scan before

    Martin Mrazik

      Greetings,

       

      I'm developing an application for handheld barcode scanner Motorla MC32NO (Android 4.1) using Symbol EMDK for Android v 3.1. I used codes from basic and advanced scanning tutorials just to be sure I'm doing nothing wrong. Now I have a problem with trigger. If I pull the trigger, laser turns on and I can read barcodes.  But if I pull it without scanning any barcode, laser turns of and I cannot scan any more barcodes until I restart my activity.
      When I pull the trigger and hold it, scanner status is SCANNING and after a while it changes to IDLE, then the laser turns off and onData event is not fired of course. If I then release and pull the trigger again nothing happens.
      I also tried to simulate this behavior with DWDemo application which was shipped with my barcode scanner. It turns the laser on again regarding I scanned barcode or not. I attached my source code. Can you please tell me how can I force my app to behave to turn the reader on everytime I pull the trigger?
      Thank you
        • Re: Cannot read again when no barcode was scan before
          Bill Hecox

          Hello Martin,  I think the "continuous scanning" code you are looking for is in the barcode sample app ( Barcode Sample1 )that is installed on you PC when you install the EMDK. Most of what you need is in the OnStatus method.  Give that a look and let me know if you have further questions.

           

          @Override
          public void onStatus(StatusData statusData) {

          ScannerStates state = statusData.getState();

          switch(state) {
          case IDLE:
          statusString = statusData.getFriendlyName()+" is enabled and idle...";
          new AsyncStatusUpdate().execute(statusString);
          if (bContinuousMode) {
          try {
          // An attempt to use the scanner continuously and rapidly (with a delay < 100 ms between scans)
          // may cause the scanner to pause momentarily before resuming the scanning.
          // Hence add some delay (>= 100ms) before submitting the next read.
          try {
          Thread.sleep(100);
          } catch (InterruptedException e) {
          e.printStackTrace();
          }

          scanner.read();
          } catch (ScannerException e) {
          statusString = e.getMessage();
          new AsyncStatusUpdate().execute(statusString);
          }
          }
          new AsyncUiControlUpdate().execute(true);
          break;