UWP连接/断开蓝牙设备时的回调

huangapple go评论72阅读模式
英文:

UWP Callback when connect/disconnect to a bluetooth devices

问题

我们有一个要求,需要监听蓝牙连接的变化:
例如:连接到任何蓝牙设备,断开与任何蓝牙设备的连接。

请注意,这不是用于监视特定蓝牙设备状态,而是用于监视Windows上任何蓝牙设备的连接/断开。

是否有适用于UWP的API支持此功能?谢谢。

英文:

We have a requirement to listen the Bluetooth connection changes:
such as: connect to a any BT devices, disconnect to a any BT devices.

Please note, it is not for monitoring certain BT devices status, it's for monitoring any BT devices connect/disconnect on Windows.

Is there any API (available for UWP) to support this feature? Thanks.

答案1

得分: 0

你可以使用事件DeviceWatcher.AddedDeviceWatcher.Removed来监视Windows上连接/断开连接的任何蓝牙设备。

建议您参考示例#DeviceEnumerationAndPairing,选择监视蓝牙设备。在蓝牙设备断开连接或连接后,您将收到消息。

英文:

You can use Event DeviceWatcher.Added and DeviceWatcher.Removed to monitor any Bluetooth devices connect/disconnect on Windows.

It is recommended that you refer to the sample #DeviceEnumerationAndPairing and choose to monitor Bluetooth devices. After the bluetooth device is disconnected or connected, you will receive the message.

huangapple
  • 本文由 发表于 2023年7月18日 11:07:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76709289.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定