28#define LWM2M_OS_MAX_WORK_QS 2
33#define LWM2M_OS_MAX_TIMER_COUNT (6 + (LWM2M_OS_MAX_WORK_QS * 4))
41#define LWM2M_OS_MAX_SEM_COUNT (8 + (LWM2M_OS_MAX_WORK_QS * 1))
45#define LWM2M_OS_LTE_MODE_NONE -1
47#define LWM2M_OS_LTE_MODE_CAT_M1 6
49#define LWM2M_OS_LTE_MODE_CAT_NB1 7
54#define LWM2M_OS_STORAGE_BASE 0xCA00
55#define LWM2M_OS_STORAGE_END 0xCAFF
106#define LWM2M_OS_DOWNLOAD_EVT_FRAGMENT 0
107#define LWM2M_OS_DOWNLOAD_EVT_ERROR 1
108#define LWM2M_OS_DOWNLOAD_EVT_DONE 2
109#define LWM2M_OS_DOWNLOAD_EVT_CLOSED 3
122 struct lwm2m_os_fragment {
505#define LWM2M_OS_DFU_IMG_TYPE_NONE 0
509#define LWM2M_OS_DFU_IMG_TYPE_APPLICATION 1
513#define LWM2M_OS_DFU_IMG_TYPE_MODEM_DELTA 2
517#define LWM2M_OS_DFU_IMG_TYPE_APPLICATION_FILE 3
531#define LWM2M_OS_DFU_HEADER_MAGIC 0x424ad2dc
532#define LWM2M_OS_DFU_HEADER_MAGIC_LEN sizeof(uint32_t)
533#define LWM2M_OS_DFU_HEADER_LEN (LWM2M_OS_DFU_HEADER_MAGIC_LEN + sizeof(struct lwm2m_os_dfu_header))
static const struct event_proxy_config cfg
Definition event_proxy_def.h:28
int lwm2m_os_work_q_t
Definition lwm2m_os.h:35
int lwm2m_os_download_file_size_get(size_t *size)
Retrieve size of file being downloaded.
int lwm2m_os_download_disconnect(void)
Disconnect from the server.
int lwm2m_os_at_init(lwm2m_os_at_handler_callback_t callback)
Initialize AT command driver.
int lwm2m_os_timer_start_on_q(lwm2m_os_work_q_t *work_q, lwm2m_os_timer_t *timer, int64_t delay)
Start a timer on a specific queue.
int lwm2m_os_sem_init(lwm2m_os_sem_t **sem, unsigned int initial_count, unsigned int limit)
Initialize a semaphore.
int lwm2m_os_storage_delete(uint16_t id)
Delete a non-volatile storage entry.
void(* lwm2m_os_at_handler_callback_t)(const char *notif)
AT command error handler callback function.
Definition lwm2m_os.h:60
void(* lwm2m_os_timer_handler_t)(lwm2m_os_timer_t *timer)
Timer callback function.
Definition lwm2m_os.h:65
int lwm2m_os_sem_t
Definition lwm2m_os.h:43
bool lwm2m_os_timer_is_pending(lwm2m_os_timer_t *timer)
Check if a timer task is pending.
void lwm2m_os_sms_client_deregister(int handle)
degister as an SMS client/listener.
void lwm2m_os_lte_mode_request(int32_t prefer)
set preferred bearer in modem.
int lwm2m_os_dfu_done(bool successful, uint32_t crc32)
Finalize the current firmware upgrade and CRC-validate the image if required.
int(* lwm2m_os_download_callback_t)(const struct lwm2m_os_download_evt *event)
Download client asynchronous event handler.
Definition lwm2m_os.h:154
int lwm2m_os_storage_read(uint16_t id, void *data, size_t len)
Read an entry from non-volatile storage.
int64_t lwm2m_os_uptime_get(void)
Get uptime, in milliseconds.
bool lwm2m_os_dfu_application_update_validate(void)
Validate the application image update.
int lwm2m_os_pdn_ctx_configure(uint8_t cid, const char *apn, enum lwm2m_os_pdn_fam family)
Configure a Packet Data Protocol context.
int lwm2m_os_pdn_default_callback_set(lwm2m_os_pdn_event_handler_t cb)
Set a callback for events pertaining to the default PDP context (zero).
int lwm2m_os_uicc_bootstrap_read(uint8_t *p_buffer, int buffer_size)
Read UICC LwM2M bootstrap record.
int lwm2m_os_dfu_img_type(const void *const buf, size_t len, struct lwm2m_os_dfu_header **header)
Find the image type for the buffer of bytes received.
int lwm2m_os_pdn_ctx_create(uint8_t *cid, lwm2m_os_pdn_event_handler_t cb)
Create a Packet Data Protocol (PDP) context.
void lwm2m_os_free(void *ptr)
Free memory.
int lwm2m_os_nrf_errno(void)
Translate the error number.
void lwm2m_os_timer_get(lwm2m_os_timer_handler_t handler, lwm2m_os_timer_t **timer)
Reserve a timer task from the OS.
int lwm2m_os_sms_client_register(lwm2m_os_sms_callback_t lib_callback, void *context)
Register as an SMS client/listener.
bool lwm2m_os_uicc_bootstrap_is_enabled(void)
Check if UICC LwM2M bootstrap is enabled.
int64_t lwm2m_os_timer_remaining(lwm2m_os_timer_t *timer)
Obtain the time remaining on a timer.
void(* lwm2m_os_pdn_event_handler_t)(uint8_t cid, enum lwm2m_os_pdn_event event, int reason)
PDN event handler.
Definition lwm2m_os.h:179
uint32_t lwm2m_os_rand_get(void)
Get a random value.
int lwm2m_os_sleep(int ms)
Put a thread to a sleep.
lwm2m_os_pdn_event
PDN event.
Definition lwm2m_os.h:157
@ LWM2M_OS_PDN_EVENT_CTX_DESTROYED
Definition lwm2m_os.h:166
@ LWM2M_OS_PDN_EVENT_ACTIVATED
Definition lwm2m_os.h:159
@ LWM2M_OS_PDN_EVENT_IPV6_DOWN
Definition lwm2m_os.h:162
@ LWM2M_OS_PDN_EVENT_APN_RATE_CONTROL_ON
Definition lwm2m_os.h:164
@ LWM2M_OS_PDN_EVENT_IPV6_UP
Definition lwm2m_os.h:161
@ LWM2M_OS_PDN_EVENT_APN_RATE_CONTROL_OFF
Definition lwm2m_os.h:165
@ LWM2M_OS_PDN_EVENT_NETWORK_DETACHED
Definition lwm2m_os.h:163
@ LWM2M_OS_PDN_EVENT_DEACTIVATED
Definition lwm2m_os.h:160
@ LWM2M_OS_PDN_EVENT_CNEC_ESM
Definition lwm2m_os.h:158
int lwm2m_os_dfu_start(int img_type, size_t max_file_size, bool crc_validate)
Start a firmware upgrade.
void lwm2m_os_sem_give(lwm2m_os_sem_t *sem)
Give a semaphore.
void * lwm2m_os_malloc(size_t size)
Allocate memory.
int lwm2m_os_storage_write(uint16_t id, const void *data, size_t len)
Write an entry to non-volatile storage.
int lwm2m_os_timer_t
Definition lwm2m_os.h:36
void lwm2m_os_dfu_reset(void)
Reset the current DFU target.
int lwm2m_os_pdn_deactivate(uint8_t cid)
Deactivate a Packet Data Network (PDN) connection.
int lwm2m_os_pdn_ctx_destroy(uint8_t cid)
Destroy a Packet Data Protocol context.
lwm2m_os_work_q_t * lwm2m_os_work_q_start(int index, const char *name)
Start a workqueue.
lwm2m_os_pdn_fam
PDN family.
Definition lwm2m_os.h:130
@ LWM2M_OS_PDN_FAM_IPV4
Definition lwm2m_os.h:131
@ LWM2M_OS_PDN_FAM_NONIP
Definition lwm2m_os.h:134
@ LWM2M_OS_PDN_FAM_IPV4V6
Definition lwm2m_os.h:133
@ LWM2M_OS_PDN_FAM_IPV6
Definition lwm2m_os.h:132
void lwm2m_os_timer_cancel(lwm2m_os_timer_t *timer, bool sync)
Cancel a timer run.
int lwm2m_os_sem_take(lwm2m_os_sem_t *sem, int timeout)
Take a semaphore.
int64_t lwm2m_os_uptime_delta(int64_t *ref)
Get uptime delta, in milliseconds.
void lwm2m_os_sys_reset(void)
Reboot system.
int lwm2m_os_dfu_pause(void)
Pause the DFU process and release the resources temporarily.
int lwm2m_os_dfu_schedule_update(void)
Schedule update for uploaded image.
void lwm2m_os_timer_release(lwm2m_os_timer_t *timer)
Release a timer task.
int lwm2m_os_pdn_id_get(uint8_t cid)
Retrieve the PDN ID for a given PDP Context.
void lwm2m_os_sem_reset(lwm2m_os_sem_t *sem)
Reset a semaphore.
void(* lwm2m_os_sms_callback_t)(struct lwm2m_os_sms_data *const data, void *context)
SMS subscriber callback function.
Definition lwm2m_os.h:100
int lwm2m_os_pdn_activate(uint8_t cid, int *esm, enum lwm2m_os_pdn_fam *family)
Activate a Packet Data Network (PDN) connection.
int lwm2m_os_dfu_fragment(const char *buf, size_t len, uint32_t crc32)
Receive a firmware image fragment and validate its CRC if required.
int lwm2m_os_download_get(const char *host, const struct lwm2m_os_download_cfg *cfg, size_t from)
Establish a connection with the server and download a file.
int lwm2m_os_download_init(lwm2m_os_download_callback_t lib_callback)
Initialize the download client.
size_t lwm2m_os_lte_modes_get(int32_t *modes)
get enabled system modes from modem.
uint8_t sec_tag_count
Definition lwm2m_os.h:144
enum lwm2m_os_pdn_fam family
Definition lwm2m_os.h:148
int pdn_id
Definition lwm2m_os.h:146
const int * sec_tag_list
Definition lwm2m_os.h:142
Download client configuration options.
Definition lwm2m_os.h:140
int id
Definition lwm2m_os.h:117
int error
Definition lwm2m_os.h:120
const void * buf
Definition lwm2m_os.h:123
size_t len
Definition lwm2m_os.h:124
struct lwm2m_os_download_evt::@149::lwm2m_os_fragment fragment
Download client event.
Definition lwm2m_os.h:115
union lwm2m_os_sms_header header
Definition lwm2m_os.h:90
int payload_len
Definition lwm2m_os.h:92
char * payload
Definition lwm2m_os.h:94
SMS PDU data.
Definition lwm2m_os.h:88
char * address_str
Definition lwm2m_os.h:68
uint8_t length
Definition lwm2m_os.h:69
bool present
Definition lwm2m_os.h:73
uint16_t src_port
Definition lwm2m_os.h:75
uint16_t dest_port
Definition lwm2m_os.h:74