* Store active dataset and pending dataset in non-volatile memory.
* Retrieve active dataset and pending dataset from non-volatile memory after each reboot.
* Leader will generate the active dataset if it is not initialized.
* Clear pending dataset after it replaces active dataset.
* Create different pseudo flash files for posix nodes.
This change is attempting to address two issues:
1. Returning `kThreadError_Busy`, when `kThreadError_Already`,
`kThreadError_InvalidState`, or even the lazy
`kThreadError_Failed` would be more-appropriate/less-misleading.
2. Setters returning an error when the value to be changed is already
set to the requested value.
Number one hurts debuggability. Number two makes the code more fragile.
The cases where both intersect can be maddening.
This change replaces cases inappropriately returning
`kThreadError_Busy` with a better, more specific error code. It also
makes some "setter" functions (Including `otInterfaceUp()` and
`otThreadStart()`) return success if the value is already set.
- Call otPlatRadioReceive() on SetChannel().
- Only call NextOperation() in the idle state.
- Call otPlatRadioReceive() with the proper channel in HandleBeginTransmit().
- Remove unnecessary mBeginTransmit tasklet.
These changes address various issues found in the POSIX platform UART
driver which lead to the process not terminating properly when the
parent dies or closes `stdin`/`stdout`. Some of the errors could even
lead to unexpected program termination.
Among the various errors corrected are:
* Using `assert()` to terminate under normal operating conditions.
* `posixUartProcess()` only checked `s_in_fd` for readability and
did not check `s_out_fd` for writability. It also caused data
corruption if `write()` ever returned less than all of the bytes
sent.
* `ISIG` was being set on the termios flags. This can cause problems
when the serial API is used for binary data (Like when used with
the NCP app). (This requires the CLI be explicitly able to be able
to handle CTRL-C when built for POSIX)
* Socket errors weren't being tracked on `select()`.
* The platform main loop would (possibly) terminate if `select()`
failed with `EINTR`, which makes it difficult to attach to the
process with a debugger.
This commit changes the `NcpSpi` class implementation such that SPI
tx frame preparation always happens from the same task `mPrepareTxFrameTask`
This ensures that the callbacks to base class `Ncp` are also invoked from the
the same task (and not from the the task calling `OutboundFrameEnd()`).
* 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.
This commit changes the posix logging implementation to write the
entire log line in a single `fprintf()` command. This change helps
keep the open thread logs separate from other wpantund logs (syslog)
in simulator (posix) run.
This commit modifies the `NcpBase` and `NcpUart` classes to use new
Ncp buffer model (defined `in NcpFrameBuffer` class).
Here are the main changes in this commit:
- It changes the 'NcpUart` to adopt the `NcpFrameBuffer` for storing the
outbound frames. This allows multiple frames to be queued for tx.
- `NcpUart` is changed so that the outgoing frames are encoded and
sent over to Uart in smaller chunks. This helps reduce the required
buffer size for storing the encoded outbound uart data.
- The spinel command handler methods in `NcpBase` are modified to return
ThreadError status to indicate success or failure (e.g., when there is no
buffer space for a response frame).
- If the response to a spinel command cannot be sent (no buffer space) the
`NcpBase` remembers the set of TIDs (transaction ids) of such commands
so to reply later with error status `SPINEL_STATUS_NOMEM` when buffer
space becomes available. This ensures that spinel commands will get
a response even in case of full buffer.
- The `NcpSpi` class is modified to address the changes from `NcpBase` but
this commit does not change the buffer model for the `NcpSpi`. It adds
`spi-stubs.c` to enable building the ncp app with spi feature under
posix platform.
This change includes the addition of two new platform API functions:
* `otPlatReset()`
* `otPlatGetResetReason()`
They are pretty straightforward. Every platform must implement both, but
`otPlatReset()` is allowed to simply return if the platform doesn't support
being reset (like the posix platform).
This commit addresses issue #283.