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

HID Ble Keyboard + LBS(button service) question

Hi All,

I'm new in developing BLE 4.0 device, now have a project is adding LBS(led button service) to a standard ble HID keyboard application in SDK 9.0, the reason why I need HID service is this is only way that the iOS can discover my BLE device in [setting] -> [Bluetooth], otherwise, a BLE device can only be dsicovered by the APP which works with it.

Now the problem is, I can connect my device in iOS [setting] -> [Bluetooth] and when press the button, the lbs function works(I send a button characteristic of read value of 1 when pressed and send 0 when button is released), so that the App on the iPhone side work as expected. But if I turn off the Bluetooth in iPhone and turn on again, it re-connects the device automatically, this looks good, but at the moment, the lbs service no longer works, App on the iPhone stops reacting when the button is pressed.

I'm sure the button is working because the LED toggled the status when button is pressed, just the function "ble_lbs_on_button_change" seems not working anymore. The only way to let it work again is in iPhone's Bluetooth setting, "forget" my device and connect again then everything backs to normal.

Can anyone tell me how to fix this? Anything I did wrong in my code? Any help will be appreciated.

Thanks,

Parents
  • Most likely iOS forgets the state of your CCCD's when you turn bluetooth off/on, so i suggest you enable it from your iOS application again. If this doesn't help please provide a sniffer trace showing the failing scenario, and also check for an error code when calling sd_ble_gatts_hvx (I would guess you are getting invalid state here).

  • Hi,

    I did another test and I found as long as the device is not reset, the button will behave normal, but with SDK9.0, if iOS's Bluetooth is turned off, the device will reset every few minutes, this will result my BLE device can't work.

    I search the forum and found this reset issues is fixed in SDK11.0 and I have a test with the HID_keyboard example, it doesn't reset but SDK11.0 comes another problem, iOS7.0/9.0 can not find my BLE keyboard in Bluetooth, only iOS 8.4. is able to discover it, also SDK11.0 has only Softdevice 130, no 110, does the Softdevice version has to do with the discovery from iOS? Any idea to help?

    Thanks,

Reply
  • Hi,

    I did another test and I found as long as the device is not reset, the button will behave normal, but with SDK9.0, if iOS's Bluetooth is turned off, the device will reset every few minutes, this will result my BLE device can't work.

    I search the forum and found this reset issues is fixed in SDK11.0 and I have a test with the HID_keyboard example, it doesn't reset but SDK11.0 comes another problem, iOS7.0/9.0 can not find my BLE keyboard in Bluetooth, only iOS 8.4. is able to discover it, also SDK11.0 has only Softdevice 130, no 110, does the Softdevice version has to do with the discovery from iOS? Any idea to help?

    Thanks,

Children
No Data
Related