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
  • Hello,

    I can't seem to get the battery level indicator either when I connect my Logitech mouse, but does show if I click on the Bluetooth icon in the menu bar:

    Do you see the same?

    Best regards,

    Vidar

    Edit: To clarify, macOS did not display the battery level for my logitech mouse in Bluetooth preferences either. It did however display it in the dropdown menu when I selected the bluetooth icon from the menubar. So I think this indicates that the battery level can't be displayed in Bluetooth preferences. Though I haven't found anything in the Apple documentation to confirm this.


  • In this photo that I am sharing, you can see my store-bought M720 Bluetooth Mouse and its battery level. The custom device I am working on is named "TL_Dev" and although we have an active and otherwise functional connection, it wont display the battery level.

  • It worked for me when I tried the original ble_app_hids_mouse example in SDK 16.0.0 which enables the Battery service by default.

    Could you try to connect to your device from the nRF connect app on Android or iOS, then subscribe to battery level notifications to verify that it works?

  • Hi Vidar,

    Sorry for the delayed response. I can connect to my device via the iOS nRF Connect app and I can successfully Subscribe to the Battery Level Notifications. While keeping an eye on this subscription, I verified that it does appear to be reporting the correct battery percentages. So from this standpoint, everything seems to be working as expected (minus the battery icon in the Bluetooth dropdown menu).

    As a next step, I will try and verify the original SDK example works on my end and with my DK. I can report back to you my findings, but am also curious if you have any other ideas I could try.

    Many thanks

    cor10

  • Hi,

    No worries. Unfortunately, there is not much else I can think of except for trying to compare differences between your implementation and the one in the SDK (assuming battery reporting works when you try our HID example).

  • It does appear to be an issue with our custom hardware or the firmware changes we have made along the way....your default HID Mouse example does behave as expected with the battery status icon in the drop down menu. Thanks

Reply Children
  • Thanks for confirming. Hopefully it won't take too long to find out what change it is.

  • 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.

Related