Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added doxygen group for newtmgr API and a section on mcumgr #1616

Merged
merged 2 commits into from Jan 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/os/modules/devmgmt/newtmgr.rst
Expand Up @@ -50,3 +50,11 @@ newtmgr supports BLE and serial connections.

The newtmgr framework has a smaller code size and memory footprint than
oicmgr but does not support open connectivity.

API
----------

.. doxygengroup:: Newtmgr
:content-only:
:members:

19 changes: 19 additions & 0 deletions docs/os/modules/devmgmt/oicmgr.rst
Expand Up @@ -133,3 +133,22 @@ Yes

The ``oicmgr`` framework supports transport over BLE, serial, and IP
connections to the device.

NewtMgr Protocol Specifics
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Requests
^^^^^^^^^
1. The NMP op is indicated by the OIC op. The OIC op is always the same: put.
2. There are no URI Query CoAP options.
3. The NMP header is included in the payload as a key-value pair (key="_h"). This pair is in the root map of the request and is a sibling of the other request fields. The value of this pair is the big-endian eight-byte NMP header with a length field of 0.

Responses
^^^^^^^^^
1. As with requests, the NMP header is included in the payload as a key-value pair (key="_h").
2. There is no "r" or "w" field. The response fields are inserted into the root map as a sibling of the "_h" pair.
3. Errors encountered during processing of NMP requests are reported identically to other NMP responses (embedded NMP response).

Notes
^^^^^
Keys that start with an underscore are reserved to the OIC manager protocol (e.g., "_h"). NMP requests and responses must not name any of their fields with a leading underscore.
16 changes: 16 additions & 0 deletions docs/os/modules/mcumgr/mcumgr.rst
@@ -0,0 +1,16 @@
MCU Manager (mcumgr)
--------------------

.. toctree::
:maxdepth: 1

mcumgr, a derivative of newtmgr, is a device/image/embedded OS management library with pluggable transport and encoding components and is, by design, operating system and hardware independent. It relies on hardware porting layers from the operating system it runs on. Currently, mcumgr runs on both the Apache Mynewt and Zephyr operating systems.

So how is it different from newtmgr? There is one substantial difference between the two: newtmgr supports two wire formats - NMP (plain newtmgr protocol) and OMP (CoAP newtmgr protocol). mcumgr only supports NMP (called "SMP" in mcumgr).

NMP is a simple binary format: 8-byte header plus CBOR payload
OMP uses CoAP requests to the `/omgr` CoAP resource

A request has the same effect on the receiving device regardless of wire format, but OMP fits more cleanly in a system that is already using CoAP. Documentation on mcumgr can be found in the source code repository: `https://github.com/apache/mynewt-mcumgr`

There has been some discussion about combining all this functionality into a single library (mcumgr). Your views are welcome on dev@mynewt.apache.org.
1 change: 1 addition & 0 deletions docs/os/os_user_guide.rst
Expand Up @@ -13,6 +13,7 @@ OS User Guide
Baselibc <modules/baselibc>
Drivers <modules/drivers/driver>
Device Management with Newt Manager <modules/devmgmt/newtmgr>
Device Management with MCUmgr <modules/mcumgr/mcumgr>
Image Manager <modules/imgmgr/imgmgr>
Compile-Time Configuration <modules/sysinitconfig/sysinitconfig>
File System <modules/fs/fs>
Expand Down
9 changes: 9 additions & 0 deletions mgmt/newtmgr/transport/ble/include/nmgrble/newtmgr_ble.h
Expand Up @@ -20,6 +20,11 @@
#ifndef _NEWTMGR_BLE_H_
#define _NEWTMGR_BLE_H_

/**
* @addtogroup Newtmgr
* @{
*/

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -39,4 +44,8 @@ nmgr_ble_update_rsp_len(struct os_mbuf *req, uint16_t *len, uint8_t *flags);
}
#endif

/**
* @} Newtmgr
*/

#endif /* _NETMGR_H */
9 changes: 9 additions & 0 deletions mgmt/newtmgr/transport/ble/src/newtmgr_ble.c
Expand Up @@ -26,6 +26,11 @@
#include "newtmgr/newtmgr.h"
#include "console/console.h"

/**
* @addtogroup Newtmgr
* @{
*/

/* nmgr ble mqueue */
struct os_mqueue nmgr_ble_mq;

Expand Down Expand Up @@ -239,3 +244,7 @@ newtmgr_ble_pkg_init(void)
rc = nmgr_ble_gatt_svr_init();
SYSINIT_PANIC_ASSERT(rc == 0);
}

/**
* @} Newtmgr
*/
21 changes: 15 additions & 6 deletions mgmt/newtmgr/transport/nmgr_uart/src/nmgr_uart.c
Expand Up @@ -29,6 +29,11 @@
#include <crc/crc16.h>
#include <base64/base64.h>

/**
* @addtogroup Newtmgr
* @{
*/

#define SHELL_NLIP_PKT 0x0609
#define SHELL_NLIP_DATA 0x0414
#define SHELL_NLIP_MAX_FRAME 128
Expand All @@ -48,7 +53,7 @@ struct nmgr_uart_state {
struct os_mbuf_pkthdr *nus_rx;
};

/*
/**
* Header for frames arriving over serial.
*/
struct nmgr_ser_hdr {
Expand All @@ -64,7 +69,7 @@ nmgr_uart_mtu(struct os_mbuf *m)
return MGMT_MAX_MTU;
}

/*
/**
* Called by mgmt to queue packet out to UART.
*/
static int
Expand Down Expand Up @@ -178,7 +183,7 @@ nmgr_uart_out(struct nmgr_transport *nt, struct os_mbuf *m)
return -1;
}

/*
/**
* Called by UART driver to send out next character.
*
* Interrupts disabled when nmgr_uart_tx_char/nmgr_uart_rx_char are called.
Expand Down Expand Up @@ -215,7 +220,7 @@ nmgr_uart_tx_char(void *arg)
return ch;
}

/*
/**
* Check for full packet. If frame is not right, free the mbuf.
*/
static void
Expand Down Expand Up @@ -288,7 +293,7 @@ nmgr_uart_rx_pkt(struct nmgr_uart_state *nus, struct os_mbuf_pkthdr *rxm)
os_mbuf_free_chain(m);
}

/*
/**
* Callback from mgmt task context.
*/
static void
Expand All @@ -307,7 +312,7 @@ nmgr_uart_rx_frame(struct os_event *ev)
}
}

/*
/**
* Receive a character from UART.
*/
static int
Expand Down Expand Up @@ -385,3 +390,7 @@ nmgr_uart_pkg_init(void)

nus->nus_cb_ev.ev_cb = nmgr_uart_rx_frame;
}

/**
* @} Newtmgr
*/