From bd40e8ac62ee2c6c225534c4a700e44e5d3db58f Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Mon, 8 Apr 2024 21:06:27 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0bleservice=20=E7=9A=84at?= =?utf8?q?=E8=B0=83=E8=AF=95=E6=8C=87=E4=BB=A4=EF=BC=8C=E6=B5=8B=E8=AF=95?= =?utf8?q?=E5=8A=9F=E8=80=97=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../peripheral/utils/custom_utils_at_cmd.c | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c index 6422343e3..16b87408e 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c @@ -325,6 +325,39 @@ static uint32_t custom_get_tpinfo(uint8_t *para, uint32_t paraLen, char *strComm return ERRCODE_SUCC; } +#include "bleService.h" + +static uint32_t custom_bleservice_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + + uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 }; + uint32_t argc = 0; + + int ret = ConvertCmdToParam(para, paraLen, argv, &argc); + if (ret != CUSTOM_UTILS_SUCCESS) { + PRINT("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n"); + return ERRCODE_FAIL; + } + + if (argc != 1) { + PRINT("CUSTOM_UTILSTEST ATCMD Set Parameter Failed argc %d\n",argc); + return ERRCODE_FAIL; + } + + int32_t _switch = atoi((char*)argv[0]); + + if (_switch == 1) + { + openBle(); + }else{ + ble_unregist_server(); + closeBle(); + } + + return ERRCODE_SUCC; +} + static const at_cmd_table_t g_custom_utils_cmd[] = { { (char *)"AT^CUSTOM_SN", custom_utils_setsn, (char *)"123456789ABCDEF2345678" }, { (char *)"AT^CUSTOM_SN_REQ", custom_utils_getsn, (char *)" " }, @@ -358,6 +391,8 @@ static const at_cmd_table_t g_custom_utils_cmd[] = { { (char *)"AT^GSENSOR", custom_gsensor_getdata, (char *)" " }, { (char *)"AT^GETTP", custom_get_tpinfo, (char *)" " }, + { (char *)"AT^BLESERVICE", custom_bleservice_test, (char *)" " }, + }; at_cmd_table_t *get_custom_utils_cmd_table(uint32_t *cmd_count) -- 2.17.1