|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
MCUmgr SMP transport API. More...
Data Structures | |
| struct | smp_transport_api_t |
| Function pointers of SMP transport functions, if a handler is NULL then it is not supported/implemented. More... | |
| struct | smp_transport |
| SMP transport object for sending SMP responses. More... | |
| struct | smp_transport_bridge |
| Bridged transport context. More... | |
| struct | smp_client_transport_entry |
| SMP Client transport structure. More... | |
Typedefs | |
| typedef int(* | smp_transport_out_fn) (struct net_buf *nb) |
| SMP transmit callback for transport. | |
| typedef uint16_t(* | smp_transport_get_mtu_fn) (const struct net_buf *nb) |
| SMP MTU query callback for transport. | |
| typedef int(* | smp_transport_ud_copy_fn) (struct net_buf *dst, const struct net_buf *src) |
| SMP copy user_data callback. | |
| typedef void(* | smp_transport_ud_free_fn) (void *ud) |
| SMP free user_data callback. | |
| typedef bool(* | smp_transport_query_valid_check_fn) (struct net_buf *nb, void *arg) |
| Function for checking if queued data is still valid. | |
| typedef void(* | smp_transport_ud_req_init_fn) (struct net_buf *nb, void *priv) |
| SMP init request buffer. | |
| typedef bool(* | smp_transport_bridge_connect_fn) (struct smp_transport_bridge *bridge, bool direction, uint32_t mode, bool same_transport, zcbor_state_t *input_data, zcbor_state_t *output_data) |
| SMP transport bridge connect. | |
| typedef void(* | smp_transport_bridge_disconnect_fn) (struct smp_transport_bridge *bridge, bool direction) |
| SMP transport bridge disconnect. | |
| typedef int(* | smp_transport_bridge_out_fn) (const struct smp_transport_bridge *bridge, struct net_buf *nb, bool direction) |
| SMP transport bridge output data. | |
| typedef bool(* | mgmt_client_transport_cb_t) (const struct smp_client_transport_entry *transport, void *user_data) |
| Callback for SMP client transports. | |
| typedef bool(* | smp_transport_bridge_modes_fn) (zcbor_state_t *output_data, int *rc) |
| SMP transport bridge details. | |
| typedef bool(* | smp_transport_bridge_config_details_fn) (uint32_t mode, zcbor_state_t *output_data, int *rc) |
| SMP transport bridge config details. | |
Enumerations | |
| enum | smp_transport_type { SMP_SERIAL_TRANSPORT = 0 , SMP_RAW_SERIAL_TRANSPORT , SMP_BLUETOOTH_TRANSPORT , SMP_SHELL_TRANSPORT , SMP_UDP_IPV4_TRANSPORT , SMP_UDP_IPV6_TRANSPORT , SMP_LORAWAN_TRANSPORT , SMP_SPI_TRANSPORT , SMP_USER_DEFINED_TRANSPORT = 64 } |
| SMP transport type for client registration. More... | |
Functions | |
| int | smp_transport_init (struct smp_transport *smpt) |
| Initializes a Zephyr SMP transport object. | |
| void | smp_rx_remove_invalid (struct smp_transport *zst, void *arg) |
| Used to remove queued requests for an SMP transport that are no longer valid. | |
| void | smp_rx_clear (struct smp_transport *zst) |
| Used to clear pending queued requests for an SMP transport. | |
| void | smp_client_transport_register (struct smp_client_transport_entry *entry) |
| Register a Zephyr SMP transport object for client. | |
| struct smp_transport * | smp_client_transport_get (int smpt_type) |
| Discover a registered SMP transport client object. | |
| bool | smp_client_transport_foreach (mgmt_client_transport_cb_t user_cb, void *user_data) |
| Iterate over SMP client/transports. | |
MCUmgr SMP transport API.
| typedef bool(* mgmt_client_transport_cb_t) (const struct smp_client_transport_entry *transport, void *user_data) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Callback for SMP client transports.
| transport | SMP client transport |
| user_data | user data supplied to smp_client_transport_foreach() function |
| typedef bool(* smp_transport_bridge_config_details_fn) (uint32_t mode, zcbor_state_t *output_data, int *rc) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transport bridge config details.
Used to see what configuration options a transport has to establish a connection.
| mode | mode of the transport |
| output_data | CBOR data for output |
| rc | mcumgr_err_t code to return, if error |
| typedef bool(* smp_transport_bridge_connect_fn) (struct smp_transport_bridge *bridge, bool direction, uint32_t mode, bool same_transport, zcbor_state_t *input_data, zcbor_state_t *output_data) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transport bridge connect.
Used when establishing a bridge to another transport.
| bridge | contains the bridging context |
| direction | specifies direction of transport, either TRANSPORT_MGMT_DIRECTION_INCOMING or TRANSPORT_MGMT_DIRECTION_OUTGOING |
| mode | mode of the transport |
| same_transport | true if the incoming and outgoing transports both are using this transport |
| input_data | CBOR data from input |
| output_data | CBOR data for output (to return an error) |
| typedef void(* smp_transport_bridge_disconnect_fn) (struct smp_transport_bridge *bridge, bool direction) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transport bridge disconnect.
Used when disconnecting an already established bridge with another transport.
| bridge | contains the bridging context |
| direction | specifies direction of transport, either TRANSPORT_MGMT_DIRECTION_INCOMING or TRANSPORT_MGMT_DIRECTION_OUTGOING |
| typedef bool(* smp_transport_bridge_modes_fn) (zcbor_state_t *output_data, int *rc) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transport bridge details.
Used to see number of transport modes.
| output_data | CBOR data for output |
| rc | mcumgr_err_t code to return, if error |
| typedef int(* smp_transport_bridge_out_fn) (const struct smp_transport_bridge *bridge, struct net_buf *nb, bool direction) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transport bridge output data.
Pass data for output through transport bridge.
| bridge | contains the bridging context |
| nb | data that should be output |
| direction | specifies direction of transport, either TRANSPORT_MGMT_DIRECTION_INCOMING or TRANSPORT_MGMT_DIRECTION_OUTGOING |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP MTU query callback for transport.
The supplied net_buf should contain a request received from the peer whose MTU is being queried. This function takes a net_buf parameter because some transports store connection-specific information in the net_buf user header (e.g., the Bluetooth transport stores the peer address).
| nb | Contains a request from the relevant peer. |
| typedef int(* smp_transport_out_fn) (struct net_buf *nb) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transmit callback for transport.
The supplied net_buf is always consumed, regardless of return code.
| nb | The net_buf to transmit. |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Function for checking if queued data is still valid.
This function is used to check if queued SMP data is still valid e.g. on a remote device disconnecting, this is triggered when smp_rx_remove_invalid() is called.
| nb | net buf containing queued request. |
| arg | Argument provided when calling smp_rx_remove_invalid() function. |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP copy user_data callback.
The supplied src net_buf should contain a user_data that cannot be copied using regular memcpy function (e.g., the Bluetooth transport net_buf user_data stores the connection reference that has to be incremented when is going to be used by another buffer).
| dst | Source buffer user_data pointer. |
| src | Destination buffer user_data pointer. |
| typedef void(* smp_transport_ud_free_fn) (void *ud) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP free user_data callback.
This function frees net_buf user data, because some transports store connection-specific information in the net_buf user data (e.g., the Bluetooth transport stores the connection reference that has to be decreased).
| ud | Contains a user_data pointer to be freed. |
| typedef void(* smp_transport_ud_req_init_fn) (struct net_buf *nb, void *priv) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP init request buffer.
The supplied net_buf should be for a SMP request
| nb | net buf for SMP request |
| priv | SMP transport private data |
| enum smp_transport_type |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
SMP transport type for client registration.
| bool smp_client_transport_foreach | ( | mgmt_client_transport_cb_t | user_cb, |
| void * | user_data ) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Iterate over SMP client/transports.
| user_cb | Callback function |
| user_data | User data supplied to callback function |
| struct smp_transport * smp_client_transport_get | ( | int | smpt_type | ) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Discover a registered SMP transport client object.
| smpt_type | Type of transport |
| void smp_client_transport_register | ( | struct smp_client_transport_entry * | entry | ) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Register a Zephyr SMP transport object for client.
| entry | The transport to construct. |
| void smp_rx_clear | ( | struct smp_transport * | zst | ) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Used to clear pending queued requests for an SMP transport.
| zst | The transport to use. |
| void smp_rx_remove_invalid | ( | struct smp_transport * | zst, |
| void * | arg ) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Used to remove queued requests for an SMP transport that are no longer valid.
A smp_transport_query_valid_check_fn() function must be registered for this to function. If the smp_transport_query_valid_check_fn() function returns false during a callback, the queried command will classed as invalid and dropped.
| zst | The transport to use. |
| arg | Argument provided to callback smp_transport_query_valid_check_fn() function. |
| int smp_transport_init | ( | struct smp_transport * | smpt | ) |
#include <zephyr/mgmt/mcumgr/transport/smp.h>
Initializes a Zephyr SMP transport object.
| smpt | The transport to construct. |