Comments (8)
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.
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.
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.
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,
- Under C++11 I would definitevely go with std::array.
- Under C++03 and most MCU programming circumstances, std::deque is far more predictable and efficient than std::vector in terms of heap usage, specially for low count of elements,
http://www.cplusplus.com/reference/deque/deque/
http://stackoverflow.com/questions/1436020/c-stl-containers-whats-the-difference-between-deque-and-list
http://baptiste-wicht.com/posts/2012/12/cpp-benchmark-vector-list-deque.html
from ble.
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,
- Under C++11 I would definitevely go with std::array.
- Under C++03 and most MCU programming circumstances, std::deque is
far more predictable and efficient than std::vector in terms of heap usage,
specially for low count of elements,
http://www.cplusplus.com/reference/deque/deque/
http://stackoverflow.com/questions/1436020/c-stl-containers-whats-the-difference-between-deque-and-list
http://baptiste-wicht.com/posts/2012/12/cpp-benchmark-vector-list-deque.html—
Reply to this email directly or view it on GitHub
#30 (comment).
from ble.
Absolutely yes to the C style. Simpler for this case. Sorry, I jumped straight to C++ style.
from ble.
The signature could be,
void getTxPowerPermittedValues(int8_t* const, size_t* const); // C style
from ble.
fixed in f557237
from ble.
Related Issues (20)
- AdvertisementCallbackParams_t should include addressType for the peerAddr HOT 3
- GapState_t missing information? HOT 2
- GapAdvertisingData using deprecated type aliases HOT 1
- Time unit inconsistencies in GapScanningParams HOT 1
- Duplicated functionality in GapAdvertisingParams and GapScanningParams HOT 1
- BLE.h conflict with Nordic SDK ble.h HOT 5
- Using ANCS HOT 3
- Add error handling to GattClient procedures HOT 3
- Will we support BLE profiles? HOT 2
- "connection parameters update request" CALLBACK IS MISSING FROM MBED STACK HOT 12
- Possible Ticker BLE_API conflict causing problems with Nordic devices? HOT 7
- Link to documentation from README is broken
- NRF_52 Development Kit notification events don't fire on the central, when peripheral data changes HOT 24
- Linker error when using the Nordics Experimental Flash Data Storage API's. HOT 1
- NRF5: Byte order of characteristics with multi-byte data types incorrect HOT 4
- please implement missing key features HOT 1
- X-Nucleo-IDB05A1 Not Working HOT 4
- Can I control the channel the device is advertising on with this API?
- How to call BLE APIs from the board to host side using icetea?
- #include "mbed.h" where is it??? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ble.