Skip to content

Commit

Permalink
Merge branch 'feature/add_support_pcl_vsc_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
fix(Nimble): Add VSC / VSE handling code and structure for PCL Set RSSI (v5.1)

See merge request espressif/esp-idf!24608
  • Loading branch information
rahult-github committed Jul 7, 2023
2 parents f1b9af7 + 7c6ab05 commit 68654bf
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
6 changes: 6 additions & 0 deletions components/bt/host/nimble/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -661,3 +661,9 @@ config BT_NIMBLE_BLE_GATT_BLOB_TRANSFER
help
This option is used when data to be sent is more than 512 bytes. For peripheral role,
BT_NIMBLE_MSYS_1_BLOCK_COUNT needs to be increased according to the need.

config BT_NIMBLE_VS_SUPPORT
bool "Enable support for VSC and VSE"
help
This option is used to enable support for sending Vendor Specific HCI commands and handling
Vendor Specific HCI Events.
9 changes: 8 additions & 1 deletion components/bt/host/nimble/port/include/esp_nimble_cfg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -1681,4 +1681,11 @@
#endif
#endif

#ifndef MYNEWT_VAL_BLE_HCI_VS
#define MYNEWT_VAL_BLE_HCI_VS CONFIG_BT_NIMBLE_VS_SUPPORT
#define MYNEWT_VAL_BLE_HCI_VS_OCF_OFFSET (0)
#else
#define MYNEWT_VAL_BLE_HCI_VS (0)
#endif

#endif
5 changes: 5 additions & 0 deletions components/bt/porting/nimble/include/nimble/hci_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,11 @@ struct ble_hci_vs_rd_static_addr_rp {
uint8_t addr[6];
} __attribute__((packed));


#if SOC_BLE_POWER_CONTROL_SUPPORTED && MYNEWT_VAL(BLE_HCI_VS)
#define BLE_HCI_OCF_VS_PCL_SET_RSSI (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0111))
#endif

/* Command Specific Definitions */
/* --- Set controller to host flow control (OGF 0x03, OCF 0x0031) --- */
#define BLE_HCI_CTLR_TO_HOST_FC_OFF (0)
Expand Down
18 changes: 18 additions & 0 deletions examples/bluetooth/nimble/blecent/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,24 @@ blecent_gap_event(struct ble_gap_event *event, void *arg)
blecent_power_control(event->connect.conn_handle);
#endif

#if MYNEWT_VAL(BLE_HCI_VS)
#if MYNEWT_VAL(BLE_POWER_CONTROL)
int8_t vs_cmd[10]= {0, 0,-70,-60,-68,-58,-75,-65,-80,-70};

vs_cmd[0] = ((uint8_t)(event->connect.conn_handle & 0xFF));
vs_cmd[1] = ((uint8_t)(event->connect.conn_handle >> 8) & 0xFF);

rc = ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_PCL_SET_RSSI ,
&vs_cmd, sizeof(vs_cmd), NULL, 0);
if (rc != 0) {
MODLOG_DFLT(INFO, "Failed to send VSC %x \n", rc);
return 0;
}
else
MODLOG_DFLT(INFO, "Successfully issued VSC , rc = %d \n", rc);
#endif
#endif

#if CONFIG_EXAMPLE_ENCRYPTION
/** Initiate security - It will perform
* Pairing (Exchange keys)
Expand Down

0 comments on commit 68654bf

Please sign in to comment.