fix(nimble): Exposed the ble_gap_wl_tx_add API to add a device in whitelist, other fixes

This commit is contained in:
Abhinav Kudnar
2024-10-10 18:52:21 +08:00
committed by Rahul Tank
parent 9b20b462e7
commit 4831c488a4
4 changed files with 61 additions and 2 deletions
+9
View File
@@ -96,6 +96,15 @@ int ble_hs_hci_util_write_sugg_def_data_len(uint16_t sugg_max_tx_octets, uint16_
*/
int ble_gap_wl_tx_rmv(const ble_addr_t *addrs);
/**
* Adds the address in controller's white list.
*
* @param addrs The entry to be added in the white list.
*
* @return 0 on success; nonzero on failure.
*/
int ble_gap_wl_tx_add(const ble_addr_t *addrs);
/**
* Clears all addresses from controller's white list.
*
+16
View File
@@ -3376,8 +3376,24 @@ int ble_gap_dtm_enh_rx_start(uint8_t rx_chan, uint8_t index, uint8_t phy);
* @return 0 on success; nonzero on failure
*/
int ble_gap_read_rem_ver_info(uint16_t conn_handle, uint8_t *version, uint16_t *manufacturer, uint16_t *subversion);
/**
* Read local resolvable address command
*
* @param peer_addr_type Peer Identity Address type
*
* @param peer_addr Peer Identity Address
*
* @param out_addr Local Resolvable Address received from controller.
*
* @return 0 on success; nonzero on failure
*/
int ble_gap_rd_local_resolv_addr(uint8_t peer_addr_type, const ble_addr_t *peer_addr,
uint8_t *out_addr);
#ifdef __cplusplus
}
#endif
+34 -2
View File
@@ -3112,7 +3112,7 @@ ble_gap_wl_busy(void)
ble_gap_master.conn.using_wl;
}
static int
int
ble_gap_wl_tx_add(const ble_addr_t *addr)
{
struct ble_hci_le_add_whte_list_cp cmd;
@@ -8295,7 +8295,15 @@ ble_gap_unpair(const ble_addr_t *peer_addr)
// Checking if the device is in ble_store
if (!rc) {
if (value.sec.irk_present) {
// Delete the IRK as it is Distributed
/* We cannot delete entry from resolving list if there is ongoing
* discovery or advertising in progress */
if (ble_gap_adv_active() ||
ble_gap_disc_active()) {
return BLE_HS_EBUSY;
}
// Delete the IRK as it is Distributed
rc = ble_hs_pvcy_remove_entry(key.sec.peer_addr.type,key.sec.peer_addr.val);
if (rc != 0) {
BLE_HS_LOG(ERROR, "Error while removing IRK , rc = %x\n",rc);
@@ -9148,6 +9156,30 @@ ble_gap_set_transmit_power_reporting_enable(uint16_t conn_handle,
return BLE_HS_ENOTSUP;
#endif
}
int
ble_gap_rd_local_resolv_addr(uint8_t peer_addr_type, const ble_addr_t *peer_addr,
uint8_t *out_addr)
{
struct ble_hci_le_rd_local_resolv_addr_cp cmd;
struct ble_hci_le_rd_local_resolv_addr_rp rsp;
uint16_t opcode;
int rc;
opcode = BLE_HCI_OP(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_RD_LOCAL_RESOLV_ADDR);
cmd.peer_addr_type = peer_addr_type;
memcpy(&cmd.peer_id_addr, peer_addr->val, sizeof(cmd.peer_id_addr));
rc = ble_hs_hci_cmd_tx(opcode, &cmd, sizeof(cmd), &rsp, sizeof(rsp));
if (rc!=0) {
return rc;
}
memcpy(out_addr, &rsp.rpa, sizeof(rsp.rpa));
return 0;
}
#if MYNEWT_VAL(BLE_HCI_VS)
#if MYNEWT_VAL(BLE_POWER_CONTROL)
+2
View File
@@ -224,11 +224,13 @@ ble_hs_id_addr(uint8_t id_addr_type, const uint8_t **out_id_addr,
switch (id_addr_type) {
case BLE_ADDR_PUBLIC:
case BLE_ADDR_PUBLIC_ID:
id_addr = ble_hs_id_pub;
nrpa = 0;
break;
case BLE_ADDR_RANDOM:
case BLE_ADDR_RANDOM_ID:
id_addr = ble_hs_id_rnd;
nrpa = (ble_hs_id_rnd[5] & 0xc0) == 0;
break;