Can only see value of first GATT Characteristic
-
Hello!
I am trying to implement some Bluetooth functionality to my LoPy4.
Right now playing a bit with creating multiple characteristics within a service. I am using the nRF connect app to connect my phone via BLE, and see the data. But for some reason, I can only see the value of the first characteristic, and not the two following.Here I am creating a Location and Navigation service with latitude, longitude and altitude characteristics.
lan = bt.service(0x1819, nbr_chars=3) # 0.001 precision lan.characteristic(uuid=0x2AAE, value=int(gps.lat * 1000)) lan.characteristic(uuid=0x2AAF, value=int(gps.lon * 1000)) lan.characteristic(uuid=0x2AB3, value=int(gps.alt * 1000))
But my app looks like this:
As you can see, there are for some reason only descriptors for the first characteristic and I can't find the value of the longitude and altitude. If I change the order around, it's always the first one working.
-
Well for some reason this was no longer a problem anymore, even though I don't believe I changed anything.
-
@thinginnovations I can try to implement this, but I don't see how callbacks will help? I have no control of what will be sent to the nRF Connect-app in the callback functions.
-
@thinginnovations the code you see above is basically everything I did for services and characteristics. So I don't think I created any callbacks for the characteristics?
-
@robertsehlstedt Did you create individual callbacks for each characteristic?
-
@thinginnovations Hello! Yes I did this to see the value of the first characteristic, but unfortunately it doesn't work for the others.
-
@robertsehlstedt Looks like you're using the Nordic nRF Connect. I've used this too and you need to press the downward pointing arrow to read the value on each characteristic. Using the upwards pointing arrow would enable you to write the value. You can disable the write when setting up the characteristic on the Lopy4.
There seems to be a lack of examples on using the GATT services.Cheers
Andrew