Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cb005fc

Browse filesBrowse files
robert-alfarome-no-dev
authored andcommitted
Extend BLEDevice::setPower() to include powerType parameter. It's optional and set to ESP_BLE_PWR_TYPE_DEFAULT for compatibility. (espressif#3623)
Extend BLEDevice::setPower() to include powerType parameter. It's optional and set to ESP_BLE_PWR_TYPE_DEFAULT for compatibility.
1 parent 89351e3 commit cb005fc
Copy full SHA for cb005fc

File tree

2 files changed

+19
-4
lines changed
Filter options

2 files changed

+19
-4
lines changed

‎libraries/BLE/src/BLEDevice.cpp

Copy file name to clipboardExpand all lines: libraries/BLE/src/BLEDevice.cpp
+18-3Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,26 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr;
441441
* * ESP_PWR_LVL_P1
442442
* * ESP_PWR_LVL_P4
443443
* * ESP_PWR_LVL_P7
444+
*
445+
* The power types can be one of:
446+
* * ESP_BLE_PWR_TYPE_CONN_HDL0
447+
* * ESP_BLE_PWR_TYPE_CONN_HDL1
448+
* * ESP_BLE_PWR_TYPE_CONN_HDL2
449+
* * ESP_BLE_PWR_TYPE_CONN_HDL3
450+
* * ESP_BLE_PWR_TYPE_CONN_HDL4
451+
* * ESP_BLE_PWR_TYPE_CONN_HDL5
452+
* * ESP_BLE_PWR_TYPE_CONN_HDL6
453+
* * ESP_BLE_PWR_TYPE_CONN_HDL7
454+
* * ESP_BLE_PWR_TYPE_CONN_HDL8
455+
* * ESP_BLE_PWR_TYPE_ADV
456+
* * ESP_BLE_PWR_TYPE_SCAN
457+
* * ESP_BLE_PWR_TYPE_DEFAULT
458+
* @param [in] powerType.
444459
* @param [in] powerLevel.
445460
*/
446-
/* STATIC */ void BLEDevice::setPower(esp_power_level_t powerLevel) {
447-
log_v(">> setPower: %d", powerLevel);
448-
esp_err_t errRc = ::esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, powerLevel);
461+
/* STATIC */ void BLEDevice::setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType) {
462+
log_v(">> setPower: %d (type: %d)", powerLevel, powerType);
463+
esp_err_t errRc = ::esp_ble_tx_power_set(powerType, powerLevel);
449464
if (errRc != ESP_OK) {
450465
log_e("esp_ble_tx_power_set: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
451466
};

‎libraries/BLE/src/BLEDevice.h

Copy file name to clipboardExpand all lines: libraries/BLE/src/BLEDevice.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BLEDevice {
3737
static BLEScan* getScan(); // Get the scan object
3838
static std::string getValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID); // Get the value of a characteristic of a service on a server.
3939
static void init(std::string deviceName); // Initialize the local BLE environment.
40-
static void setPower(esp_power_level_t powerLevel); // Set our power level.
40+
static void setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT); // Set our power level.
4141
static void setValue(BLEAddress bdAddress, BLEUUID serviceUUID, BLEUUID characteristicUUID, std::string value); // Set the value of a characteristic on a service on a server.
4242
static std::string toString(); // Return a string representation of our device.
4343
static void whiteListAdd(BLEAddress address); // Add an entry to the BLE white list.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.