Skip to content

Commit

Permalink
[BT] Add FW name get cmd to att cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Nov 6, 2023
1 parent 290deaa commit 846dcff
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion main/bluetooth/att_cfg.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, Jacques Gagnon
* Copyright (c) 2019-2023, Jacques Gagnon
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 846dcff

Please sign in to comment.