Zephyr Project API 4.4.99
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
12
13#ifndef H_IMG_MGMT_CLIENT_
14#define H_IMG_MGMT_CLIENT_
15
16#include <inttypes.h>
20
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
37 bool bootable: 1;
39 bool pending: 1;
41 bool confirmed: 1;
43 bool active: 1;
45 bool permanent: 1;
46};
47
63
75
85
105
121
133void img_mgmt_client_init(struct img_mgmt_client *client, struct smp_client_object *smp_client,
134 int image_list_size, struct mcumgr_image_data *image_list);
135
148int img_mgmt_client_upload_init(struct img_mgmt_client *client, size_t image_size,
149 uint32_t image_num, const char *image_hash);
150
162int img_mgmt_client_upload(struct img_mgmt_client *client, const uint8_t *data, size_t length,
163 struct mcumgr_image_upload *res_buf);
164
176
177int img_mgmt_client_state_write(struct img_mgmt_client *client, char *hash, bool confirm,
178 struct mcumgr_image_state *res_buf);
179
190
200
202
206
207#ifdef __cplusplus
208}
209#endif
210
211#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:48
#define IMG_MGMT_DATA_SHA_LEN
Definition img_mgmt.h:31
mcumgr_err_t
MCUmgr error codes.
Definition mgmt_defines.h:96
Header file for the MCUmgr SMP client API.
__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:91
size_t image_size
Image size.
Definition img_mgmt_client.h:97
uint32_t image_num
Image slot num.
Definition img_mgmt_client.h:103
size_t offset
Image upload offset state.
Definition img_mgmt_client.h:99
char sha256[32]
Image 256-bit hash.
Definition img_mgmt_client.h:93
size_t upload_header_size
Worst case init upload message size.
Definition img_mgmt_client.h:101
bool hash_initialized
True when Hash is configured, false when not.
Definition img_mgmt_client.h:95
IMG mgmt client object.
Definition img_mgmt_client.h:109
int image_list_length
Client image list buffer size.
Definition img_mgmt_client.h:115
struct smp_client_object * smp_client
SMP client object.
Definition img_mgmt_client.h:111
int status
Command status.
Definition img_mgmt_client.h:119
struct mcumgr_image_data * image_list
Image list buffer.
Definition img_mgmt_client.h:117
struct img_gr_upload upload
Image Upload state data for client internal use.
Definition img_mgmt_client.h:113
Image list data.
Definition img_mgmt_client.h:51
struct mcumgr_image_list_flags flags
Image Flags.
Definition img_mgmt_client.h:61
uint32_t slot_num
Image slot num.
Definition img_mgmt_client.h:53
char hash[32]
Image SHA256 checksum.
Definition img_mgmt_client.h:57
char version[(sizeof("255.255.65535.4294967295"))+1]
Image Version.
Definition img_mgmt_client.h:59
uint32_t img_num
Image number.
Definition img_mgmt_client.h:55
Image list flags.
Definition img_mgmt_client.h:35
bool pending
Pending update state.
Definition img_mgmt_client.h:39
bool bootable
Bootable image.
Definition img_mgmt_client.h:37
bool confirmed
Confirmed image.
Definition img_mgmt_client.h:41
bool active
Active image.
Definition img_mgmt_client.h:43
bool permanent
Permanent image state.
Definition img_mgmt_client.h:45
MCUmgr Image list response.
Definition img_mgmt_client.h:67
enum mcumgr_err_t status
Status.
Definition img_mgmt_client.h:69
struct mcumgr_image_data * image_list
Image list pointer.
Definition img_mgmt_client.h:73
int image_list_length
Length of image_list.
Definition img_mgmt_client.h:71
MCUmgr Image upload response.
Definition img_mgmt_client.h:79
enum mcumgr_err_t status
Status.
Definition img_mgmt_client.h:81
size_t image_upload_offset
Reported image offset.
Definition img_mgmt_client.h:83
SMP client object.
Definition smp_client.h:32