commit
c7bb3d36bc
1 changed files with 188 additions and 0 deletions
@ -0,0 +1,188 @@ |
|||
#pragma once |
|||
|
|||
#include <stdint.h> |
|||
|
|||
#pragma pack(push, 1) |
|||
|
|||
typedef struct { |
|||
uint8_t frame_type; |
|||
uint8_t frame_index; |
|||
uint8_t cmd; |
|||
uint8_t data[]; |
|||
} ify_hrs_packet_t; |
|||
|
|||
typedef enum { |
|||
kifyhrs_ecode_success = 0, |
|||
kifyhrs_ecode_unkown_error = 1, |
|||
kifyhrs_ecode_cmd_not_support = 2, |
|||
kifyhrs_ecode_illegal_parameter = 3, |
|||
kifyhrs_ecode_device_busy = 4, |
|||
kifyhrs_ecode_hardware_error = 5, |
|||
kifyhrs_ecode_sensor_drop = 6, |
|||
kifyhrs_ecode_no_record_find = 7, |
|||
} ify_hrs_error_code_t; |
|||
|
|||
typedef enum { |
|||
kifyhrs_pt_cmd = 1, |
|||
kifyhrs_pt_cmd_receipt = 2, |
|||
kifyhrs_pt_report = 3, |
|||
kifyhrs_pt_error_receipt = 4, |
|||
} ify_hrs_packet_type_t; |
|||
|
|||
typedef enum { |
|||
kifyhrs_sensor_pos_none = 0, // 无指定位置 |
|||
kifyhrs_sensor_pos_I = 1, // I |
|||
kifyhrs_sensor_pos_II = 2, // II |
|||
kifyhrs_sensor_pos_III = 3, // III |
|||
kifyhrs_sensor_pos_V1 = 4, // V1 |
|||
kifyhrs_sensor_pos_V2 = 5, // V2 |
|||
kifyhrs_sensor_pos_V3 = 6, // V3 |
|||
kifyhrs_sensor_pos_V4 = 7, // V4 |
|||
kifyhrs_sensor_pos_V5 = 8, // V5 |
|||
kifyhrs_sensor_pos_V6 = 9, // V6 |
|||
kifyhrs_sensor_pos_aVR = 10, // |
|||
kifyhrs_sensor_pos_aVL = 11, // |
|||
kifyhrs_sensor_pos_aVF = 12, // |
|||
} ify_hrs_sensor_pos_t; |
|||
|
|||
typedef enum { |
|||
ify_hrs_cmd_read_device_version = 1, |
|||
ify_hrs_cmd_read_sensor_info = 2, |
|||
ify_hrs_cmd_read_device_state = 3, |
|||
ify_hrs_cmd_read_time = 4, |
|||
ify_hrs_cmd_sync_time = 5, |
|||
ify_hrs_cmd_start_capture = 6, |
|||
ify_hrs_cmd_stop_capture = 7, |
|||
ify_hrs_cmd_start_realtime_report = 8, |
|||
ify_hrs_cmd_stop_realtime_report = 9, |
|||
ify_hrs_cmd_read_records_info = 10, |
|||
ify_hrs_cmd_del_record = 11, |
|||
ify_hrs_cmd_start_upload_record = 12, |
|||
ify_hrs_cmd_enter_ota = 13, |
|||
ify_hrs_cmd_read_sn = 14, |
|||
ify_hrs_cmd_reset = 15, |
|||
|
|||
ify_hrs_report_heartrate_data = 101, |
|||
ify_hrs_report_battery_level = 102, |
|||
ify_hrs_report_low_battey_level = 103, |
|||
ify_hrs_report_sample_finish_end = 104, |
|||
ify_hrs_report_sensor_drop_detect = 105, |
|||
ify_hrs_report_record_upload_end = 106, |
|||
|
|||
} ify_hrs_cmd_t; |
|||
|
|||
/******************************************************************************* |
|||
* packet_struct * |
|||
*******************************************************************************/ |
|||
typedef struct { |
|||
uint16_t placeholder; |
|||
uint16_t blestack_version; |
|||
uint16_t bootloader_version; |
|||
uint16_t firmware_version; |
|||
uint16_t hardware_version; |
|||
} device_version_info_receipt_t; |
|||
|
|||
typedef struct { |
|||
uint8_t sensor_num; // 数量 |
|||
uint8_t sensor_precision; // 精度 |
|||
uint8_t sensor_sample_rate; // 采样率 |
|||
uint8_t sensor0_pos; // 位置 |
|||
uint8_t sensor1_pos; // 位置 |
|||
uint8_t sensor2_pos; // 位置 |
|||
} sensor_info_receipt_t; |
|||
|
|||
typedef struct { |
|||
uint8_t drop_state0; |
|||
uint8_t drop_state1; |
|||
struct { |
|||
uint8_t sampling_state : 1; // 位置 |
|||
uint8_t report_state : 1; // 位置 |
|||
uint8_t low_battery : 1; // 位置 |
|||
uint8_t full_storge : 1; // 位置 |
|||
uint8_t holder : 4; // 位置 |
|||
} device_state0; |
|||
uint8_t device_state1; // 预留 |
|||
uint8_t powerlevel; // 电量 |
|||
uint8_t storage_item_num; // 记录存储条数 |
|||
} device_state_receipt_t; |
|||
|
|||
typedef struct { |
|||
uint8_t year; |
|||
uint8_t month; |
|||
uint8_t day; |
|||
uint8_t hour; |
|||
uint8_t minute; |
|||
uint8_t second; |
|||
} read_time_receipt_t; |
|||
|
|||
typedef struct { |
|||
uint8_t year; |
|||
uint8_t month; |
|||
uint8_t day; |
|||
uint8_t hour; |
|||
uint8_t minute; |
|||
uint8_t second; |
|||
} sync_time_cmd_t; |
|||
|
|||
typedef struct { |
|||
uint8_t year; |
|||
uint8_t month; |
|||
uint8_t day; |
|||
uint8_t hour; |
|||
uint8_t minute; |
|||
uint8_t second; |
|||
} start_capture_cmd_t; |
|||
|
|||
typedef struct { |
|||
uint8_t record_index; // 最近第几条记录 |
|||
} read_record_info_cmd_t; |
|||
|
|||
typedef struct { |
|||
uint8_t record_id[6]; |
|||
uint32_t frameNum; |
|||
uint32_t dataSize; |
|||
uint8_t sensorNum; |
|||
uint8_t captureRate; // N*10HZ |
|||
uint8_t capturePrecision; |
|||
uint8_t compressAlgorithm; // 压缩算法 |
|||
} read_record_info_receipt_t; |
|||
|
|||
typedef struct { |
|||
uint8_t record_id[6]; |
|||
} del_record_cmd_t; |
|||
|
|||
typedef struct { |
|||
uint8_t record_id[6]; |
|||
} start_upload_record_cmd_t; |
|||
|
|||
typedef struct { |
|||
uint8_t sn[14]; |
|||
} read_sn_receipt_t; |
|||
|
|||
typedef struct { |
|||
uint8_t errorcode; |
|||
} error_receipt_t; |
|||
|
|||
/******************************************************************************* |
|||
* 上报相关结构体 * |
|||
*******************************************************************************/ |
|||
|
|||
typedef struct { |
|||
uint8_t frame_type; |
|||
uint8_t frame_index; |
|||
uint8_t cmd; |
|||
|
|||
uint32_t sample_data_index; |
|||
uint8_t data[]; // 上报的数据 |
|||
} heartrate_report_packet_t; |
|||
|
|||
typedef struct { |
|||
uint8_t frame_type; |
|||
uint8_t frame_index; |
|||
uint8_t cmd; |
|||
|
|||
uint8_t drop_state0; |
|||
uint8_t drop_state1; |
|||
} sensor_drop_event_report_packet_t; |
|||
|
|||
#pragma pack(pop) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue