Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
smp_client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef H_SMP_CLIENT_
14#define H_SMP_CLIENT_
15
16#include <zephyr/kernel.h>
17#include <zephyr/net_buf.h>
18#include <mgmt/mcumgr/transport/smp_internal.h>
21
28
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
58int smp_client_object_init(struct smp_client_object *smp_client, int smp_type);
59
66static inline void smp_client_object_set_data(struct smp_client_object *smp_client, void *data)
67{
68 smp_client->priv = data;
69}
70
76static inline void *smp_client_object_get_data(struct smp_client_object *smp_client)
77{
78 return smp_client->priv;
79}
80
90typedef int (*smp_client_res_fn)(struct net_buf *nb, void *user_data);
91
101int smp_client_single_response(struct net_buf *nb, const struct smp_hdr *res_hdr);
102
116 uint8_t command_id, uint8_t op,
117 enum smp_mcumgr_version_t version);
124
138int smp_client_send_cmd(struct smp_client_object *smp_client, struct net_buf *nb,
139 smp_client_res_fn cb, void *user_data, int timeout_in_sec);
140
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif /* H_SMP_CLIENT_ */
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_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)
Allocate buffer and initialize with SMP header.
static void * smp_client_object_get_data(struct smp_client_object *smp_client)
Get private data for SMP transport.
Definition smp_client.h:76
void smp_client_buf_free(struct net_buf *nb)
Free a SMP client buffer.
int(* smp_client_res_fn)(struct net_buf *nb, void *user_data)
Response callback for SMP send.
Definition smp_client.h:90
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.
static void smp_client_object_set_data(struct smp_client_object *smp_client, void *data)
Set private data for SMP transport.
Definition smp_client.h:66
Public kernel APIs.
SMP - Simple Management Protocol.
smp_mcumgr_version_t
SMP MCUmgr protocol version, part of the SMP header.
Definition smp.h:39
Buffer management.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Group structure.
Definition grp.h:18
Kernel FIFO structure.
Definition kernel.h:2935
A structure used to submit work.
Definition kernel.h:4601
Network buffer representation.
Definition net_buf.h:1015
uint8_t user_data[]
System metadata for this buffer.
Definition net_buf.h:1125
SMP client object.
Definition smp_client.h:32
struct smp_transport * smpt
SMP transport object.
Definition smp_client.h:38
uint8_t smp_seq
SMP SEQ.
Definition smp_client.h:40
struct k_fifo tx_fifo
FIFO for client TX queue.
Definition smp_client.h:36
void * priv
SMP transport data.
Definition smp_client.h:42
struct k_work work
Must be the first member.
Definition smp_client.h:34
SMP transport object for sending SMP responses.
Definition smp.h:131