Anjay Lite
Loading...
Searching...
No Matches
fw_update.h
Go to the documentation of this file.
1/*
2 * Copyright 2023-2025 AVSystem <avsystem@avsystem.com>
3 * AVSystem Anjay Lite LwM2M SDK
4 * All rights reserved.
5 *
6 * Licensed under AVSystem Anjay Lite LwM2M Client SDK - Non-Commercial License.
7 * See the attached LICENSE file for details.
8 */
9
10#include <anj/init.h>
11
12#ifndef ANJ_DM_FW_UPDATE_H
13# define ANJ_DM_FW_UPDATE_H
14
15# include <stddef.h>
16# include <stdint.h>
17
18# include <anj/core.h>
19# include <anj/dm/core.h>
20
21# ifdef __cplusplus
22extern "C" {
23# endif
24
25# ifdef ANJ_WITH_DEFAULT_FOTA_OBJ
26
27# define ANJ_DM_FW_UPDATE_URI_MAX_LEN 255
28
29/*
30 * Numeric values of the Firmware Update Protocol Support resource. See LwM2M
31 * specification for details.
32 */
39
66
90
113 void *user_ptr, const void *data, size_t data_size);
114
138
163 const char *uri);
164
194typedef int anj_dm_fw_update_update_start_t(void *user_ptr);
195
219typedef const char *anj_dm_fw_update_get_name_t(void *user_ptr);
220
244typedef const char *anj_dm_fw_update_get_version_t(void *user_ptr);
245
259typedef void anj_dm_fw_update_reset_t(void *user_ptr);
260
297
298/*
299 * Representation of a FW Update Object that holds values of its resources and
300 * its internal state.
301 */
302typedef struct {
303 /* /5/0/3 State Resouce value holder */
304 int8_t state;
305 /* /5/0/5 Result Resource value holder */
306 int8_t result;
307 /* Set of user provided callback handlers */
309 /* Opaque user pointer passed back with each call of @ref user_handlers
310 * callbacks. Can be used to e.g. determine the the context or distiguish FW
311 * Update Object entities in a multiple LwM2M Clients system */
312 void *user_ptr;
313# if defined(ANJ_FOTA_WITH_PULL_METHOD)
314 /* /5/0/1 Package URI Resource value holder */
316# endif // defined (ANJ_FOTA_WITH_PULL_METHOD)
317# if defined(ANJ_FOTA_WITH_PUSH_METHOD)
319# endif // defined (ANJ_FOTA_WITH_PUSH_METHOD)
321
322/*
323 * Complex structure of a whole FW Update Object entity context that holds the
324 * object and its instance that are linked to Static Data Model as well as the
325 * object representation.
326 *
327 * User is expected to instantiate a structure of this type, initialize
328 * only the @ref repr field and not modify it directly throughout the LwM2M
329 * Client life.
330 */
336
358 void *user_ptr);
359
378 anj_t *anj,
381
404 anj_t *anj,
407
408# endif // ANJ_WITH_DEFAULT_FOTA_OBJ
409
410# ifdef __cplusplus
411}
412# endif
413
414#endif // ANJ_DM_FW_UPDATE_H
struct anj_struct anj_t
Definition defs.h:133
anj_dm_fw_update_result_t anj_dm_fw_update_package_write_t(void *user_ptr, const void *data, size_t data_size)
Definition fw_update.h:112
const char * anj_dm_fw_update_get_name_t(void *user_ptr)
Definition fw_update.h:219
void anj_dm_fw_update_reset_t(void *user_ptr)
Definition fw_update.h:259
anj_dm_fw_update_result_t
Definition fw_update.h:54
@ ANJ_DM_FW_UPDATE_RESULT_CONNECTION_LOST
Definition fw_update.h:59
@ ANJ_DM_FW_UPDATE_RESULT_OUT_OF_MEMORY
Definition fw_update.h:58
@ ANJ_DM_FW_UPDATE_RESULT_UNSUPPORTED_PROTOCOL
Definition fw_update.h:64
@ ANJ_DM_FW_UPDATE_RESULT_INTEGRITY_FAILURE
Definition fw_update.h:60
@ ANJ_DM_FW_UPDATE_RESULT_SUCCESS
Definition fw_update.h:56
@ ANJ_DM_FW_UPDATE_RESULT_INVALID_URI
Definition fw_update.h:62
@ ANJ_DM_FW_UPDATE_RESULT_NOT_ENOUGH_SPACE
Definition fw_update.h:57
@ ANJ_DM_FW_UPDATE_RESULT_UNSUPPORTED_PACKAGE_TYPE
Definition fw_update.h:61
@ ANJ_DM_FW_UPDATE_RESULT_INITIAL
Definition fw_update.h:55
@ ANJ_DM_FW_UPDATE_RESULT_FAILED
Definition fw_update.h:63
#define ANJ_DM_FW_UPDATE_URI_MAX_LEN
Definition fw_update.h:27
const char * anj_dm_fw_update_get_version_t(void *user_ptr)
Definition fw_update.h:244
anj_dm_fw_update_result_t anj_dm_fw_update_package_write_start_t(void *user_ptr)
Definition fw_update.h:89
anj_dm_fw_update_state_t
Definition fw_update.h:33
@ ANJ_DM_FW_UPDATE_STATE_DOWNLOADED
Definition fw_update.h:36
@ ANJ_DM_FW_UPDATE_STATE_UPDATING
Definition fw_update.h:37
@ ANJ_DM_FW_UPDATE_STATE_DOWNLOADING
Definition fw_update.h:35
@ ANJ_DM_FW_UPDATE_STATE_IDLE
Definition fw_update.h:34
anj_dm_fw_update_result_t anj_dm_fw_update_package_write_finish_t(void *user_ptr)
Definition fw_update.h:137
void anj_dm_fw_update_object_set_update_result(anj_t *anj, anj_dm_fw_update_entity_ctx_t *entity_ctx, anj_dm_fw_update_result_t result)
int anj_dm_fw_update_update_start_t(void *user_ptr)
Definition fw_update.h:194
int anj_dm_fw_update_object_install(anj_t *anj, anj_dm_fw_update_entity_ctx_t *entity_ctx, anj_dm_fw_update_handlers_t *handlers, void *user_ptr)
anj_dm_fw_update_result_t anj_dm_fw_update_uri_write_t(void *user_ptr, const char *uri)
Definition fw_update.h:162
int anj_dm_fw_update_object_set_download_result(anj_t *anj, anj_dm_fw_update_entity_ctx_t *entity_ctx, anj_dm_fw_update_result_t result)
Definition fw_update.h:331
anj_dm_obj_inst_t inst
Definition fw_update.h:333
anj_dm_obj_t obj
Definition fw_update.h:332
anj_dm_fw_update_repr_t repr
Definition fw_update.h:334
Definition fw_update.h:264
anj_dm_fw_update_get_name_t * get_name
Definition fw_update.h:287
anj_dm_fw_update_package_write_start_t * package_write_start_handler
Definition fw_update.h:267
anj_dm_fw_update_reset_t * reset_handler
Definition fw_update.h:295
anj_dm_fw_update_update_start_t * update_start_handler
Definition fw_update.h:283
anj_dm_fw_update_uri_write_t * uri_write_handler
Definition fw_update.h:279
anj_dm_fw_update_get_version_t * get_version
Definition fw_update.h:291
anj_dm_fw_update_package_write_finish_t * package_write_finish_handler
Definition fw_update.h:275
anj_dm_fw_update_package_write_t * package_write_handler
Definition fw_update.h:271
Definition fw_update.h:302
void * user_ptr
Definition fw_update.h:312
bool write_start_called
Definition fw_update.h:318
anj_dm_fw_update_handlers_t * user_handlers
Definition fw_update.h:308
int8_t state
Definition fw_update.h:304
int8_t result
Definition fw_update.h:306
Definition defs.h:84
Definition defs.h:114