mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-11 04:27:58 +00:00
feat(nimble): Added API to get resolve ADV data
This commit is contained in:
@@ -49,6 +49,20 @@ int ble_gap_host_check_status(void);
|
||||
int
|
||||
ble_gap_dev_authorization(uint16_t conn_handle, bool authorized);
|
||||
|
||||
/**
|
||||
* This API is called to get ADV data for a specific type.
|
||||
|
||||
*
|
||||
* @param adv_data Pointer of ADV data (unsigned 8 bit integer) which to be resolved.
|
||||
* @param adv_type Finding ADV data type.
|
||||
* @param adv_data_len Total length of Advertising data.
|
||||
* @param length Return the length of ADV data not including type.
|
||||
*
|
||||
* @return Pointer (unsigned 8 bit integer) of type specific ADV data.
|
||||
*/
|
||||
uint8_t*
|
||||
ble_resolve_adv_data(const uint8_t *adv_data, uint8_t adv_type, uint8_t adv_data_len , uint8_t * length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -728,6 +728,22 @@ ble_gap_set_prefered_le_phy(uint16_t conn_handle, uint8_t tx_phys_mask,
|
||||
&cmd, sizeof(cmd), NULL, 0);
|
||||
}
|
||||
|
||||
uint8_t* ble_resolve_adv_data(const uint8_t *adv_data, uint8_t adv_type, uint8_t adv_data_len , uint8_t * length)
|
||||
{
|
||||
int rc = 0;
|
||||
const struct ble_hs_adv_field *fields;
|
||||
const uint8_t *data;
|
||||
|
||||
rc = ble_hs_adv_find_field(adv_type, adv_data, adv_data_len, &fields); /*Fill adv field*/
|
||||
|
||||
if (rc == 0) {
|
||||
*length = fields->length -1 ; /* minus length of type*/
|
||||
data = fields->value; /* Type specific adv data*/
|
||||
return (uint8_t*)data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
/*****************************************************************************
|
||||
* $misc *
|
||||
*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user