|
@ -14,8 +14,8 @@ |
|
|
|
|
|
|
|
|
APP_TIMER_DEF(m_record_upload_tmr); // 数据上报定时器 |
|
|
APP_TIMER_DEF(m_record_upload_tmr); // 数据上报定时器 |
|
|
APP_TIMER_DEF(m_record_upload_finish_packet_report_tmr); // 数据上报完成上报定时器 |
|
|
APP_TIMER_DEF(m_record_upload_finish_packet_report_tmr); // 数据上报完成上报定时器 |
|
|
static uint8_t txbuf[128]; |
|
|
|
|
|
static uint8_t reportbuf[128]; |
|
|
|
|
|
|
|
|
static uint8_t txbuf[250]; |
|
|
|
|
|
static uint8_t reportbuf[250]; |
|
|
static bool m_realtime_report_state = false; |
|
|
static bool m_realtime_report_state = false; |
|
|
static int m_upload_record_state = 0; |
|
|
static int m_upload_record_state = 0; |
|
|
static uint32_t m_upload_data_state_enter_tp = 0; |
|
|
static uint32_t m_upload_data_state_enter_tp = 0; |
|
@ -61,7 +61,7 @@ int ble_stop_realtime_report() { |
|
|
m_realtime_report_state = false; |
|
|
m_realtime_report_state = false; |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
void ble_cmder_try_report_one_sample_data(uint32_t frameIndex, uint16_t data0, uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data4) { |
|
|
|
|
|
|
|
|
void ble_cmder_try_report_one_sample_data(app_event_t* event) { |
|
|
if (!m_realtime_report_state) { |
|
|
if (!m_realtime_report_state) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -70,20 +70,27 @@ void ble_cmder_try_report_one_sample_data(uint32_t frameIndex, uint16_t data0, u |
|
|
reportpacket->cmd = ify_hrs_report_heartrate_data; |
|
|
reportpacket->cmd = ify_hrs_report_heartrate_data; |
|
|
reportpacket->frame_index = 0; |
|
|
reportpacket->frame_index = 0; |
|
|
reportpacket->frame_type = kifyhrs_pt_report; |
|
|
reportpacket->frame_type = kifyhrs_pt_report; |
|
|
reportpacket->sample_data_index = frameIndex; |
|
|
|
|
|
|
|
|
|
|
|
reportpacket->data[0] = (data0 >> 0) & 0xFF; // 第一帧数据 |
|
|
|
|
|
reportpacket->data[1] = (data0 >> 8) & 0xFF; // 第一帧数据 |
|
|
|
|
|
reportpacket->data[2] = (data1 >> 0) & 0xFF; // 第二帧数据 |
|
|
|
|
|
reportpacket->data[3] = (data1 >> 8) & 0xFF; // 第二帧数据 |
|
|
|
|
|
reportpacket->data[4] = (data2 >> 0) & 0xFF; // 第三帧数据 |
|
|
|
|
|
reportpacket->data[5] = (data2 >> 8) & 0xFF; // 第三帧数据 |
|
|
|
|
|
reportpacket->data[6] = (data3 >> 0) & 0xFF; // 第四帧数据 |
|
|
|
|
|
reportpacket->data[7] = (data3 >> 8) & 0xFF; // 第四帧数据 |
|
|
|
|
|
reportpacket->data[8] = (data4 >> 0) & 0xFF; // 第五帧数据 |
|
|
|
|
|
reportpacket->data[9] = (data4 >> 8) & 0xFF; // 第五帧数据 |
|
|
|
|
|
|
|
|
|
|
|
uint16_t sendlen = sizeof(heartrate_report_packet_t) + 10; |
|
|
|
|
|
|
|
|
reportpacket->sample_data_index = event->val.little_data_block.frameIndex; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < LITTLE_DATA_BLOCK_FRAME_NUM; i++) { |
|
|
|
|
|
reportpacket->data[i * 4] = (event->val.little_data_block.data[i] >> 0) & 0xFF; |
|
|
|
|
|
reportpacket->data[i * 4 + 1] = (event->val.little_data_block.data[i] >> 8) & 0xFF; |
|
|
|
|
|
reportpacket->data[i * 4 + 2] = (event->val.little_data_block.data[i] >> 16) & 0xFF; |
|
|
|
|
|
reportpacket->data[i * 4 + 3] = (event->val.little_data_block.data[i] >> 24) & 0xFF; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
STATIC_ASSERT(sizeof(one_frame_t) == 4); |
|
|
|
|
|
|
|
|
|
|
|
// reportpacket->data[2] = (data1 >> 0) & 0xFF; // 第二帧数据 |
|
|
|
|
|
// reportpacket->data[3] = (data1 >> 8) & 0xFF; // 第二帧数据 |
|
|
|
|
|
// reportpacket->data[4] = (data2 >> 0) & 0xFF; // 第三帧数据 |
|
|
|
|
|
// reportpacket->data[5] = (data2 >> 8) & 0xFF; // 第三帧数据 |
|
|
|
|
|
// reportpacket->data[6] = (data3 >> 0) & 0xFF; // 第四帧数据 |
|
|
|
|
|
// reportpacket->data[7] = (data3 >> 8) & 0xFF; // 第四帧数据 |
|
|
|
|
|
// reportpacket->data[8] = (data4 >> 0) & 0xFF; // 第五帧数据 |
|
|
|
|
|
// reportpacket->data[9] = (data4 >> 8) & 0xFF; // 第五帧数据 |
|
|
|
|
|
|
|
|
|
|
|
uint16_t sendlen = sizeof(heartrate_report_packet_t) + LITTLE_DATA_BLOCK_FRAME_NUM * 4; |
|
|
zdatachannel_data_send2(reportbuf, sendlen); |
|
|
zdatachannel_data_send2(reportbuf, sendlen); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|