1

I want to read input from two Honeywell scanners, namely Voyager 1202g and Orbit 7190g. For some business requirements, both devices need to be used from the same machine. Both scanners use the Honeywell POS4NET driver.

I need to know, which scanner is delivering the data.

The Scanner objcts are created as follows

// This code is only for illustrating how my application works
// and may therefore be incomplete.

Microsoft.PointOfService.PosExplorer posExp = new PosExplorer(this);
DeviceCollection devices = posExp.GetDevices("Scanner", 
    DeviceCompatibilities.OposAndCompatibilityLevel1);
var listOfScanners =  { Voy1202g ,  Orbit7190g };     // symbolical code

foreach (string device in listOfScanners)
{
    var scanningDevice = posExp.CreateInstance(device) as Microsoft.PointOfService.Scanner;
    if (scanningDevice != null)
    {
        scanningDevice.Claim(1000);
        scanningDevice.DeviceEnabled = true;
        scanningDevice.DataEvent += ScanningDevice_DataEvent;
        scanningDevice.DecodeData = true;
        scanningDevice.DataEventEnabled = true;
        scanningDevice.ErrorEvent += ScanningDevice_ErrorEvent;
    }
}

Problem: When reading data inside the event handler ScanningDevice_DataEvent, I can no longer distinguish between them, because for both scanners, the identical event is fired, no matter which scanner is actually reading the barcode.

void ScanningDevice_DataEvent(object sender, DataEventArgs e)
{
    Scanner scanner = (Scanner)sender; // <--- sender is always the last one
                                       //       in listOfScanners, i.e. 
                                       //       Orbit7190g in this case. 
    // Additional code here ...

}

This issue only arises, when two scanners use the same driver. If I use two or more different scanners, that do not share the driver, it works as expected. It also does, if I start 2 different instances of my application, each one reading from one of the scanners.

Question: How can I make my application fire the correct event?

Remark: To me, it looks as if Microsoft.PointOfService holds a single instance of the handler per ServiceObject type , which, in this case, is always HHP.PointOfService.ServiceObjects.Scanner.HandHeldScanner. When changing the order in which the events are assigned, the recognized scanner also changes.

  • 1
    I think you should be able to get IP. See "Scoping the device selection" at : https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/pos-get-started – jdweng May 15 '18 at 13:19
  • 1
    @mjwills Thanks for the hint; I added some explanatory code at the top of my listing – Hermann Schachner May 15 '18 at 13:35
  • 1
    Oops, that's a typo. Fixed. – Hermann Schachner May 15 '18 at 13:38
  • Maybe there is problem in driver, Honeywell do not provide usage of 2+ scanners with the same PC. Or they assume that scanned barcodes will be identified by type - i.e. the scanners are not differentiated. For example, if you have 2 USB keyboards, Windows will show entered characters from any keyboard. If you have 2 USB mouses, the mouse arrow will be moved equally by both mouses and you will not have 2 mouse arrows. – i486 May 16 '18 at 09:34

0 Answers0