From: 孙春阳 Date: Wed, 13 Aug 2025 16:23:23 +0000 (+0800) Subject: 临时提交 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=3a03ef29d5ad11878f4992dbfac408c4e33a8931;p=mirrors%2FFD230.git 临时提交 --- diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp index 4ff62376d..7685fd358 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp @@ -434,11 +434,13 @@ static int ws_queue_put(ws_message_queue_t* queue, const uint8_t* data, uint16_t /* 添加消息到队列 */ ws_message_item_t* item = &queue->messages[queue->tail]; + memset(item->data,0,WS_MESSAGE_MAX_SIZE); memcpy(item->data, data, length); item->length = length; item->type = type; item->timestamp = osKernelGetTickCount(); item->in_use = true; + printf("ws_queue_put type %d , length %d , data %s\n",type,item->length,item->data); queue->tail = (queue->tail + 1) % WS_QUEUE_SIZE; queue->count++; @@ -868,17 +870,27 @@ uint8_t get_bk_websocket_tts_tick(void) void asr_on_ws_packet_callback(uint8_t* data, size_t datalen, WebSocketMessageType type) { if(asr_client !=NULL && asr_client->msg_queue !=NULL) - ws_queue_put(asr_client->msg_queue,data,datalen,type); + { + // printf("asr_on_ws_packet_callback %d %s\n",datalen,data); + ws_queue_put(asr_client->msg_queue,data,datalen,type); + } + } void tts_on_ws_packet_callback(uint8_t* data, size_t datalen, WebSocketMessageType type) { if(tts_client !=NULL && tts_client->msg_queue !=NULL) - ws_queue_put(tts_client->msg_queue,data,datalen,type); + { + // printf("tts_on_ws_packet_callback %d %s\n",datalen,data); + ws_queue_put(tts_client->msg_queue,data,datalen,type); + } } void chat_on_ws_packet_callback(uint8_t* data, size_t datalen, WebSocketMessageType type) { if(chat_client !=NULL && chat_client->msg_queue !=NULL) - ws_queue_put(chat_client->msg_queue,data,datalen,type); + { + ws_queue_put(chat_client->msg_queue,data,datalen,type); + } + } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp index d81b4a4ce..4057ee22b 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp @@ -718,34 +718,33 @@ int ws_process_received_data(WebSocketClient *client, const uint8_t *data, size_ printf("\n=== WebSocket Raw Data Received ===\n"); printf("Client: %s:%s\n", client->host, client->path); printf("Total bytes: %zu\n", len); - printf("Raw data (hex): "); - - // 打印所有数据的十六进制表示 - for (size_t i = 0; i < len; i++) { - printf("%02X ", data[i]); - // 每16字节换行,提高可读性 - if ((i + 1) % 16 == 0) { - printf("\n "); - } - } - printf("\n"); + // printf("Raw data (hex): "); + // // 打印所有数据的十六进制表示 + // for (size_t i = 0; i < len; i++) { + // printf("%02X ", data[i]); + // // 每16字节换行,提高可读性 + // if ((i + 1) % 16 == 0) { + // printf("\n "); + // } + // } + // printf("\n"); - // 打印ASCII表示(可打印字符) - printf("Raw data (ASCII): "); - for (size_t i = 0; i < len; i++) { - if (data[i] >= 32 && data[i] <= 126) { - printf("%c", data[i]); - } else if (data[i] == '\r') { - printf("\\r"); - } else if (data[i] == '\n') { - printf("\\n"); - } else if (data[i] == '\t') { - printf("\\t"); - } else { - printf("."); - } - } - printf("\n"); + // // 打印ASCII表示(可打印字符) + // printf("Raw data (ASCII): "); + // for (size_t i = 0; i < len; i++) { + // if (data[i] >= 32 && data[i] <= 126) { + // printf("%c", data[i]); + // } else if (data[i] == '\r') { + // printf("\\r"); + // } else if (data[i] == '\n') { + // printf("\\n"); + // } else if (data[i] == '\t') { + // printf("\\t"); + // } else { + // printf("."); + // } + // } + // printf("\n"); // 打印数据统计信息 // printf("Data analysis:\n"); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/websocket_parser.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/websocket_parser.cpp index 3bdaede4a..d695d81d1 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/websocket_parser.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/websocket_parser.cpp @@ -129,7 +129,7 @@ ws_parser_t* ws_parser_init() { void ws_parser_reset(ws_parser_t* parser) { if (!parser) return; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "WS: Resetting parser state"); + // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "WS: Resetting parser state"); parser->state = WS_STATE_START; parser->buffer_pos = 0; @@ -543,7 +543,7 @@ int ws_parse_stream(ws_parser_t* parser, const uint8_t* data, size_t len) { return i+1; } else if (result == -1) { // 解析错误,重置解析器 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WS: Parse error at byte %zu, resetting parser, byte: %02X", i, data[i]); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WS: Parse error at byte %zu, resetting parser, byte: %02X", i, data[i]); ws_parser_reset(parser); continue; }