3

I like to use a RaspberryPi to act as HeartRate Sensor and transmit these data via BLTH to other Health/Sport-Apps. Finally all is working fine with python and bluez I'm able to create a BLTH GATT Server and advertise HR-Data via Service 0x180d.

The last problem is I'm not able to change the Appearance of the BLTH in Generic Access (0x1800). Apprearance is to find here with UUID: 0x2A01.

I tryed to do this the manual way via bluetoothctl: menu advertise appearance 833 (for HeartRate) appearance on back advertise on

This will fail with: Failed to register advertisement: org.bluez.Error.Failed

nevermind to which value i change the apperance (also if the value is well known and accepted) it fail the advertisement. If i switch appearance off it will start advertisment. Any hint, what do to or what I just missed? I already updated bluez from 5.50 to 5.54 also used bluez in experimental mode

  • and using newest raspian os with all updates

Many thanks for help

KingPo
  • 93
  • 2
  • 6

1 Answers1

7

These are the steps that I used on my Raspberry Pi:

pi@raspberrypi:~ $ bluetoothctl 
[bluetooth]# menu advertise 
[bluetooth]# clear
[bluetooth]# uuids 0x180D
[bluetooth]# appearance 833
[bluetooth]# name heart_test
[bluetooth]# discoverable on
[bluetooth]# back
[bluetooth]# advertise on
[CHG] Controller 00:02:5B:03:44:07 SupportedInstances: 0x04
[CHG] Controller 00:02:5B:03:44:07 ActiveInstances: 0x01
Advertising object registered
UUID: Heart Rate(0x180D)
Tx Power: off
LocalName: heart_test
Appearance: Heart Rate Belt (0x0341)
Discoverable: on
[bluetooth]#

And it gave me this on me this in the nRF app when I scanned for it:

view of scan in nRF app

ukBaz
  • 6,985
  • 2
  • 8
  • 31
  • 1
    Hey ukBaz, this was absolutely helpful. As mentioned I expected I missed something, so it was the registering of UUID 0x180D already there. I done this in my phyton script already and expected the appearance is a generic setup needs to be done before. Many thanks this helped! – KingPo Nov 20 '20 at 21:22
  • Did is see correctly that this feature of changing appearance is not jet included in python-bluezero library? Or did i miss again something? – KingPo Nov 22 '20 at 07:38
  • 1
    There have been a few features that have been added to the [BlueZ API](https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt?h=5.50) that need to be added to [Bluezero](bluezero/advertisement.py). Please raise an issue or submit a pull request on the repository – ukBaz Nov 22 '20 at 08:17