How can I display the Bluetooth HID Mouse Battery Level Status Icon next to device name in Mac OS Bluetooth Preferences list?

System Details:

  • Chip: nRF52840
  • nRF5 SDK: Version 16.0.0
  • mdk version: 8.46.0
  • nrfjprog version: 10.15.4 external
  • nrfutil version: 6.1.3
  • JLinkARM.dll version: 7.64d

Hello,

I have a working nRF52840 custom device that supports the HID Mouse service via BLE and it is working great so far. As part of the nRF HID implementation, our code also support BAS. I want to view my custom device's battery level in my Macbook Pro's Bluetooth Preferences Drop-Down Menu, which lists all my connected BLE devices. In this Drop-Down menu, I can not only see my devices, but I can conveniently view the battery level status icon next to the device name. This gives a quick, high-level battery status update to the user.

Part of me was hoping that setting up the BAS service would simply do the trick, but sadly that is not the case. I tried searching around online for this topic, but had a hard time finding anything specific. What else do I need to set up in my firmware to enable this battery level status icon to appear next to my device's name in my Bluetooth menu? Is this possible? I am happy to share any code if it helps

Thank you for your time & help,
Corten

Parents Reply Children
  • I believe I finally found the answer. Can you verify on your end that the Battery Level Status Icon in the Bluetooth Drop-down Menu is only present for devices that perform bonding? I am using an nRF52840 DK with nRF5 SKD v16 with s140, and all I did to edit the default nrf ble_app_hids_mouse example was to disable bonding:

    #define SEC_PARAM_BOND                  0
    and in the peer_manager_init() function:
    sec_param.kdist_own.enc  = 1;
    sec_param.kdist_own.id   = 1;
    sec_param.kdist_peer.enc = 1;
    sec_param.kdist_peer.id  = 1;


    With these changes, I can make a BLE connection to my nRF52840 DK, but I can no longer see the Battery Level Status Icon indicator in the Bluetooth drop-down menu. Is that the same on your end? Would there be any way to enable this convenient battery level indication without bonding?

  • Hello Vidar, just wanted to follow up regarding my recent question about whether or not this feature only works with BONDED devices. Do you know if this is definitely the case? Thanks

  • Hello,

    Sorry for the delayed response. The HID over GATT profile does require bonding according to the specification here: https://www.bluetooth.com/specifications/specs/hid-over-gatt-profile-1-0/ (see section 6.1). I have not found any documentation from Apple stating whether the enforce this requirement or not. But from past experience, I don't think corebluetooth will automatically subscribe to a characteristic unless it is bonded with the device.

    Do you not support bonding in your project?

  • Hey, no worries on the delay. Thanks for the link to the spec, that makes sense.
    Regarding the behavior or CoreBluetooth, that would make sense about bonding....and eventually, we will support bonding for our devices that we make for users, but our development devices perform Pairing w/o Bonding because its just a simple/more convenient process.

    In any event, this sort of confirms what I was reaching for, at least for the time being. Until I am able to explore the bonding behavior in greater depth, I may stop trying to get this battery level indication to work on my Mac. I have already seen that the battery level indication that I seek is working perfectly on a PC, so it does seem Mac-specific and likely it needs Bonding.

  • Thanks for the update. I tested the ble_app_hid_mouse example today with and without bonding, and it turns out my assumption was wrong - CoreBluetooth starts subscribing to the battery service even if I just pair without bonding.

    Despite this, the battery level only gets displayed when I pair with the bonding flag set.

    Sniffer captures for reference:

    - ble_app_hid_mouse_w_bonding.pcapng

    - ble_app_hid_mouse_wo_bonding.pcapng

Related