Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
img_mgmt_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
7#ifndef H_IMG_MGMT_CLIENT_
8#define H_IMG_MGMT_CLIENT_
9
10#include <inttypes.h>
13
21#ifdef __cplusplus
22extern "C" {
23#endif
24
30 bool bootable: 1;
32 bool pending: 1;
34 bool confirmed: 1;
36 bool active: 1;
38 bool permanent: 1;
39};
40
56
68
78
98
114
126void img_mgmt_client_init(struct img_mgmt_client *client, struct smp_client_object *smp_client,
127 int image_list_size, struct mcumgr_image_data *image_list);
128
141int img_mgmt_client_upload_init(struct img_mgmt_client *client, size_t image_size,
142 uint32_t image_num, const char *image_hash);
143
155int img_mgmt_client_upload(struct img_mgmt_client *client, const uint8_t *data, size_t length,
156 struct mcumgr_image_upload *res_buf);
157
170int img_mgmt_client_state_write(struct img_mgmt_client *client, char *hash, bool confirm,
171 struct mcumgr_image_state *res_buf);
172
183
195
200#ifdef __cplusplus
201}
202#endif
203
204#endif /* H_IMG_MGMT_CLIENT_ */
void img_mgmt_client_init(struct img_mgmt_client *client, struct smp_client_object *smp_client, int image_list_size, struct mcumgr_image_data *image_list)
Inilialize image group client.
int img_mgmt_client_erase(struct img_mgmt_client *client, uint32_t slot)
Erase selected Image Slot.
int img_mgmt_client_upload(struct img_mgmt_client *client, const uint8_t *data, size_t length, struct mcumgr_image_upload *res_buf)
Upload part of image.
int img_mgmt_client_upload_init(struct img_mgmt_client *client, size_t image_size, uint32_t image_num, const char *image_hash)
Initialize image upload.
int img_mgmt_client_state_write(struct img_mgmt_client *client, char *hash, bool confirm, struct mcumgr_image_state *res_buf)
Write image state.
int img_mgmt_client_state_read(struct img_mgmt_client *client, struct mcumgr_image_state *res_buf)
Read image state.
#define IMG_MGMT_VER_MAX_STR_LEN
Definition img_mgmt.h:39
#define IMG_MGMT_DATA_SHA_LEN
Definition img_mgmt.h:28
mcumgr_err_t
MCUmgr error codes.
Definition mgmt_defines.h:96
flags
Definition parser.h:96
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
IMG mgmt client upload structure.
Definition img_mgmt_client.h:84
size_t image_size
Image size.
Definition img_mgmt_client.h:90
uint32_t image_num
Image slot num.
Definition img_mgmt_client.h:96
size_t offset
Image upload offset state.
Definition img_mgmt_client.h:92
char sha256[32]
Image 256-bit hash.
Definition img_mgmt_client.h:86
size_t upload_header_size
Worst case init upload message size.
Definition img_mgmt_client.h:94
bool hash_initialized
True when Hash is configured, false when not.
Definition img_mgmt_client.h:88
IMG mgmt client object.
Definition img_mgmt_client.h:102
int image_list_length
Client image list buffer size.
Definition img_mgmt_client.h:108
struct smp_client_object * smp_client
SMP client object.
Definition img_mgmt_client.h:104
int status
Command status.
Definition img_mgmt_client.h:112
struct mcumgr_image_data * image_list
Image list buffer.
Definition img_mgmt_client.h:110
struct img_gr_upload upload
Image Upload state data for client internal use.
Definition img_mgmt_client.h:106
Image list data.
Definition img_mgmt_client.h:44
uint32_t slot_num
Image slot num.
Definition img_mgmt_client.h:46
char hash[32]
Image SHA256 checksum.
Definition img_mgmt_client.h:50
char version[(sizeof("255.255.65535.4294967295"))+1]
Image Version.
Definition img_mgmt_client.h:52
uint32_t img_num
Image number.
Definition img_mgmt_client.h:48
Image list flags.
Definition img_mgmt_client.h:28
bool pending
Pending update state.
Definition img_mgmt_client.h:32
bool bootable
Bootable image.
Definition img_mgmt_client.h:30
bool confirmed
Confirmed image.
Definition img_mgmt_client.h:34
bool active
Active image.
Definition img_mgmt_client.h:36
bool permanent
Permanent image state.
Definition img_mgmt_client.h:38
MCUmgr Image list response.
Definition img_mgmt_client.h:60
enum mcumgr_err_t status
Status.
Definition img_mgmt_client.h:62
struct mcumgr_image_data * image_list
Image list pointer.
Definition img_mgmt_client.h:66
int image_list_length
Length of image_list.
Definition img_mgmt_client.h:64
MCUmgr Image upload response.
Definition img_mgmt_client.h:72
enum mcumgr_err_t status
Status.
Definition img_mgmt_client.h:74
size_t image_upload_offset
Reported image offset.
Definition img_mgmt_client.h:76
SMP client object.
Definition smp_client.h:26