简体   繁体   English

com端口中的事件处理

[英]event handling in com port

i wrote a c++ code to communicate with usb gsm modem using com ports. 我写了一个C ++代码,使用com端口与USB gsm调制解调器进行通讯。 now i want to be informed immediately when the modem is pulled out or disconnected somehow. 现在,当调制解调器被拔出或断开时,我想立即得到通知。 can i do this by using event handling or any other way? 我可以通过使用事件处理或任何其他方式来做到这一点吗? if the answer is yes then I'll be very grateful if someone tell me the way. 如果答案是肯定的,那么如果有人告诉我我将不胜感激。 thanks in advance :). 提前致谢 :)。

thanks Arefin 谢谢阿雷芬

Yes. 是。 The USB standard is quite definite about the fact that unplugging of devices is allowed and must be managed by the OS. USB标准非常明确,可以允许拔出设备,并且必须由操作系统进行管理。 Since you haven't told us which OS, we can't point you to the precise function. 由于您尚未告诉我们哪个操作系统,因此我们无法为您指出确切的功能。 In general, you'd look at the device management functions. 通常,您将查看设备管理功能。

If your platform is Win32, there are messages for device removal that you can register for. 如果您的平台是Win32,则可以注册一些设备删除消息。 I'm sure there is something similar in Linux and other large OS. 我确定Linux和其他大型OS中也有类似的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM