.net 框架有好的串口类吗?
有人知道有一个好的(希望是免费的)类来替代 .net SerialPort 类吗? 这给我带来了问题,我需要一个稍微灵活一点的。
请参阅我关于我的问题的其他线程,但本质上我需要抑制 IOCTL_SERIAL_SET_DTR 和 IOCTL_SERIAL_CLR_DTR 命令当我打开端口时发出,所以我需要比.net框架提供的类更灵活的东西。
Does anybody know of a good (hopefully free) class to replace the .net SerialPort class? It is causing me issues and I need one that is slightly more flexible.
See my other thread about my issues, but essentially I need to suppress the IOCTL_SERIAL_SET_DTR and IOCTL_SERIAL_CLR_DTR commands from being issued when I open the port, so I need something more flexible than the class provided by the .net framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
几年前,我使用 OpenNETCF.IO.Serial在串行支持添加到 .net 之前。 它适用于紧凑型框架,但我将它用于紧凑型设备和常规 Windows 应用程序。 你可以获得源代码,这样你就可以自己修改它,这就是我所做的。
它基本上围绕从 kernel32.dll 导入的串行函数创建 ac# 包装器。
您可能还想看看如何捕获因 USB 电缆被拔出而消失的串行端口
这是代码我以前叫它
Several years ago I used OpenNETCF.IO.Serial before serial support was added to .net. It is for the compact framework but I used it for both compact devices and regular windows apps. You get the source code so you can modify it yourself which is what I did.
It basically creates a c# wrapper around the serial function imported out of kernel32.dll.
You might also want to have a look at How to capture a serial port that disappears because the usb cable gets unplugged
Here is the code that I used to call it
我还没有尝试过这个,但也许你可以:
I haven't tried tried this but, perhaps you can:
System.IO.Ports.SerialPort
by using Reflector or similar标准 .NET SerialPort 不是密封类 - 您是否有机会从子类获得所需的行为?
The standard .NET SerialPort isn't a sealed class - any chance you can get the behaviour you need from a subclass?