NordicSemiconductor / bluetooth-numbers-database

An up-to-date listing of all the various Bluetooth Specification-related elements that are defined by our industry (Company IDs, Service UUIDs, Characteristic UUIDs and Descriptor UUIDs), that you can use instead of rolling your own.
Other
326 stars 50 forks source link

Characteristics formats and extensions #92

Open Yohannfra opened 1 year ago

Yohannfra commented 1 year ago

Hi, I started adding two fields in the file characteristic_uuid.json

Both are optional and non related.

I only modified a few for now, and it looks like this

    { "name": "Aerobic Heart Rate Lower Limit", "identifier": "org.bluetooth.characteristic.aerobic_heart_rate_lower_limit", "uuid": "2A7E" , "source": "gss", "format": "%d", "extension": "bpm"},
    { "name": "Aerobic Heart Rate Upper Limit", "identifier": "org.bluetooth.characteristic.aerobic_heart_rate_upper_limit", "uuid": "2A84" , "source": "gss", "format": "%d", "extension": "bpm"},
    { "name": "Aerobic Threshold", "identifier": "org.bluetooth.characteristic.aerobic_threshold", "uuid": "2A7F" , "source": "gss", "format": "%d", "extension": "bpm"},

    { "name": "Battery Level", "identifier": "org.bluetooth.characteristic.battery_level", "uuid": "2A19" , "source": "gss", "format": "%d", "extension": "%"},

    { "name": "Firmware Revision String", "identifier": "org.bluetooth.characteristic.firmware_revision_string", "uuid": "2A26", "source": "gss", "format": "%s" },

    { "name": "First Name", "identifier": "org.bluetooth.characteristic.first_name", "uuid": "2A8A", "source": "gss", "format": "%s"},

    { "name": "Latitude", "identifier": "org.bluetooth.characteristic.latitude", "uuid": "2AAE", "source": "gss", "format": "%.2f", "extension": "°"},
    { "name": "Longitude", "identifier": "org.bluetooth.characteristic.longitude", "uuid": "2AAF", "source": "gss", "format": "%.2f", "extension": "°" },

What are your thoughts on this ? Would you be interested for a PR ?

Thanks

Juliano55 commented 1 year ago

i dont know how to use or do that

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: Yohann @.> Sent: Monday, November 21, 2022 9:49:39 PM To: NordicSemiconductor/bluetooth-numbers-database @.> Cc: Subscribed @.***> Subject: [NordicSemiconductor/bluetooth-numbers-database] Characteristics formats and extensions (Issue #92)

Hi, I started adding two fields in the file characteristic_uuid.json

Both are optional and non related.

I only modified a few for now, and it looks like this

{ "name": "Aerobic Heart Rate Lower Limit", "identifier": "org.bluetooth.characteristic.aerobic_heart_rate_lower_limit", "uuid": "2A7E" , "source": "gss", "format": "%d", "extension": "bpm"},

{ "name": "Aerobic Heart Rate Upper Limit", "identifier": "org.bluetooth.characteristic.aerobic_heart_rate_upper_limit", "uuid": "2A84" , "source": "gss", "format": "%d", "extension": "bpm"},

{ "name": "Aerobic Threshold", "identifier": "org.bluetooth.characteristic.aerobic_threshold", "uuid": "2A7F" , "source": "gss", "format": "%d", "extension": "bpm"},

{ "name": "Battery Level", "identifier": "org.bluetooth.characteristic.battery_level", "uuid": "2A19" , "source": "gss", "format": "%d", "extension": "%"},

{ "name": "Firmware Revision String", "identifier": "org.bluetooth.characteristic.firmware_revision_string", "uuid": "2A26", "source": "gss", "format": "%s" },

{ "name": "First Name", "identifier": "org.bluetooth.characteristic.first_name", "uuid": "2A8A", "source": "gss", "format": "%s"},

{ "name": "Latitude", "identifier": "org.bluetooth.characteristic.latitude", "uuid": "2AAE", "source": "gss", "format": "%.2f", "extension": "°"},

{ "name": "Longitude", "identifier": "org.bluetooth.characteristic.longitude", "uuid": "2AAF", "source": "gss", "format": "%.2f", "extension": "°" },

What are your thoughts on this ? Would you be interested for a PR ?

Thanks

— Reply to this email directly, view it on GitHubhttps://github.com/NordicSemiconductor/bluetooth-numbers-database/issues/92, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3B4SZ55ID3ZWCRUYUUOZWTWJOY3HANCNFSM6AAAAAASG424YI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Yohannfra commented 1 year ago

How to use or what to do is up to whoever use this json. The reason to add these fields is that these values are standard and many applications could benefits from a simple hint of how to print them.

dinesharjani commented 1 year ago

I think this is interesting. But we'd have to bump the API version, so instead of everything being inside /v1 it should be /v2.

@bencefr what do you think?

Yohannfra commented 1 year ago

This is more specific but something like a 'map' field with the meaning of the value (when possible) could also be useful when the value refers to something.

For example in the HRS service there is the Body Sensor Location which is a single byte representing the place where is the sensor.

It could look like this in the json

    { "name": "Body Sensor Location", "identifier": "org.bluetooth.characteristic.body_sensor_location", "uuid": "2A38" , "source": "gss", "map": ["other", "chest", "wrist", "finger", "hand", "ear_lobe", "foot"]},

And the value of the characteristic could be used as an index to find the readable value directly.

Yohannfra commented 1 year ago

And for multi bytes values the format could also be used with multiple format specifiers

For the Date of Birth characteristic it could look like this

    { "name": "Date of Birth","identifier": "org.bluetooth.characteristic.date_of_birth", "uuid": "2A85" , "source": "gss", "format": "%d/%d/%d" },
Yohannfra commented 1 year ago

This project tried something similar https://github.com/sputnikdev/bluetooth-gatt-parser with Java and characteristics defined in xml files. For the above example of the Body Sensor Location the xml file is:

<?xml version="1.0" encoding="UTF-8"?><!-- Copyright 2011 Bluetooth SIG, Inc. All rights reserved. -->
<Characteristic xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/characteristic.xsd"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                type="org.bluetooth.characteristic.body_sensor_location" uuid="2A38" name="Body Sensor Location">
    <InformativeText></InformativeText>
    <Value>
        <Field name="Body Sensor Location">
            <Requirement>Mandatory</Requirement>
            <Format>8bit</Format>
            <Enumerations>
                <Enumeration key="0" value="Other"/>
                <Enumeration key="1" value="Chest"/>
                <Enumeration key="2" value="Wrist"/>
                <Enumeration key="3" value="Finger"/>
                <Enumeration key="4" value="Hand"/>
                <Enumeration key="5" value="Ear Lobe"/>
                <Enumeration key="6" value="Foot"/>
                <ReservedForFutureUse start="7" end="255"/>
            </Enumerations>
        </Field>
    </Value>
</Characteristic>
Footer