esp-nimble-cpp
1.4.0
|
Extended advertisement data. More...
Public Member Functions | |
NimBLEExtAdvertisement (uint8_t priPhy=BLE_HCI_LE_PHY_1M, uint8_t secPhy=BLE_HCI_LE_PHY_1M) | |
Construct a BLE extended advertisement. More... | |
void | setAppearance (uint16_t appearance) |
Set the appearance. More... | |
void | setCompleteServices (const NimBLEUUID &uuid) |
Set a single service to advertise as a complete list of services. More... | |
void | setCompleteServices16 (const std::vector< NimBLEUUID > &v_uuid) |
Set the complete list of 16 bit services to advertise. More... | |
void | setCompleteServices32 (const std::vector< NimBLEUUID > &v_uuid) |
Set the complete list of 32 bit services to advertise. More... | |
void | setFlags (uint8_t flag) |
Set the advertisement flags. More... | |
void | setManufacturerData (const std::string &data) |
Set manufacturer specific data. More... | |
void | setURI (const std::string &uri) |
Set the URI to advertise. More... | |
void | setName (const std::string &name) |
Set the complete name of this device. More... | |
void | setPartialServices (const NimBLEUUID &uuid) |
Set a single service to advertise as a partial list of services. More... | |
void | setPartialServices16 (const std::vector< NimBLEUUID > &v_uuid) |
Set the partial list of services to advertise. More... | |
void | setPartialServices32 (const std::vector< NimBLEUUID > &v_uuid) |
Set the partial list of services to advertise. More... | |
void | setServiceData (const NimBLEUUID &uuid, const std::string &data) |
Set the service data (UUID + data) More... | |
void | setShortName (const std::string &name) |
Set the short name. More... | |
void | setData (const uint8_t *data, size_t length) |
Set the advertisement data. More... | |
void | addData (const std::string &data) |
Add data to the payload to be advertised. More... | |
void | addData (const uint8_t *data, size_t length) |
Add data to the payload to be advertised. More... | |
void | addTxPower () |
Adds Tx power level to the advertisement data. | |
void | setPreferredParams (uint16_t min, uint16_t max) |
Set the preferred connection interval parameters. More... | |
void | setLegacyAdvertising (bool val) |
Sets wether the advertisement should use legacy (BLE 4.0, 31 bytes max) advertising. More... | |
void | setConnectable (bool val) |
Sets wether this advertisement should advertise as a connectable device. More... | |
void | setScannable (bool val) |
Sets wether the advertisement has scan response data available. More... | |
void | setMinInterval (uint32_t mininterval) |
Set the minimum advertising interval. More... | |
void | setMaxInterval (uint32_t maxinterval) |
Set the maximum advertising interval. More... | |
void | setPrimaryPhy (uint8_t phy) |
Set the primary advertising PHY to use. More... | |
void | setSecondaryPhy (uint8_t phy) |
Set the secondary advertising PHY to use. More... | |
void | setScanFilter (bool scanRequestWhitelistOnly, bool connectWhitelistOnly) |
Set the filtering for the scan filter. More... | |
void | setDirectedPeer (const NimBLEAddress &addr) |
Sets the peer to directly advertise to. More... | |
void | setDirected (bool val, bool high_duty=true) |
Enable or disable direct advertisements to the peer set with NimBLEExtAdvertisement::setDirectedPeer More... | |
void | setAnonymous (bool val) |
Sets whether the advertisement should be anonymous. More... | |
void | setPrimaryChannels (bool ch37, bool ch38, bool ch39) |
Sets The primary channels to advertise on. More... | |
void | setTxPower (int8_t dbm) |
Sets the transmission power level for this advertisement. More... | |
void | setAddress (const NimBLEAddress &addr) |
Set the address to use for this advertisement. More... | |
void | enableScanRequestCallback (bool enable) |
Sets whether the scan response request callback should be called. More... | |
void | clearData () |
Clears the data stored in this instance, does not change settings. More... | |
size_t | getDataSize () |
Get the size of the current data. | |
Extended advertisement data.
NimBLEExtAdvertisement::NimBLEExtAdvertisement | ( | uint8_t | priPhy = BLE_HCI_LE_PHY_1M , |
uint8_t | secPhy = BLE_HCI_LE_PHY_1M |
||
) |
Construct a BLE extended advertisement.
[in] | priPhy | The primary Phy to advertise on, can be one of:
|
[in] | secPhy | The secondary Phy to advertise on, can be one of:
|
void NimBLEExtAdvertisement::addData | ( | const std::string & | data | ) |
Add data to the payload to be advertised.
[in] | data | The data to be added to the payload. |
void NimBLEExtAdvertisement::addData | ( | const uint8_t * | data, |
size_t | length | ||
) |
Add data to the payload to be advertised.
[in] | data | The data to be added to the payload. |
[in] | length | The size of data to be added to the payload. |
void NimBLEExtAdvertisement::clearData | ( | ) |
Clears the data stored in this instance, does not change settings.
This will clear all data but preserves advertising parameter settings.
void NimBLEExtAdvertisement::enableScanRequestCallback | ( | bool | enable | ) |
Sets whether the scan response request callback should be called.
[in] | enable | If true the scan response request callback will be called for this advertisement. |
void NimBLEExtAdvertisement::setAddress | ( | const NimBLEAddress & | addr | ) |
Set the address to use for this advertisement.
[in] | addr | The address to use. |
void NimBLEExtAdvertisement::setAnonymous | ( | bool | val | ) |
Sets whether the advertisement should be anonymous.
[in] | val | Set to true to enable anonymous advertising. |
Anonymous advertising omits the device's address from the advertisement.
void NimBLEExtAdvertisement::setAppearance | ( | uint16_t | appearance | ) |
Set the appearance.
[in] | appearance | The appearance code value. |
void NimBLEExtAdvertisement::setCompleteServices | ( | const NimBLEUUID & | uuid | ) |
Set a single service to advertise as a complete list of services.
[in] | uuid | The service to advertise. |
void NimBLEExtAdvertisement::setCompleteServices16 | ( | const std::vector< NimBLEUUID > & | v_uuid | ) |
Set the complete list of 16 bit services to advertise.
[in] | v_uuid | A vector of 16 bit UUID's to advertise. |
void NimBLEExtAdvertisement::setCompleteServices32 | ( | const std::vector< NimBLEUUID > & | v_uuid | ) |
Set the complete list of 32 bit services to advertise.
[in] | v_uuid | A vector of 32 bit UUID's to advertise. |
void NimBLEExtAdvertisement::setConnectable | ( | bool | val | ) |
Sets wether this advertisement should advertise as a connectable device.
[in] | val | True = connectable. |
void NimBLEExtAdvertisement::setData | ( | const uint8_t * | data, |
size_t | length | ||
) |
Set the advertisement data.
[in] | data | The data to be set as the payload. |
[in] | length | The size of data. |
This will completely replace any data that was previously set.
void NimBLEExtAdvertisement::setDirected | ( | bool | val, |
bool | high_duty = true |
||
) |
Enable or disable direct advertisements to the peer set with NimBLEExtAdvertisement::setDirectedPeer
[in] | val | true = send directed advertisements to peer. |
[in] | high_duty | true = use fast advertising rate, default - true. |
void NimBLEExtAdvertisement::setDirectedPeer | ( | const NimBLEAddress & | addr | ) |
Sets the peer to directly advertise to.
[in] | addr | The address of the peer to direct the advertisements. |
void NimBLEExtAdvertisement::setFlags | ( | uint8_t | flag | ) |
Set the advertisement flags.
[in] | flag | The flags to be set in the advertisement.
|
void NimBLEExtAdvertisement::setLegacyAdvertising | ( | bool | val | ) |
Sets wether the advertisement should use legacy (BLE 4.0, 31 bytes max) advertising.
[in] | val | true = using legacy advertising. |
void NimBLEExtAdvertisement::setManufacturerData | ( | const std::string & | data | ) |
Set manufacturer specific data.
[in] | data | The manufacturer data to advertise. |
void NimBLEExtAdvertisement::setMaxInterval | ( | uint32_t | maxinterval | ) |
Set the maximum advertising interval.
[in] | maxinterval | Maximum value for advertising interval in 0.625ms units, 0 = use default. |
void NimBLEExtAdvertisement::setMinInterval | ( | uint32_t | mininterval | ) |
Set the minimum advertising interval.
[in] | mininterval | Minimum value for advertising interval in 0.625ms units, 0 = use default. |
void NimBLEExtAdvertisement::setName | ( | const std::string & | name | ) |
Set the complete name of this device.
[in] | name | The name to advertise. |
void NimBLEExtAdvertisement::setPartialServices | ( | const NimBLEUUID & | uuid | ) |
Set a single service to advertise as a partial list of services.
[in] | uuid | The service to advertise. |
void NimBLEExtAdvertisement::setPartialServices16 | ( | const std::vector< NimBLEUUID > & | v_uuid | ) |
Set the partial list of services to advertise.
[in] | v_uuid | A vector of 16 bit UUID's to advertise. |
void NimBLEExtAdvertisement::setPartialServices32 | ( | const std::vector< NimBLEUUID > & | v_uuid | ) |
Set the partial list of services to advertise.
[in] | v_uuid | A vector of 32 bit UUID's to advertise. |
void NimBLEExtAdvertisement::setPreferredParams | ( | uint16_t | min, |
uint16_t | max | ||
) |
Set the preferred connection interval parameters.
[in] | min | The minimum interval desired. |
[in] | max | The maximum interval desired. |
void NimBLEExtAdvertisement::setPrimaryChannels | ( | bool | ch37, |
bool | ch38, | ||
bool | ch39 | ||
) |
Sets The primary channels to advertise on.
[in] | ch37 | Advertise on channel 37. |
[in] | ch38 | Advertise on channel 38. |
[in] | ch39 | Advertise on channel 39. |
This will set a bitmask using the input parameters to allow different
combinations. If all inputs are false then all 3 channels will be used.
void NimBLEExtAdvertisement::setPrimaryPhy | ( | uint8_t | phy | ) |
Set the primary advertising PHY to use.
[in] | phy | Can be one of following constants:
|
void NimBLEExtAdvertisement::setScanFilter | ( | bool | scanRequestWhitelistOnly, |
bool | connectWhitelistOnly | ||
) |
Set the filtering for the scan filter.
[in] | scanRequestWhitelistOnly | If true, only allow scan requests from those on the white list. |
[in] | connectWhitelistOnly | If true, only allow connections from those on the white list. |
void NimBLEExtAdvertisement::setScannable | ( | bool | val | ) |
Sets wether the advertisement has scan response data available.
[in] | val | true = scan response is available. |
void NimBLEExtAdvertisement::setSecondaryPhy | ( | uint8_t | phy | ) |
Set the secondary advertising PHY to use.
[in] | phy | Can be one of following constants:
|
void NimBLEExtAdvertisement::setServiceData | ( | const NimBLEUUID & | uuid, |
const std::string & | data | ||
) |
Set the service data (UUID + data)
[in] | uuid | The UUID to set with the service data. |
[in] | data | The data to be associated with the service data advertised. |
void NimBLEExtAdvertisement::setShortName | ( | const std::string & | name | ) |
Set the short name.
[in] | name | The short name of the device. |
void NimBLEExtAdvertisement::setTxPower | ( | int8_t | dbm | ) |
Sets the transmission power level for this advertisement.
[in] | dbm | the transmission power to use in dbm. |
The allowable value range depends on device hardware.
The ESP32C3 and ESP32S3 have a range of -27 to +18.
void NimBLEExtAdvertisement::setURI | ( | const std::string & | uri | ) |
Set the URI to advertise.
[in] | uri | The uri to advertise. |