定义
“GATT层”中定义的所有属性都有一个UUID值,UUID是全球唯一的128位的号码,它用来识别不同的特性。
换算规则
128_bit_value=16_bit_value2^96+Bluetooth_Base_UUID
128_bit_value=32_bit_value2^96+BIuetooth_Base_UUID
Bluetooth_Base_UUID = 00000000-0000-1000-8000-00805F9B34FB
假如16bits的uuid为0x1234,则转换成128bits的uuid是:
0x00001234-0000-1000-8000-00805F9B34FB
假如32bits的uuid是0x12345678,则转换成128bits的uuid是
0x12345678-0000-1000-8000-00805F9B34FB
常用UUID
// Sample Services.
attributes.put(“0000180D-0000-1000-8000-00805F9B34FB”, “Heart Rate Service”);
attributes.put(“0000180A-0000-1000-8000-00805F9B34FB”, “Device Information Service”);
// Sample Characteristics.
attributes.put(“00002A37-0000-1000-8000-00805F9B34FB”, “Heart Rate Measurement”);
attributes.put(“00002A29-0000-1000-8000-00805F9B34FB”, “Manufacturer Name String”);
// GATT Services
attributes.put(“00001800-0000-1000-8000-00805F9B34FB”, “Generic Access”);
attributes.put(“00001801-0000-1000-8000-00805F9B34FB”, “Generic Attribute”);
// GATT Declarations
attributes.put(“00002800-0000-1000-8000-00805F9B34FB”, “Primary Service”);
attributes.put(“00002801-0000-1000-8000-00805F9B34FB”, “Secondary Service”);
attributes.put(“00002802-0000-1000-8000-00805F9B34FB”, “Include”);
attributes.put(“00002803-0000-1000-8000-00805F9B34FB”, “Characteristic”);
// GATT Descriptors
attributes.put(“00002900-0000-1000-8000-00805F9B34FB”, “Characteristic Extended Properties”);
attributes.put(“00002901-0000-1000-8000-00805F9B34FB”, “Characteristic User Description”);
attributes.put(“00002902-0000-1000-8000-00805F9B34FB”, “Client Characteristic Configuration”);
attributes.put(“00002903-0000-1000-8000-00805F9B34FB”, “Server Characteristic Configuration”);
attributes.put(“00002904-0000-1000-8000-00805F9B34FB”, “Characteristic Presentation Format”);
attributes.put(“00002905-0000-1000-8000-00805F9B34FB”, “Characteristic Aggregate Format”);
attributes.put(“00002906-0000-1000-8000-00805F9B34FB”, “Valid Range”);
attributes.put(“00002907-0000-1000-8000-00805F9B34FB”, “External Report Reference Descriptor”);
attributes.put(“00002908-0000-1000-8000-00805F9B34FB”, “Report Reference Descriptor”);
// GATT Characteristics
attributes.put(“00002A00-0000-1000-8000-00805F9B34FB”, “Device Name”);
attributes.put(“00002A01-0000-1000-8000-00805F9B34FB”, “Appearance”);
attributes.put(“00002A02-0000-1000-8000-00805F9B34FB”, “Peripheral Privacy Flag”);
attributes.put(“00002A03-0000-1000-8000-00805F9B34FB”, “Reconnection Address”);
attributes.put(“00002A04-0000-1000-8000-00805F9B34FB”, “PPCP”);
attributes.put(“00002A05-0000-1000-8000-00805F9B34FB”, “Service Changed”);
// GATT Service UUIDs
attributes.put(“00001802-0000-1000-8000-00805F9B34FB”, “Immediate Alert”);
attributes.put(“00001803-0000-1000-8000-00805F9B34FB”, “Link Loss”);
attributes.put(“00001804-0000-1000-8000-00805F9B34FB”, “Tx Power”);
attributes.put(“00001805-0000-1000-8000-00805F9B34FB”, “Current Time Service”);
attributes.put(“00001806-0000-1000-8000-00805F9B34FB”, “Reference Time Update Service”);
attributes.put(“00001807-0000-1000-8000-00805F9B34FB”, “Next DST Change Service”);
attributes.put(“00001808-0000-1000-8000-00805F9B34FB”, “Glucose”);
attributes.put(“00001809-0000-1000-8000-00805F9B34FB”, “Health Thermometer”);
attributes.put(“0000180A-0000-1000-8000-00805F9B34FB”, “Device Information”);
attributes.put(“0000180B-0000-1000-8000-00805F9B34FB”, “Network Availability”);
attributes.put(“0000180D-0000-1000-8000-00805F9B34FB”, “Heart Rate”);
attributes.put(“0000180E-0000-1000-8000-00805F9B34FB”, “Phone Alert Status Service”);
attributes.put(“0000180F-0000-1000-8000-00805F9B34FB”, “Battery Service”);
attributes.put(“00001810-0000-1000-8000-00805F9B34FB”, “Blood Pressure”);
attributes.put(“00001811-0000-1000-8000-00805F9B34FB”, “Alert Notification Service”);
attributes.put(“00001812-0000-1000-8000-00805F9B34FB”, “Human Interface Device”);
attributes.put(“00001813-0000-1000-8000-00805F9B34FB”, “Scan Parameters”);
attributes.put(“00001814-0000-1000-8000-00805F9B34FB”, “Running Speed and Cadence”);
attributes.put(“00001816-0000-1000-8000-00805F9B34FB”, “Cycling Speed and Cadence”);
attributes.put(“00001818-0000-1000-8000-00805F9B34FB”, “Cycling Power”);
attributes.put(“00001819-0000-1000-8000-00805F9B34FB”, “Location and Navigation”);
// GATT Characteristic UUIDs
attributes.put(“00002A06-0000-1000-8000-00805F9B34FB”, “Alert Level”);
attributes.put(“00002A07-0000-1000-8000-00805F9B34FB”, “Tx Power Level”);
attributes.put(“00002A08-0000-1000-8000-00805F9B34FB”, “Date Time”);
attributes.put(“00002A09-0000-1000-8000-00805F9B34FB”, “Day of Week”);
attributes.put(“00002A0A-0000-1000-8000-00805F9B34FB”, “Day Date Time”);
attributes.put(“00002A0C-0000-1000-8000-00805F9B34FB”, “Exact Time 256”);
attributes.put(“00002A0D-0000-1000-8000-00805F9B34FB”, “DST Offset”);
attributes.put(“00002A0E-0000-1000-8000-00805F9B34FB”, “Time Zone”);
attributes.put(“00002A0F-0000-1000-8000-00805F9B34FB”, “Local Time Information”);
attributes.put(“00002A11-0000-1000-8000-00805F9B34FB”, “Time with DST”);
attributes.put(“00002A12-0000-1000-8000-00805F9B34FB”, “Time Accuracy”);
attributes.put(“00002A13-0000-1000-8000-00805F9B34FB”, “Time Source”);
attributes.put(“00002A14-0000-1000-8000-00805F9B34FB”, “Reference Time Information”);
attributes.put(“00002A16-0000-1000-8000-00805F9B34FB”, “Time Update Control Point”);
attributes.put(“00002A17-0000-1000-8000-00805F9B34FB”, “Time Update State”);
attributes.put(“00002A18-0000-1000-8000-00805F9B34FB”, “Glucose Measurement”);
attributes.put(“00002A19-0000-1000-8000-00805F9B34FB”, “Battery Level”);
attributes.put(“00002A1C-0000-1000-8000-00805F9B34FB”, “Temperature Measurement”);
attributes.put(“00002A1D-0000-1000-8000-00805F9B34FB”, “Temperature Type”);
attributes.put(“00002A1E-0000-1000-8000-00805F9B34FB”, “Intermediate Temperature”);
attributes.put(“00002A21-0000-1000-8000-00805F9B34FB”, “Measurement Interval”);
attributes.put(“00002A22-0000-1000-8000-00805F9B34FB”, “Boot Keyboard Input Report”);
attributes.put(“00002A23-0000-1000-8000-00805F9B34FB”, “System ID”);
attributes.put(“00002A24-0000-1000-8000-00805F9B34FB”, “Model Number String”);
attributes.put(“00002A25-0000-1000-8000-00805F9B34FB”, “Serial Number String”);
attributes.put(“00002A26-0000-1000-8000-00805F9B34FB”, “Firmware Revision String”);
attributes.put(“00002A27-0000-1000-8000-00805F9B34FB”, “Hardware Revision String”);
attributes.put(“00002A28-0000-1000-8000-00805F9B34FB”, “Software Revision String”);
attributes.put(“00002A29-0000-1000-8000-00805F9B34FB”, “Manufacturer Name String”);
attributes.put(“00002A2A-0000-1000-8000-00805F9B34FB”, “IEEE 11073-20601 Regulatory Certification Data List”);
attributes.put(“00002A2B-0000-1000-8000-00805F9B34FB”, “Current Time”);
attributes.put(“00002A31-0000-1000-8000-00805F9B34FB”, “Scan Refresh”);
attributes.put(“00002A32-0000-1000-8000-00805F9B34FB”, “Boot Keyboard Output Report”);
attributes.put(“00002A33-0000-1000-8000-00805F9B34FB”, “Boot Mouse Input Report”);
attributes.put(“00002A34-0000-1000-8000-00805F9B34FB”, “Glucose Measurement Context”);
attributes.put(“00002A35-0000-1000-8000-00805F9B34FB”, “Blood Pressure Measurement”);
attributes.put(“00002A36-0000-1000-8000-00805F9B34FB”, “Intermediate Cuff Pressure”);
attributes.put(“00002A37-0000-1000-8000-00805F9B34FB”, “Heart Rate Measurement”);
attributes.put(“00002A38-0000-1000-8000-00805F9B34FB”, “Body Sensor Location”);
attributes.put(“00002A39-0000-1000-8000-00805F9B34FB”, “Heart Rate Control Point”);
attributes.put(“00002A3E-0000-1000-8000-00805F9B34FB”, “Network Availability”);
attributes.put(“00002A3F-0000-1000-8000-00805F9B34FB”, “Alert Status”);
attributes.put(“00002A40-0000-1000-8000-00805F9B34FB”, “Ringer Control Point”);
attributes.put(“00002A41-0000-1000-8000-00805F9B34FB”, “Ringer Setting”);
attributes.put(“00002A42-0000-1000-8000-00805F9B34FB”, “Alert Category ID Bit Mask”);
attributes.put(“00002A43-0000-1000-8000-00805F9B34FB”, “Alert Category ID”);
attributes.put(“00002A44-0000-1000-8000-00805F9B34FB”, “Alert Notification Control Point”);
attributes.put(“00002A45-0000-1000-8000-00805F9B34FB”, “Unread Alert Status”);
attributes.put(“00002A46-0000-1000-8000-00805F9B34FB”, “New Alert”);
attributes.put(“00002A47-0000-1000-8000-00805F9B34FB”, “Supported New Alert Category”);
attributes.put(“00002A48-0000-1000-8000-00805F9B34FB”, “Supported Unread Alert Category”);
attributes.put(“00002A49-0000-1000-8000-00805F9B34FB”, “Blood Pressure Feature”);
attributes.put(“00002A4A-0000-1000-8000-00805F9B34FB”, “HID Information”);
attributes.put(“00002A4B-0000-1000-8000-00805F9B34FB”, “Report Map”);
attributes.put(“00002A4C-0000-1000-8000-00805F9B34FB”, “HID Control Point”);
attributes.put(“00002A4D-0000-1000-8000-00805F9B34FB”, “Report”);
attributes.put(“00002A4E-0000-1000-8000-00805F9B34FB”, “Protocol Mode”);
attributes.put(“00002A4F-0000-1000-8000-00805F9B34FB”, “Scan Interval Window”);
attributes.put(“00002A50-0000-1000-8000-00805F9B34FB”, “PnP ID”);
attributes.put(“00002A51-0000-1000-8000-00805F9B34FB”, “Glucose Feature”);
attributes.put(“00002A52-0000-1000-8000-00805F9B34FB”, “Record Access Control Point”);
attributes.put(“00002A53-0000-1000-8000-00805F9B34FB”, “RSC Measurement”);
attributes.put(“00002A54-0000-1000-8000-00805F9B34FB”, “RSC Feature”);
attributes.put(“00002A55-0000-1000-8000-00805F9B34FB”, “SC Control Point”);
attributes.put(“00002A5B-0000-1000-8000-00805F9B34FB”, “CSC Measurement”);
attributes.put(“00002A5C-0000-1000-8000-00805F9B34FB”, “CSC Feature”);
attributes.put(“00002A5D-0000-1000-8000-00805F9B34FB”, “Sensor Location”);
attributes.put(“00002A63-0000-1000-8000-00805F9B34FB”, “Cycling Power Measurement”);
attributes.put(“00002A64-0000-1000-8000-00805F9B34FB”, “Cycling Power Vector”);
attributes.put(“00002A65-0000-1000-8000-00805F9B34FB”, “Cycling Power Feature”);
attributes.put(“00002A66-0000-1000-8000-00805F9B34FB”, “Cycling Power Control Point”);
attributes.put(“00002A67-0000-1000-8000-00805F9B34FB”, “Location and Speed”);
attributes.put(“00002A68-0000-1000-8000-00805F9B34FB”, “Navigation”);
attributes.put(“00002A69-0000-1000-8000-00805F9B34FB”, “Position Quality”);
attributes.put(“00002A6A-0000-1000-8000-00805F9B34FB”, “LN Feature”);
attributes.put(“00002A6B-0000-1000-8000-00805F9B34FB”, “LN Control Point”);