简体   繁体   English

如何断开Windows 8.1上的蓝牙LE设备

[英]How to disconnect bluetooth LE device on Windows 8.1

I'm developing an application with bluetooth low energy under Windows 8.1 and working with microsoft bluetooth le stack. 我正在开发一个在Windows 8.1下使用蓝牙低能耗的应用程序,并使用微软蓝牙文件栈。 I almost finish with all routines, I implemented: connection, reconnection, detection connection/disconnection notifications, connection state check... but one thing left - disconnection. 我几乎完成了所有例程,我实现了:连接,重新连接,检测连接/断开连接通知,连接状态检查......但还有一件事 - 断开连接。

So, how to disconnect connected device using C++? 那么,如何使用C ++断开连接的设备?

你不能,他们没有在windows sdk中实现这个功能,说维持连接比重新连接更好(在功耗方面)。

  1. Remove all ValueChanged events (-=) 删除所有ValueChanged事件( - =)
  2. Set all GattCharacteristic to null 将所有GattCharacteristic设置为null
  3. Call Dispose on all Gatt Devices Services 呼叫处理所有Gatt设备服务
  4. Call dispose on the BluetoothLEDevice 呼叫处理BluetoothLEDevice
  5. Set the BluetoothLEDevice member to null 将BluetoothLEDevice成员设置为null
  6. GC.Collect() 所以GC.Collect()
  7. GC.WaitForPendingFinalizers() GC.WaitForPendingFinalizers()

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

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