Below is the output from a 'bluetoothctl' session for one of my thingy:52's
This is running on a raspberry pi 4 using Ubuntu Mate 20.xx
The output below is using command line 'bluetoothctl'. (Clearly the actual Mac adrs you see has been altered for this post)
The Thingy can be connected to and all characteristics can be read ( those identified as 'Read' in the spec)
Using 'bluetoothctl: notify on' for other notification capable characteristics will produce updates.
Regarding reading the battery level/value, the nRF Connect app for iOS can read the battery level.
The bluetoothctl session below shows that I can connect to the thingy:52, drill into the battery characteristic, set it to notify,
but no notification is received. This is even after sufficient time has elapsed for the battery state to change.
Yes, I am aware that the documentation shows no battery notification is sent unless the state of the battery (read that as level of charge) changes.
However, the iOS nRFConnect app is able to do a one-shot read of the battery level/value if one taps on the 'single down arrow' icon.
The FW version 2.2.0 (which is running on my Thingy:52) shows the battery level type to be both Read/Notify.
I would not argue since the iOS app allows a single-shot read.
From the 'bluetoothctl' session below, the service '000a' and char '000b' is the battery service as found by the 'bluetoothctl' command
[bluetooth]# list-attributes xx:18:81:32:yy:B0
// I identified this as the Battery Service, the 0001801 was my clue.
[NEW] Primary Service (Handle 0xb000)
/org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
[NEW] Characteristic (Handle 0xd6b0)
/org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a/char000b
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
[NEW] Descriptor (Handle 0x4680)
/org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a/char000b/desc000d
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Can anyone tell me what is needed in order to do at least a one shot read of the battery value?
Note if I do a ' read' I do get an error, the same error as when I try to read a notification only attribute.
Any help is appreciated...
Regards...
Bluetoothctl session begin:
[bluetooth]# connect xx:18:81:32:yy:B0
[Thingy2]# menu gatt
[Thingy2]# select-attribute /org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a/char000b
[Thingy2:/service000a/char000b]# attribute-info /org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a/char000b
Characteristic - Service Changed
UUID: 00002a05-0000-1000-8000-00805f9b34fb
Service: /org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a
Notifying: no //<---
Flags: indicate
[Thingy2:/service000a/char000b]# notify on
[CHG] Attribute /org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a/char000b Notifying: yes
Notify started //<---
[Thingy2:/service000a/char000b]# attribute-info /org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a/char000b
Characteristic - Service Changed
UUID: 00002a05-0000-1000-8000-00805f9b34fb
Service: /org/bluez/hci0/dev_xx_18_81_32_yy_B0/service000a
Notifying: yes //<---
Flags: indicate
[Thingy2:/service000a/char000b]#