Skip to content

Commit

Permalink
host: Add support for LE Set Data Related Address change command
Browse files Browse the repository at this point in the history
  • Loading branch information
rahult-github committed Oct 3, 2023
1 parent 080e6d3 commit dfc33dc
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nimble/host/include/host/ble_gap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,17 @@ int ble_gap_set_path_loss_reporting_param(uint16_t conn_handle, uint8_t high_thr
uint8_t high_hysteresis, uint8_t low_threshold,
uint8_t low_hysteresis, uint16_t min_time_spent);
#endif

/**
* Set Data Related Address Changes Param
*
* @param adv_handle Advertising handle
* @param change_reason Reasons for refreshing addresses
*
* @return 0 on success; nonzero on failure.
*/
int ble_gap_set_data_related_addr_change_param(uint8_t adv_handle, uint8_t change_reason);

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions nimble/host/src/ble_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -6756,3 +6756,9 @@ ble_gap_set_transmit_power_reporting_enable(uint16_t conn_handle,
return BLE_HS_ENOTSUP;
#endif
}

int
ble_gap_set_data_related_addr_change_param(uint8_t adv_handle, uint8_t change_reason)
{
return ble_hs_hci_util_set_data_addr_change(adv_handle, change_reason);
}
1 change: 1 addition & 0 deletions nimble/host/src/ble_hs_hci_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ int ble_hs_hci_acl_tx(struct ble_hs_conn *conn, struct os_mbuf **om);
int ble_hs_hci_frag_num_mbufs(void);
int ble_hs_hci_frag_num_mbufs_free(void);

int ble_hs_hci_util_set_data_addr_change(uint8_t adv_handle, uint8_t change_reason);
#ifdef __cplusplus
}
#endif
Expand Down
14 changes: 14 additions & 0 deletions nimble/host/src/ble_hs_hci_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,17 @@ ble_hs_hci_set_chan_class(const uint8_t *chan_map)
BLE_HCI_OCF_LE_SET_HOST_CHAN_CLASS),
&cmd, sizeof(cmd), NULL, 0);
}

int
ble_hs_hci_util_set_data_addr_change(uint8_t adv_handle, uint8_t change_reason)
{
struct ble_hci_le_set_data_addr_change_cp cmd;
uint16_t opcode;

opcode = BLE_HCI_OP(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_SET_DATA_ADDR_CHANGE);

cmd.adv_handle = adv_handle;
cmd.change_reason = change_reason;

return ble_hs_hci_cmd_tx(opcode, &cmd, sizeof(cmd), NULL, 0);
}
6 changes: 6 additions & 0 deletions nimble/include/nimble/hci_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,12 @@ struct ble_hci_le_set_transmit_power_report_enable_cp {
uint8_t remote_enable;
} __attribute__((packed));

#define BLE_HCI_OCF_LE_SET_DATA_ADDR_CHANGE (0x007C)
struct ble_hci_le_set_data_addr_change_cp {
uint8_t adv_handle;
uint8_t change_reason;
} __attribute__((packed));

#define BLE_HCI_OCF_LE_SET_DEFAULT_SUBRATE (0x007D)
struct ble_hci_le_set_default_subrate_cp {
uint16_t subrate_min;
Expand Down

0 comments on commit dfc33dc

Please sign in to comment.