Last week in a project of ours we were exploring the BLE capabilities of
CoreBluetooth framework in iOS: the vast majority of apps have the iPhone working as a central Bluetooth hub and interacting with various BLE peripherals that advertise their services.
We wanted instead to have the iPhone acting as a peripheral and advertise its services to another Bluetooth enabled device.
For the sake of simplicity we decided to implement an HID device: the iPhone would’ve acted as a bluetooth keyboard.
We set up our service and characteristics constants as:
define humanInterfaceDeviceService @“0X180D”
define bootKeyboardInputReportService @“0X2A22”
define bootKeyboardOutputReportService @“0X2A32”
Unfortunately the service was not being correctly discovered and after some tedious debugging, we found out Apple has intentionally reserved HID support for iOS since it filters out all related services during the discovery process, although there’s no clear documentation about that.
Changing constants to non standard ones solved the discovery problem, although in this way the iPhone cannot work anymore as a standard HID device.