fix (Nimble): Add PCL Set RSSI VSC and example code for its usage

This adds API to send a vs hci command and an event to handle vs hci events
Also added information for Set RSSI VSC for Power control.
This commit is contained in:
Rahul Tank 2023-06-12 16:55:52 +05:30
parent 7f8ecb218a
commit 6eb1a8f51f
2 changed files with 23 additions and 0 deletions

View File

@ -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)

View File

@ -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)