Thingy: 52 SoC 蓝牙 BLE 服务协议定义
项目文件源于 Thingy_SDK_V2.1.0, 详细说明请见另一篇博客 "Nordic Thingy:52 SDK 安装及编译"
文件: ble_tss.c
#define BLE_UUID_TSS_CONFIG_CHAR 0x0501 /**< The UUID of the config Characteristic. */
#define BLE_UUID_TSS_SPKR_CHAR 0x0502 /**< The UUID of the speaker Characteristic. */
#define BLE_UUID_TSS_SPKR_STAT_CHAR 0x0503 /**< The UUID of the speaker Status Characteristic. */
#define BLE_UUID_TSS_MIC_CHAR 0x0504 /**< The UUID of the microphone Characteristic. */
// EF68xxxx-9B35-4933-9B10-52FFA9740042
#define TSS_BASE_UUID {{0x42, 0x00, 0x74, 0xA9, 0xFF, 0x52, 0x10, 0x9B, 0x33, 0x49, 0x35, 0x9B, 0x00, 0x00, 0x68, 0xEF}}
文件: ble_tms.c
#define BLE_UUID_TMS_CONFIG_CHAR 0x0401 /**< The UUID of the config Characteristic. */
#define BLE_UUID_TMS_TAP_CHAR 0x0402 /**< The UUID of the tap Characteristic. */
#define BLE_UUID_TMS_ORIENTATION_CHAR 0x0403 /**< The UUID of the orientation Characteristic. */
#define BLE_UUID_TMS_QUATERNION_CHAR 0x0404 /**< The UUID of the quaternion Characteristic. */
#define BLE_UUID_TMS_PEDOMETER_CHAR 0x0405 /**< The UUID of the pedometer Characteristic. */
#define BLE_UUID_TMS_RAW_CHAR 0x0406 /**< The UUID of the raw data Characteristic. */
#define BLE_UUID_TMS_EULER_CHAR 0x0407 /**< The UUID of the euler Characteristic. */
#define BLE_UUID_TMS_ROT_MAT_CHAR 0x0408 /**< The UUID of the rotation matrix Characteristic. */
#define BLE_UUID_TMS_HEADING_CHAR 0x0409 /**< The UUID of the compass heading Characteristic. */
#define BLE_UUID_TMS_GRAVITY_CHAR 0x040A /**< The UUID of the gravity vector Characteristic. */
// EF68xxxx-9B35-4933-9B10-52FF-A974-0042
#define TSS_BASE_UUID {{0x42, 0x00, 0x74, 0xA9, 0xFF, 0x52, 0x10, 0x9B, 0x33, 0x49, 0x35, 0x9B, 0x00, 0x00, 0x68, 0xEF}}
文件: ble_tes.c
#define BLE_UUID_TES_TEMPERATURE_CHAR 0x0201 /**< The UUID of the temperature Characteristic. */
#define BLE_UUID_TES_PRESSURE_CHAR 0x0202 /**< The UUID of the pressure Characteristic. */
#define BLE_UUID_TES_HUMIDITY_CHAR 0x0203 /**< The UUID of the humidity Characteristic. */
#define BLE_UUID_TES_GAS_CHAR 0x0204 /**< The UUID of the gas Characteristic. */
#define BLE_UUID_TES_COLOR_CHAR 0x0205 /**< The UUID of the gas Characteristic. */
#define BLE_UUID_TES_CONFIG_CHAR 0x0206 /**< The UUID of the config Characteristic. */
// EF68xxxx-9B35-4933-9B10-52FFA9740042
#define TSS_BASE_UUID {{0x42, 0x00, 0x74, 0xA9, 0xFF, 0x52, 0x10, 0x9B, 0x33, 0x49, 0x35, 0x9B, 0x00, 0x00, 0x68, 0xEF}}
文件: ble_tcs.c
#define BLE_UUID_TCS_DEVICE_NAME_CHAR 0x0101 /**< The UUID of the device name Characteristic. */
#define BLE_UUID_TCS_ADV_PARAMS_CHAR 0x0102 /**< The UUID of the advertising parameters Characteristic. */
#define BLE_UUID_TCS_APPEARANCE_CHAR 0x0103 /**< The UUID of the appearance Characteristic. */
#define BLE_UUID_TCS_CONN_PARAM_CHAR 0x0104 /**< The UUID of the connection parameters Characteristic. */
#define BLE_UUID_TCS_BEACON_PARAM_CHAR 0x0105 /**< The UUID of the beacon Characteristic. */
#define BLE_UUID_TCS_CLOUD_PARAM_CHAR 0x0106 /**< The UUID of the cloud token Characteristic. */
#define BLE_UUID_TCS_FW_VERSION_CHAR 0x0107 /**< The UUID of the FW version Characteristic. */
#define BLE_UUID_TCS_MTU_CHAR 0x0108 /**< The UUID of the MTU Characteristic. */
// EF68xxxx-9B35-4933-9B10-52FFA9740042
#define TSS_BASE_UUID {{0x42, 0x00, 0x74, 0xA9, 0xFF, 0x52, 0x10, 0x9B, 0x33, 0x49, 0x35, 0x9B, 0x00, 0x00, 0x68, 0xEF}}
Thingy: 52 Android App 蓝牙 BLE 服务协议定义
文件:app\thingylib\java\no.nordicsemi.android.thingylib\utils\ThingyUtils.java
源自 Nordic Thingy 52, Android App 源码, 参见文章 "Nordic Thingy:52 Android App 源码及APK"
public static final UUID THINGY_BASE_UUID = new UUID(0xEF6801009B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_CONFIGURATION_SERVICE = new UUID(0xEF6801009B354933L, 0x9B1052FFA9740042L);
public static final UUID DEVICE_NAME_CHARACTERISTIC_UUID = new UUID(0xEF6801019B354933L, 0x9B1052FFA9740042L);
public static final UUID ADVERTISING_PARAM_CHARACTERISTIC_UUID = new UUID(0xEF6801029B354933L, 0x9B1052FFA9740042L);
public static final UUID APPEARANCE_CHARACTERISTIC_UUID = new UUID(0xEF6801039B354933L, 0x9B1052FFA9740042L);
public static final UUID CONNECTION_PARAM_CHARACTERISTIC_UUID = new UUID(0xEF6801049B354933L, 0x9B1052FFA9740042L);
public static final UUID EDDYSTONE_URL_CHARACTERISTIC_UUID = new UUID(0xEF6801059B354933L, 0x9B1052FFA9740042L);
public static final UUID CLOUD_TOKEN_CHARACTERISTIC_UUID = new UUID(0xEF6801069B354933L, 0x9B1052FFA9740042L);
public static final UUID FIRMWARE_VERSION_CHARACERISTIC_UUID = new UUID(0xEF6801079B354933L, 0x9B1052FFA9740042L);
public static final UUID BATTERY_SERVICE = UUID.fromString("0000180F-0000-1000-8000-00805f9b34fb");
public static final UUID BATTERY_SERVICE_CHARACTERISTIC = UUID.fromString("00002A19-0000-1000-8000-00805f9b34fb");
public static final UUID THINGY_ENVIRONMENTAL_SERVICE = new UUID(0xEF6802009B354933L, 0x9B1052FFA9740042L);
public static final UUID TEMPERATURE_CHARACTERISTIC = new UUID(0xEF6802019B354933L, 0x9B1052FFA9740042L);
public static final UUID PRESSURE_CHARACTERISTIC = new UUID(0xEF6802029B354933L, 0x9B1052FFA9740042L);
public static final UUID HUMIDITY_CHARACTERISTIC = new UUID(0xEF6802039B354933L, 0x9B1052FFA9740042L);
public static final UUID AIR_QUALITY_CHARACTERISTIC = new UUID(0xEF6802049B354933L, 0x9B1052FFA9740042L);
public static final UUID COLOR_CHARACTERISTIC = new UUID(0xEF6802059B354933L, 0x9B1052FFA9740042L);
public static final UUID CONFIGURATION_CHARACTERISTIC = new UUID(0xEF6802069B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_UI_SERVICE = new UUID(0xEF6803009B354933L, 0x9B1052FFA9740042L);
public static final UUID LED_CHARACTERISTIC = new UUID(0xEF6803019B354933L, 0x9B1052FFA9740042L);
public static final UUID BUTTON_CHARACTERISTIC = new UUID(0xEF6803029B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_MOTION_SERVICE = new UUID(0xEF6804009B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_MOTION_CONFIGURATION_CHARACTERISTIC = new UUID(0xEF6804019B354933L, 0x9B1052FFA9740042L);
public static final UUID TAP_CHARACTERISTIC = new UUID(0xEF6804029B354933L, 0x9B1052FFA9740042L);
public static final UUID ORIENTATION_CHARACTERISTIC = new UUID(0xEF6804039B354933L, 0x9B1052FFA9740042L);
public static final UUID QUATERNION_CHARACTERISTIC = new UUID(0xEF6804049B354933L, 0x9B1052FFA9740042L);
public static final UUID PEDOMETER_CHARACTERISTIC = new UUID(0xEF6804059B354933L, 0x9B1052FFA9740042L);
public static final UUID RAW_DATA_CHARACTERISTIC = new UUID(0xEF6804069B354933L, 0x9B1052FFA9740042L);
public static final UUID EULER_CHARACTERISTIC = new UUID(0xEF6804079B354933L, 0x9B1052FFA9740042L);
public static final UUID ROTATION_MATRIX_CHARACTERISTIC = new UUID(0xEF6804089B354933L, 0x9B1052FFA9740042L);
public static final UUID HEADING_CHARACTERISTIC = new UUID(0xEF6804099B354933L, 0x9B1052FFA9740042L);
public static final UUID GRAVITY_VECTOR_CHARACTERISTIC = new UUID(0xEF68040A9B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_SOUND_SERVICE = new UUID(0xEF6805009B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_SOUND_CONFIG_CHARACTERISTIC = new UUID(0xEF6805019B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_SPEAKER_DATA_CHARACTERISTIC = new UUID(0xEF6805029B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_SPEAKER_STATUS_CHARACTERISTIC = new UUID(0xEF6805039B354933L, 0x9B1052FFA9740042L);
public static final UUID THINGY_MICROPHONE_CHARACTERISTIC = new UUID(0xEF6805049B354933L, 0x9B1052FFA9740042L);
public static final UUID CLIENT_CHARACTERISTIC_CONFIGURATOIN_DESCRIPTOR = new UUID(0x0000290200001000L, 0x800000805f9B34FBL);
public final static ParcelUuid PARCEL_SECURE_DFU_SERVICE = ParcelUuid.fromString("0000FE59-0000-1000-8000-00805F9B34FB");
public final static UUID SECURE_DFU_SERVICE = UUID.fromString("0000FE59-0000-1000-8000-00805F9B34FB");
public static final UUID THINGY_BUTTONLESS_DFU_SERVICE = new UUID(0x8E400001F3154F60l, 0x9FB8838830DAEA50L);
public static final UUID DFU_DEFAULT_CONTROL_POINT_CHARACTERISTIC = new UUID(0x8EC90001F3154F60l, 0x9FB8838830DAEA50L);
public static final UUID DFU_CONTROL_POINT_CHARACTERISTIC_WITHOUT_BOND_SHARING = new UUID(0x8EC90003F3154F60l, 0x9FB8838830DAEA50L);
NORDIC Thingy 52 原文手册说明
This section focuses on the custom services used in the Thingy firmware together with their configuration parameters.
The Thingy configuration service is responsible for handling all general configuration parameters that are not related to a particular module.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
Base UUID | EF68xxxx-9B35-4933-9B10-52FFA9740042 | |||
Thingy configuration service | 0100 | |||
Device name characteristic | 0101 | Write/Read | max 10 bytes | Device name as ASCII string. |
Advertising param characteristic | 0102 | Write/Read | 3 bytes | Advertising parameters (in units):
|
Connection param characteristic | 0104 | Write/Read | 8 bytes | Connection parameters:
|
Eddystone URL | 0105 | Write/Read | 3-17 bytes | Eddystone URL. Data format:
|
Cloud token | 0106 | Write/Read | max 250 bytes | Cloud token to be used for identification against cloud services. |
FW version | 0107 | Read | 3 bytes |
|
MTU request | 0108 | Write/Read req | 3 bytes | MTU request. Not retained.
|
The environment module is responsible for reading the temperature, pressure, humidity, air quality/gas, and light intensity/color sensors, as well as for sending data and configuration. It is running on top of the environment BLE service (ble_tes), the environment sensor drivers, and the environment flash storage with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. The configuration is stored in flash. To turn on sensor reading, enable notifications from the desired characteristic by writing 0x0001 to the Client Characteristic Configuration Descriptor (CCCD) for that characteristic.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
Base UUID | EF68xxxx-9B35-4933-9B10-52FFA9740042 | |||
Weather station service | 0200 | |||
Temperature characteristic | 0201 | Notify | 2 bytes | Temperature in Celsius
|
Pressure characteristic | 0202 | Notify | 5 bytes | Pressure in hPa
|
Humidity characteristic | 0203 | Notify | 1 bytes | Relative humidity in %
|
Gas (Air quality) characteristic | 0204 | Notify | 4 bytes |
|
Color characteristic | 0205 | Notify | 8 bytes |
|
Configuration characteristic | 0206 | Write/Read | 12 bytes |
|
The UI module handles the onboard LEDs, buttons, and other potential UI components like a quadrature decoder, touchscreen etc. The UI module runs on top of the UI BLE Service (ble_uis), the LED and button drivers, and the UI flash storage with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. This module enables RGB LED value setting and button event notifications via BLE. Button notification is enabled by writing 0x0001 to the CCCD of the button characteristic.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
Base UUID | EF68xxxx-9B35-4933-9B10-52FFA9740042 | |||
UI service | 0300 | |||
LED characteristic | 0301 | Write req/Read | Max 5 bytes | RGB Value:
|
Button characteristic | 0302 | Notify | 1 byte | Boolean button state:
|
EXT pin characteristic | 0303 | Write req/Read | 4 bytes | External pin control. Range 0 - 255. 0 is off, 255 is on. PWM is not implemented. So either 0 or 255.
|
The motion module is responsible for reading the 9-axis motion sensor and the low power accelerometer, as well as for sending the data and flash storage of the configuration parameters for this module. It is running on top of the motion BLE service (ble_tms) with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. The configuration is stored in flash memory. To turn on sensor reading, enable notifications from the desired characteristic by writing 0x0001 to the Client Characteristic Configuration Descriptor (CCCD) for that characteristic.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
Base UUID | EF68xxxx-9B35-4933-9B10-52FFA9740042 | |||
Thingy motion service | 0400 | |||
Config characteristic | 0401 | Write/Read | 9 bytes | Motion configuration:
|
Tap characteristic | 0402 | Notify | 2 bytes | Direction and count of taps:
|
Orientation characteristic | 0403 | Notify | 1 byte |
|
Quaternion characteristic | 0404 | Notify | 16 bytes | Attitude represented with quaternions (2Q30 fixed point):
|
Step counter characteristic | 0405 | Notify | 8 bytes | Step counter:
|
Raw data characteristic | 0406 | Notify | 18 bytes | Motion sensor raw data:
|
Euler characteristic | 0407 | Notify | 12 bytes | Attitude represented in Euler angles (16Q16 fixed point)
|
Rotation matrix char | 0408 | Notify | 18 bytes | Attitude in rotation matrix (2Q14 fixed point)
|
Heading characteristic | 0409 | Notify | 4 bytes | Heading (16Q16 fixed point)
|
Gravity vector | 040A | Notify | 12 bytes | Attitude represented by a gravity vector:
|
The sound module is responsible for handling both the speaker and the microphone. The sound module is built on top of the sound BLE service (ble_tss) with base UUID EF68xxxx-9B35-4933-9B10-52FFA9740042. The configuration is stored in flash.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
Base UUID | EF68xxxx-9B35-4933-9B10-52FFA9740042 | |||
Thingy sound service | 0500 | |||
Config characteristic | 0501 | Write/Read | 2 bytes | Sound configuration
|
Speaker data characteristic | 0502 | Write without resp | Max 273 bytes | In frequency mode:
|
Speaker status characteristic | 0503 | Notify | 1 byte | Speaker status
|
Microphone characteristic | 0504 | Notify | Max 273 bytes | ADCPM mode
|
This module is responsible for handling battery level information.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
UUID | 180F | Notify/Read | 1 byte |
|
This module is responsible for running Device Firmware Updates on Thingy.
Name | UUID | Type | Data | Description |
---|---|---|---|---|
Secure DFU Service | FE59 | |||
Base UUID | 0000xxxx-0000-1000-8000-00805f9b34fb | |||
DFU Control Point characteristic | 8EC90001-F315-4F60-9FB8-838830DAEA50 | Notify/Write | 1 byte | Steps to put Thingy into Buttonless DFU mode:
|