我正在编写一个应用程序,它使用单声道中 SerialPort 类公开的串行端口.到目前为止,我所写的内容在 Windows 中完美运行,但是在 linux 中,从未输入过 DataReceived 事件处理程序,因此我无法从我的设备接收任何数据.我已将事件处理程序声明如下:
I am writing an app that uses the serial port exposed by the SerialPort class in mono. What I have written so far works perfect in windows, however in linux the DataReceived event handler is never entered, so I cannot receive any data form my device. I have declared the event handler as follows:
comPort.DataReceived += new SerialDataReceivedEventHandler(comPort_DataReceived);基本上,我正在探索良好的跨平台选项,但这是一个交易破坏者.有关如何解决此问题或发生了什么的任何建议?
Basically I am exploring good cross-platform options and this is a deal-breaker. Any advise on how to fix this or what is going on?
编辑-我还应该指出,我已经用其他应用程序测试了 linux 上的串行端口和设备,一切似乎都在工作.
Edit- I should also point out that I have tested the serial port and device on linux with other applications and all appears to be working.
推荐答案mono 不支持串口事件.
mono does not support Event for serialport.
显示在 mono 的网站
更多推荐
linux中单声道中的SerialPort不响应DataReceived事件
发布评论