我已经创建了一个监视器来使用Windows.Devices.PointOfService连接到BarcodeScanner
var watcher = DeviceInformation.CreateWatcher(BarcodeScanner.GetDeviceSelector());
var id = "";
watcher.Added += async (sender, information) =>
{
id = information.Id;
var barcodeScanner = await BarcodeScanner.FromIdAsync(id);
...
}信息参数包含与我的barcodeScanner相关的所有数据,但当我尝试使用FromIdAsync获取它时,它始终为空。这些都是包含在信息中的数据
- information {Windows.Devices.Enumeration.DeviceInformation} Windows.Devices.Enumeration.DeviceInformation
EnclosureLocation null Windows.Devices.Enumeration.EnclosureLocation
Id "\\\\?\\HID#VID_0536&PID_02E1&MI_01#c&d907bf5&0&0000#{c243ffbd-3afc-45e9-b3d3-2ba18bc7ebc5}\\POSBarcodeScanner" string
IsDefault false bool
IsEnabled true bool
Kind DeviceInterface Windows.Devices.Enumeration.DeviceInformationKind
Name "3800G" string
+ Pairing {Windows.Devices.Enumeration.DeviceInformationPairing} Windows.Devices.Enumeration.DeviceInformationPairing
+ Properties {System.__ComObject} System.Collections.Generic.IReadOnlyDictionary<string, object> {System.__ComObject}
+ Native View 0x1d148140 <Information not available, no symbols loaded for Windows.Devices.Enumeration.dll> IUnknown *此设备列出为已启用,可通过POS访问。
我哪里错了?我也尝试过创建按钮点击后的观察者,但没有任何改变。
发布于 2018-09-11 19:01:32
如果您正在使用的扫描仪的型号名称是问题代码中的"3800G“,则Windows.Devices.PointOfService可能不支持该型号。
支持的型号列表如下所示。
Supported Point of Service Peripherals
如果您想将其与Windows.Devices.PointOfService一起使用,请将其更改为本文中描述的模型。
额外的:
统一POS标准和Windows®Embedded for Point of Service是.NET/JavaPOS API的OPOS/POS。不是Windows.Devices.PointOfService接口。
该型号没有在Honeywell's site上列出。
并且,在日本的销售代理可以在销售结束时显示。它可能是一个旧型号。最好是换成新的型号。
例如,detailed manual of 1900 series的第21页介绍了USB条形码扫描仪模式设置。
如果3800G手册中没有该模式设置说明,则3800G不能使用Windows.Devices.PointOfService接口。
如果您可以设置它,如果您安装了与此模式对应的设备驱动程序,则可以使用它。
发布于 2018-09-14 21:43:52
@Luigi Saggese,
您必须首先将此扫描仪置于USB HID条形码扫描仪模式。有关将扫描仪置于此模式的编程代码,请参阅Honeywell 3800g Users Guide的第1-3页。
一旦扫描仪处于此模式,您应该会在Windows设备管理器中看到POS条形码扫描仪节点。特定的扫描仪将在设备管理器中显示为POS HID条形码扫描仪,因为它使用的是支持USB HID POS扫描仪协议的内置类驱动程序。在这一点上,它应该可以与您的观察者一起工作。
Terry Warwick,微软
https://stackoverflow.com/questions/52272168
复制相似问题