Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

MCUmgr SMP client API. More...

Data Structures

struct  smp_client_object
 SMP client object. More...
 

Typedefs

typedef int(* smp_client_res_fn) (struct net_buf *nb, void *user_data)
 Response callback for SMP send.
 

Functions

int smp_client_object_init (struct smp_client_object *smp_client, int smp_type)
 Initialize a SMP client object.
 
int smp_client_single_response (struct net_buf *nb, const struct smp_hdr *res_hdr)
 SMP client response handler.
 
struct net_bufsmp_client_buf_allocation (struct smp_client_object *smp_client, uint16_t group, uint8_t command_id, uint8_t op, enum smp_mcumgr_version_t version)
 Allocate buffer and initialize with SMP header.
 
void smp_client_buf_free (struct net_buf *nb)
 Free a SMP client buffer.
 
int smp_client_send_cmd (struct smp_client_object *smp_client, struct net_buf *nb, smp_client_res_fn cb, void *user_data, int timeout_in_sec)
 SMP client data send request.
 

Detailed Description

MCUmgr SMP client API.

Typedef Documentation

◆ smp_client_res_fn

typedef int(* smp_client_res_fn) (struct net_buf *nb, void *user_data)

#include <include/zephyr/mgmt/mcumgr/smp/smp_client.h>

Response callback for SMP send.

Parameters
nbnet_buf for response
user_datasame user data that was provided as part of the request
Returns
0 on success.
mcumgr_err_t code on failure.

Function Documentation

◆ smp_client_buf_allocation()

struct net_buf * smp_client_buf_allocation ( struct smp_client_object smp_client,
uint16_t  group,
uint8_t  command_id,
uint8_t  op,
enum smp_mcumgr_version_t  version 
)

#include <include/zephyr/mgmt/mcumgr/smp/smp_client.h>

Allocate buffer and initialize with SMP header.

Parameters
smp_clientSMP client object
groupSMP group id
command_idSMP command id
opSMP operation type
versionSMP MCUmgr version
Returns
A newly-allocated buffer net_buf on success
NULL on failure.

◆ smp_client_buf_free()

void smp_client_buf_free ( struct net_buf nb)

#include <include/zephyr/mgmt/mcumgr/smp/smp_client.h>

Free a SMP client buffer.

Parameters
nbThe net_buf to free.

◆ smp_client_object_init()

int smp_client_object_init ( struct smp_client_object smp_client,
int  smp_type 
)

#include <include/zephyr/mgmt/mcumgr/smp/smp_client.h>

Initialize a SMP client object.

Parameters
smp_clientThe Client to construct.
smp_typeSMP transport type for discovering transport object
Returns
0 if successful
mcumgr_err_t code on failure

◆ smp_client_send_cmd()

int smp_client_send_cmd ( struct smp_client_object smp_client,
struct net_buf nb,
smp_client_res_fn  cb,
void *  user_data,
int  timeout_in_sec 
)

#include <include/zephyr/mgmt/mcumgr/smp/smp_client.h>

SMP client data send request.

Parameters
smp_clientSMP client object
nbnet_buf packet for send
cbCallback for response handler
user_datauser defined data pointer which will be returned back to response callback
timeout_in_secTimeout in seconds for send process. Client will retry transport based CONFIG_SMP_CMD_RETRY_TIME
Returns
0 on success.
mcumgr_err_t code on failure.

◆ smp_client_single_response()

int smp_client_single_response ( struct net_buf nb,
const struct smp_hdr *  res_hdr 
)

#include <include/zephyr/mgmt/mcumgr/smp/smp_client.h>

SMP client response handler.

Parameters
nbresponse net_buf
res_hdrParsed SMP header
Returns
0 on success.
mcumgr_err_t code on failure.