Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Appearance Names as well as IDs #62

Open
askpatrickw opened this issue Feb 15, 2020 · 0 comments
Open

Add Appearance Names as well as IDs #62

askpatrickw opened this issue Feb 15, 2020 · 0 comments

Comments

@askpatrickw
Copy link
Contributor

In PR #61 I added GAP_APPEARANCE and called out some additional work needed.

TODO: Add Appearance Names as well as IDs likely as "appearance: {id: , description:}"
https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.gap.appearance.xml
"The external appearance of this device. The values are composed of a category (10-bits) and sub-categories (6-bits)."

My initial thought is to create a dict constant to do the lookup

GAP_APPEARANCE_DESC = {
    'id_1': 'description',
    'id_2': 'description',
}

and then to modify the GAP_APPEARANCE to add the ID and lookup the description.

appearance_id = int.from_bytes(payload, byteorder='little')
advertisement.appearance = {
                               "id": appearance_id,
                               "description": GAP_APPEARANCE_DESC[appearance_id]
                           }

If anyone has a better suggestion please recommend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant