Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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>
14
22#ifdef __cplusplus
23extern "C" {
24#endif
25
31 bool bootable: 1;
33 bool pending: 1;
35 bool confirmed: 1;
37 bool active: 1;
39 bool permanent: 1;
40};
41
57
69
79
99
115
127void img_mgmt_client_init(struct img_mgmt_client *client, struct smp_client_object *smp_client,
128 int image_list_size, struct mcumgr_image_data *image_list);
129
142int img_mgmt_client_upload_init(struct img_mgmt_client *client, size_t image_size,
143 uint32_t image_num, const char *image_hash);
144
156int img_mgmt_client_upload(struct img_mgmt_client *client, const uint8_t *data, size_t length,
157 struct mcumgr_image_upload *res_buf);
158
171int img_mgmt_client_state_write(struct img_mgmt_client *client, char *hash, bool confirm,
172 struct mcumgr_image_state *res_buf);
173
184
196
201#ifdef __cplusplus
202}
203#endif
204
205#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:42
#define IMG_MGMT_DATA_SHA_LEN
Definition img_mgmt.h:31
mcumgr_err_t
MCUmgr error codes.
Definition mgmt_defines.h:96
flags
Definition parser.h:97
__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:85
size_t image_size
Image size.
Definition img_mgmt_client.h:91
uint32_t image_num
Image slot num.
Definition img_mgmt_client.h:97
size_t offset
Image upload offset state.
Definition img_mgmt_client.h:93
char sha256[32]
Image 256-bit hash.
Definition img_mgmt_client.h:87
size_t upload_header_size
Worst case init upload message size.
Definition img_mgmt_client.h:95
bool hash_initialized
True when Hash is configured, false when not.
Definition img_mgmt_client.h:89
IMG mgmt client object.
Definition img_mgmt_client.h:103
int image_list_length
Client image list buffer size.
Definition img_mgmt_client.h:109
struct smp_client_object * smp_client
SMP client object.
Definition img_mgmt_client.h:105
int status
Command status.
Definition img_mgmt_client.h:113
struct mcumgr_image_data * image_list
Image list buffer.
Definition img_mgmt_client.h:111
struct img_gr_upload upload
Image Upload state data for client internal use.
Definition img_mgmt_client.h:107
Image list data.
Definition img_mgmt_client.h:45
uint32_t slot_num
Image slot num.
Definition img_mgmt_client.h:47
char hash[32]
Image SHA256 checksum.
Definition img_mgmt_client.h:51
char version[(sizeof("255.255.65535.4294967295"))+1]
Image Version.
Definition img_mgmt_client.h:53
uint32_t img_num
Image number.
Definition img_mgmt_client.h:49
Image list flags.
Definition img_mgmt_client.h:29
bool pending
Pending update state.
Definition img_mgmt_client.h:33
bool bootable
Bootable image.
Definition img_mgmt_client.h:31
bool confirmed
Confirmed image.
Definition img_mgmt_client.h:35
bool active
Active image.
Definition img_mgmt_client.h:37
bool permanent
Permanent image state.
Definition img_mgmt_client.h:39
MCUmgr Image list response.
Definition img_mgmt_client.h:61
enum mcumgr_err_t status
Status.
Definition img_mgmt_client.h:63
struct mcumgr_image_data * image_list
Image list pointer.
Definition img_mgmt_client.h:67
int image_list_length
Length of image_list.
Definition img_mgmt_client.h:65
MCUmgr Image upload response.
Definition img_mgmt_client.h:73
enum mcumgr_err_t status
Status.
Definition img_mgmt_client.h:75
size_t image_upload_offset
Reported image offset.
Definition img_mgmt_client.h:77
SMP client object.
Definition smp_client.h:26