From 4b512c5e7b74b65fd8e2b391fcb6a0f4a99ba74c Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Wed, 26 Jul 2023 19:43:02 +0530 Subject: [PATCH] fix(nimble): Add API to send pcl set rssi vsc --- components/bt/host/nimble/nimble | 2 +- examples/bluetooth/nimble/blecent/main/main.c | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index e24f65acda..3172618555 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit e24f65acdafed8334c122acf06972545a184ba2f +Subproject commit 3172618555b02dad599e9a76f56f1d6a64557f78 diff --git a/examples/bluetooth/nimble/blecent/main/main.c b/examples/bluetooth/nimble/blecent/main/main.c index ac16ece4eb..edee64bb06 100644 --- a/examples/bluetooth/nimble/blecent/main/main.c +++ b/examples/bluetooth/nimble/blecent/main/main.c @@ -632,6 +632,11 @@ blecent_gap_event(struct ble_gap_event *event, void *arg) { struct ble_gap_conn_desc desc; struct ble_hs_adv_fields fields; +#if MYNEWT_VAL(BLE_HCI_VS) +#if MYNEWT_VAL(BLE_POWER_CONTROL) + struct ble_gap_set_auto_pcl_params params; +#endif +#endif int rc; switch (event->type) { @@ -673,19 +678,16 @@ blecent_gap_event(struct ble_gap_event *event, void *arg) #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 + memset(¶ms, 0x0, sizeof(struct ble_gap_set_auto_pcl_params)); + params.conn_handle = event->connect.conn_handle; + rc = ble_gap_set_auto_pcl_param(¶ms); + 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