The child/router entries are generally cleared using `memset()` to avoid
explicitly setting all fields to zero. As a result, it is necessary to
explicitly clear the link quality state to properly initialize the last
RSSI reading. The user-specific constructors are also removed.
This commit adds a new template class `ot::String<size>` which
implements a fixed-length character string. This class is then used as
return value of `ToString()` methods from different classes. This
simplifies the `ToString()` implementation and its use. This commit
also adds a unit test for `String`.
This commit adds a new class `SuccessRateTracker` which can be used to
tracker success/failure rate of an operation. It uses an exponentially
moving average IIR filter to maintain the rate using a `uint16_t` as
its storage. Unit test `test_link_quality` is updated to include a new
test case ``ot::TestSuccessRateTracker()` verifying the behavior of
the new class.
This commit uses the new class to track the CCA failure rate (over all
frame transmissions) at MAC layer.
This commit introduces a new class `RssAverager` (which contains the
existing averaging logic from`LinkQualityInfo` class). It also updates
`Message` class to maintain the average RSS for a received message
(note that a message may be composed of multiple 802.15.4 fragments
data frames each received with different signal strength). The
`MeshForwarder::LogIp6Message()` is updated to log the RSS value for
received/dropped messages.
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.
* 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
This commit adds a new class `LinkQualityInfo` which stores all
relevant information about quality of a link, including average
received signal strength (RSS), link margin, and link quality value.
The RSS average is obtained using an adaptive exponential moving
average filter. A unit-test is also added for the new class.
The Neighbor class now includes an instance of LinkQualityInfo. The
RSS average is updated from 'mac.cpp' whenever a valid/verified packet
is received from the corresponding neighbor. The mesh_forwarder,
mle_router, and mle modules are modified to use the new methods from
the newly added class.
This change addresses issue #175.