Developer World
Spresense SDK Library v3.2.0-ebc0364
lte_lwm2m.h File Reference

LwM2M API definitions provided by Modem. More...

#include <nuttx/config.h>
#include <stdint.h>
#include <nuttx/wireless/lte/lte.h>

Go to the source code of this file.

Classes

struct  lwm2mstub_resource_s
 
struct  lwm2mstub_instance_s
 
struct  lwm2mstub_ovcondition_s
 
struct  lwm2mstub_serverinfo_s
 

Macros

Identifiers of Resource Handling Side

Resource handling side identifier which is set on handl member in lwm2mstub_resource_s

#define LWM2MSTUB_RESOURCE_HANDLENOCARE   (0)
 The resource handling is not cared This parameter set on handl member when you don't change it by lte_setm2m_objectdefinition.
 
#define LWM2MSTUB_RESOURCE_HANDLEHOST   (1)
 The resource is handled by host side.
 
#define LWM2MSTUB_RESOURCE_HANDLEMODEMH   (2)
 The resource is not handled.
 
Max size definitions

Several max size definitions

#define LWM2MSTUB_MAX_WRITE_SIZE   (1500)
 Max size of write data.
 
#define LWM2MSTUB_MAX_TOKEN_SIZE   (8 * 2 + 1)
 Max size of observation token.
 
#define LWM2MSTUB_MAX_SERVER_NAME   (256)
 Max server name length in lwm2mstub_serverinfo_s.
 
#define LWM2MSTUB_MAX_DEVID   (256)
 Max device id length in lwm2mstub_serverinfo_s.
 
#define LWM2MSTUB_MAX_SEQKEY   (256)
 Max security key length in lwm2mstub_serverinfo_s.
 
Valid field bit map definitions

Bit position of valid_mask in lwm2mstub_ovcondition_s

#define LWM2MSTUB_CONDVALID_MINPERIOD   (1<<0)
 Bit position of min_period If this bit is set in valid_mask on lwm2mstub_ovcondition_s, min_period field has valid information.
 
#define LWM2MSTUB_CONDVALID_MAXPERIOD   (1<<1)
 Bit position of min_period If this bit is set in valid_mask on lwm2mstub_ovcondition_s, max_period field has valid information.
 
#define LWM2MSTUB_CONDVALID_GRATERTHAN   (1<<2)
 Bit position of gt_cond If this bit is set in valid_mask on lwm2mstub_ovcondition_s, gt_cond field has valid information.
 
#define LWM2MSTUB_CONDVALID_LESSTHAN   (1<<3)
 Bit position of lt_cond If this bit is set in valid_mask on lwm2mstub_ovcondition_s, lt_cond field has valid information.
 
#define LWM2MSTUB_CONDVALID_STEP   (1<<4)
 Bit position of step_val If this bit is set in valid_mask on lwm2mstub_ovcondition_s, step_val field has valid information.
 
Firmware update notifies

Event to notice when firmware update reporting by lwm2mstub_fwupstate_cb_t callback

#define LWM2MSTUB_FWUP_PEND_DL   (0)
 Downloading firmware image is pending.
 
#define LWM2MSTUB_FWUP_PEND_UPD   (1)
 Updating downloaded firmware is pending.
 
#define LWM2MSTUB_FWUP_COMP_DL   (2)
 Downloading firmware image is completed.
 
#define LWM2MSTUB_FWUP_FAIL_DL   (3)
 Failed the downloading firmware.
 
#define LWM2MSTUB_FWUP_CANCELED   (4)
 Firmware updating is canceled by server.
 
DISCARD: Registration command code

Those parameter is discarded. Those will be removed. Strong recommend to use Ltelwm2m_macro_regcmd

#define LWM2MSTUB_CMD_REGISTER   (0)
 Register to a server.
 
#define LWM2MSTUB_CMD_DEREGISTER   (1)
 De-register from a server.
 
#define LWM2MSTUB_CMD_UPDATERESIGER   (2)
 Update registration to a server.
 
Current server state

Current server status

#define LWM2MSTUB_STATE_NOTREGISTERD   (0)
 This device is not registered.
 
#define LWM2MSTUB_STATE_REGISTPENDING   (1)
 Registering is pending.
 
#define LWM2MSTUB_STATE_REGISTERD   (2)
 This device is registered.
 
#define LWM2MSTUB_STATE_REGISTERFAILED   (3)
 Registration failed.
 
#define LWM2MSTUB_STATE_UPDATEPENDING   (4)
 Registration updating.
 
#define LWM2MSTUB_STATE_DEREGISTPENDING   (5)
 De-registering.
 
#define LWM2MSTUB_STATE_BSHOLDOFF   (6)
 Bootstrap hold off.
 
#define LWM2MSTUB_STATE_BSREQUESTED   (7)
 Bootstrap is requested.
 
#define LWM2MSTUB_STATE_BSONGOING   (8)
 Bootstrap is on going.
 
#define LWM2MSTUB_STATE_BSDONE   (9)
 Bootstrap is done.
 
#define LWM2MSTUB_STATE_BSFAILED   (10)
 Bootstrap is failed.
 
Resource operation mode

Resource operation mode which is set on operation member in lwm2mstub_resource_s

#define LWM2MSTUB_RESOP_READ   (0)
 The resource is "READ" operation.
 
#define LWM2MSTUB_RESOP_WRITE   (1)
 The resource is "WRITE" operation.
 
#define LWM2MSTUB_RESOP_RW   (2)
 The resource is "READ and WRITE" operation.
 
#define LWM2MSTUB_RESOP_EXEC   (3)
 The resource is "EXECUTE" operation.
 
Resource instance type

Resource multiple/single type which is set on inst_type member in lwm2mstub_resource_s

#define LWM2MSTUB_RESINST_SINGLE   (0)
 The resource is "SINGLE" instance.
 
#define LWM2MSTUB_RESINST_MULTI   (1)
 The resource is "MULTIPLE" instance.
 
Resource data type

Resource data type which is set on data_type member in lwm2mstub_resource_s

#define LWM2MSTUB_RESDATA_NONE   (0)
 The resource data type is "NONE".
 
#define LWM2MSTUB_RESDATA_STRING   (1)
 The resource data type is "String".
 
#define LWM2MSTUB_RESDATA_INT   (2)
 The resource data type is "Integer".
 
#define LWM2MSTUB_RESDATA_UNSIGNED   (3)
 The resource data type is "Unsigned integer".
 
#define LWM2MSTUB_RESDATA_FLOAT   (4)
 The resource data type is "Float".
 
#define LWM2MSTUB_RESDATA_BOOL   (5)
 The resource data type is "Boolean".
 
#define LWM2MSTUB_RESDATA_OPAQUE   (6)
 The resource data type is "Opaque".
 
#define LWM2MSTUB_RESDATA_TIME   (7)
 The resource data type is "Time".
 
#define LWM2MSTUB_RESDATA_OBJLINK   (8)
 The resource data type is "Object Link".
 
Secure mode type

Secure mode type

#define LWM2MSTUB_SECUREMODE_PSK   (0)
 The secure mode is "PSK".
 
#define LWM2MSTUB_SECUREMODE_RPK   (1)
 The secure mode is "RSK".
 
#define LWM2MSTUB_SECUREMODE_CERT   (2)
 The secure mode is "CERT".
 
#define LWM2MSTUB_SECUREMODE_NOSEC   (3)
 The secure mode is "Non secure".
 
#define LWM2MSTUB_SECUREMODE_CERTEST   (4)
 The secure mode is "CERTEST".
 
Registration command code

Secure mode type

#define LWM2MSTUB_CONNECT_REGISTER   (0)
 Registration start command.
 
#define LWM2MSTUB_CONNECT_DEREGISTER   (1)
 De-registration start command.
 
#define LWM2MSTUB_CONNECT_REREGISTER   (2)
 Re-registration start command.
 
#define LWM2MSTUB_CONNECT_BOOTSTRAP   (3)
 Bootstrap start command.
 
Response code for server operation

Secure mode type

#define LWM2MSTUB_RESP_CHANGED   (0)
 The request is accepted and the parameter changed.
 
#define LWM2MSTUB_RESP_CONTENT   (1)
 The request is to context.
 
#define LWM2MSTUB_RESP_BADREQ   (2)
 The request is bad request.
 
#define LWM2MSTUB_RESP_UNAUTH   (3)
 The request is not authorized.
 
#define LWM2MSTUB_RESP_NOURI   (4)
 The request URI doesn't exist.
 
#define LWM2MSTUB_RESP_NOTALLOW   (5)
 The request is not allowed.
 
#define LWM2MSTUB_RESP_NOTACCEPT   (6)
 The request is not accepted.
 
#define LWM2MSTUB_RESP_UNSUPPORT   (7)
 The request is not supported.
 
#define LWM2MSTUB_RESP_INTERNALERROR   (8)
 Internal error is occurred then the request received.
 
Server operation notification

Server operation code reported by lwm2mstub_fwupstate_cb_t callback

#define LWM2MSTUB_OP_WRITE   (0)
 Client received "Write" operation.
 
#define LWM2MSTUB_OP_EXEC   (1)
 Client received "Execute" operation.
 
#define LWM2MSTUB_OP_WATTR   (4)
 Client received "Write Attributes" operation.
 
#define LWM2MSTUB_OP_DISCOVER   (5)
 Client received "Discover" operation.
 
#define LWM2MSTUB_OP_READ   (6)
 Client received "Read" operation.
 
#define LWM2MSTUB_OP_OBSERVE   (7)
 Client received "Observe" operation.
 
#define LWM2MSTUB_OP_CANCELOBS   (8)
 Client received "Cancel observation" operation.
 
#define LWM2MSTUB_OP_OFFLINE   (9)
 Client is offline now.
 
#define LWM2MSTUB_OP_ONLINE   (10)
 Client is online now.
 
#define LWM2MSTUB_OP_SENDNOTICE   (11)
 Client sent observation notification to a server.
 
#define LWM2MSTUB_OP_RCVWUP   (12)
 Client received wakeup SMS.
 
#define LWM2MSTUB_OP_RCVOBSACK   (13)
 Client received notification acknowledge.
 
#define LWM2MSTUB_OP_CLIENTON   (14)
 Client ON: LMM2M client exits Client OFF state and tries to re-connect server.
 
#define LWM2MSTUB_OP_CLIENTOFF   (15)
 Client OFF: LWM2M client has exhausted server connection retries.
 
#define LWM2MSTUB_OP_FAILNOTIFY   (16)
 Confirmable NOTIFY failed.
 
#define LWM2MSTUB_OP_BSFINISH   (20)
 Bootstrap finished and completed successfully.
 
#define LWM2MSTUB_OP_REGSUCCESS   (21)
 Registration finished and completed successfully. all server observation requests are cleaned, the host should clean host objects observation rules too.
 
#define LWM2MSTUB_OP_REGUPDATED   (22)
 Register update finished and completed successfully.
 
#define LWM2MSTUB_OP_DEREGSUCCESS   (23)
 De-register finished and completed successfully.
 
#define LWM2MSTUB_OP_NOSENDNOTICE   (24)
 Notification was not saved and not sent to server.
 

Typedefs

Callback function types

Callback function types to receive notification from server.

typedef void(* lwm2mstub_write_cb_t) (int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst, FAR char *value, int len)
 Write request call back function type. More...
 
typedef void(* lwm2mstub_read_cb_t) (int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst)
 Read request call back function type. More...
 
typedef void(* lwm2mstub_exec_cb_t) (int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst)
 Execution request call back function type. More...
 
typedef void(* lwm2mstub_ovstart_cb_t) (int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst, FAR char *token, FAR struct lwm2mstub_ovcondition_s *cond)
 Observe start request call back function type. More...
 
typedef void(* lwm2mstub_ovstop_cb_t) (int seq_no, int srv_id, FAR struct lwm2mstub_instance_s *inst, FAR char *token)
 Observation stop request call back function type. More...
 
typedef void(* lwm2mstub_operation_cb_t) (int event, int srv_id, FAR struct lwm2mstub_instance_s *inst)
 Server operation call back function type. More...
 
typedef void(* lwm2mstub_fwupstate_cb_t) (int event)
 Firmware update call back function type. More...
 

Functions

Functions before Radio ON

API functions which can effect before lte_radio_on()

Those functions can be called just after lte_power_on() until before lte_radio_on().

int lte_setm2m_endpointname (FAR char *name)
 Set endpoint name. More...
 
int lte_getm2m_endpointname (FAR char *name, int len)
 Get endpoint name. More...
 
int lte_getm2m_servernum (void)
 Get Server num. More...
 
int lte_setm2m_serverinfo (FAR struct lwm2mstub_serverinfo_s *info, int id)
 Server configuration. More...
 
int lte_getm2m_serverinfo (FAR struct lwm2mstub_serverinfo_s *info, int id)
 Get server configuration. More...
 
int lte_getm2m_enabled_objectnum (void)
 Get enabled objects number. More...
 
int lte_getm2m_enabled_objects (FAR uint16_t *objids, int objnum)
 Get object IDs of currently active objects. More...
 
int lte_enablem2m_objects (FAR uint16_t *objids, int objnum)
 Enable objects. More...
 
int lte_getm2m_objresourcenum (uint16_t objid)
 Get resource number on the object. More...
 
int lte_getm2m_objresourceinfo (uint16_t objids, int res_num, FAR struct lwm2mstub_resource_s *reses)
 Get the information of resources on the object. More...
 
int lte_setm2m_objectdefinition (uint16_t objids, int res_num, FAR struct lwm2mstub_resource_s *reses)
 Configure the resources of the object. More...
 
bool lte_getm2m_qmode (void)
 Get current Queue mode of LwM2M. More...
 
int lte_setm2m_qmode (bool en)
 Set Queue mode of LwM2M. More...
 
int lte_apply_m2msetting (void)
 Activate all configurations. More...
 
Functions after Radio ON

API functions which can effect after lte_radio_on()

Those functions can be called after lte_radio_on().

int lte_m2m_connection (int cmd)
 Control connection to server. More...
 
int lte_set_report_m2mwrite (lwm2mstub_write_cb_t cb)
 Register callback function pointer for write request. More...
 
int lte_set_report_m2mread (lwm2mstub_read_cb_t cb)
 Register callback function pointer for read request. More...
 
int lte_set_report_m2mexec (lwm2mstub_exec_cb_t cb)
 Register callback function pointer for execute request. More...
 
int lte_set_report_m2movstart (lwm2mstub_ovstart_cb_t cb)
 Register callback function pointer for observation start request. More...
 
int lte_set_report_m2movstop (lwm2mstub_ovstop_cb_t cb)
 Register callback function pointer for observation stop request. More...
 
int lte_set_report_m2moperation (lwm2mstub_operation_cb_t cb)
 Register callback function pointer for server operation. More...
 
int lte_set_report_m2mfwupdate (lwm2mstub_fwupstate_cb_t cb)
 Register callback function pointer for firmware update status. More...
 
int lte_m2m_readresponse (int seq_no, FAR struct lwm2mstub_instance_s *inst, int resp, FAR char *readvalue, int len)
 Response result of read request to the server. More...
 
int lte_m2m_writeresponse (int seq_no, FAR struct lwm2mstub_instance_s *inst, int resp)
 Response result of write request to the server. More...
 
int lte_m2m_executeresp (int seq_no, FAR struct lwm2mstub_instance_s *inst, int resp)
 Response result of execute request to the server. More...
 
int lte_m2m_observeresp (int seq_no, int resp)
 Response result of observation start/stop request to the server. More...
 

Detailed Description

LwM2M API definitions provided by Modem.