QUERY · ISSUE
ble support and encrypted characteristics
enhancementextmod
Are there plans for supporting encrypted characteristics in the new BLE API? In my use case I set a password into the BLE device and I don't want to send it in the clear. So my characteristic needs to be marked encrypted.
Not sure if this involves much code at the python level, it should be more along the lines of pushing the right flags down into the various implementations. The stacks will take care of the encrypt/decrypt.
CANDIDATE · ISSUE
Can Characteristics have data types?
Is there an api (and does BT allow it) to assign a data type to a Characteristic?
I am creating my own service and characteristics using 128bit UUID's. I'd like to in effect say "this characteristic is an integer" - is that possible?
You can add a "Characteristic presentation format" descriptor to the characteristic for for that.
Please could you point me to the api?
It looks like it's another 16 bit uuid hex string - does it get appended to the characteristic uuid?
I haven't used the MicroPython Bluetooth API, I just know BLE in general.
I assume it would just be part of https://docs.micropython.org/en/latest/library/bluetooth.html#bluetooth.BLE.gatts_register_services
which says:
And you would need to look up the Bluetooth specs to figure out the UUID and the required flags for the "Characteristic presentation format" descriptor to know what values to fill in.
@dlech You are correct but I think this might be different to what @adrianblakey is asking.
I get the impression that what you want is to be able to say that e.g. this characteristic is a temperature, and therefore (e.g. the temp characteristic on the standard environmental service) should be interpreted as a sint16 deci-degrees. i.e. if I
read()it, it should return back a float "degrees" (even though internally it's the sint16).There's currently no support for this... I haven't given it a lot of thought yet but I think it would be very useful. Maybe having a library of standard converters, and being able to pass it to the
Characteristicconstructor (on the server, some other mechanism on the client).@dlech is right, and here are the specs: (see also https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/uuids/)
@adrianblakey you need to create the characteristic with this descriptor (2904)
and then write (using the value handle of this descriptor) the appropriate values in those fields
e.g in binary