|
|
@ -415,12 +415,45 @@ static const char* hex2str(const uint8_t* data, int32_t len) { |
|
|
|
return rx; |
|
|
|
} |
|
|
|
|
|
|
|
// void cmd_remove_note(char* input, int inputlen) { |
|
|
|
// bool detect_note = false; |
|
|
|
// for (int i = 0; i < inputlen; i++) { |
|
|
|
// if (!detect_note && input[i] == '#') { |
|
|
|
// detect_note = true; |
|
|
|
// } |
|
|
|
// if (detect_note) { |
|
|
|
// input[i] = 0; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// void cmd_prase_cmd(char* input, int inputlen, int32_t* argc, char* argv[]) { |
|
|
|
// for (int i = 0; input[i] == 0 || i < inputlen; i++) { |
|
|
|
// if (input[i] == ' ' || input[i] == '\r' || input[i] == '\n') { |
|
|
|
// input[i] = 0; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// int j = 0; |
|
|
|
// for (int i = 0; input[i] == 0 || i < inputlen; i++) { |
|
|
|
// if (input[i] != 0 && j == 0) { |
|
|
|
// argv[*argc] = &input[i]; |
|
|
|
// j = 1; |
|
|
|
// *argc = *argc + 1; |
|
|
|
// continue; |
|
|
|
// } |
|
|
|
|
|
|
|
// if (input[i] == 0 && j == 1) { |
|
|
|
// j = 0; |
|
|
|
// continue; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
char cmdcache[256] = {0}; |
|
|
|
static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { |
|
|
|
/** |
|
|
|
* @brief 接收到指令数据 |
|
|
|
*/ |
|
|
|
if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) { |
|
|
|
ZLOGI("rx:%s", hex2str(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
static void on_service_init(void) { |
|
|
|