使用BOS平台下面的串口控件问题
金蝶云社区-370223768
370223768
0人赞赏了该文章 1,337次浏览 未经作者许可,禁止转载编辑于2016年03月23日 14:29:42

我通过一个菜单初始化一个串口控件
[code]if (e.BarItemKey == "tbButton")
{

KDSerialPortConfig cfg;
cfg = new KDSerialPortConfig();
cfg.PortName = "COM1";
cfg.Rate = 1200;
cfg.Parity =0;
cfg.Bits = 8;
cfg.StopBits = 1;
cfg.Timeout = -1;
cfg.EncodingName = "ASCII";
//this.View.GetControl("F_sd_SerialPortCtrl").Init(cfg);
this.View.GetControl("F_sd_SerialPortCtrl").InvokeControlMethod("Init", cfg);
this.View.GetControl("F_sd_SerialPortCtrl").Visible = true;
}[/code]然后在数据接收事件中的赋值给界面的一个文本框
[code] public override void PortDataReceived(KDSerialPortEventArgs e)
{
//base.PortDataReceived(e);
this.Model.SetValue("F_sd_Text", e.Value);
this.View.UpdateView("F_sd_Text");
//this.View.ShowMessage("数据到达", 0);

}[/code]
文本框是可以正确的赋值,但是接收到的数据确实不对的。
Url:/ ServiceName:service100 PageId:d68bf7c6-4de2-4c10-8115-35bd36cbc461 MethodName:PortDataReceived Params:["F_SD_SERIALPORTCTRL",{"Key":"F_SD_SERIALPORTCTRL","DataType":"String","Value":"0200000000000000","Row":0,"ReceivedDataType":1},null]

Url:/ ServiceName:service100 PageId:d68bf7c6-4de2-4c10-8115-35bd36cbc461 MethodName:PortDataReceived Params:["F_SD_SERIALPORTCTRL",{"Key":"F_SD_SERIALPORTCTRL","DataType":"String","Value":"02","Row":0,"ReceivedDataType":1},null]


这是两次接收的数据。
实际中接受的数据应该是0231323630393931420D03
02是开始标志,0D是结束标志 03应该是校验和
但是cloud中接收的数据却不是这个问题,请问是什么原因呢?
cloud串口控件是否是直接将串口传过来的BYTE数组转成了16进制数,然后拼成了字符串?还是有其他的处理?