nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
lwm2m_os.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  lwm2m_os_sms_deliver_address
 
struct  lwm2m_os_sms_udh_app_port
 
struct  lwm2m_os_sms_deliver_header
 
union  lwm2m_os_sms_header
 
struct  lwm2m_os_sms_data
 SMS PDU data. More...
 
struct  lwm2m_os_download_evt
 Download client event. More...
 
struct  lwm2m_os_download_cfg
 Download client configuration options. More...
 
struct  lwm2m_os_dfu_header
 

Macros

#define LWM2M_OS_MAX_WORK_QS   2
 Maximum number of work queues that the system must support.
 
#define LWM2M_OS_MAX_TIMER_COUNT   (4 + (LWM2M_OS_MAX_WORK_QS * 4))
 Maximum number of timers that the system must support.
 
#define LWM2M_OS_MAX_SEM_COUNT   (6 + (LWM2M_OS_MAX_WORK_QS * 1))
 Maximum number of semaphores that the system must support.
 
#define LWM2M_OS_LTE_MODE_NONE   -1
 
#define LWM2M_OS_LTE_MODE_CAT_M1   6
 
#define LWM2M_OS_LTE_MODE_CAT_NB1   7
 
#define LWM2M_OS_STORAGE_BASE   0xCA00
 Range of the non-volatile storage identifiers used by the library.
 
#define LWM2M_OS_STORAGE_END   0xCAFF
 
#define LWM2M_OS_DOWNLOAD_EVT_FRAGMENT   0
 
#define LWM2M_OS_DOWNLOAD_EVT_ERROR   1
 
#define LWM2M_OS_DOWNLOAD_EVT_DONE   2
 
#define LWM2M_OS_DOWNLOAD_EVT_CLOSED   3
 
#define LWM2M_OS_DFU_IMG_TYPE_NONE   0
 
#define LWM2M_OS_DFU_IMG_TYPE_APPLICATION   1
 
#define LWM2M_OS_DFU_IMG_TYPE_MODEM_DELTA   2
 
#define LWM2M_OS_DFU_IMG_TYPE_APPLICATION_FILE   3
 
#define LWM2M_OS_DFU_HEADER_MAGIC   0x424ad2dc
 
#define LWM2M_OS_DFU_HEADER_MAGIC_LEN   sizeof(uint32_t)
 
#define LWM2M_OS_DFU_HEADER_LEN   (LWM2M_OS_DFU_HEADER_MAGIC_LEN + sizeof(struct lwm2m_os_dfu_header))
 

Typedefs

typedef int lwm2m_os_work_q_t
 
typedef int lwm2m_os_timer_t
 
typedef int lwm2m_os_sem_t
 
typedef void(* lwm2m_os_at_handler_callback_t) (const char *notif)
 AT command error handler callback function.
 
typedef void(* lwm2m_os_timer_handler_t) (lwm2m_os_timer_t *timer)
 Timer callback function.
 
typedef void(* lwm2m_os_sms_callback_t) (struct lwm2m_os_sms_data *const data, void *context)
 SMS subscriber callback function.
 
typedef int(* lwm2m_os_download_callback_t) (const struct lwm2m_os_download_evt *event)
 Download client asynchronous event handler.
 
typedef void(* lwm2m_os_pdn_event_handler_t) (uint8_t cid, enum lwm2m_os_pdn_event event, int reason)
 PDN event handler.
 

Enumerations

enum  lwm2m_os_pdn_fam { LWM2M_OS_PDN_FAM_IPV4 , LWM2M_OS_PDN_FAM_IPV6 , LWM2M_OS_PDN_FAM_IPV4V6 , LWM2M_OS_PDN_FAM_NONIP }
 PDN family. More...
 
enum  lwm2m_os_pdn_event {
  LWM2M_OS_PDN_EVENT_CNEC_ESM , LWM2M_OS_PDN_EVENT_ACTIVATED , LWM2M_OS_PDN_EVENT_DEACTIVATED , LWM2M_OS_PDN_EVENT_IPV6_UP ,
  LWM2M_OS_PDN_EVENT_IPV6_DOWN , LWM2M_OS_PDN_EVENT_NETWORK_DETACHED
}
 PDN event. More...
 

Functions

int lwm2m_os_pdn_ctx_create (uint8_t *cid, lwm2m_os_pdn_event_handler_t cb)
 Create a Packet Data Protocol (PDP) context.
 
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_ctx_destroy (uint8_t cid)
 Destroy a Packet Data Protocol context.
 
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_pdn_deactivate (uint8_t cid)
 Deactivate a Packet Data Network (PDN) connection.
 
int lwm2m_os_pdn_id_get (uint8_t cid)
 Retrieve the PDN ID for a given PDP 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).
 
void * lwm2m_os_malloc (size_t size)
 Allocate memory.
 
void lwm2m_os_free (void *ptr)
 Free memory.
 
int lwm2m_os_sem_init (lwm2m_os_sem_t **sem, unsigned int initial_count, unsigned int limit)
 Initialize a semaphore.
 
int lwm2m_os_sem_take (lwm2m_os_sem_t *sem, int timeout)
 Take a semaphore.
 
void lwm2m_os_sem_give (lwm2m_os_sem_t *sem)
 Give a semaphore.
 
void lwm2m_os_sem_reset (lwm2m_os_sem_t *sem)
 Reset a semaphore.
 
int64_t lwm2m_os_uptime_get (void)
 Get uptime, in milliseconds.
 
int64_t lwm2m_os_uptime_delta (int64_t *ref)
 Get uptime delta, in milliseconds.
 
int lwm2m_os_sleep (int ms)
 Put a thread to a sleep.
 
void lwm2m_os_sys_reset (void)
 Reboot system.
 
uint32_t lwm2m_os_rand_get (void)
 Get a random value.
 
int lwm2m_os_storage_delete (uint16_t id)
 Delete a non-volatile storage entry.
 
int lwm2m_os_storage_read (uint16_t id, void *data, size_t len)
 Read an entry from non-volatile storage.
 
int lwm2m_os_storage_write (uint16_t id, const void *data, size_t len)
 Write an entry to non-volatile storage.
 
lwm2m_os_work_q_tlwm2m_os_work_q_start (int index, const char *name)
 Start a workqueue.
 
void lwm2m_os_timer_get (lwm2m_os_timer_handler_t handler, lwm2m_os_timer_t **timer)
 Reserve a timer task from the OS.
 
void lwm2m_os_timer_release (lwm2m_os_timer_t *timer)
 Release a timer task.
 
int lwm2m_os_timer_start (lwm2m_os_timer_t *timer, int64_t delay)
 Start a timer on system work queue.
 
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.
 
void lwm2m_os_timer_cancel (lwm2m_os_timer_t *timer, bool sync)
 Cancel a timer run.
 
int64_t lwm2m_os_timer_remaining (lwm2m_os_timer_t *timer)
 Obtain the time remaining on a timer.
 
bool lwm2m_os_timer_is_pending (lwm2m_os_timer_t *timer)
 Check if a timer task is pending.
 
int lwm2m_os_at_init (lwm2m_os_at_handler_callback_t callback)
 Initialize AT command driver.
 
int lwm2m_os_sms_client_register (lwm2m_os_sms_callback_t lib_callback, void *context)
 Register as an SMS client/listener.
 
void lwm2m_os_sms_client_deregister (int handle)
 degister as an SMS client/listener.
 
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_disconnect (void)
 Disconnect from the server.
 
int lwm2m_os_download_init (lwm2m_os_download_callback_t lib_callback)
 Initialize the download client.
 
int lwm2m_os_download_file_size_get (size_t *size)
 Retrieve size of file being downloaded.
 
size_t lwm2m_os_lte_modes_get (int32_t *modes)
 get enabled system modes from modem.
 
void lwm2m_os_lte_mode_request (int32_t prefer)
 set preferred bearer in modem.
 
int lwm2m_os_nrf_errno (void)
 Translate the error number.
 
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_dfu_start (int img_type, size_t max_file_size, bool crc_validate)
 Start a firmware upgrade.
 
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_dfu_done (bool successful, uint32_t crc32)
 Finalize the current firmware upgrade and CRC-validate the image if required.
 
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_dfu_reset (void)
 Reset the current DFU target.
 
bool lwm2m_os_dfu_application_update_validate (void)
 Validate the application image update.