如何从 C# 程序识别哪些 COM 端口连接到蓝牙?
如何从 C# 程序识别哪些 COM 端口连接到蓝牙?
这是我的要求。让我们假设我的计算机中的 COM 端口连接到各种设备。假设我们有 COM 端口 1 到 9,并且目前已连接 2、3、4、5 和 7。现在我需要确定端口2、3、4、5和7中哪些端口连接了蓝牙设备?
我需要使用 C# 程序来完成此操作。有什么建议吗?
How to identify which COM ports are connected to BlueTooth from a C# Program?
Here is my requirement. Let us assume the COM ports in my computer are connected to various devices. Let's say we have COM ports 1 through 9, and 2, 3, 4, 5, and 7 are connected at the moment. Now I need to identify, among ports 2, 3, 4, 5 and 7, which ports are connected to BlueTooth devices?
I need to do this using a C# program. Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅 http://32feet.codeplex.com/wikipage?title= Getting%20Virtual%20COM%20Port%20Names 简而言之使用WMI查看端口硬件id中的BluetoothAddress。
当然,我不喜欢虚拟 COM 端口,并且始终建议尽可能使用直接套接字/API 连接。 http://32feet.codeplex.com/wikipage?title=Bluetooth%20Serial%20Ports http://32feet.codeplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections
See http://32feet.codeplex.com/wikipage?title=Getting%20Virtual%20COM%20Port%20Names In brief use WMI to see the BluetoothAddress in the port hardware id.
Of course I'm not a fan of virtual COM port and always recommend using a direct sockets/API connection where possible. http://32feet.codeplex.com/wikipage?title=Bluetooth%20Serial%20Ports http://32feet.codeplex.com/wikipage?title=General%20Bluetooth%20Data%20Connections
您可以在注册表中查看。
如果您有多个设备,还可以有“\Device\BthModem1”或“\Device\BthModem2”等。
You can look in the registry.
If you have more than one device, there can also be "\Device\BthModem1" or "\Device\BthModem2" ect.