0 Replies Latest reply on Mar 1, 2019 2:51 AM by Daniel van der Tang

    com.symbol.scanning.Scanner$ScannerExceptions: Scanner is in an invalid state to make the operation

    Daniel van der Tang

      Hello,

       

      We've some TC25 devices where the scanner doesn't pass status and scans to the application via emdk when a user triggers to fast. The app doesn't crash or show an exception. But when this occurs i see the following in the device monitor.

       

      After this exception the app doesn't receive status updates (latest is WAITING) and barcode scans:

       

      03-01 03:32:55.952: W/System.err(7284): com.symbol.scanning.Scanner$ScannerExceptions: Scanner is in an invalid state to make the operation
      03-01 03:32:55.952: W/System.err(7284): at com.symbol.scanning.Scanner.createScannerException(Scanner.java:376)
      03-01 03:32:55.952: W/System.err(7284): at com.symbol.scanning.Scanner.readSubmitLegacy(Scanner.java:2620)
      03-01 03:32:55.952: W/System.err(7284): at com.symbol.scanning.Scanner.scanSubmitRead(Scanner.java:3068)
      03-01 03:32:55.952: W/System.err(7284): at com.symbol.emdk.emdkservice.barcode.SvcScanner$8.run(SvcScanner.java:865)
      03-01 03:32:55.952: W/System.err(7284): at android.os.Handler.handleCallback(Handler.java:751)
      03-01 03:32:55.953: W/System.err(7284): at android.os.Handler.dispatchMessage(Handler.java:95)
      03-01 03:32:55.953: W/System.err(7284): at android.os.Looper.loop(Looper.java:154)
      03-01 03:32:55.953: W/System.err(7284): at android.os.HandlerThread.run(HandlerThread.java:61)
      

       

      The device is always working with hard trigger and always the internal 2d scanner. This is the status code in Xamarin Android.

       

                private void scanner_Status(object sender, Scanner.StatusEventArgs e)
               {
                   StatusData statusData = e.P0;
                   StatusData.ScannerStates state = e.P0.State;
       
                   Console.WriteLine(DateTime.Now.ToString());
                   Console.WriteLine("scanner state");
                   Console.WriteLine(state);
       
                   if (state == StatusData.ScannerStates.Idle)
                   {
                       if (GlobalApplication.ZebraScanner.IsEnabled && !GlobalApplication.ZebraScanner.IsReadPending)
                       {
                           try
                           {
                               Thread.Sleep(300);
                               if (GlobalApplication.ZebraScanner.IsEnabled && !GlobalApplication.ZebraScanner.IsReadPending)
                               {
                                   GlobalApplication.ZebraScanner.Read();
                               }
                           }
                           catch (ScannerException ex)
                           {
                               Console.WriteLine(ex.Message);
                               Console.WriteLine(ex.StackTrace);
                           }
                           catch (NullReferenceException ex)
                           {
                               Console.WriteLine(ex.Message);
                               Console.WriteLine(ex.StackTrace);
                           }
                       }
                   }
       
               }
      
      
      

       

      Is there a way to solve this issue?