This commit contains the following changes to the `NcpFrameBuffer`
class:
It updates `NcpFrameBuffer` callbacks by adding `FrameAddedCallback`
and `FrameRemovedCallback` which are respectively invoked when a frame
is added/removed to/from the NCP buffer.
It also adds new concept of NCP frame tag which is a unique (within
the queued NCP frames) value associated with every successfully
queued/added frame in `NcpFrameBufffer`. The tags are passed in the
callbacks to indicate the frame that was added or removed. New
methods are added to get the tag of the frame at front/top of the
queue and the tag associated with last (successfully) added frame. The
tags are used to track when a NCP frame is removed, which enable us to
detect when the reply to a specific spinel exchange is sent (e.g.,
this is used to track the reply to `SPINEL_HOST_POWER_STATE_ONLINE`
property).
The `NcpBase`, `NcpSpi`, and `NcpUart` implementation are modified to
use the new callbacks and tag related methods.
This commit also updates the `test_ncp_buffer` unit test:
- Additional checks are added to test the new callbacks behavior
- Tests are updated to verify the tag related methods and their
functionality.
- A new fuzz test is added for NCP buffer where over many iteration, a
random number of frame with random content and random length are
added to the NCP frame buffer. It is then verified that frames with
same content are read back.
This change updates the NCP related files to use `otMessage` and
`otMessageQueue` APIs to replace the direct calls into OpenThread
internal `Message` and `MessageQueue` classes.
* Add diagnostics module in OpenThread
- provide the same diagnostics interface for both CLI and NCP usage
- implement common diagnostics features based on existing platform interface defined in 'include/platform/'
- other more platform specific diagnostics features will be processed under platform layer
- update CLI interface to support diagnostics feature
- update both Posix and CC2538 platform to support diagnostics feature
* Add diagnostics module unit test
- move platform.h from "examples/platform" to "include/platform"
- add test_diag.cpp to test diagnostics module
* Add a configuration option that would enable/disable diagnostics module
Add --enable-diag configuration option to enable/disable diagnostics module when building OpenThread.