nmxact: Create a listener for each OMP response

Prior to this change, nmxact created a single CoAP listener to handle
all incoming OMP responses.  This listener would parse the embedded NMP
message, then dispatch to the appropriate NMP listener based on the NMP
sequence number.

There is a problem with this approach.  If the server rejects an
outgoing OMP request with a CoAP error (e.g., the omp resource
requires a more secure connection), then the error does not get passed
up to the caller.  The error response does not contain an embedded NMP
response, so there is no way to match it with the appropriate listener.
The result is that nmxact drops the CoAP error, and the OMP operation
eventually times out.

This commit makes the following changes:
    * Every outgoing OMP request contains a single-byte token consisting
      of the NMP sequence number.
    * A new CoAP listener and NMP listener are created for each expected
      OMP response.
    * Both NMP errors and CoAP errors are communicated to the caller.

With this change, when an OMP elicits a CoAP error, newtmgr displays the
error and terminates.
2 files changed
tree: 30aaf8ec21f437fc2ca232ab30b252d6db4a1602
  1. docs/
  2. newtmgr/
  3. nmxact/
  4. .gitignore
  5. .rat-excludes
  6. go.mod
  7. go.sum
  8. LICENSE
  9. Makefile
  10. NOTICE
  11. README.md
  12. RELEASE_NOTES.md
README.md

Newtmgr

Newt Manager (newtmgr) is the application tool that enables a user to communicate with and manage remote devices running the Mynewt OS. It uses a connection profile to establish a connection with a device and sends command requests to the device. The newtmgr tool documentation can be found under /docs which are published at http://mynewt.apache.org/latest/os/modules/devmgmt/newtmgr.html

Building

Build the newtmgr tool as follows:

  1. Unpack newtmgr source.
  2. Rename resulting apache-mynewt-newtmgr-1.3.0 directory to $GOPATH/src/mynewt.apache.org/newtmgr
  3. cd $GOPATH/src/mynewt.apache.org/newtmgr/newtmgr
  4. go build