Git Product home page Git Product logo

Comments (8)

rgrover avatar rgrover commented on July 17, 2024

ble_error_t BLEDevice::setTxPower(int8_t txPower) resolves to sd_ble_gap_tx_power_set().


/**@brief Set the radio's transmit power.
 *
 * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
 *
 * @note -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm.
 *
 * @return @ref NRF_SUCCESS Successfully changed the transmit power.
 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
 * @return @ref NRF_ERROR_BUSY The stack is busy, process pending events and retry.
 */
SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power));

do you get an error as a return value? If not, then you'll need to take this up with Nordic. devzone.nordicsemi.com

from ble.

joseangeljimenez avatar joseangeljimenez commented on July 17, 2024

Hello Rohit,

Thanks for your help. I have now finished checking all the accepted values for setTxPower / sd_ble_gap_tx_power_set(), and verified that the underlying Nordic SoftDevice is working as expected.

For all -30, -20, -16, -12, -8, -4, 0, 4 dBm, the RSSI at the Central device follows. For instance, if the RSSI at the Central device is ~-50dBm for a TX power of 4dBm, changing the TX power setting to 0dBm is seen from the Central device as a RSSI of ~-54dBm. And so on...

As a nice to have improvement to the actual BLE API documentation, I suggest to add a the range of valid input values for setTxPower().

Best regards,
Jose Angel

from ble.

rgrover avatar rgrover commented on July 17, 2024

Hi Jose,

You commented "I suggest to add a the range of valid input values for setTxPower()."
Are you suggesting that we create a separate API which can return a set of valid TxPower values (using an iterator perhaps)?

from ble.

joseangeljimenez avatar joseangeljimenez commented on July 17, 2024

Hello Rohit,

As the library currently supports only one backend (nRF51822), you could simply add a little description to the high level documentation of the BLEDevice::setTxPower() method.

However, paving the way for new backends, a simple API like the one below will do,
std::deque<int8_t> getTxPowerPermittedValues(); // C++03

Regards,
Jose Angel


P.S.: For those landing in this page with little C++ experience...

C++ can get tricky really fast, and something apparentrly trivial as returning an array of integer values turns out to be not so trivial,
http://stackoverflow.com/questions/4264304/how-to-return-an-array-from-a-method

My rationale,

from ble.

rgrover avatar rgrover commented on July 17, 2024

how about keeping things really simple: return a static array--i.e. pointer
to a const int32_t and a unsigned count?

On Tue, Feb 24, 2015 at 6:08 PM, José Ángel Jiménez <
[email protected]> wrote:

Hello Rohit,

As the library currently supports only one backend (nRF51822), you could
simply add a little description to the high level documentation of the
BLEDevice::setTxPower() method.

However, paving the way for new backends, a simple API like the one below
will do,
std::deque getTxPowerPermittedValues(); // C++

Regards,

Jose Angel

P.S.: For those landing in this page with little C++ experience...

C++ can get tricky really fast, and something apparentrly trivial as
returning an array of integer values turns out to be not so trivial,

http://stackoverflow.com/questions/4264304/how-to-return-an-array-from-a-method

My rationale,


Reply to this email directly or view it on GitHub
#30 (comment).

from ble.

joseangeljimenez avatar joseangeljimenez commented on July 17, 2024

Absolutely yes to the C style. Simpler for this case. Sorry, I jumped straight to C++ style.

from ble.

joseangeljimenez avatar joseangeljimenez commented on July 17, 2024

The signature could be,
void getTxPowerPermittedValues(int8_t* const, size_t* const); // C style

from ble.

rgrover avatar rgrover commented on July 17, 2024

fixed in f557237

from ble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.