This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to send the VIRTUAL_CABLE_UNPLUG request ?

Hi: chip:nRF51822 code:ble keyboard

How to send the VIRTUAL_CABLE_UNPLUG request by Bluetooth HID devices?
If Virtual Cable Unplug is received by a Bluetooth HID device ,how can i know?

HID_SPCE_V11.pdf (HUMAN INTERFACE DEVICE PROFILE 1.1)
3 Bluetooth HID Protocol............... 24
3.1.2.2 HID_CONTROL ................ 26

3.1.2.2.3 VIRTUAL_CABLE_UNPLUG
A HID_CONTROL message with a parameter of VIRTUAL_CABLE_UNPLUG may be sent by the Bluetooth HID Host to the Bluetooth HID device or by the Bluetooth HID device to the Bluetooth HID Host. If Virtual Cable Unplug is sent by a Bluetooth HID device or Bluetooth HID Host, then the sender shall destroy or invalidate all Bluetooth bonding and Virtual Cable information that was previously stored in persistent memory for the device to which the VIRTUAL_CABLE_UNPLUG request was sent. If Virtual Cable Unplug is received by a Bluetooth HID device or Bluetooth HID Host, then the recipient shall destroy or invalidate all Bluetooth bonding and Virtual Cable information that was previously stored in persistent memory for the device which sent the VIRTUAL_CABLE_UNPLUG request. The recipient shall not send a HANDSHAKE message but shall acknowledge this command by sending back an L2CAP Disconnect Request signal for the Interrupt channel.  After the Interrupt channel has closed, the recipient of the VIRTUAL_CABLE_UNPLUG shall then send an L2CAP Disconnect Request signal for the Control channel. If there are no other profiles using the ACL connection then the recipient of the VIRTUAL_CABLE_UNPLUG should then disconnect the ACL connection. The recipient should discard any control transfers which are pending at the time of the receipt of the  VIRTUAL_CABLE_UNPLUG.

A HID_CONTROL message with a parameter of VIRTUAL_CABLE_UNPLUG is the only HID_CONTROL message a Bluetooth HID device may send to a Bluetooth HID Host. A Bluetooth HID Host shall ignore all other HID_CONTROL messages sent by Bluetooth HID devices.

Related