diff options
Diffstat (limited to 'net/nimble/host/include/host/ble_hs_adv.h')
-rw-r--r-- | net/nimble/host/include/host/ble_hs_adv.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/nimble/host/include/host/ble_hs_adv.h b/net/nimble/host/include/host/ble_hs_adv.h index 0377d1d9..8ae2b00b 100644 --- a/net/nimble/host/include/host/ble_hs_adv.h +++ b/net/nimble/host/include/host/ble_hs_adv.h @@ -22,18 +22,21 @@ #include <inttypes.h> +/** Max field payload size (account for 2-byte header). */ +#define BLE_HS_ADV_MAX_FIELD_SZ (BLE_HCI_MAX_ADV_DATA_LEN - 2) + struct ble_hs_adv_fields { /*** 0x01 - Flags. */ uint8_t flags; unsigned flags_is_present:1; /*** 0x02,0x03 - 16-bit service class UUIDs. */ - void *uuids16; + uint16_t *uuids16; uint8_t num_uuids16; unsigned uuids16_is_complete:1; /*** 0x04,0x05 - 32-bit service class UUIDs. */ - void *uuids32; + uint32_t *uuids32; uint8_t num_uuids32; unsigned uuids32_is_complete:1; @@ -48,7 +51,7 @@ struct ble_hs_adv_fields { unsigned name_is_complete:1; /*** 0x0a - Tx power level. */ - uint8_t tx_pwr_lvl; + int8_t tx_pwr_lvl; unsigned tx_pwr_lvl_is_present:1; /*** 0x0d - Class of device. */ @@ -141,6 +144,12 @@ struct ble_hs_adv_fields { #define BLE_HS_ADV_TX_PWR_LVL_LEN 1 +/** + * Set the tx_pwr_lvl field to this if you want the stack to fill in the tx + * power level field. + */ +#define BLE_HS_ADV_TX_PWR_LVL_AUTO (-128) + #define BLE_HS_ADV_DEVICE_CLASS_LEN 3 #define BLE_HS_ADV_SLAVE_ITVL_RANGE_LEN 4 @@ -165,10 +174,4 @@ struct ble_hs_adv_fields { #define BLE_HS_ADV_SVC_DATA_UUID128_MIN_LEN 16 -int ble_hs_adv_set_flat(uint8_t type, int data_len, void *data, - uint8_t *dst, uint8_t *dst_len, uint8_t max_len); -int ble_hs_adv_set_fields(struct ble_hs_adv_fields *adv_fields, - uint8_t *dst, uint8_t *dst_len, uint8_t max_len); -int ble_hs_adv_parse_fields(struct ble_hs_adv_fields *adv_fields, uint8_t *src, - uint8_t src_len); #endif |