From ae02e58a363b8404778273dd4c8f91944d7684b1 Mon Sep 17 00:00:00 2001 From: wangfq Date: Tue, 30 Jun 2026 17:52:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20json=5Fget=5Fcmd=20=E6=9C=AA=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=BC=95=E5=8F=B7=E5=AF=BC=E8=87=B4=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit simple_parse_json 提取字符串值时保留双引号, json_get_cmd 直接用于 strcmp 匹配命令表, 因 "pwd_verify" != pwd_verify 导致所有命令都走进 'unsupported command' 分支。 改用 json_get_str_field (自动去引号) 修复。 --- vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c index 420082b..0264b58 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c @@ -85,10 +85,7 @@ static uint32_t json_get_msg_id(const char *json) { } static void json_get_cmd(const char *json, char *out, int out_len) { - reset_tmp(); - simple_parse_json(json, "\"cmd\"", g_tmp_value); - strncpy(out, g_tmp_value, out_len - 1); - out[out_len - 1] = '\0'; + json_get_str_field(json, "\"cmd\"", out, out_len); } static char *json_get_data_str(const char *json) {