蓝牙协议总体结构
跑步机、走步机、椭圆机、划船机、智能单车需要按照协议完成开发。
华为运动健康通过FTMP(Fitness Machine Profile)及在FTMP之上的扩展使得华为运动健康与运动器材互联时提供智能体验。协议总体结构如下图所示:
图1 蓝牙Profile
服务 | 简称 | UUID | 用途 |
---|---|---|---|
Fitness Machine Service | FTMS | 0x1826 | 健身器材服务,用于与对端同步设备的Workout状态、Workout数据。 |
Device Information Service | DIS | 0x180A | 设备信息服务,用于读取设备信息。 |
说明
标准文本下载:Specifications | Bluetooth® Technology Website
下载FTMP V1.0 、FTMS V1.0 、DIS V1.1三份标准文本。
特征值交互过程
图2 特征值交互过程
DIS标准特征值支持范围
特征值 | 属性 | UUID | 设备类型 | 用途说明 |
---|---|---|---|---|
Manufacturer Name String | Read | 0x2A29 | 跑步机、椭圆机、划船机、智能单车、走步机 | 厂家名字符串 |
Model Number String | Read | 0x2A24 | 跑步机、椭圆机、划船机、智能单车、走步机 | 型号字符串 |
Serial Number String | Read | 0x2A25 | 跑步机、椭圆机、划船机、智能单车、走步机 | 序列号字符串 |
Hardware Revision String | Read | 0x2A27 | 跑步机、椭圆机、划船机、智能单车、走步机 | 硬件版本号 |
Firmware Revision String | Read | 0x2A26 | 跑步机、椭圆机、划船机、智能单车、走步机 | 固件版本号 |
Software Revision StringRead | Read | 0x2A28 | 跑步机、椭圆机、划船机、智能单车、走步机 | 软件版本号 |
System ID | Read | 0x2A23 | 跑步机、椭圆机、划船机、智能单车、走步机 | 系统ID |
FTMS标准特征值支持范围
FTMS标准特征值列表
特征值 | 属性 | UUID | 设备类型 | 用途说明 |
---|---|---|---|---|
Read | 0x2ACC | 跑步机、走步机、椭圆机、划船机、智能单车 | 描述设备支持的能力 | |
Notify | 0x2ACD | 仅跑步机、走步机 | 上报实时运动数据 | |
Notify | 0x2ACE | 仅椭圆机 | 上报实时运动数据 | |
Notify | 0x2AD1 | 仅划船机 | 上报实时运动数据 | |
Notify | 0x2AD2 | 仅智能单车 | 上报实时运动数据 | |
Read/Notify | 0x2AD3 | 跑步机、走步机、椭圆机、划船机、智能单车 | 上报设备状态数据 | |
Read | 0x2AD4 | 跑步机、走步机、智能单车 | 上报支持的速度范围 | |
Read | 0x2AD5 | 跑步机、走步机 | 上报支持的坡度范围 | |
Read | 0x2AD6 | 椭圆机 | 上报支持的阻力范围 | |
Read | 0x2AD8 | 椭圆机、划船机、智能单车 | 上报支持的功率范围 | |
Read | 0x2AD7 | 跑步机、走步机、椭圆机、划船机、智能单车 | 上报支持的心率范围 | |
Write, Indicate | 0x2AD9 | 跑步机、走步机可选支持、椭圆机、划船机、智能单车 | 控制健身设备的状态暂停、恢复等 | |
Notify | 0x2ADA | 跑步机、走步机、椭圆机、划船机、智能单车 | 上报健身设备的运动状态变更 |
广播包华为自定义参数
AD Type为 0xFF时,代表厂家自定义广播参数。如下广播参数代表符合华为运动健康规范的运动器材,可以在华为运动健康App进行广播扫描时识别。
1字节 | 1字节 | 2字节 | n字节 |
---|---|---|---|
Length | AD Type | Vendor ID | Type-Len-Value(Len和Value可选) |
- AD Type = 0xFF
- Vendor ID = 0x7D02
- Type = 0x01
- Len = N/A(0x01的Value为定长,故Len不存在)
- Value = 0x05 0x00 0xFF 0xFF
广播包Service Data AD Type
字段 | 类型 | 大小 | 说明 |
---|---|---|---|
Service Data AD Type | Uint8 | 1 | - |
Fitness Machine Service UUID | Uint16 | 2 | - |
Flags | Bit0 | - | Fitness Machine Available: 0:False;1:True |
Bit1-7 | - | 保留 | |
Fitness Machine Type | Bit0 | 根据产品实际能力填写 | Treadmill Supported |
Bit1 | Cross Trainer Supported | ||
Bit2 | Step Climber Supported | ||
Bit3 | Stair Climber Supported | ||
Bit4 | Rower Supported | ||
Bit5 | Indoor Bike Supported | ||
Bit6-15 | 保留 |
Fitness Machine Feature
字段 | 类型 | 说明 |
---|---|---|
Fitness Machine Features | Bit0 | Average Speed Supported |
Bit1 | Cadence Supported | |
Bit2 | Total Distance Supported | |
Bit3 | Inclination Supported | |
Bit4 | Elevation Gain Supported | |
Bit5 | Pace Supported | |
Bit6 | Step Count Supported | |
Bit7 | Resistance Level Supported | |
Bit8 | Stride Count Supported | |
Bit9 | Expended Energy Supported | |
Bit10 | Heart Rate Measurement Supported | |
Bit11 | Metabolic Equivalent Supported | |
Bit12 | Elapsed Time Supported | |
Bit13 | Remaining Time Supported | |
Bit14 | Power Measurement Supported | |
Bit15 | Force on Belt and Power Output Supported | |
Bit16 | User Data Retention Supported | |
Bit17-31 | Reserved for Future Use | |
Target Setting Features | Bit0 | Speed Target Setting Supported |
Bit1 | Inclination Target Setting Supported | |
Bit2 | Resistance Target Setting Supported | |
Bit3 | Power Target Setting Supported | |
Bit4 | Heart Rate Target Setting Supported | |
Bit5 | Targeted Expended Energy Configuration Supported | |
Bit6 | Targeted Step Number Configuration Supported | |
Bit7 | Targeted Stride Number Configuration Supported | |
Bit8 | Targeted Distance Configuration Supported | |
Bit9 | Targeted Training Time Configuration Supported | |
Bit10 | Targeted Time in Two Heart Rate Zones Configuration Supported | |
Bit11 | Targeted Time in Three Heart Rate Zones Configuration Supported | |
Bit12 | Targeted Time in Five Heart Rate Zones Configuration Supported | |
Bit13 | Indoor Bike Simulation Parameters Supported | |
Bit14 | Wheel Circumference Configuration Supported | |
Bit15 | Spin Down Control Supported | |
Bit16 | Targeted Cadence Configuration Supported | |
Bit17-31 | Reserved for Future Use |
字段取值根据产品实际能力填写。
必须支持的字段类型请参考运动设备规格要求。
Treadmill Data
用于跑步机、走步机向App发送实时运动数据。数据格式如下,由一个Flag和多个参数组成,具体参数的多少由Flags字段中的值决定。
Flags字段长度2 octet,各bit含义:
bit | Definition | Value |
---|---|---|
0 | More Data | 根据实际能力填写,More Data、Total Distance、Expended Energy、Elapsed Time数据必须存在。 支持坡度的跑步机,Inclination and Ramp Angle Setting和Elevation Gain必须存在;支持步数的跑步机,Steps必须存在。 说明 其中,More Data置0表示存在;其他数据置1表示存在。 |
1 | Average Speed | |
2 | Total Distance | |
3 | Inclination and Ramp Angle Setting | |
4 | Elevation Gain | |
5 | Instantaneous Pace | |
6 | Average Pace | |
7 | Expended Energy | |
8 | Heart Rate | |
9 | Metabolic Equivalent | |
10 | Elapsed Time | |
11 | Remaining Time | |
12 | Force on Belt and Power Output | |
13 | Steps |
Flags字段后参数列表:
参数 | 格式 | 单位 | 支持程度 |
---|---|---|---|
Instantaneous Speed | uint16 | 0.01 Km/h | 必须 |
Average Speed | uint16 | 0.01 Km/h | 可选 |
Total Distance | uint24 | metre | 必须 |
Inclination | sint16 | 0.1 percent | 可选 |
Ramp Angle Setting | sint16 | 0.1 degree | 可选 |
Positive Elevation Gain | uint16 | 0.1 Metre | 可选 |
Negative Elevation Gain | uint16 | 0.1 metre | 可选 |
Instantaneous Pace | uint8 | 0.1 Km/m | 可选 |
Average Pace | uint8 | 0.1 Km/m | 可选 |
Total Energy | uint16 | kcal | 必须 |
Energy Per Hour | uint16 | kcal | 可选 |
Energy Per Minute | uint8 | kcal | 可选 |
Heart Rate | uint8 | Beats/m | 可选 |
Metabolic Equivalent | uint8 | 0.1 meta | 可选 |
Elapsed Time | uint16 | second | 必须 |
Remaining Time | uint16 | second | 可选 |
Force on Belt | sint16 | newton | 可选 |
Power Output | sint16 | Watts | 可选 |
Steps | uint24 | step | 可选 |
Cross Trainer Data
用于椭圆机向App发送实时运动数据。数据格式如下,由一个Flag和多个参数组成,具体参数的多少由Flags字段中的值决定。
Flags字段长度2 octet,各bit含义:
bit | Definition | Value |
---|---|---|
0 | More Data | 根据实际能力填写,More Data、Total Distance、Stride Count、Resistance Level、Instantaneous Power、Average Power、Expended Energy、Elapsed Time数据必须存在。 支持心率的椭圆机,Heart Rate必须存在。 说明 其中,More Data置0表示存在;其他数据置1表示存在。 |
1 | Average Speed | |
2 | Total Distance | |
3 | Step Count | |
4 | Stride Count | |
5 | Elevation Gain | |
6 | Inclination and Ramp Angle Setting | |
7 | Resistance Level | |
8 | Instantaneous Power | |
9 | Average Power | |
10 | Expended Energy | |
11 | Heart Rate | |
12 | Metabolic Equivalent | |
13 | Elapsed Time | |
14 | Remaining Time | |
15 | Movement Direction |
Flags字段后参数列表:
参数 | 格式 | 单位 | 支持程度 |
---|---|---|---|
Instantaneous Speed | uint16 | 0.01 Km/h | 必选 |
Average Speed | uint16 | 0.01 Km/h | 可选 |
Total Distance | uint24 | metre | 必选 |
Step Per Minute | uint16 | step_per_minute | 必选 |
Average Step Rate | uint16 | step_per_minute | 必选 |
Stride Count | uint16 | Unitless | 必选 |
Inclination | sint16 | 0.1 percent | 可选 |
Ramp Angle Setting | sint16 | 0.1 degree | 可选 |
Positive Elevation Gain | uint16 | 1 Metre | 可选 |
Negative Elevation Gain | uint16 | 1 metre | 可选 |
Resistance Level | sint16 | 0.1 unitless | 必选 |
Instantaneous Power | sint16 | Watt | 必选 |
Average Power | sint16 | Watt | 必选 |
Total Energy | uint16 | kcal | 必选 |
Energy Per Hour | uint16 | kcal | 可选 |
Energy Per Minute | uint8 | kcal | 可选 |
Heart Rate | uint8 | Beats/m | 可选 |
Metabolic Equivalent | uint8 | 0.1 meta | 可选 |
Elapsed Time | uint16 | second | 必选 |
Remaining Time | uint16 | second | 可选 |
Rower Data
用于划船机向App发送实时运动数据。数据格式如下,由一个Flag和多个参数组成,具体参数的多少由Flags字段中的值决定。
Flags字段长度2 octet,各bit含义:
bit | Definition | Value |
---|---|---|
0 | More Data | 根据实际能力填写,More Data、Average Stroke Rate、Total Distance、Instantaneous Pace、Instantaneous Power、Average Power、Expended Energy、Elapsed Time数据必须存在。 支持心率的划船机,Heart Rate必须存在。 说明 其中,More Data置0表示存在;其他数据置1表示存在。 |
1 | Average Stroke | |
2 | Total Distance | |
3 | Instantaneous Pace | |
4 | Average Pace | |
5 | Instantaneous Power | |
6 | Average Power | |
7 | Resistance Level | |
8 | Expended Energy | |
9 | Heart Rate | |
10 | Metabolic Equivalent | |
11 | Elapsed Time | |
12 | Remaining Time |
Flags字段后参数列表:
参数 | 格式 | 单位 | 支持程度 |
---|---|---|---|
Stroke Rate | Uint8 | 0.5 stroke/m | 必选 |
Stroke Count | uint16 | Unitless | 必选 |
Average Stroke Rate | Uint8 | 0.5 stroke/m | 必选 |
Total Distance | uint24 | metre | 必选 |
Instantaneous Pace | uint16 | Seconds(500m) | 必选 |
Average Pace | uint16 | Seconds(500m) | 可选 |
Instantaneous Power | sint16 | watt | 必选 |
Average Power | sint16 | watt | 必选 |
Resistance Level | sint16 | Unitless | 可选 |
Total Energy | uint16 | kcal | 必选 |
Energy Per Hour | uint16 | kcal | 可选 |
Energy Per Minute | uint8 | kcal | 可选 |
Heart Rate | uint8 | Beats/m | 可选 |
Metabolic Equivalent | uint8 | 0.1 meta | 可选 |
Elapsed Time | uint16 | second | 必选 |
Remaining Time | uint16 | second | 可选 |
Indoor Bike Data
用于智能单车向App发送实时运动数据。数据格式如下,由一个Flag和多个参数组成,具体参数的多少由Flags字段中的值决定。
Flags字段长度2 octet,各bit含义:
bit | Definition | Value |
---|---|---|
0 | More Data | 根据实际能力填写,More Data、Instantaneous Cadence、Total Distance、Resistance Level、Instantaneous Power、Average Power、Expended Energy、Elapsed Time数据必须存在。 支持心率的单车,Heart Rate必须存在。 说明 其中,More Data置0表示存在;其他数据置1表示存在。 |
1 | Average Speed | |
2 | Instantaneous Cadence | |
3 | Average Cadence | |
4 | Total Distance | |
5 | Resistance Level | |
6 | Instantaneous Power | |
7 | Average Power | |
8 | Expended Energy | |
9 | Heart Rate | |
10 | Metabolic Equivalent | |
11 | Elapsed Time | |
12 | Remaining Time |
Flags字段后参数列表:
参数 | 格式 | 单位 | 支持程度 |
---|---|---|---|
Instantaneous Speed | uint16 | 0.01 Km/h | 必选 |
Average Speed | uint16 | 0.01 Km/h | 可选 |
Instantaneous Cadence | uint16 | 0.5 /min | 必选 |
Average Cadence | uint16 | 0.5 /min | 可选 |
Total Distance | uint24 | metre | 必选 |
Resistance Level | Sin16 | 1 unitless | 必选 |
Instantaneous Power | sint16 | 1 watt | 必选 |
Average Power | sint16 | 1 watt | 必选 |
Total Energy | uint16 | kcal | 必选 |
Energy Per Hour | uint16 | kcal | 可选 |
Energy Per Minute | uint8 | kcal | 可选 |
Heart Rate | uint8 | Beats/m | 可选 |
Metabolic Equivalent | uint8 | 0.1 meta | 可选 |
Elapsed Time | uint16 | second | 必选 |
Remaining Time | uint16 | second | 可选 |
Training Status
当前运动设备的工作状态:
参数 | 格式 | 取值 | 含义 |
---|---|---|---|
Flags | Bit0 | 1 | 是否存在Training Status参数 |
Bit1 | 0 | 是否存在Training Status String参数 | |
Bit2-7 | 0 | 保留 | |
Training status | Unit8 | 0x00 | 其他未知状态 |
0x01 | IDLE状态 | ||
0x0D | 正在跑步时的状态 | ||
0x0E | Pre-workout,开启前读秒时状态 | ||
0x0F | Post-workout,结束后读秒时状态 | ||
0x10-0xFF | 保留 | ||
Training Status String | Octet | - | 无需支持 |
Supported Speed Range
设备支持的参数范围:
参数 | 格式 | 单位 |
---|---|---|
Min speed | uint16 | 0.01 Km/h |
Max speed | Uint16 | 0.01 Km/h |
Min increment | uint16 | 0.01 m/h |
Supported Inclination Range
支持的坡度范围:
参数 | 格式 | 单位 |
---|---|---|
Min inclination | sint16 | 0.1 percent |
Max inclination | sint16 | 0.1 percent |
Min increment | uint16 | 0.1 percent |
Supported Resistance Level Range
支持的阻力范围:
参数 | 格式 | 单位 |
---|---|---|
Min inclination | sint16 | 0.1 unitless |
Max inclination | sint16 | 0.1 unitless |
Min increment | uint16 | 0.1 unitless |
Supported Power Range
支持的功率范围:
参数 | 格式 | 单位 |
---|---|---|
Min inclination | sint16 | Watt |
Max inclination | sint16 | Watt |
Min increment | uint16 | Watt |
Supported Heart Rate Range
支持的心率范围:
参数 | 格式 | 单位 |
---|---|---|
Min Heart Rate | Uint8 | Beats/m |
Max Heart Rate | Uint8 | Beats/m |
Min increment | Uint8 | Beats/m |
Fitness Machine Control Point
对设备状态进行控制的特征值,其格式如下:
参数 | 格式 | 大小 |
---|---|---|
Op Code | Uint8 | 1 octet |
Parameter | Variable | 0 to 18 octets |
其中parameter的内容随Op Code的取值而定。
Op Code | Requirement | Definition | Parameter |
---|---|---|---|
0x00 | Mandatory | Request Control | N/A |
0x01 | Mandatory | Reset: | N/A |
0x02 | Optional | Set target speed | Target Speed, uint16, 0.01 km/h |
0x03 | Optional | Set target inclination | Target Inclination, SINT16, 0.1 percent |
0x04 | Optional | Set Target Resistance Level | Target Resistance Level, UINT8, 0.1 unitless |
0x05 | Optional | Set Target Power | Target Power, SINT16,Watt |
0x07 | Mandatory | Start or resume | N/A |
0x08 | Mandatory | Stop or pause | Control Information; 01:stop;02:Pause;Other:RFU |
0x80 | Mandatory | Response Code | - |
当手机进行请求控制时,运动设备需要用0x80进行响应,响应的格式如下:
参数 | 格式 | 大小 | 取值 | 含义 |
---|---|---|---|---|
Response Code | Uint8 | 1 | 0x80 | 相应取值 |
Request Code | Uint8 | 1 | Request Op Code | 被响应的请求操作码 |
Result Code | Unit8 | 1 | 00 | 保留 |
01 | 成功 | |||
02 | 不支持操作 | |||
03 | 参数错误 | |||
04 | 操作失败 | |||
05 | 不允许控制 | |||
06-FF | 保留 | |||
Response Parameter | Octets | 0-17 octet | 不支持 | 不支持 |
Fitness Machine Status
此特征值由运动设备在自身的运动状态(如用户在面板改变了速度、坡度等)发生变化时,主动通知手机端,让手机端实时的同步了解状态变化。
此特征值上报内容格式如下:
参数 | 格式 | 大小 |
---|---|---|
Op Code | 8bits | 1 octet |
Parameter | Variable | Variable |
Op Code含义及其Parameter的内容如下
Op Code | Definition | Parameter |
---|---|---|
0x00 | RFU | N/A |
0x01 | Reset | N/A |
0x02 | Fitness Machine Stopped or Paused by the User | Control Information:unit8 0x01:stop; 0x02:pause |
0x03 | Fitness Machine Stopped by Safety Key | N/A |
0x04 | Fitness Machine Started or Resumed by the User | N/A |
0x05 | Target Speed Changed | New Target Value uint16 |
0x06 | Target Incline Changed | New Target Value sint16 |
0x07 | Target Resistance Level Changed | New Target Value uint8 |
FTMS华为扩展特征值
特征值 | 属性 | UUID | 用途说明 |
---|---|---|---|
Fitness Extension Data | write | d18d2c10-c44c-11e8-a355-529269fb1459 | 在FTMS扩展的特征值,
|
华为扩展特征值的作用有如下几个:
-
对设备的控制功能进行解锁。基于安全考虑,未解锁情况下,不允许蓝牙设备直接控制设备的启动、停止、速度、坡度等。
- 将手机的实时心率、计步、卡路里参数推送到设备进行同步显示。
参数 | 格式 | 大小 | 取值(0:Not 1:Present) | 含义 |
---|---|---|---|---|
Flags | 16bits | 2octets | Bit0 | 参数包含解锁码 |
Bit1 | 参数包含心率 | |||
Bit2 | 参数包含总卡路里 | |||
Bit3 | 参数包含动态卡路里 | |||
Bit4 | 参数包含计步 | |||
Bit5-15 | 保留 | |||
UnlockCode | Octets | 6 | 厂家自定义,6字节解锁码 | 厂家自定义,6字节解锁码,解锁码为0-F的6个数字 |
Heart Rate | Unit8 | 1 | 心率值 | 心率值 |
Total Energy | Unit16 | 2 | 总卡路里 | 总卡路里 |
Dynamic Energy | Unit16 | 2 | 动态卡路里 | 动态卡路里 |
Step Count | Unit16 | 2 | 实时步数 | 实时步数 |