none
POS for .NET - Scanner - What could cause some QR code to not trigger DataEvent while other does? RRS feed

  • Question

  • We successfully run an App using POS for .NET for about a year now. This App basicaly read QRCode on network device to get MAC address. But recently we had a weird issue: some particular QRCode were not received by our App.

    We did run our code using Step by Step Debugger and Breaking point. Most of QRcode are working properly but some others are not working at all.
    I mean the Scanner.DataEvent is not fired for specific QRCode. We did also check with the OPOS tool provided by the scanner manufacturer (DualTest from Datalogic) and all data are well received.

    2 sample of QRCode data:
    F09FC2F09402-q2zZ2n is working in all case
    18E8299096EC-qHERPC does not work with POS for .Net but is working fine with other OPOS tool.
    To give more context here below a simplified version of our source code using POS for .Net 1.4.1:

    public class CodeScanner 
    {
        public event Action<String> DataReceived;
        private Microsoft.PointOfService.Scanner _scanner;
    
        public Boolean Connect() 
        {
           Microsoft.PointOfService.PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer(); //null reference if POS .net is not installed
           Microsoft.PointOfService.DeviceInfo device = null;
           foreach (Microsoft.PointOfService.DeviceInfo d in posExplorer.GetDevices(DeviceType.Scanner))
           {
               if (d.ServiceObjectName == "RS232Imager")
               {
                    device = d;
               }
           }
    
           _scanner = (Microsoft.PointOfService.Scanner)posExplorer.CreateInstance(device);
           _scanner.Open();
           _scanner.Claim(1000);
           _scanner.DataEvent += Scanner_DataEvent;
           _scanner.DeviceEnabled = true;
           _scanner.DataEventEnabled = true;
           _scanner.DecodeData = true;
    
           return true;
        }
    
        private void Scanner_DataEvent(Object sender, DataEventArgs e)
        {
            String data = System.Text.Encoding.UTF8.GetString(_scanner.ScanData);
            Task.Run(() => DataReceived?.Invoke(data));
            _scanner.DataEventEnabled = true;
            _scanner.ClearInput();
        }
    }

    Thursday, September 12, 2019 7:01 AM

All replies

  • Hi Guillaume Raymond at Smart Liberty,

    Thank you for posting here.

    >>But recently we had a weird issue: some particular QRCode were not received by our App.

    Have you made any changes to POS for .Net 1.4.1 recently?

    If not, I suggest you report a problem in Developer Community for more help.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 16, 2019 2:13 AM
    Moderator