乐趣区

低功耗蓝牙UUID类

低功耗蓝牙 UUID 有套算得上规范的定义,看到有人分享了明天花些工夫整成一个工具类。内容比拟多整顿起来也挺花工夫,心愿定义蓝牙 UUID 的敌人能尽量按规范来。

/**
 * 低功耗蓝牙 UUID
 */
public class BleUUID {
    // 根底 ID
    public static final String BASE_GUID = "00000000-0000-1000-8000-00805F9B34FB";
    /**
     * GATT 配置
     */
    public static final String GAP = "00001800-0000-1000-8000-00805F9B34FB";
    public static final String GATT = "00001801-0000-1000-8000-00805F9B34FB";
    public static final String IMMEDIATE_ALERT = "00001802-0000-1000-8000-00805F9B34FB";
    public static final String LINK_LOSS = "00001803-0000-1000-8000-00805F9B34FB";
    public static final String TX_POWER = "00001804-0000-1000-8000-00805F9B34FB";

    /**
     * GAP 服务
     */
    public static final String HEALTH_THERMOMETER = "00001809-0000-1000-8000-00805F9B34FB";
    public static final String DEVICE_INFORMATION = "0000180A-0000-1000-8000-00805F9B34FB";
    public static final String HEART_RATE = "0000180D-0000-1000-8000-00805F9B34FB";
    public static final String PHONE_ALERT_STATUS_SERVICE = "0000180E-0000-1000-8000-00805F9B34FB";
    public static final String BATTERY_SERVICE = "0000180F-0000-1000-8000-00805F9B34FB";
    public static final String BLOOD_PRESSURE = "00001810-0000-1000-8000-00805F9B34FB";
    public static final String HUMAN_INTERFACE_DEVICE = "00001812-0000-1000-8000-00805F9B34FB";
    public static final String SCAN_PARAMETERS = "00001813-0000-1000-8000-00805F9B34FB";
    public static final String RUNNING_SPEED_AND_CADENCE = "00001814-0000-1000-8000-00805F9B34FB";
    public static final String AUTOMATION_IO = "00001815-0000-1000-8000-00805F9B34FB";
    public static final String CYCLING_SPEED_AND_CADENCE = "00001816-0000-1000-8000-00805F9B34FB";
    public static final String PULSE_OXIMETER = "00001817-0000-1000-8000-00805F9B34FB";
    public static final String CYCLING_POWER = "00001818-0000-1000-8000-00805F9B34FB";
    public static final String LOCATION_AND_NAVIGATION_SERVICE = "00001819-0000-1000-8000-00805F9B34FB";
    public static final String CONTINOUS_GLUCOSE_MEASUREMENT_SERVICE = "0000181A-0000-1000-8000-00805F9B34FB";
    public static final String USER_DATA = "0000181C-0000-1000-8000-00805F9B34FB";
    public static final String TEMPERATURE_MEASUREMENT = "00002A1C-0000-1000-8000-00805F9B34FB";
    public static final String TEMPERATURE_TYPE = "00002A1D-0000-1000-8000-00805F9B34FB";
    public static final String INTERMEDIATE_TEMPERATURE = "00002A1E-0000-1000-8000-00805F9B34FB";
    public static final String TEMPERATURE_IN_CELSIUS = "00002A1F-0000-1000-8000-00805F9B34FB";
    public static final String TEMPERATURE_IN_FAHRENHEIT = "00002A20-0000-1000-8000-00805F9B34FB";
    public static final String MEASUREMENT_INTERVAL = "00002A21-0000-1000-8000-00805F9B34FB";
    public static final String BOOT_KEYBOARD_INPUT_REPORT = "00002A22-0000-1000-8000-00805F9B34FB";
    public static final String SYSTEM_ID = "00002A23-0000-1000-8000-00805F9B34FB";
    public static final String MODEL_NUMBER_STRING = "00002A24-0000-1000-8000-00805F9B34FB";
    public static final String SERIAL_NUMBER_STRING = "00002A25-0000-1000-8000-00805F9B34FB";
    public static final String FIRMWARE_REVISION_STRING = "00002A26-0000-1000-8000-00805F9B34FB";
    public static final String HARDWARE_REVISION_STRING = "00002A27-0000-1000-8000-00805F9B34FB";
    public static final String SOFTWARE_REVISION_STRING = "00002A28-0000-1000-8000-00805F9B34FB";
    public static final String MANUFACTURER_NAME_STRING = "00002A29-0000-1000-8000-00805F9B34FB";
    public static final String IEEE_REGULATORY = "00002A2A-0000-1000-8000-00805F9B34FB"; //IEEE 11073-20601 Regulatory
    public static final String CURRENT_TIME = "00002A2B-0000-1000-8000-00805F9B34FB";
    public static final String ELEVATION = "00002A2C-0000-1000-8000-00805F9B34FB";
    public static final String LATITUDE = "00002A2D-0000-1000-8000-00805F9B34FB";
    public static final String LONGITUDE = "00002A2D-0000-1000-8000-00805F9B34FB";
    public static final String POSITION_2D = "00002A2F-0000-1000-8000-00805F9B34FB";
    public static final String POSITION_3D = "00002A30-0000-1000-8000-00805F9B34FB";
    public static final String SCAN_REFRESH = "00002A31-0000-1000-8000-00805F9B34FB";
    public static final String BOOT_KEYBOARD_OUTPUT_REPORT = "00002A32-0000-1000-8000-00805F9B34FB";
    public static final String BOOT_MOUSE_INPUT_REPORT = "00002A33-0000-1000-8000-00805F9B34FB";
    public static final String Glucose_Measurement_Context = "00002A34-0000-1000-8000-00805F9B34FB";
    public static final String BLOOD_PRESSURE_MEASUREMENT = "00002A35-0000-1000-8000-00805F9B34FB";
    public static final String Intermediate_Cuff_Pressure = "00002A36-0000-1000-8000-00805F9B34FB";
    public static final String HEART_RATE_MEASUREMENT = "00002A37-0000-1000-8000-00805F9B34FB";
    public static final String BODY_SENSOR_LOCATION = "00002A38-0000-1000-8000-00805F9B34FB";
    public static final String HEART_RATE_CONTROL_POINT = "00002A39-0000-1000-8000-00805F9B34FB";
    public static final String REMOVABLE = "00002A3A-0000-1000-8000-00805F9B34FB";
    public static final String SERVICE_REQUIRED = "00002A3B-0000-1000-8000-00805F9B34FB";
    public static final String SCIENTIFIC_TEMPERATURE_IN_CELSIUS = "00002A3C-0000-1000-8000-00805F9B34FB";
    public static final String STRING = "00002A3D-0000-1000-8000-00805F9B34FB";
    public static final String NETWORK_AVAILABILITY = "00002A3E-0000-1000-8000-00805F9B34FB";
    public static final String ALERT_STATUS = "00002A3F-0000-1000-8000-00805F9B34FB";
    public static final String RINGER_CONTROL_POINT = "00002A40-0000-1000-8000-00805F9B34FB";
    public static final String RINGER_SETTING = "00002A41-0000-1000-8000-00805F9B34FB";
    public static final String ALERT_CATEGORY_ID_BIT_MASK = "00002A42-0000-1000-8000-00805F9B34FB";
    public static final String ALERT_CATEGORY_ID = "00002A43-0000-1000-8000-00805F9B34FB";
    public static final String ALERT_NOTIFICATION_CONTROL_POINT = "00002A44-0000-1000-8000-00805F9B34FB";
    public static final String UNREAD_ALERT_STATUS = "00002A45-0000-1000-8000-00805F9B34FB";
    public static final String NEW_ALERT = "00002A46-0000-1000-8000-00805F9B34FB";
    public static final String SUPPORTED_NEW_ALERT_CATEGORY = "00002A47-0000-1000-8000-00805F9B34FB";
    public static final String SUPPORTED_UNREAD_ALERT_CATEGORY = "00002A48-0000-1000-8000-00805F9B34FB";
    public static final String BLOOD_PRESSURE_FEATURE = "00002A49-0000-1000-8000-00805F9B34FB";
    public static final String HID_INFORMATION = "00002A4A-0000-1000-8000-00805F9B34FB";
    public static final String REPORT_MAP = "00002A4B-0000-1000-8000-00805F9B34FB";
    public static final String HID_CONTROL_POINT = "00002A4C-0000-1000-8000-00805F9B34FB";
    public static final String UNKNOWN = "00002A4D-0000-1000-8000-00805F9B34FB"; // 临时还不晓得做什么用的
    public static final String PROTOCOL_MODE = "00002A4E-0000-1000-8000-00805F9B34FB";
    public static final String SCAN_INTERVAL_WINDOW = "00002A4F-0000-1000-8000-00805F9B34FB";
    public static final String PNP_ID = "00002A50-0000-1000-8000-00805F9B34FB";
    public static final String GLUCOSE_FEATURES = "00002A51-0000-1000-8000-00805F9B34FB";
    public static final String RECORD_ACCESS_CONTROL_POINT = "00002A52-0000-1000-8000-00805F9B34FB";
    public static final String RSC_MEASUREMENT = "00002A53-0000-1000-8000-00805F9B34FB";
    public static final String RSC_FEATURE = "00002A54-0000-1000-8000-00805F9B34FB";
    public static final String SC_CONTROL_POINT = "00002A55-0000-1000-8000-00805F9B34FB";
    public static final String DIGITAL_INPUT = "00002A56-0000-1000-8000-00805F9B34FB";
    public static final String DIGITAL_OUTPUT = "00002A57-0000-1000-8000-00805F9B34FB";
    public static final String ANALOG_INPUT = "00002A58-0000-1000-8000-00805F9B34FB";
    public static final String ANALOG_OUTPUT = "00002A59-0000-1000-8000-00805F9B34FB";
    public static final String AGGREGATE_INPUT = "00002A5A-0000-1000-8000-00805F9B34FB";
    public static final String CSC_MEASUREMENT = "00002A5B-0000-1000-8000-00805F9B34FB";
    public static final String CSC_FEATURE = "00002A5C-0000-1000-8000-00805F9B34FB";
    public static final String SENSOR_LOCATION = "00002A5D-0000-1000-8000-00805F9B34FB";
    public static final String PULSE_OXIMETRY_SPOT_CHECK_MEASUREMENT = "00002A5E-0000-1000-8000-00805F9B34FB";
    public static final String PULSE_OXIMETRY_CONTINUOUS_MEASUREMENT = "00002A5F-0000-1000-8000-00805F9B34FB";
    public static final String PULSE_OXIMETRY_PULSATILE_EVENT = "00002A60-0000-1000-8000-00805F9B34FB";
    public static final String PULSE_OXIMETRY_FEATURES = "00002A61-0000-1000-8000-00805F9B34FB";
    public static final String PULSE_OXIMETRY_CONTROL_POINT = "00002A62-0000-1000-8000-00805F9B34FB";
    public static final String CYCLING_POWER_MEASUREMENT_CHARACTERISTIC = "00002A63-0000-1000-8000-00805F9B34FB";
    public static final String CYCLING_POWER_VECTOR_CHARACTERISTIC = "00002A64-0000-1000-8000-00805F9B34FB";
    public static final String CYCLING_POWER_FEATURE_CHARACTERISTIC = "00002A65-0000-1000-8000-00805F9B34FB";
    public static final String CYCLING_POWER_CONTROL_POINT_CHARACTERISTIC = "00002A66-0000-1000-8000-00805F9B34FB";
    public static final String LOCATION_AND_SPEED_CHARACTERISTIC = "00002A67-0000-1000-8000-00805F9B34FB";
    public static final String NAVIGATION_CHARACTERISTIC = "00002A68-0000-1000-8000-00805F9B34FB";
    public static final String POSITION_QUALITY_CHARACTERISTIC = "00002A69-0000-1000-8000-00805F9B34FB";
    public static final String LN_FEATURE_CHARACTERISTIC = "00002A6A-0000-1000-8000-00805F9B34FB";
    public static final String LN_CONTROL_POINT_CHARACTERISTIC = "00002A6B-0000-1000-8000-00805F9B34FB";
    public static final String CGM_MEASUREMENT_CHARACTERISTIC = "00002A6C-0000-1000-8000-00805F9B34FB";
    public static final String CGM_FEATURES_CHARACTERISTIC = "00002A6D-0000-1000-8000-00805F9B34FB";
    public static final String CGM_STATUS_CHARACTERISTIC = "00002A6E-0000-1000-8000-00805F9B34FB";
    public static final String CGM_SESSION_START_TIME_CHARACTERISTIC = "00002A6F-0000-1000-8000-00805F9B34FB";
    public static final String APPLICATION_SECURITY_POINT_CHARACTERISTIC = "00002A70-0000-1000-8000-00805F9B34FB";
    public static final String CGM_SPECIFIC_OPS_CONTROL_POINT_CHARACTERISTIC = "00002A71-0000-1000-8000-00805F9B34FB";
    public static final String GLASS_IDENTITY = "F96647CF-7F25-4277-843D-F407B4192F8B";
    // GATT 属性类型
    public static final String PRIMARY_SERVICE = "00002800-0000-1000-8000-00805F9B34FB";
    public static final String SECONDARY_SERVICE = "00002801-0000-1000-8000-00805F9B34FB";
    public static final String INCLUDE = "00002802-0000-1000-8000-00805F9B34FB";
    public static final String CHARACTERISTIC = "00002803-0000-1000-8000-00805F9B34FB";

    /**
     * GATT CHARACTERISTIC 描述符
     */
    public static final String CHARACTERISTIC_EXTENDED_PROPERTIES = "00002900-0000-1000-8000-00805F9B34FB";
    public static final String CHARACTERISTIC_USER_DESCRIPTION = "00002901-0000-1000-8000-00805F9B34FB";
    public static final String CLIENT_CHARACTERISTIC_CONFIGURATION = "00002902-0000-1000-8000-00805F9B34FB";
    public static final String SERVER_CHARACTERISTIC_CONFIGURATION = "00002903-0000-1000-8000-00805F9B34FB";
    public static final String CHARACTERISTIC_FORMAT = "00002904-0000-1000-8000-00805F9B34FB";
    public static final String CHARACTERISTIC_AGGREGATE_FORMAT = "00002905-0000-1000-8000-00805F9B34FB";
    public static final String VALID_RANGE = "00002906-0000-1000-8000-00805F9B34FB";
    public static final String EXTERNAL_REPORT_REFERENCE = "00002907-0000-1000-8000-00805F9B34FB";
    public static final String REPORT_REFERENCE = "00002908-0000-1000-8000-00805F9B34FB";

    /**
     *  GATT CHARACTERISTIC 类型
     */
    public static final String DEVICE_NAME = "00002A00-0000-1000-8000-00805F9B34FB";
    public static final String APPEARANCE = "00002A01-0000-1000-8000-00805F9B34FB";
    public static final String PERIPHERAL_PRIVACY_FLAG = "00002A02-0000-1000-8000-00805F9B34FB";
    public static final String RECONNECTION_ADDRESS = "00002A03-0000-1000-8000-00805F9B34FB";
    public static final String PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS = "00002A04-0000-1000-8000-00805F9B34FB";
    public static final String SERVICE_CHANGED = "00002A05-0000-1000-8000-00805F9B34FB";
    public static final String ALERT_LEVEL = "00002A06-0000-1000-8000-00805F9B34FB";
    public static final String TX_POWER_LEVEL = "00002A07-0000-1000-8000-00805F9B34FB";
    public static final String DATE_TIME = "00002A08-0000-1000-8000-00805F9B34FB";
    public static final String DAY_OF_WEEK = "00002A09-0000-1000-8000-00805F9B34FB";
    public static final String DAY_DATE_TIME = "00002A0A-0000-1000-8000-00805F9B34FB";
    public static final String EXACT_TIME_100 = "00002A0B-0000-1000-8000-00805F9B34FB";
    public static final String EXACT_TIME_256 = "00002A0C-0000-1000-8000-00805F9B34FB";
    public static final String DST_OFFSET = "00002A0D-0000-1000-8000-00805F9B34FB";
    public static final String TIME_ZONE = "00002A0E-0000-1000-8000-00805F9B34FB";
    public static final String LOCAL_TIME_INFORMATION = "00002A0F-0000-1000-8000-00805F9B34FB";
    public static final String SECONDARY_TIME_ZONE = "00002A10-0000-1000-8000-00805F9B34FB";
    public static final String TIME_WITH_DST = "00002A11-0000-1000-8000-00805F9B34FB";
    public static final String TIME_ACCURACY = "00002A12-0000-1000-8000-00805F9B34FB";
    public static final String TIME_SOURCE = "00002A13-0000-1000-8000-00805F9B34FB";
    public static final String REFERENCE_TIME_INFORMATION = "00002A14-0000-1000-8000-00805F9B34FB";
    public static final String TIME_BROADCAST = "00002A15-0000-1000-8000-00805F9B34FB";
    public static final String TIME_UPDATE_CONTROL_POINT = "00002A16-0000-1000-8000-00805F9B34FB";
    public static final String TIME_UPDATE_STATE = "00002A17-0000-1000-8000-00805F9B34FB";
    public static final String GLUCOSE_MEASUREMENT = "00002A18-0000-1000-8000-00805F9B34FB";
    public static final String BATTERY_LEVEL = "00002A19-0000-1000-8000-00805F9B34FB";
    public static final String BATTERY_POWER_STATE = "00002A1A-0000-1000-8000-00805F9B34FB";
    public static final String BATTERY_LEVEL_STATE = "00002A1B-0000-1000-8000-00805F9B34FB";
    public static final String KEY_SERVICE = "0000FFE0-0000-1000-8000-00805F9B34FB";
    public static final String KEY_SERVICE_CHARACTERISTIC = "0000FFE1-0000-1000-8000-00805F9B34FB";
    /**
     * TI Sensor TAG Device
     */
    public static final String UUID_IRT_SERV = "F000AA00-0451-4000-B000-000000000000";
    public static final String UUID_IRT_DATA = "F000AA01-0451-4000-B000-000000000000"; // ObjectLSB:ObjectMSB:AmbientLSB:AmbientMSB
    public static final String UUID_IRT_CONF = "F000AA02-0451-4000-B000-000000000000"; // 0: disable, 1: enable
    public static final String UUID_IRT_PERI = "F000AA03-0451-4000-B000-000000000000"; // Period in tens of milliseconds
    public static final String UUID_ACC_SERV = "F000AA10-0451-4000-B000-000000000000";
    public static final String UUID_ACC_DATA = "F000AA11-0451-4000-B000-000000000000";
    public static final String UUID_ACC_CONF = "F000AA12-0451-4000-B000-000000000000"; // 0: disable, 1: enable
    public static final String UUID_ACC_PERI = "F000AA13-0451-4000-B000-000000000000"; // Period in tens of milliseconds
    public static final String UUID_HUM_SERV = "F000AA20-0451-4000-B000-000000000000";
    public static final String UUID_HUM_DATA = "F000AA21-0451-4000-B000-000000000000";
    public static final String UUID_HUM_CONF = "F000AA22-0451-4000-B000-000000000000"; // 0: disable, 1: enable
    public static final String UUID_HUM_PERI = "F000AA23-0451-4000-B000-000000000000"; // Period in tens of milliseconds
    public static final String UUID_MAG_SERV = "F000AA30-0451-4000-B000-000000000000";
    public static final String UUID_MAG_DATA = "F000AA31-0451-4000-B000-000000000000";
    public static final String UUID_MAG_CONF = "F000AA32-0451-4000-B000-000000000000"; // 0: disable, 1: enable
    public static final String UUID_MAG_PERI = "F000AA33-0451-4000-B000-000000000000"; // Period in tens of milliseconds
    public static final String UUID_BAR_SERV = "F000AA40-0451-4000-B000-000000000000";
    public static final String UUID_BAR_DATA = "F000AA41-0451-4000-B000-000000000000";
    public static final String UUID_BAR_CONF = "F000AA42-0451-4000-B000-000000000000"; // 0: disable, 1: enable
    public static final String UUID_BAR_CALI = "F000AA43-0451-4000-B000-000000000000"; // Calibration characteristic
    public static final String UUID_BAR_PERI = "F000AA44-0451-4000-B000-000000000000"; // Period in tens of milliseconds
    public static final String UUID_GYR_SERV = "F000AA50-0451-4000-B000-000000000000";
    public static final String UUID_GYR_DATA = "F000AA51-0451-4000-B000-000000000000";
    public static final String UUID_GYR_CONF = "F000AA52-0451-4000-B000-000000000000"; // 0: disable, bit 0: enable x, bit 1: enable y, bit 2: enable z
    public static final String UUID_GYR_PERI = "F000AA53-0451-4000-B000-000000000000"; // Period in tens of milliseconds
    public static final String TEST_SERVICE = "F000AA60-0451-4000-B000-000000000000";
    public static final String TEST_DATA = "F000AA61-0451-4000-B000-000000000000";
    public static final String TEST_CONFIG = "F000AA62-0451-4000-B000-000000000000"; // Bit 7: Enable Test Mode; Bit 0-1 LED BitMask
    public static final String CONNECTION_CONTROL_SERVICE = "F000CCC0-0451-4000-B000-000000000000";
    public static final String CONNECTION_PARAMETERS = "F000CCC1-0451-4000-B000-000000000000";
    public static final String REQUEST_CONNECTION_PARAMETERS = "F000CCC2-0451-4000-B000-000000000000";
    public static final String DISCONNECT_REQUEST = "F000CCC3-0451-4000-B000-000000000000";
    public static final String OAD_SERVICE = "F000FFC0-0451-4000-B000-000000000000";
    public static final String OAD_IMAGE_IDENTIFY = "F000FFC1-0451-4000-B000-000000000000";
    public static final String OAD_IMAGE_BLOCK = "F000FFC2-0451-4000-B000-000000000000";
}
退出移动版