|
@ -4,6 +4,7 @@ |
|
|
#include "app_event.h" |
|
|
#include "app_event.h" |
|
|
#include "app_event_distribute.h" |
|
|
#include "app_event_distribute.h" |
|
|
#include "app_scheduler.h" |
|
|
#include "app_scheduler.h" |
|
|
|
|
|
#include "basic/device_version_info_mgr.h" |
|
|
#include "board/board.h" |
|
|
#include "board/board.h" |
|
|
#include "board/board_battery_state.h" |
|
|
#include "board/board_battery_state.h" |
|
|
#include "device_ctrl_service.h" |
|
|
#include "device_ctrl_service.h" |
|
@ -12,7 +13,6 @@ |
|
|
#include "zble_module.h" |
|
|
#include "zble_module.h" |
|
|
#include "zdatachannel_service.h" |
|
|
#include "zdatachannel_service.h" |
|
|
#include "znordic.h" |
|
|
#include "znordic.h" |
|
|
#include "basic/device_version_info_mgr.h" |
|
|
|
|
|
|
|
|
|
|
|
static uint8_t rxbufcache[256]; |
|
|
static uint8_t rxbufcache[256]; |
|
|
static bool is_rxbufcache_used = false; // 接收到的消息是否正在被处理中 |
|
|
static bool is_rxbufcache_used = false; // 接收到的消息是否正在被处理中 |
|
@ -70,7 +70,7 @@ static void send_error_receipt(ify_hrs_packet_t* rxpacket, int32_t errorcode) { |
|
|
txheader->cmd = rxpacket->cmd; |
|
|
txheader->cmd = rxpacket->cmd; |
|
|
txheader->frame_index = rxpacket->frame_index; |
|
|
txheader->frame_index = rxpacket->frame_index; |
|
|
txheader->frame_type = kifyhrs_pt_error_receipt; |
|
|
txheader->frame_type = kifyhrs_pt_error_receipt; |
|
|
receipt->errorcode = errorcode; |
|
|
|
|
|
|
|
|
receipt->errorcode = errorcode; |
|
|
zdatachannel_data_send2(m_txbuf, sendlen); |
|
|
zdatachannel_data_send2(m_txbuf, sendlen); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -124,7 +124,6 @@ void prvf_report_sample_data(uint32_t frameIndex, one_frame_data_t* data, int32_ |
|
|
* @brief 第一导联数据 |
|
|
* @brief 第一导联数据 |
|
|
*/ |
|
|
*/ |
|
|
for (int i = 0; i < ndata; i++) { |
|
|
for (int i = 0; i < ndata; i++) { |
|
|
|
|
|
|
|
|
reportpacket->data[i * 9 + 0] = ((data[i].data0)) >> 0; |
|
|
reportpacket->data[i * 9 + 0] = ((data[i].data0)) >> 0; |
|
|
reportpacket->data[i * 9 + 1] = ((data[i].data0)) >> 8; |
|
|
reportpacket->data[i * 9 + 1] = ((data[i].data0)) >> 8; |
|
|
reportpacket->data[i * 9 + 2] = ((data[i].data0)) >> 16; |
|
|
reportpacket->data[i * 9 + 2] = ((data[i].data0)) >> 16; |
|
@ -273,8 +272,13 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) { |
|
|
ify_hrs_packet_t* rxheader = (ify_hrs_packet_t*)p_event_data; |
|
|
ify_hrs_packet_t* rxheader = (ify_hrs_packet_t*)p_event_data; |
|
|
ify_hrs_packet_t* txheader = (ify_hrs_packet_t*)m_txbuf; |
|
|
ify_hrs_packet_t* txheader = (ify_hrs_packet_t*)m_txbuf; |
|
|
ify_hrs_cmd_t cmd = (ify_hrs_cmd_t)rxheader->cmd; |
|
|
ify_hrs_cmd_t cmd = (ify_hrs_cmd_t)rxheader->cmd; |
|
|
|
|
|
int paramLen = len - sizeof(ify_hrs_packet_t); |
|
|
memset(m_txbuf, 0, sizeof(m_txbuf)); |
|
|
memset(m_txbuf, 0, sizeof(m_txbuf)); |
|
|
|
|
|
|
|
|
|
|
|
if (len < sizeof(ify_hrs_packet_t)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ZLOGI("rx cmd:%d index:%d datalen:%d", cmd, rxheader->frame_index, len - sizeof(ify_hrs_packet_t)); |
|
|
ZLOGI("rx cmd:%d index:%d datalen:%d", cmd, rxheader->frame_index, len - sizeof(ify_hrs_packet_t)); |
|
|
NRF_LOG_HEXDUMP_INFO(p_event_data, len); |
|
|
NRF_LOG_HEXDUMP_INFO(p_event_data, len); |
|
|
|
|
|
|
|
@ -358,10 +362,33 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) { |
|
|
send_error_receipt(rxheader, kifyhrs_ecode_device_busy); |
|
|
send_error_receipt(rxheader, kifyhrs_ecode_device_busy); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DeviceCtrl_startSample(); |
|
|
|
|
|
|
|
|
DeviceCtrl_startSample(0); |
|
|
|
|
|
send_success_receipt(rxheader, 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if (cmd == ify_hrs_cmd_start_capture_time_v2) { |
|
|
|
|
|
// kifyhrs_ecode_parameter_error |
|
|
|
|
|
// hwss_start_capture(); |
|
|
|
|
|
|
|
|
|
|
|
if (paramLen < 4) { |
|
|
|
|
|
send_error_receipt(rxheader, kifyhrs_ecode_parameter_error); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int32_t capture_time_s = *(int32_t*)(&rxheader->data[0]); |
|
|
|
|
|
|
|
|
|
|
|
if (RecordUpload_is_uploading()) { |
|
|
|
|
|
ZLOGI("uploading,can not start capture"); |
|
|
|
|
|
send_error_receipt(rxheader, kifyhrs_ecode_device_busy); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DeviceCtrl_startSample(capture_time_s); |
|
|
send_success_receipt(rxheader, 0); |
|
|
send_success_receipt(rxheader, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
// ify_hrs_cmd_start_upload_record_v2 |
|
|
|
|
|
|
|
|
else if (cmd == ify_hrs_cmd_stop_capture) { |
|
|
else if (cmd == ify_hrs_cmd_stop_capture) { |
|
|
// hwss_stop_capture(); |
|
|
// hwss_stop_capture(); |
|
|
DeviceCtrl_stopSample(); |
|
|
DeviceCtrl_stopSample(); |
|
|