[BLE][C++]: Correct method to initiate disconnect on Windows Bluetooth stack?

Nidhi S V 11 Reputation points
2021-06-01T07:52:53.793+00:00

Hello All,

Work Setup:
OS: Windows 10 Enterprise
VS Version: Microsoft Visual Studio Professional 2019 Version 16.8.3
Programming Language: C++

The call to trigger disconnect as per documentation is Close() or Dispose().
On using the methods on an object of type BluetoothLEDevice would always return in compilation error as below.

error C2039: 'Close': is not a member of 'Windows::Devices::Bluetooth::BluetoothLEDevice'
error C2039: 'Dispose': is not a member of 'Windows::Devices::Bluetooth::BluetoothLEDevice'
message : You should invoke the destructor, '~BluetoothLEDevice' instead

Also, suggests to invoke the destructor instead. On using the destructor call, it has been observed that a disconnect is issued only on the last connected device.
How can a BLE disconnect be achieved for a device of choice in C++?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,912 questions
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.