From 846dcfff9844a7a22e2b99e6231168ce350849ec Mon Sep 17 00:00:00 2001 From: Jacques Gagnon Date: Sun, 5 Nov 2023 13:44:11 -0500 Subject: [PATCH] [BT] Add FW name get cmd to att cfg --- main/bluetooth/att_cfg.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main/bluetooth/att_cfg.c b/main/bluetooth/att_cfg.c index 921ef19f..ae789f21 100644 --- a/main/bluetooth/att_cfg.c +++ b/main/bluetooth/att_cfg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, Jacques Gagnon + * Copyright (c) 2019-2023, Jacques Gagnon * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,7 @@ #define CFG_CMD_GET_GAMEID 0x04 #define CFG_CMD_GET_CFG_SRC 0x05 #define CFG_CMD_GET_FILE 0x06 +#define CFG_CMD_GET_FW_NAME 0x07 #define CFG_CMD_SET_DEFAULT_CFG 0x10 #define CFG_CMD_SET_GAMEID_CFG 0x11 #define CFG_CMD_OPEN_DIR 0x12 @@ -290,6 +291,16 @@ static void bt_att_cfg_cmd_fw_ver_rsp(uint16_t handle) { bt_att_cmd(handle, BT_ATT_OP_READ_RSP, 23); } +static void bt_att_cfg_cmd_fw_name_rsp(uint16_t handle) { + const esp_app_desc_t *app_desc = esp_app_get_description(); + + memcpy(bt_hci_pkt_tmp.att_data, app_desc->project_name, 23); + bt_hci_pkt_tmp.att_data[23] = 0; + printf("# %s %s\n", __FUNCTION__, bt_hci_pkt_tmp.att_data); + + bt_att_cmd(handle, BT_ATT_OP_READ_RSP, 23); +} + static void bt_att_cfg_cmd_bdaddr_rsp(uint16_t handle) { bt_addr_le_t bdaddr; @@ -400,6 +411,9 @@ static void bt_att_cfg_cmd_rd_hdlr(uint16_t handle) { case CFG_CMD_GET_FILE: bt_att_cfg_cmd_file_rsp(handle); break; + case CFG_CMD_GET_FW_NAME: + bt_att_cfg_cmd_fw_name_rsp(handle); + break; default: printf("# Invalid read cfg cmd: %02X\n", cfg_cmd); bt_att_cfg_cmd_abi_ver_rsp(handle);