NimBLEDevice::get/setPower support full power range. (#229)

* Calculates the tx power level to and from dbm to `esp_power_level` types for esp32 devices.
* Add esp32 specific funtions `NimBLEDevice::setPowerLevel` and `NimBLEDevice::getPowerLevel` which take and return the related `esp_power_level* ` types.

---------

Co-authored-by: h2zero <powell.rg@gmail.com>
This commit is contained in:
thekurtovicandh2zero authored and GitHub committed 2024-12-02 15:19:44 -07:00
1 parent 15392bf581
commit 6c85cfa6c3
2 files changed
+56 -57

No files matched your search

+7 -2
View File
@@ -114,8 +114,6 @@ class NimBLEDevice {
static bool onWhiteList(const NimBLEAddress& address);
static size_t getWhiteListCount();
static NimBLEAddress getWhiteListAddress(size_t index);
static bool setPower(int8_t dbm);
static int getPower();
static bool setOwnAddrType(uint8_t type);
static bool setOwnAddr(const NimBLEAddress& addr);
static bool setOwnAddr(const uint8_t* addr);
@@ -135,6 +133,13 @@ class NimBLEDevice {
static void onReset(int reason);
static void onSync(void);
static void host_task(void* param);
static int getPower();
static bool setPower(int8_t dbm);
# if defined(ESP_PLATFORM)
static esp_power_level_t getPowerLevel(esp_ble_power_type_t powerType = ESP_BLE_PWR_TYPE_DEFAULT);
static bool setPowerLevel(esp_power_level_t powerLevel, esp_ble_power_type_t powerType = ESP_BLE_PWR_TYPE_DEFAULT);
# endif
# if CONFIG_BT_NIMBLE_EXT_ADV
static bool setDefaultPhy(uint8_t txPhyMask, uint8_t rxPhyMask);