Thread (and OpenThread) does not employ any form of transmit power control.
As a result, while OpenThread provides APIs to control transmit power, it
simply buffers and passes the transmit power value straight through to the
radio.
Currently, the transmit power APIs allow specifying an int8_t in units of
dBm. This is overly constraining for platforms that have more advanced ways
of configuring the transmit power.
This commit removes the transmit power configuration from the core. This
provides better flexibility in platform-specific ways to configure transmit
power.
This commit makes the following changes: It defines the public
`otInstance` as an empty opaque structure which is used by all public
C OpenThread APIs. It defines a new class `ot::Instance` (inheriting
from `otInstance) which is then used in core source files. The
functionality related to the instance is also moved/added into the
newly added `Instance` class (as class/static or member methods).
This commit changes the `InstanceLocator` class to keep track of a
reference to `otInstance` (instead of a pointer) to make it behave
similar to other `ObjectLocator` classes. The method `GetInstance()`
in all locator objects is updated to provide a reference (instead
of a pointer) to `otInstance`.
The logging macros are updated such that a reference to `otInstance`
is passed as the first argument (with the exception of
`otLog<Level>Plat()` macros which are used by platform code in C
domain). The documentation for log macros are also updated.
* [timer] multiple microseconds timer support
* Remove TimerSchedulerLocator, Timer inherit from Ip6Locator instead to get TimerScheduler.
* Add separate UsecTimer and UsecTimerScheduler for multiple microseconds timer support.
* [timer] refine Timer names
* Rename alarm header files to alarm-milli.h and alarm-micro.h
* Rename alarm APIs to start with otPlatAlarmMilli and otPlatAlarmMicro
* Rename Timer classes to TimerMilli/TimerMilliScheduler and TimerMicro/TimerMicroScheduler
* [Timer] Refactor Timer code structure
* Create TimerBase and TimerSchedulerBase class for common functions;
* Use TimerMilli/TimerMicro and TimerMilliScheduler/TimerMicroScheduler for different functions;
* Define AlarmApi, so then TimerMilliScheduler/TimerMicroScheduler could use different AlarmApi.
This commit new configuration option `enable-multiple-instances` and
its corresponding option `OPENTHREAD_ENABLE_MULTIPLE_INSTANCES`. When
enabled OpenThread supports handling of multiple instances. By default
this is disabled.
This commit also adds two optimizations for single instance case to
simplify the code and also help reduce memory/RAM usage:
(1) OpenThread objects/classes typically keep a reference to a higher
level object (e.g., many classes keep track of owning `ThreadNetif`)
to be able to access other objects/methods within OpenThread class
hierarchy. In single instance mode, the reference member variables are
removed and instead global functions are used to access the singleton
objects from one class to the other. To implement this, a group of
`<Object>Locator` classes are defined (e.g., `ThreadNetifLocator`,
etc.) which are then used as base class of other OpenThread classes.
(2) OpenThread objects which provide a callback/handler (e.g.,
`Timer`, `Tasklet`, etc.) have `void *mContext` member variable which
is used to keep track of the owner of the object. In single instance
mode the `mConext` member variables are removed since the owner is
expected to be a singleton and can be uniquely determined from the
callback function.
To implement this, two changes are made: First the handler methods are
modified to provide a reference to the object (e.g., `Timer` handler
will provide a `Timer &aTimer` as a parameter of its handler
callback). Second, a new base class `Context` is introduced which
hides the implementation providing an arbitrary context information. A
new static method `GetOwner(aContext)` is added to classes which own a
callback providing objects. This method help convert a `Context` to
the reference of the owner class object.
* Diag module should continue to send next packet even if the last transmission failed
* Remove unnecessary aFramePending parameter from diag transmit done callback
* Add otPlatRadioGetReceiveSensitivity() API
* Add a new otPlatRadioGetReceiveSensitivity() API to get sensitivity value;
* Use the receive sensitivity value as the noise floor for link metric computation;
* Remove some unused noise floor related functions.
* Add SPINEL_PROP_PHY_RX_SENSITIVITY Spinel/NCP property
* change user mode openthread to enable dynamic memory allocation in mbedtls
* complete merge by adding OPENTHREAD_MULTIPLE_INSTANCE to last file
* remove some extraneous changes that got pulled in accidentally
* fix spacing
* fix crash in existing tests due to this change
* fix x86 build
* Fix scanning behavior with default channel. Change logic around otPlatRadioGetTransmitBuffer so that the buffer becomes the property of OT post call. The MAC will keep a pointer to the tx buffer and pass it into otPlatRadioTransmit. This change should make the notion of retrying the transmit operation with the same buffer more intuitive.