Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/BLEAdvertising.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,20 @@ void BLEAdvertisementData::setShortName(std::string name) {
} // setShortName


/**
* @brief Set the TXPower parameter.
* @param [in] TXpower to include in the payload.
*
*/
void BLEAdvertisementData::setTXPower(uint8_t TXPower) {
char cdata[3];
cdata[0] = 2;
cdata[1] = ESP_BLE_AD_TYPE_TX_PWR; // 0x0A
cdata[2] = TXPower;
addData(std::string(cdata, 3));
} // setTXPower


/**
* @brief Retrieve the payload that is to be advertised.
* @return The payload that is to be advertised.
Expand Down
1 change: 1 addition & 0 deletions src/BLEAdvertising.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class BLEAdvertisementData {
void setPartialServices(BLEUUID uuid);
void setServiceData(BLEUUID uuid, std::string data);
void setShortName(std::string name);
void setTXPower(uint8_t TXPower);
void addData(std::string data); // Add data to the payload.
std::string getPayload(); // Retrieve the current advert payload.

Expand Down