Microsoft POS 无法识别扫描仪
我有 Metro Technologies 的条形码扫描仪,并且正在使用 Microsoft POS 检测来自扫描仪的输入。它使用 USB 连接到我的系统 港口。但 POS 无法识别扫描仪。
public Form1()
{
InitializeComponent();
explorer = new PosExplorer(this);
explorer.DeviceAddedEvent += new
DeviceChangedEventHandler(explorer_DeviceAddedEvent);
}
void explorer_DeviceAddedEvent(object sender, DeviceChangedEventArgs e)
{
if (e.Device.Type == "Scanner")
{
scanner = (Scanner)explorer.CreateInstance(e.Device);
scanner.Open();
scanner.Claim(1000);
scanner.DeviceEnabled = true;
scanner.DataEvent += new
DataEventHandler(activeScanner_DataEvent);
scanner.DataEventEnabled = true;
scanner.DecodeData = true;
}
}
void activeScanner_DataEvent(object sender, DataEventArgs e)
{
UpdateEventHistory("Data Event");
ASCIIEncoding encoder = new ASCIIEncoding();
try
{
// Display the ASCII encoded label text
txtbScanDataLabel.Text =
encoder.GetString(activeScanner.ScanDataLabel);
// Display the encoding type
txtbScanDataType.Text = activeScanner.ScanDataType.ToString();
// re-enable the data event for subsequent scans
activeScanner.DataEventEnabled = true;
}
catch (PosControlException)
{
// Log any errors
UpdateEventHistory("DataEvent Operation Failed");
}
}
I have a barcode scanner from Metro Technologies and I am using Microsoft POS
to detect the input from the scanner. It is connected to my system using USB
port. But the scanner is not getting identified by the POS.
public Form1()
{
InitializeComponent();
explorer = new PosExplorer(this);
explorer.DeviceAddedEvent += new
DeviceChangedEventHandler(explorer_DeviceAddedEvent);
}
void explorer_DeviceAddedEvent(object sender, DeviceChangedEventArgs e)
{
if (e.Device.Type == "Scanner")
{
scanner = (Scanner)explorer.CreateInstance(e.Device);
scanner.Open();
scanner.Claim(1000);
scanner.DeviceEnabled = true;
scanner.DataEvent += new
DataEventHandler(activeScanner_DataEvent);
scanner.DataEventEnabled = true;
scanner.DecodeData = true;
}
}
void activeScanner_DataEvent(object sender, DataEventArgs e)
{
UpdateEventHistory("Data Event");
ASCIIEncoding encoder = new ASCIIEncoding();
try
{
// Display the ASCII encoded label text
txtbScanDataLabel.Text =
encoder.GetString(activeScanner.ScanDataLabel);
// Display the encoding type
txtbScanDataType.Text = activeScanner.ScanDataType.ToString();
// re-enable the data event for subsequent scans
activeScanner.DataEventEnabled = true;
}
catch (PosControlException)
{
// Log any errors
UpdateEventHistory("DataEvent Operation Failed");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自一些论坛以及 POS SDK 文档:
您必须将其添加到目录中的 xml 文件中:
您必须检查设备的硬件 ID 并将其替换为标签
这是即插即用配置。
From some forums and also in POS SDK documentation:
You have to add this in an xml file in the directory:
You have to check the Hardware Id of your device and replace it inside the
<HardwareId>
tagThis is plug and play configuration.
这是完整的代码
Here is the entire code
我不熟悉您正在使用的扫描仪,但是根据我之前使用过的所有内容,您通常希望确保扫描仪本身配置为正确的模式/设置/等。通常,这是通过完成手册中的配置序列来完成的,您将在其中扫描对设备进行编程的各种条形码。
如果没有其他问题,您可以排除硬件配置问题而不是代码问题。
explorer_DeviceAddedEvent
是否会触发?扫描仪
在哪里和
activeScanner
已初始化?[编辑]
检查扫描仪本身或附带的文档中的硬件 ID (HID),尝试将以下行添加到您的代码中。
看看这是否能让您进一步...请参阅此处< /a> 有关详细信息,您可以提供 HID 或将该信息添加到 XML 配置文件中
I'm not familiar with the scanner you are using, but with all that I've worked with before you generally want to make sure that the scanner itself is configured for the correct mode/settings/etc. Usually this is done by going through a configuration sequence that's in the manual where you'll scan various barcodes that program the device.
If nothing else you can rule out an issue with the hardware config as opposed to your code.
Does the
explorer_DeviceAddedEvent
ever fire?Where are
scanner
and
activeScanner
initialized?[EDIT]
Check the scanner itself or the docs that came with it for a Hardware ID (HID), try adding the following line to your code.
See if that gets you any further...see here for more info, you can provide the HID or add that info in an XML config file
我在这里找到了配置(Windows 7平台):
I found the configuration here (Windows 7 platform):