我目前正在开展一个项目,使用 C#、POS for .NET 和 Honeywell 的 POS4NET 套件来控制 Honeywell Genesis 7580G 扫描仪。我想获取当前的串行读取超时,所以我通过以下方式从 POS4NET 调用 DirectIO() 方法:
string command = "TRGSTO?.";
DirectIOData response = scanner.DirectIO(18, 1024, Encoding.ASCII.GetBytes(command));
byte[] buffer = (byte[])response.Object;
Console.WriteLine("$: Response: " + Encoding.ASCII.GetString(buffer));
此代码打印:
“$:响应:TRGSTO20”
其中缺少三个零(时间单位为毫秒)和 [ACK] 字符。我期待这个...
“$:响应:TRGSTO20000[ACK]”
但是,如果我更改命令以获得不同的设置...
string command = "BEPPWR?.";
DirectIOData response = scanner.DirectIO(18, 1024, Encoding.ASCII.GetBytes(command));
byte[] buffer = (byte[])response.Object;
Console.WriteLine("$: Response: " + Encoding.ASCII.GetString(buffer));
代码按预期工作,并打印
“$:响应:BEPPWR1[ACK]”
使用 DirectIO() 发送查询命令的正确方法是什么?