|
|
@ -1,3 +1,5 @@ |
|
|
|
#include "ble_proto_utils.h" |
|
|
|
|
|
|
|
#include "ble_proto_packet.h" |
|
|
|
|
|
|
|
bool ble_through_proto_check_packet(ble_through_proto_t *packet) { |
|
|
@ -32,3 +34,47 @@ uint8_t ble_through_proto_sum(ble_through_proto_t *packet) { |
|
|
|
} |
|
|
|
return sum; |
|
|
|
} |
|
|
|
|
|
|
|
#define ITERM(_cmd, content) \ |
|
|
|
{ .cmd = _cmd, .length = BLE_PACKET_BASE_SIZE() + sizeof(content) } |
|
|
|
|
|
|
|
#define EMPTY_CONTENT uint8_t |
|
|
|
#if 0 |
|
|
|
|
|
|
|
static cmd_info_t cmdinfos[] = { |
|
|
|
ITERM(kproto_cmd_ble_master_reset, EMPTY_CONTENT), |
|
|
|
ITERM(kproto_cmd_ble_master_read_version, ble_master_read_version_t), |
|
|
|
ITERM(kproto_cmd_ble_master_start_scan, ble_master_start_scan_t), |
|
|
|
ITERM(kproto_cmd_ble_master_stop_scan, EMPTY_CONTENT), |
|
|
|
ITERM(kproto_cmd_ble_master_enter_dfu, EMPTY_CONTENT), |
|
|
|
ITERM(kproto_cmd_ble_master_clear_reset_flag, EMPTY_CONTENT), |
|
|
|
ITERM(kproto_report_ble_master_connected_event, ble_master_connected_event_t), |
|
|
|
ITERM(kproto_report_ble_master_scan_result, ble_master_scan_result_t), |
|
|
|
ITERM(kproto_report_ble_master_power_on, EMPTY_CONTENT), |
|
|
|
ITERM(kproto_report_ble_master_heart, ble_master_heart_t), |
|
|
|
|
|
|
|
ITERM(kble_app_proto_cmd_sync_state, ble_app_proto_cmd_sync_state_t), |
|
|
|
ITERM(kble_app_proto_cmd_trigger_pump_start_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_cmd_trigger_pump_stop_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_cmd_trigger_reflux_start_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_cmd_trigger_reflux_stop_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_cmd_trigger_prepare_start_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_cmd_trigger_prepare_stop_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_cmd_read_version, ble_app_proto_cmd_read_version_t), |
|
|
|
ITERM(kble_app_proto_report_reflux_butt_short_press_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_report_reflux_butt_long_press_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_report_action_butt_short_press_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_report_action_butt_long_press_event, EMPTY_CONTENT), |
|
|
|
ITERM(kble_app_proto_report_client_heart, ble_app_proto_report_client_heart_t), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
cmd_info_t *getcmdinfo(uint8_t cmd) { |
|
|
|
for (int i = 0; i < sizeof(cmdinfos) / sizeof(cmd_info_t); i++) { |
|
|
|
if (cmdinfos[i].cmd == cmd) { |
|
|
|
return &cmdinfos[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
#endif |