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

missing uuids and description fix #272

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bleak/backends/bluezdbus/characteristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from bleak.backends.characteristic import BleakGATTCharacteristic
from bleak.backends.descriptor import BleakGATTDescriptor
from bleak.uuids import uuidstr_to_str


_GattCharacteristicsFlagsEnum = {
Expand Down Expand Up @@ -68,8 +69,7 @@ def uuid(self) -> str:
@property
def description(self) -> str:
"""Description for this characteristic"""
# No description available in DBus backend.
return ""
return uuidstr_to_str(self._uuid)

@property
def properties(self) -> List:
Expand Down
6 changes: 6 additions & 0 deletions bleak/backends/bluezdbus/descriptor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from bleak.backends.descriptor import BleakGATTDescriptor
from bleak.uuids import uuidstr_to_str


class BleakGATTDescriptorBlueZDBus(BleakGATTDescriptor):
Expand Down Expand Up @@ -41,3 +42,8 @@ def handle(self) -> int:
def path(self) -> str:
"""The DBus path. Mostly needed by `bleak`, not by end user"""
return self.__path

@property
def description(self) -> str:
"""Description for this descriptor"""
return uuidstr_to_str(self.uuid)
3 changes: 2 additions & 1 deletion bleak/backends/corebluetooth/characteristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from bleak.backends.corebluetooth.descriptor import BleakGATTDescriptorCoreBluetooth
from bleak.backends.descriptor import BleakGATTDescriptor
from bleak.backends.corebluetooth.utils import cb_uuid_to_str
from bleak.uuids import uuidstr_to_str


class CBChacteristicProperties(Enum):
Expand Down Expand Up @@ -92,7 +93,7 @@ def uuid(self) -> str:
def description(self) -> str:
"""Description for this characteristic"""
# No description available in Core Bluetooth backend.
return ""
return uuidstr_to_str(self._uuid)

@property
def properties(self) -> List:
Expand Down
6 changes: 6 additions & 0 deletions bleak/backends/corebluetooth/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from Foundation import CBDescriptor

from bleak.backends.descriptor import BleakGATTDescriptor
from bleak.uuids import uuidstr_to_str


class BleakGATTDescriptorCoreBluetooth(BleakGATTDescriptor):
Expand Down Expand Up @@ -42,3 +43,8 @@ def uuid(self) -> str:
def handle(self) -> int:
"""Integer handle for this descriptor"""
return int(self.obj.handle())

@property
def description(self) -> str:
"""Description for this descriptor"""
return uuidstr_to_str(self.uuid)
12 changes: 6 additions & 6 deletions bleak/backends/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@
"0x2902",
"GSS",
],
"0000290B-0000-1000-8000-00805f9b34fb": [
"0000290b-0000-1000-8000-00805f9b34fb": [
"Environmental Sensing Configuration",
"org.bluetooth.descriptor.es_configuration",
"0x290B",
"GSS",
],
"0000290C-0000-1000-8000-00805f9b34fb": [
"0000290c-0000-1000-8000-00805f9b34fb": [
"Environmental Sensing Measurement",
"org.bluetooth.descriptor.es_measurement",
"0x290C",
"GSS",
],
"0000290D-0000-1000-8000-00805f9b34fb": [
"0000290d-0000-1000-8000-00805f9b34fb": [
"Environmental Sensing Trigger Setting",
"org.bluetooth.descriptor.es_trigger_setting",
"0x290D",
Expand Down Expand Up @@ -81,7 +81,7 @@
"0x2903",
"GSS",
],
"0000290E-0000-1000-8000-00805f9b34fb": [
"0000290e-0000-1000-8000-00805f9b34fb": [
"Time Trigger Setting",
"org.bluetooth.descriptor.time_trigger_setting",
"0x290E",
Expand All @@ -93,7 +93,7 @@
"0x2906",
"GSS",
],
"0000290A-0000-1000-8000-00805f9b34fb": [
"0000290a-0000-1000-8000-00805f9b34fb": [
"Value Trigger Setting",
"org.bluetooth.descriptor.value_trigger_setting",
"0x290A",
Expand Down Expand Up @@ -138,4 +138,4 @@ def handle(self) -> int:
@property
def description(self):
"""A text description of what this descriptor represents"""
return _descriptor_descriptions.get(self.uuid, ["None"])[0]
return _descriptor_descriptions.get(self.uuid.lower(), ["None"])[0]
206 changes: 201 additions & 5 deletions bleak/uuids.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,13 @@
0x2802: "Include",
0x2803: "Characteristic",
# 0x2804 to 0x28ff undefined */
# Descriptors (SIG)
0x2900: "Characteristic Extended Properties",
0x2901: "Characteristic User Description",
0x2902: "Client Characteristic Configuration",
0x2903: "Server Characteristic Configuration",
0x2904: "Characteristic Format",
0x2905: "Characteristic Aggregate Formate",
0x2904: "Characteristic Presentation Format",
0x2905: "Characteristic Aggregate Format",
0x2906: "Valid Range",
0x2907: "External Report Reference",
0x2908: "Report Reference",
Expand All @@ -171,7 +172,7 @@
0x2A08: "Date Time",
0x2A09: "Day of Week",
0x2A0A: "Day Date Time",
# 0x2a0b undefined */
0x2A0B: "Exact Time 100",
0x2A0C: "Exact Time 256",
0x2A0D: "DST Offset",
0x2A0E: "Time Zone",
Expand All @@ -186,11 +187,13 @@
0x2A17: "Time Update State",
0x2A18: "Glucose Measurement",
0x2A19: "Battery Level",
# 0x2a1a and 0x2a1b undefined */
0x2A1A: "Battery Power State",
0x2A1B: "Battery Level State",
0x2A1C: "Temperature Measurement",
0x2A1D: "Temperature Type",
0x2A1E: "Intermediate Temperature",
# 0x2a1f and 0x2a20 undefined */
0x2A1F: "Temperature Celsius",
0x2A20: "Temperature Fahrenheit",
0x2A21: "Measurement Interval",
0x2A22: "Boot Keyboard Input Report",
0x2A23: "System ID",
Expand Down Expand Up @@ -369,6 +372,36 @@
0x2ADC: "Mesh Provisioning Data Out",
0x2ADD: "Mesh Proxy Data In",
0x2ADE: "Mesh Proxy Data Out",
0x2A59: "Analog Output",
0x2B29: "Client Supported Features",
0x2B2A: "Database Hash",
0x2AED: "Date UTC",
0x2A57: "Digital Output",
0x2B22: "IDD Annunciation Status",
0x2B25: "IDD Command Control Point",
0x2B26: "IDD Command Data",
0x2B23: "IDD Features",
0x2B28: "IDD History Data",
0x2B27: "IDD Record Access Control Point",
0x2B21: "IDD Status",
0x2B20: "IDD Status Changed",
0x2B24: "IDD Status Reader Control Point",
0x2A3E: "Network Availability",
0x2A5F: "PLX Continuous Measurement Characteristic",
0x2A60: "PLX Features",
0x2A5E: "PLX Spot-Check Measurement",
0x2A2F: "Position 2D",
0x2A30: "Position 3D",
0x2A62: "Pulse Oximetry Control Point",
0x2B1D: "RC Feature",
0x2B1E: "RC Settings",
0x2B1F: "Reconnection Configuration Control Point",
0x2A3A: "Removable",
0x2A3C: "Scientific Temperature Celsius",
0x2A10: "Secondary Time Zone",
0x2A3B: "Service Required",
0x2A3D: "String",
0x2A15: "Time Broadcast",
# vendor defined */
0xFEFF: "GN Netcom",
0xFEFE: "GN ReSound A/S",
Expand Down Expand Up @@ -602,6 +635,72 @@
0xFFFC: "AirFuel Alliance",
0xFFFE: "Alliance for Wireless Power (A4WP)",
0xFFFD: "Fast IDentity Online Alliance (FIDO)",
# Mesh Characteristics
0x2AE0: 'Average Current',
0x2AE1: 'Average Voltage',
0x2AE2: 'Boolean',
0x2AE3: 'Chromatic Distance From Planckian',
0x2B1C: 'Chromaticity Coordinate',
0x2AE4: 'Chromaticity Coordinates',
0x2AE5: 'Chromaticity In CCT And Duv Values',
0x2AE6: 'Chromaticity Tolerance',
0x2AE7: 'CIE 13.3-1995 Color Rendering Index',
0x2AE8: 'Coefficient',
0x2AE9: 'Correlated Color Temperature',
0x2AEA: 'Count 16',
0x2AEB: 'Count 24',
0x2AEC: 'Country Code',
0x2AED: 'Date UTC',
0x2AEE: 'Electric Current',
0x2AEF: 'Electric Current Range',
0x2AF0: 'Electric Current Specification',
0x2AF1: 'Electric Current Statistics',
0x2AF2: 'Energy',
0x2AF3: 'Energy In A Period Of Day',
0x2AF4: 'Event Statistics',
0x2AF5: 'Fixed String 16',
0x2AF6: 'Fixed String 24',
0x2AF7: 'Fixed String 36',
0x2AF8: 'Fixed String 8',
0x2AF9: 'Generic Level',
0x2AFA: 'Global Trade Item Number',
0x2AFB: 'Illuminance',
0x2AFC: 'Luminous Efficacy',
0x2AFD: 'Luminous Energy',
0x2AFE: 'Luminous Exposure',
0x2AFF: 'Luminous Flux',
0x2B00: 'Luminous Flux Range',
0x2B01: 'Luminous Intensity',
0x2B02: 'Mass Flow',
0x2ADB: 'Mesh Provisioning Data In',
0x2ADC: 'Mesh Provisioning Data Out',
0x2ADD: 'Mesh Proxy Data In',
0x2ADE: 'Mesh Proxy Data Out',
0x2B03: 'Perceived Lightness',
0x2B04: 'Percentage 8',
0x2B05: 'Power',
0x2B06: 'Power Specification',
0x2B07: 'Relative Runtime In A Current Range',
0x2B08: 'Relative Runtime In A Generic Level Range',
0x2B0B: 'Relative Value In A Period of Day',
0x2B0C: 'Relative Value In A Temperature Range',
0x2B09: 'Relative Value In A Voltage Range',
0x2B0A: 'Relative Value In An Illuminance Range',
0x2B0D: 'Temperature 8',
0x2B0E: 'Temperature 8 In A Period Of Day',
0x2B0F: 'Temperature 8 Statistics',
0x2B10: 'Temperature Range',
0x2B11: 'Temperature Statistics',
0x2B12: 'Time Decihour 8',
0x2B13: 'Time Exponential 8',
0x2B14: 'Time Hour 24',
0x2B15: 'Time Millisecond 24',
0x2B16: 'Time Second 16',
0x2B17: 'Time Second 8',
0x2B18: 'Voltage',
0x2B19: 'Voltage Specification',
0x2B1A: 'Voltage Statistics',
0x2B1B: 'Volume Flow',
}

uuid128_dict = {
Expand Down Expand Up @@ -650,10 +749,107 @@
"6e400001-b5a3-f393-e0a9-e50e24dcca9e": "Nordic UART Service",
"6e400002-b5a3-f393-e0a9-e50e24dcca9e": "Nordic UART TX",
"6e400003-b5a3-f393-e0a9-e50e24dcca9e": "Nordic UART RX",
# from nRF connect
"be15bee0-6186-407e-8381-0bd89c4d8df4": "Anki Drive Vehicle Service READ",
"be15bee1-6186-407e-8381-0bd89c4d8df4": "Anki Drive Vehicle Service WRITE",
"955a1524-0fe2-f5aa-a094-84b8d4f3e8ad": "Beacon UUID",
"00001524-1212-efde-1523-785feabcd123": "Button",
"8ec90003-f315-4f60-9fb8-838830daea50": "Buttonless DFU",
"955a1525-0fe2-f5aa-a094-84b8d4f3e8ad": "Calibration",
"a6c31338-6c07-453e-961a-d8a8a41bf368": "Candy Control Point",
"955a1528-0fe2-f5aa-a094-84b8d4f3e8ad": "Connection Interval",
"00001531-1212-efde-1523-785feabcd123": "DFU Control Point",
"8ec90001-f315-4f60-9fb8-838830daea50": "DFU Control Point",
"00001532-1212-efde-1523-785feabcd123": "DFU Packet",
"8ec90002-f315-4f60-9fb8-838830daea50": "DFU Packet",
"00001534-1212-efde-1523-785feabcd123": "DFU Version",
"ee0c2084-8786-40ba-ab96-99b91ac981d8": "Data",
"b35d7da9-eed4-4d59-8f89-f6573edea967": "Data Length",
"b35d7da7-eed4-4d59-8f89-f6573edea967": "Data One",
"22eac6e9-24d6-4bb5-be44-b36ace7c7bfb": "Data Source",
"b35d7da8-eed4-4d59-8f89-f6573edea967": "Data Two",
"c6b2f38c-23ab-46d8-a6ab-a3a870bbd5d7": "Entity Attribute",
"2f7cabce-808d-411f-9a0c-bb92ba96c102": "Entity Update",
"ee0c2085-8786-40ba-ab96-99b91ac981d8": "Flags",
"88400002-e95a-844e-c53f-fbec32ed5e54": "Fly Button Characteristic",
"00001525-1212-efde-1523-785feabcd123": "LED",
"955a1529-0fe2-f5aa-a094-84b8d4f3e8ad": "LED Config",
"ee0c2082-8786-40ba-ab96-99b91ac981d8": "Lock",
"ee0c2081-8786-40ba-ab96-99b91ac981d8": "Lock State",
"955a1526-0fe2-f5aa-a094-84b8d4f3e8ad": "Major & Minor",
"955a1527-0fe2-f5aa-a094-84b8d4f3e8ad": "Manufacturer ID",
"9fbf120d-6301-42d9-8c58-25e699a21dbd": "Notification Source",
"ee0c2088-8786-40ba-ab96-99b91ac981d8": "Period",
"ee0c2086-8786-40ba-ab96-99b91ac981d8": "Power Levels",
"ee0c2087-8786-40ba-ab96-99b91ac981d8": "Power Mode",
"9b3c81d8-57b1-4a8a-b8df-0e56f7ca51c2": "Remote Command",
"ee0c2089-8786-40ba-ab96-99b91ac981d8": "Reset",
"da2e7828-fbce-4e01-ae9e-261174997c48": "SMP Characteristic",
"8ec90004-f315-4f60-9fb8-838830daea50": "Secure Buttonless DFU",
"ef680102-9b35-4933-9b10-52ffa9740042": "Thingy Advertising Parameters Characteristic",
"ef680204-9b35-4933-9b10-52ffa9740042": "Thingy Air Quality Characteristic",
"ef680302-9b35-4933-9b10-52ffa9740042": "Thingy Button Characteristic",
"ef680106-9b35-4933-9b10-52ffa9740042": "Thingy Cloud Token Characteristic",
"ef680104-9b35-4933-9b10-52ffa9740042": "Thingy Connection Parameters Characteristic",
"ef680105-9b35-4933-9b10-52ffa9740042": "Thingy Eddystone URL Characteristic",
"ef680206-9b35-4933-9b10-52ffa9740042": "Thingy Environment Configuration Characteristic",
"ef680407-9b35-4933-9b10-52ffa9740042": "Thingy Euler Characteristic",
"ef680303-9b35-4933-9b10-52ffa9740042": "Thingy External Pin Characteristic",
"ef680107-9b35-4933-9b10-52ffa9740042": "Thingy FW Version Characteristic",
"ef68040a-9b35-4933-9b10-52ffa9740042": "Thingy Gravity Vector Characteristic",
"ef680409-9b35-4933-9b10-52ffa9740042": "Thingy Heading Characteristic",
"ef680203-9b35-4933-9b10-52ffa9740042": "Thingy Humidity Characteristic",
"ef680301-9b35-4933-9b10-52ffa9740042": "Thingy LED Characteristic",
"ef680205-9b35-4933-9b10-52ffa9740042": "Thingy Light Intensity Characteristic",
"ef680108-9b35-4933-9b10-52ffa9740042": "Thingy MTU Request Characteristic",
"ef680504-9b35-4933-9b10-52ffa9740042": "Thingy Microphone Characteristic",
"ef680401-9b35-4933-9b10-52ffa9740042": "Thingy Motion Configuration Characteristic",
"ef680101-9b35-4933-9b10-52ffa9740042": "Thingy Name Characteristic",
"ef680403-9b35-4933-9b10-52ffa9740042": "Thingy Orientation Characteristic",
"ef680405-9b35-4933-9b10-52ffa9740042": "Thingy Pedometer Characteristic",
"ef680202-9b35-4933-9b10-52ffa9740042": "Thingy Pressure Characteristic",
"ef680404-9b35-4933-9b10-52ffa9740042": "Thingy Quaternion Characteristic",
"ef680406-9b35-4933-9b10-52ffa9740042": "Thingy Raw Data Characteristic",
"ef680408-9b35-4933-9b10-52ffa9740042": "Thingy Rotation Characteristic",
"ef680501-9b35-4933-9b10-52ffa9740042": "Thingy Sound Configuration Characteristic",
"ef680502-9b35-4933-9b10-52ffa9740042": "Thingy Speaker Data Characteristic",
"ef680503-9b35-4933-9b10-52ffa9740042": "Thingy Speaker Status Characteristic",
"ef680402-9b35-4933-9b10-52ffa9740042": "Thingy Tap Characteristic",
"ef680201-9b35-4933-9b10-52ffa9740042": "Thingy Temperature Characteristic",
"ee0c2083-8786-40ba-ab96-99b91ac981d8": "Unlock",
"e95db9fe-251d-470a-a062-fa1922dfa9a8": "micro:bit Pin IO Configuration",
"e95d9250-251d-470a-a062-fa1922dfa9a8": "micro:bit Temperature",
"be15beef-6186-407e-8381-0bd89c4d8df4": "Anki Drive Vehicle Service",
"7905f431-b5ce-4e99-a40f-4b1e122d00d0": "Apple Notification Center Service",
"d0611e78-bbb4-4591-a5f8-487910ae4366": "Apple Continuity Service",
"8667556c-9a37-4c91-84ed-54ee27d90049": "Apple Continuity Characteristic",
"9fa480e0-4967-4542-9390-d343dc5d04ae": "Apple Nearby Service",
"af0badb1-5b99-43cd-917a-a77bc549e3cc": "Nearby Characteristic",
"69d1d8f3-45e1-49a8-9821-9bbdfdaad9d9": "Control Point",
"9fbf120d-6301-42d9-8c58-25e699a21dbd": "Notification Source",
"89d3502b-0f36-433a-8ef4-c502ad55f8dc": "Apple Media Service",
"9b3c81d8-57b1-4a8a-b8df-0e56f7ca51c2": "Remote Command",
"2f7cabce-808d-411f-9a0c-bb92ba96c102": "Entity Update",
"c6b2f38c-23ab-46d8-a6ab-a3a870bbd5d7": "Entity Attribute",
"955a1523-0fe2-f5aa-a094-84b8d4f3e8ad": "Beacon Config",
"a6c31337-6c07-453e-961a-d8a8a41bf368": "Candy Dispenser Service",
"00001530-1212-efde-1523-785feabcd123": "Device Firmware Update Service",
"88400001-e95a-844e-c53f-fbec32ed5e54": "Digital Bird Service",
"ee0c2080-8786-40ba-ab96-99b91ac981d8": "Eddystone-URL Configuration Service",
"8e400001-f315-4f60-9fb8-838830daea50": "Experimental Buttonless DFU Service",
"00001523-1212-efde-1523-785feabcd123": "Nordic LED Button Service",
"8d53dc1d-1db7-4cd3-868b-8a527460aa84": "SMP Service",
"ef680100-9b35-4933-9b10-52ffa9740042": "Thingy Configuration Service",
"ef680200-9b35-4933-9b10-52ffa9740042": "Thingy Environment Service",
"ef680400-9b35-4933-9b10-52ffa9740042": "Thingy Motion Service",
"ef680500-9b35-4933-9b10-52ffa9740042": "Thingy Sound Service",
"ef680300-9b35-4933-9b10-52ffa9740042": "Thingy User Interface Service",
"b35d7da6-eed4-4d59-8f89-f6573edea967": "URI Beacon Config (V1)",
}


def uuidstr_to_str(uuid_):
uuid_ = uuid_.lower()
s = uuid128_dict.get(uuid_)
if s:
return s
Expand Down