m2mb API docs  25.30.003
m2mb API sets documentation
m2mb_lwm2m.h File Reference

Header file for m2mb_lwm2m APIs. More...

Go to the source code of this file.

Data Structures

struct  M2MB_LWM2M_ENABLE_REQ_T
 
struct  M2MB_LWM2M_ACK_REQ_T
 
struct  M2MB_LWM2M_OBJ_URI_T
 
struct  M2MB_LWM2M_OBJ_LINK_T
 
struct  M2MB_LWM2M_STS_URI_T
 
struct  M2MB_LWM2M_KEYS_T
 
struct  M2MB_LWM2M_RES_T
 
struct  M2MB_LWM2M_ENABLE_RES_T
 
struct  M2MB_LWM2M_DISABLE_RES_T
 
struct  M2MB_LWM2M_ACK_RES_T
 
struct  M2MB_LWM2M_READ_RES_T
 
struct  M2MB_LWM2M_WRITE_RES_T
 
struct  M2MB_LWM2M_EXEC_RES_T
 
struct  M2MB_LWM2M_SET_RES_T
 
struct  M2MB_LWM2M_GET_RES_T
 
struct  M2MB_LWM2M_GET_STAT_RES_T
 
struct  M2MB_LWM2M_STS_RES_T
 
struct  M2MB_LWM2M_GET_TYPE_RES_T
 
struct  M2MB_LWM2M_CONN_REQ_IND_T
 
struct  M2MB_LWM2M_SESSION_END_IND_T
 
struct  M2MB_LWM2M_INFO_IND_T
 
struct  M2MB_LWM2M_SRV_INFO_IND_T
 
struct  M2MB_LWM2M_MON_REQ_T
 
struct  M2MB_LWM2M_MON_RES_T
 
struct  M2MB_LWM2M_MON_INFO_IND_T
 
struct  M2MB_LWM2M_NEW_INST_REQ_T
 
struct  M2MB_LWM2M_NEW_INST_RES_T
 
struct  M2MB_LWM2M_NFYACK_STATUS_RES_T
 
struct  M2MB_LWM2M_NFYACK_URI_RES_T
 
struct  M2MB_LWM2M_NFYACK_LIST_RES_T
 
struct  M2MB_LWM2M_NFYACK_INFO_IND_T
 
struct  M2MB_LWM2M_CIPHER_CFG_REQ_T
 the m2mb_lwm2m_cipher_cfg request data structure More...
 
struct  M2MB_LWM2M_FOTA_CFG_REQ_T
 the m2mb_lwm2m_fota_cfg request data structure More...
 
struct  M2MB_LWM2M_CIPHER_CFG_RES_T
 the m2mb_lwm2m_cipher_cfg response data structure More...
 
struct  M2MB_LWM2M_FOTA_CFG_RES_T
 the m2mb_lwm2m_fota_cfg response data structure More...
 
struct  M2MB_LWM2M_CIPHER_CFG_ITEM_T
 
struct  M2MB_LWM2M_FOTA_CFG_ITEM_T
 
struct  M2MB_LWM2M_CIPHER_CFG_READ_RES_T
 
struct  M2MB_LWM2M_FOTA_CFG_READ_RES_T
 
struct  M2MB_LWM2M_FOTA_ACK_REQ_T
 the m2mb_lwm2m_fota_ack request data structure More...
 
struct  M2MB_LWM2M_FOTA_ACK_RES_T
 the m2mb_lwm2m_fota_ack response data structure More...
 
struct  M2MB_LWM2M_FOTA_STATUS_REQ_TAG
 
struct  M2MB_LWM2M_FOTA_STATE_TAG
 
struct  M2MB_LWM2M_FOTA_STATE_RES_TAG
 
struct  M2MB_LWM2M_ODIS_DATA_T
 the m2mb_lwm2m_odis data structure More...
 
struct  M2MB_LWM2M_GET_LIST_NUM_RES_TAG
 
struct  M2MB_LWM2M_LIST_ELEMENT_RES_TAG
 
struct  M2MB_LWM2M_LIST_RES_TAG
 
struct  M2MB_LWM2M_ODIS_RES_T
 the m2mb_lwm2m_odis response data structure More...
 
struct  M2MB_LWM2M_EXIST_RES_T
 the m2mb_lwm2m_exist request data structure More...
 
struct  M2MB_LWM2M_CUST_DATA_T
 the m2mb_lwm2m_cust data structure More...
 
struct  M2MB_LWM2M_CUST_PARAM_T
 the m2mb_lwm2m_cust request data structure More...
 
struct  M2MB_LWM2M_CUST_RES_T
 the m2mb_lwm2m_cust response data structure More...
 
struct  M2MB_LWM2M_GET_REG_NUM_RES_TAG
 
struct  M2MB_LWM2M_REG_ELEMENT_RES_TAG
 
struct  M2MB_LWM2M_REG_PARAM_TAG
 
struct  M2MB_LWM2M_REG_RES_TAG
 
struct  M2MB_LWM2M_CFG_PARAM_TAG
 
struct  M2MB_LWM2M_CFG_RES_TAG
 
struct  M2MB_LWM2M_OBJSET_PARAM_TAG
 
struct  M2MB_LWM2M_OBJSET_RES_TAG
 
struct  M2MB_LWM2M_OBJGET_PARAM_TAG
 
struct  M2MB_LWM2M_OBJGET_RES_TAG
 

Macros

#define LWM2M_STRING_MAX_LENGTH   ( 20 ) /* max length allowed for the strings reporting client status, primitives etc. */
 
#define LWM2M_STAT_STRING_MAX_LENGTH   ( 10 ) /* max length allowed for the STAT string */
 
#define LWM2M_STS_ISBSTSRV_MAX_VALUE   ( 1 ) /* max value allowed for isBootstrapServer */
 
#define LWM2M_STS_EXTRA_CHARS_IN_URL   ( 3 ) /* extra chars for comma, isBstServer and string terminator, to be appended to URL */
 
#define LWM2M_STS_MIN_DATA_SIZE   ( 128 ) /* extra chars for comma, isBstServer and string terminator, to be appended to URL */
 
#define M2MB_LWM2M_ONE_BYTE   ( 1 )
 
#define M2MB_LWM2M_MAX_ENDPOINT_NAME_LEN   ( 64 ) /* max Endpoint Name length */
 
#define M2MB_LWM2M_DTLS_PSK_MAX_KEY_LEN   ( 64 ) /* max key length */
 

Typedefs

typedef HANDLE M2MB_LWM2M_HANDLE
 
typedef struct M2MB_LWM2M_FOTA_STATUS_REQ_TAG M2MB_LWM2M_FOTA_STATUS_REQ_T
 
typedef struct M2MB_LWM2M_FOTA_STATE_TAG M2MB_LWM2M_FOTA_STATE_T
 
typedef struct M2MB_LWM2M_FOTA_STATE_RES_TAG M2MB_LWM2M_FOTA_STATE_RES_T
 
typedef struct M2MB_LWM2M_GET_LIST_NUM_RES_TAG M2MB_LWM2M_GET_LIST_NUM_RES_T
 
typedef struct M2MB_LWM2M_LIST_ELEMENT_RES_TAG M2MB_LWM2M_LIST_ELEMENT_RES_T
 
typedef struct M2MB_LWM2M_LIST_RES_TAG M2MB_LWM2M_LIST_RES_T
 
typedef void(* m2mb_lwm2m_ind_callback) (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata)
 
typedef struct M2MB_LWM2M_GET_REG_NUM_RES_TAG M2MB_LWM2M_GET_REG_NUM_RES_T
 
typedef struct M2MB_LWM2M_REG_ELEMENT_RES_TAG M2MB_LWM2M_REG_ELEMENT_RES_T
 
typedef struct M2MB_LWM2M_REG_PARAM_TAG M2MB_LWM2M_REG_PARAM_T
 
typedef struct M2MB_LWM2M_REG_RES_TAG M2MB_LWM2M_REG_RES_T
 
typedef struct M2MB_LWM2M_CFG_PARAM_TAG M2MB_LWM2M_CFG_PARAM_T
 
typedef struct M2MB_LWM2M_CFG_RES_TAG M2MB_LWM2M_CFG_RES_T
 
typedef struct M2MB_LWM2M_OBJSET_PARAM_TAG M2MB_LWM2M_OBJSET_PARAM_T
 
typedef struct M2MB_LWM2M_OBJSET_RES_TAG M2MB_LWM2M_OBJSET_RES_T
 
typedef struct M2MB_LWM2M_OBJGET_PARAM_TAG M2MB_LWM2M_OBJGET_PARAM_T
 
typedef struct M2MB_LWM2M_OBJGET_RES_TAG M2MB_LWM2M_OBJGET_RES_T
 

Enumerations

enum  M2MB_LWM2M_URI_LENGTH_E {
  M2MB_LWM2M_URI_0_FIELDS = 0, M2MB_LWM2M_URI_1_FIELDS, M2MB_LWM2M_URI_2_FIELDS, M2MB_LWM2M_URI_3_FIELDS,
  M2MB_LWM2M_URI_4_FIELDS, M2MB_LWM2M_URI_MAX_NUM
}
 
enum  M2MB_LWM2M_EN_MODE_E { M2MB_LWM2M_MODE_NO_ACK, M2MB_LWM2M_MODE_ACK, M2MB_LWM2M_MODE_MAX_NUM }
 
enum  M2MB_LWM2M_ACK_ACTION_E { M2MB_LWM2M_ACTION_ACK = 1, M2MB_LWM2M_ACTION_DEFER, M2MB_LWM2M_ACTION_MAX_NUM }
 
enum  M2MB_LWM2MENA_CMD_TYPE_E { M2MB_LWM2MENA_CMD_TYPE_SET = 0, M2MB_LWM2MENA_CMD_TYPE_READ, M2MB_LWM2MENA_CMD_TYPE_MAX_NUM }
 
enum  M2MB_LWM2M_EVENT_E {
  M2MB_LWM2M_ENABLE_RES = 0, M2MB_LWM2M_DISABLE_RES, M2MB_LWM2M_ACK_RES, M2MB_LWM2M_READ_RES,
  M2MB_LWM2M_WRITE_RES, M2MB_LWM2M_EXEC_RES, M2MB_LWM2M_SET_RES, M2MB_LWM2M_GET_RES,
  M2MB_LWM2M_GET_STAT_RES, M2MB_LWM2M_STS_RES, M2MB_LWM2M_MON_RES, M2MB_LWM2M_NEW_INST_RES,
  M2MB_LWM2M_NFYACK_STATUS_RES, M2MB_LWM2M_NFYACK_URI_RES, M2MB_LWM2M_NFYACK_LIST_RES, M2MB_LWM2M_GET_TYPE_RES,
  M2MB_LWM2M_CIPHER_CFG_RES, M2MB_LWM2M_FOTA_CFG_RES, M2MB_LWM2M_CIPHER_CFG_READ_RES, M2MB_LWM2M_FOTA_CFG_READ_RES,
  M2MB_LWM2M_FOTA_ACK_RES, M2MB_LWM2M_FOTA_STATE_RES, M2MB_LWM2M_INJKEYS_RES, M2MB_LWM2M_ODIS_RES,
  M2MB_LWM2M_EXIST_RES, M2MB_LWM2M_GET_LIST_NUM_RES, M2MB_LWM2M_LIST_RES, M2MB_LWM2M_CUST_RES,
  M2MB_LWM2M_GET_REG_NUM_RES, M2MB_LWM2M_REG_RES, M2MB_LWM2M_UPD_REG_IND = 30, M2MB_LWM2M_SMS_PUSH_IND,
  M2MB_LWM2M_NOTIFY_IND, M2MB_LWM2M_NOTIFY_MON_IND, M2MB_LWM2M_CONN_REQ_IND = 60, M2MB_LWM2M_SESSION_END_IND,
  M2MB_LWM2M_SESSION_INFO_IND, M2MB_LWM2M_SRV_INFO_IND, M2MB_LWM2M_MON_INFO_IND, M2MB_LWM2M_NFYACK_INFO_IND,
  M2MB_LWM2M_OBJSET_RES = 90, M2MB_LWM2M_OBJGET_RES, M2MB_LWM2M_CFG_RES, M2MB_LWM2M_EVENT_MAX_NUM
}
 
enum  M2MB_LWM2M_CONNREQ_CAUSE_E {
  M2MB_LWM2M_CONNREQ_CAUSE_BOOTSTRAP, M2MB_LWM2M_CONNREQ_CAUSE_REGISTRATION, M2MB_LWM2M_CONNREQ_CAUSE_REREG, M2MB_LWM2M_CONNREQ_CAUSE_UPDATE,
  M2MB_LWM2M_CONNREQ_CAUSE_SMS, M2MB_LWM2M_CONNREQ_CAUSE_NOTIFY, M2MB_LWM2M_CONNREQ_CAUSE_DEREGISTRATION, M2MB_LWM2M_CONNREQ_CAUSE_MAX_NUM
}
 
enum  M2MB_LWM2M_RESULT_E {
  M2MB_LWM2M_RES_SUCCESS = 0, M2MB_LWM2M_RES_FAIL, M2MB_LWM2M_RES_FAIL_NO_ACTION, M2MB_LWM2M_RES_FAIL_UNSUPPORTED,
  M2MB_LWM2M_RES_FAIL_NOT_ALLOWED, M2MB_LWM2M_RES_FAIL_BAD_ARGS, M2MB_LWM2M_RES_FAIL_BAD_URI, M2MB_LWM2M_RES_FAIL_AGENT_UNAVAILABLE,
  M2MB_LWM2M_RES_NETWORK_ERROR = 50, M2MB_LWM2M_RES_HOST_UNREACH, M2MB_LWM2M_RES_SOCKET_ERROR, M2MB_LWM2M_RES_DTLS_ERROR,
  M2MB_LWM2M_RES_PROT_SUCCESS = 200, M2MB_LWM2M_RES_PROT_NOT_FOUND, M2MB_LWM2M_RES_PROT_NOT_ALLOWED, M2MB_LWM2M_RES_PROT_UNSUPPORTED,
  M2MB_LWM2M_RES_PROT_INTERNAL, M2MB_LWM2M_RES_PROT_UNKNOWN
}
 
enum  M2MB_LWM2M_IF_STATE_E {
  M2MB_LWM2M_IF_STATE_NONE, M2MB_LWM2M_IF_STATE_DISABLED, M2MB_LWM2M_IF_STATE_ACK_WAIT, M2MB_LWM2M_IF_STATE_ACTIVE,
  M2MB_LWM2M_IF_STATE_IDLE, M2MB_LWM2M_IF_STATE_DEREG_WAIT, M2MB_LWM2M_IF_STATE_DEREGISTERING, M2MB_LWM2M_IF_STATE_MAX
}
 
enum  M2MB_LWM2M_CL_STATE_E {
  M2MB_LWM2M_CL_STATE_DISABLED, M2MB_LWM2M_CL_STATE_DEREGISTERED = M2MB_LWM2M_CL_STATE_DISABLED, M2MB_LWM2M_CL_STATE_BOOTSTRAPPING, M2MB_LWM2M_CL_STATE_BOOTSTRAPPED,
  M2MB_LWM2M_CL_STATE_REGISTERING, M2MB_LWM2M_CL_STATE_REGISTERED, M2MB_LWM2M_CL_STATE_DEREGISTERING, M2MB_LWM2M_CL_STATE_SUSPENDED,
  M2MB_LWM2M_CL_STATE_MAX
}
 
enum  M2MB_LWM2M_SET_DATA_TYPE_E {
  M2MB_LWM2M_SET_DATA_TYPE_INTEGER, M2MB_LWM2M_SET_DATA_TYPE_FLOAT, M2MB_LWM2M_SET_DATA_TYPE_STRING, M2MB_LWM2M_SET_DATA_TYPE_HEX_BINARY,
  M2MB_LWM2M_SET_DATA_TYPE_MAX
}
 
enum  M2MB_LWM2M_INFO_ID_E {
  M2MB_LWM2M_INFO_FOTA_REBOOT, M2MB_LWM2M_INFO_DEVICE_REBOOT, M2MB_LWM2M_INFO_RESOURCE_EXECUTE, M2MB_LWM2M_INFO_FORCE_EXIT,
  M2MB_LWM2M_INFO_CLIENT_DISABLED, M2MB_LWM2M_INFO_REG_FAILURE, M2MB_LWM2M_INFO_ID_MAX
}
 general client event info More...
 
enum  M2MB_LWM2M_MON_ACTION_E { M2MB_LWM2M_MON_DISABLE = 0, M2MB_LWM2M_MON_ENABLE, M2MB_LWM2M_MON_MAX_NUM }
 
enum  M2MB_LWM2M_MON_MODE_E { M2MB_LWM2M_MON_MODE_SET_CMD = 0, M2MB_LWM2M_MON_MODE_READ_CMD, M2MB_LWM2M_MON_MODE_MAX_NUM }
 
enum  M2MB_LWM2M_CIPHER_MODE_E { M2MB_LWM2M_CIPHER_MODE_DEFAULT = 0, M2MB_LWM2M_CIPHER_MODE_ECDH = 1, M2MB_LWM2M_CIPHER_MODE_MAX_NUM }
 
enum  M2MB_LWM2M_FOTA_MODE_E {
  M2MB_LWM2M_FOTA_MODE_DEFAULT = 0, M2MB_LWM2M_FOTA_MODE_ACK_DWL = 1, M2MB_LWM2M_FOTA_MODE_ACK_UPD = 2, M2MB_LWM2M_FOTA_MODE_ACK_ALL = 3,
  M2MB_LWM2M_FOTA_MODE_REJECT = 4, M2MB_LWM2M_FOTA_MODE_MAX_NUM
}
 the ciphers supported by the m2mb lwm2m More...
 
enum  M2MB_LWM2M_FOTA_TOUT_ACTION_E { M2MB_LWM2M_FOTA_TOUT_ACTION_RESET_SM = 0, M2MB_LWM2M_FOTA_TOUT_ACTION_ACK = 1, M2MB_LWM2M_FOTA_TOUT_ACTION_MAX_NUM }
 the fota timeout actions supported by the m2mb lwm2m More...
 
enum  M2MB_LWM2M_FOTA_ACK_E { M2MB_LWM2M_FOTA_ACK_ALL = 1, M2MB_LWM2M_FOTA_ACK_MAX_NUM }
 
enum  M2MB_LWM2M_NFY_STATE_E { M2MB_LWM2M_NFY_STATE_MISSING = 0, M2MB_LWM2M_NFY_STATE_ACK_RECEIVED, M2MB_LWM2M_NFY_STATE_MAX_NUM }
 
enum  M2MB_LWM2M_KEY_ACTION_E {
  M2MB_LWM2M_KEY_CREATE, M2MB_LWM2M_KEY_DELETE_EP_NAME, M2MB_LWM2M_KEY_DELETE_ID_AND_SECRET, M2MB_LWM2M_KEY_DELETE_ALL,
  M2MB_LWM2M_KEY_MAX_ACTION
}
 
enum  ODIS_PARAMETERS_E {
  ODIS_HOST_DEVICE_ID = 0, ODIS_HOST_DEVICE_MANUFACTURER = 1, ODIS_HOST_DEVICE_MODEL = 2, ODIS_HOST_DEVICE_SW_VERSION = 3,
  ODIS_HOST_INSTANCE_ID = 4, ODIS_HOST_PARAM_MAX_NUMBER = 5
}
 the parameters set for +ODIS command More...
 
enum  M2MB_LWM2M_CUST_PARAM_ID_E { M2MB_LWM2M_CUST_PARAM_ID_CARRIER = 0, M2MB_LWM2M_CUST_PARAM_ID_DLT = 1, M2MB_LWM2M_CUST_PARAM_ID_MAX }
 the admitted parameters enum for #LWM2MCUST command More...
 
enum  CUST_PARAMETERS_E { CUST_PARAMETERS_COMMAND_ID = 0, CUST_PARAMETERS_DATA = 1, CUST_PARAM_MAX_NUMBER }
 the parameters set for #LWM2MCUST command More...
 
enum  REG_PARAMETERS_E { REG_PARAMETERS_AGENT_ID = 0, REG_PARAMETERS_SERVER_ID = 1, REG_PARAMETERS_ACTION_ID = 2, REG_PARAM_MAX_NUMBER }
 the parameters set for #LWM2MREG command More...
 
enum  M2MB_LWM2M_REG_ACTION_E {
  M2MB_LWM2M_REG_ACTION_FORCE_DEREG = 0, M2MB_LWM2M_REG_ACTION_FORCE_REG = 1, M2MB_LWM2M_REG_ACTION_UPDATE_REG = 2, M2MB_LWM2M_REG_ACTION_GET_SRV_INFO = 3,
  M2MB_LWM2M_REG_ACTION_MAX_NUM
}
 the actions set More...
 
enum  M2MB_LWM2M_REG_STATUS_E { M2MB_LWM2M_REG_STATUS_DEREGISTERED = 0, M2MB_LWM2M_REG_STATUS_SUSPENDED = 1, M2MB_LWM2M_REG_STATUS_REGISTERED = 2, M2MB_LWM2M_REG_STATUS_MAX_NUM }
 the server operation requests set More...
 
enum  M2MB_LWM2M_REG_ERROR_CODE_E {
  M2MB_LWM2M_REG_SUCCESS = 0, M2MB_LWM2M_REG_ALREADY_REGISTERED = 1, M2MB_LWM2M_REG_ALREADY_DEREGISTERED = 2, M2MB_LWM2M_REG_SERVER_NOT_FOUND = 3,
  M2MB_LWM2M_REG_CLIENT_DISABLED = 4, M2MB_LWM2M_REG_MAX_NUM
}
 
enum  M2MB_LWM2M_DATA_TYPE_E {
  M2MB_LWM2M_DATA_TYPE_INVALID = 0, M2MB_LWM2M_DATA_TYPE_NONE, M2MB_LWM2M_DATA_TYPE_STRING, M2MB_LWM2M_DATA_TYPE_INTEGER,
  M2MB_LWM2M_DATA_TYPE_FLOAT, M2MB_LWM2M_DATA_TYPE_BOOLEAN, M2MB_LWM2M_DATA_TYPE_OPAQUE, M2MB_LWM2M_DATA_TYPE_TIME,
  M2MB_LWM2M_DATA_TYPE_OBJECTLINK, M2MB_LWM2M_DATA_TYPE_STRINGARRAY, M2MB_LWM2M_DATA_TYPE_INTEGERARRAY, M2MB_LWM2M_DATA_TYPE_FLOATARRAY,
  M2MB_LWM2M_DATA_TYPE_BOOLEANARRAY, M2MB_LWM2M_DATA_TYPE_OPAQUEARRAY, M2MB_LWM2M_DATA_TYPE_TIMEARRAY, M2MB_LWM2M_DATA_TYPE_OBJECTLINKARRAY,
  M2MB_LWM2M_DATA_TYPE_LAST, M2MB_LWM2M_DATA_TYPE_FIRSTARRAYTYPE = M2MB_LWM2M_DATA_TYPE_STRINGARRAY, M2MB_LWM2M_DATA_TYPE_LASTARRAYTYPE = M2MB_LWM2M_DATA_TYPE_OBJECTLINKARRAY
}
 
enum  LWM2M_FOTA_INTERNAL_STATUS_E {
  LWM2M_FOTA_INTERNAL_STATUS_IDLE, LWM2M_FOTA_INTERNAL_STATUS_RESERVED_1, LWM2M_FOTA_INTERNAL_STATUS_WAIT_DWL_ACK, LWM2M_FOTA_INTERNAL_STATUS_DOWNLOADING,
  LWM2M_FOTA_INTERNAL_STATUS_DOWNLOADED, LWM2M_FOTA_INTERNAL_STATUS_RESERVED_2, LWM2M_FOTA_INTERNAL_STATUS_WAIT_UPD_ACK, LWM2M_FOTA_INTERNAL_STATUS_UPDATING,
  LWM2M_FOTA_INTERNAL_STATUS_REJECT, LWM2M_FOTA_INTERNAL_STATUS_FAILED, LWM2M_FOTA_INTERNAL_STATUS_MAX_NUMBER
}
 
enum  LWM2M_FW_OBJ_STATE_E {
  LWM2M_FW_OBJ_STATE_IDLE, LWM2M_FW_OBJ_STATE_DOWNLOADING, LWM2M_FW_OBJ_STATE_DOWNLOADED, LWM2M_FW_OBJ_STATE_UPDATING,
  LWM2M_FW_OBJ_STATE_MAX_NUMBER
}
 
enum  M2MB_LWM2M_CFG_ACTIONID_E { M2MB_LWM2M_CFG_ACTIONID_SET = 0, M2MB_LWM2M_CFG_ACTIONID_GET = 1, M2MB_LWM2M_CFG_ACTIONID_MAX_NUM }
 the list of actions accepted by m2mb_lwm2m_cfg api More...
 
enum  M2MB_LWM2M_CFG_PARAMID_E {
  M2MB_LWM2M_CFG_PARAMID_STOUT = 0, M2MB_LWM2M_CFG_PARAMID_IPV4_ONLY = 1, M2MB_LWM2M_CFG_PARAMID_COAP_ACK = 2, M2MB_LWM2M_CFG_PARAMID_COAP_RETRANS = 3,
  M2MB_LWM2M_CFG_PARAMID_MAX_NUM
}
 the paramId set More...
 

Functions

M2MB_RESULT_E m2mb_lwm2m_init (M2MB_LWM2M_HANDLE *h, m2mb_lwm2m_ind_callback cb, void *cb_user_param)
 m2mb_lwm2m_init initializes, for current client, the capability to interact with LwM2M agent. More...
 
M2MB_RESULT_E m2mb_lwm2m_deinit (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_deinit deinitializes LwM2M service for current client. More...
 
M2MB_RESULT_E m2mb_lwm2m_enable (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_ENABLE_REQ_T *en_params)
 m2mb_lwm2m_enable starts LwM2M client registration More...
 
M2MB_RESULT_E m2mb_lwm2m_disable (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_disable triggers LwM2M client deregistration. More...
 
M2MB_RESULT_E m2mb_lwm2m_ack (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_ACK_REQ_T *ack)
 m2mb_lwm2m_ack informs LwM2M client about network availability More...
 
M2MB_RESULT_E m2mb_lwm2m_read (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *outbuf, UINT16 outbuflen)
 m2mb_lwm2m_read reads the LwM2M resource at the given URI More...
 
M2MB_RESULT_E m2mb_lwm2m_write (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
 m2mb_lwm2m_write writes the LwM2M resource at the given URI More...
 
M2MB_RESULT_E m2mb_lwm2m_exec (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri)
 m2mb_lwm2m_exec executes the LwM2M resource at the given URI More...
 
M2MB_RESULT_E m2mb_lwm2m_set (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
 m2mb_lwm2m_set sets the value of a LwM2M resource at module side More...
 
M2MB_RESULT_E m2mb_lwm2m_get (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *outbuf, UINT16 outbuflen)
 m2mb_lwm2m_get reads the value of a LwM2M resource at module side More...
 
M2MB_RESULT_E m2mb_lwm2m_get_stat (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_get_stat reads the current status of the LwM2M client More...
 
M2MB_RESULT_E m2mb_lwm2m_sts (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_STS_URI_T *reqStsStructure)
 m2mb_lwm2m_sts sets the next server address More...
 
M2MB_RESULT_E m2mb_lwm2m_mon (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, M2MB_LWM2M_MON_REQ_T *mon_params)
 m2mb_lwm2m_mon sets the monitoring status an LwM2M resource at module side More...
 
M2MB_RESULT_E m2mb_lwm2m_newinst (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, M2MB_LWM2M_NEW_INST_REQ_T *new_inst_params)
 m2mb_lwm2m_newinst creates a specified instance for a specified object More...
 
M2MB_RESULT_E m2mb_lwm2m_nfy_ack_status (M2MB_LWM2M_HANDLE h, BOOLEAN set, BOOLEAN enable)
 m2mb_lwm2m_nfy_ack_status sets or gets the flag to enable or disable Notify Ack reporting More...
 
M2MB_RESULT_E m2mb_lwm2m_nfy_ack_uri (M2MB_LWM2M_HANDLE h, BOOLEAN add, M2MB_LWM2M_OBJ_URI_T *uri)
 m2mb_lwm2m_nfy_ack_uri adds or removes a resource URI to the list for Notify Ack reporting More...
 
M2MB_RESULT_E m2mb_lwm2m_nfy_ack_list (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uriList, UINT8 listElementsNumber)
 m2mb_lwm2m_nfy_ack_list retrieves the list for Notify Ack reporting More...
 
M2MB_RESULT_E m2mb_lwm2m_agent_config (M2MB_LWM2M_HANDLE h, UINT16 agentID)
 m2mb_lwm2m_agent_config propagates the specified client for a specific operation (such as read, write or execute resource) More...
 
M2MB_RESULT_E m2mb_lwm2m_get_resource_type (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, UINT16 *resType)
 m2mb_lwm2m_get_resource_type propagates the resource type for a required resource. More...
 
M2MB_RESULT_E m2mb_lwm2m_cipher_cfg (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CIPHER_CFG_REQ_T *cfg_params)
 m2mb_lwm2m_cipher_cfg sets and stores the cipher configuration. More...
 
M2MB_RESULT_E m2mb_lwm2m_cipher_cfg_read (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CIPHER_CFG_ITEM_T *cipherCfgData, UINT8 maxItemsNumber)
 m2mb_lwm2m_cipher_cfg_read reads the cipher configuration for all the active clients. More...
 
M2MB_RESULT_E m2mb_lwm2m_fota_cfg (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_CFG_REQ_T *cfg_params)
 m2mb_lwm2m_fota_cfg sets and stores the fota mode. More...
 
M2MB_RESULT_E m2mb_lwm2m_fota_cfg_read (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_CFG_ITEM_T *fotaCfgData, UINT8 maxItemsNumber)
 m2mb_lwm2m_fota_cfg_read reads the fota mode for all the active clients. More...
 
M2MB_RESULT_E m2mb_lwm2m_fota_ack (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_ACK_REQ_T *ack_params)
 m2mb_lwm2m_fota_ack sends the ack for the required operation. More...
 
M2MB_RESULT_E m2mb_lwm2m_fota_status (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_STATE_T *fotaStateData)
 m2mb_lwm2m_fota_status returns the fota data for the spcified LwM2M client. More...
 
M2MB_RESULT_E m2mb_lwm2m_injkeys (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_KEY_ACTION_E action, M2MB_LWM2M_KEYS_T *keys)
 m2mb_lwm2m_injkeys allows to inject or delete Endpoint Name and Keys for a given agent. More...
 
M2MB_RESULT_E m2mb_lwm2m_odis_reset (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_odis_reset is in charge of resetting the handler data fields reserved for odis. More...
 
M2MB_RESULT_E m2mb_lwm2m_odis_config (M2MB_LWM2M_HANDLE h, ODIS_PARAMETERS_E odis_item, CHAR *odis_data)
 m2mb_lwm2m_odis_config is in charge of filling the selected otis item with the given data. More...
 
M2MB_RESULT_E m2mb_lwm2m_odis (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_odis allows the user to store the odis data set into nv memory. More...
 
M2MB_RESULT_E m2mb_lwm2m_odis_set (M2MB_LWM2M_HANDLE h, UINT8 odis_instance)
 m2mb_lwm2m_odis_set allows the user to store the odis data set into the given instance in nv memory. More...
 
M2MB_RESULT_E m2mb_lwm2m_exist (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri)
 m2mb_lwm2m_exist returns the existence or not for a given uri/agent More...
 
M2MB_RESULT_E m2mb_lwm2m_get_list_entries (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_get_list_entries returns the overall number of elements, expressed in M2MB_LWM2M_LIST_ELEMENT_RES_T units, necessary to specify all the objects/instances currently defined for a client. More...
 
M2MB_RESULT_E m2mb_lwm2m_list (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_LIST_ELEMENT_RES_T *listPointer, UINT16 listSize)
 m2mb_lwm2m_list returns all the objects/instances defined for a client More...
 
M2MB_RESULT_E m2mb_lwm2m_cust (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CUST_PARAM_T *custReq)
 m2mb_lwm2m_cust stores the customization data. More...
 
M2MB_RESULT_E m2mb_lwm2m_cfg (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CFG_PARAM_T *cfgReq)
 m2mb_lwm2m_cfg sets or retrieves the lwm2m configuration value related to a given parameter More...
 
M2MB_RESULT_E m2mb_lwm2m_get_reg_entries (M2MB_LWM2M_HANDLE h)
 m2mb_lwm2m_get_reg_entries returns the overall number of elements, expressed in M2MB_LWM2M_REG_ELEMENT_RES_T units, needed to specify all the information currently stored for the server data, when calling the m2mb_lwm2m_reg with M2MB_LWM2M_REG_ACTION_GET_SRV_INFO action. More...
 
M2MB_RESULT_E m2mb_lwm2m_reg (M2MB_LWM2M_HANDLE h, M2MB_LWM2M_REG_PARAM_T *regReq, M2MB_LWM2M_REG_ELEMENT_RES_T *listPointer, UINT16 listSize)
 m2mb_lwm2m_reg manages the user connection request for the specified server. More...
 
M2MB_RESULT_E m2mb_lwm2m_objset (M2MB_LWM2M_HANDLE h, const M2MB_LWM2M_OBJSET_PARAM_T *objSetReq)
 m2mb_lwm2m_objset updates one or more resources of a Lwm2m object instance. More...
 
M2MB_RESULT_E m2mb_lwm2m_objget (M2MB_LWM2M_HANDLE h, const M2MB_LWM2M_OBJGET_PARAM_T *objGetReq, CHAR *objGetRespString, UINT16 objGetRespSize)
 m2mb_lwm2m_objget reads a Lwm2m object/object instance/resource. More...
 

Detailed Description

Header file for m2mb_lwm2m APIs.

m2m/m2m_common/m2mb_inc/m2mb_lwm2m.h

m2mb_lwm2m APIs provide actions and events for LWM2M management.

Note
Dependencies: m2mb_types.h
Author
Roberto Caboni
Date
03/05/2018

Typedef Documentation

◆ M2MB_LWM2M_REG_RES_T

LWM2M CFG

Enumeration Type Documentation

◆ CUST_PARAMETERS_E

the parameters set for #LWM2MCUST command

Enumerator
CUST_PARAMETERS_COMMAND_ID 

parameter identifier

CUST_PARAMETERS_DATA 

data identifier

CUST_PARAM_MAX_NUMBER 

pls insert any further value above CUST_PARAM_MAX_NUMBER

◆ LWM2M_FOTA_INTERNAL_STATUS_E

Enumerator
LWM2M_FOTA_INTERNAL_STATUS_IDLE 

no operation ongoing

LWM2M_FOTA_INTERNAL_STATUS_RESERVED_1 

state reserved for future developments

LWM2M_FOTA_INTERNAL_STATUS_WAIT_DWL_ACK 

download request received, waiting for ack

LWM2M_FOTA_INTERNAL_STATUS_DOWNLOADING 

download in progress

LWM2M_FOTA_INTERNAL_STATUS_DOWNLOADED 

download completed

LWM2M_FOTA_INTERNAL_STATUS_RESERVED_2 

state reserved for future developments

LWM2M_FOTA_INTERNAL_STATUS_WAIT_UPD_ACK 

update request received, waiting for ack

LWM2M_FOTA_INTERNAL_STATUS_UPDATING 

update in progress

LWM2M_FOTA_INTERNAL_STATUS_REJECT 

fota rejected status

LWM2M_FOTA_INTERNAL_STATUS_FAILED 

fota process failed

LWM2M_FOTA_INTERNAL_STATUS_MAX_NUMBER 

pls insert any further value above LWM2M_FOTA_INTERNAL_STATUS_MAX_NUMBER

◆ LWM2M_FW_OBJ_STATE_E

Enumerator
LWM2M_FW_OBJ_STATE_IDLE 

no FOTA operation currently in progress

LWM2M_FW_OBJ_STATE_DOWNLOADING 

download in progress

LWM2M_FW_OBJ_STATE_DOWNLOADED 

download completed, ready to update

LWM2M_FW_OBJ_STATE_UPDATING 

update in progress

LWM2M_FW_OBJ_STATE_MAX_NUMBER 

pls insert any further value above LWM2M_FW_OBJ_STATE_MAX_NUMBER

◆ M2MB_LWM2M_CFG_ACTIONID_E

the list of actions accepted by m2mb_lwm2m_cfg api

Enumerator
M2MB_LWM2M_CFG_ACTIONID_SET 

Set a new value

M2MB_LWM2M_CFG_ACTIONID_GET 

Get the value

M2MB_LWM2M_CFG_ACTIONID_MAX_NUM 

pls insert any further value above M2MB_LWM2M_CFG_ACTIONID_MAX_NUM

◆ M2MB_LWM2M_CFG_PARAMID_E

the paramId set

Enumerator
M2MB_LWM2M_CFG_PARAMID_STOUT 

Session timeout value

M2MB_LWM2M_CFG_PARAMID_IPV4_ONLY 

Force to use IPv4 only for LwM2M communications

M2MB_LWM2M_CFG_PARAMID_COAP_ACK 

COAP ack_timeout value

M2MB_LWM2M_CFG_PARAMID_COAP_RETRANS 

COAP max_retransmit value

M2MB_LWM2M_CFG_PARAMID_MAX_NUM 

pls insert any further value above M2MB_LWM2M_CFG_PARAMID_MAX_NUM

◆ M2MB_LWM2M_CIPHER_MODE_E

Enumerator
M2MB_LWM2M_CIPHER_MODE_DEFAULT 

default ciphers

M2MB_LWM2M_CIPHER_MODE_ECDH 

ECDH ciphers

M2MB_LWM2M_CIPHER_MODE_MAX_NUM 

first invalid code; every successive insertions should be above this symbol

◆ M2MB_LWM2M_CUST_PARAM_ID_E

the admitted parameters enum for #LWM2MCUST command

Enumerator
M2MB_LWM2M_CUST_PARAM_ID_CARRIER 

the customization carrier identifier

M2MB_LWM2M_CUST_PARAM_ID_DLT 

param id to delete the existing customization, if any

M2MB_LWM2M_CUST_PARAM_ID_MAX 

pls insert any further value above the label M2MB_LWM2M_CUST_PARAM_ID_MAX

◆ M2MB_LWM2M_DATA_TYPE_E

Enumerator
M2MB_LWM2M_DATA_TYPE_INVALID 

indicates an invalid resource type

M2MB_LWM2M_DATA_TYPE_NONE 

indicates a resource with no type

M2MB_LWM2M_DATA_TYPE_STRING 

indicates a resource capable of holding an ASCII string (UTF-8 is not supported)

M2MB_LWM2M_DATA_TYPE_INTEGER 

indicates a resource capable of holding a LWM2M Integer value

M2MB_LWM2M_DATA_TYPE_FLOAT 

indicates a resource capable of holding a LWM2M Float value

M2MB_LWM2M_DATA_TYPE_BOOLEAN 

indicates a resource capable of holding a LWM2M Boolean value

M2MB_LWM2M_DATA_TYPE_OPAQUE 

indicates a resource capable of holding a LWM2M Opaque value

M2MB_LWM2M_DATA_TYPE_TIME 

indicates a resource capable of holding a LWM2M Time value

M2MB_LWM2M_DATA_TYPE_OBJECTLINK 

indicates a resource capable of holding a LWM2M ObjectLink value

M2MB_LWM2M_DATA_TYPE_STRINGARRAY 

indicates a multiple-instance resource capable of holding a number of ASCII string values

M2MB_LWM2M_DATA_TYPE_INTEGERARRAY 

indicates a multiple-instance resource capable of holding a number of LWM2M Integer values

M2MB_LWM2M_DATA_TYPE_FLOATARRAY 

indicates a multiple-instance resource capable of holding a number of LWM2M Float values

M2MB_LWM2M_DATA_TYPE_BOOLEANARRAY 

indicates a multiple-instance resource capable of holding a number of LWM2M Boolean values

M2MB_LWM2M_DATA_TYPE_OPAQUEARRAY 

indicates a multiple-instance resource capable of holding a number of LWM2M Opaque values

M2MB_LWM2M_DATA_TYPE_TIMEARRAY 

indicates a multiple-instance resource capable of holding a number of LWM2M Time values

M2MB_LWM2M_DATA_TYPE_OBJECTLINKARRAY 

indicates a multiple-instance resource capable of holding a number of LWM2M ObjectLink values

M2MB_LWM2M_DATA_TYPE_LAST 

Reserved value

M2MB_LWM2M_DATA_TYPE_FIRSTARRAYTYPE 

Reserved value

M2MB_LWM2M_DATA_TYPE_LASTARRAYTYPE 

Reserved value

◆ M2MB_LWM2M_EVENT_E

Enumerator
M2MB_LWM2M_CIPHER_CFG_RES 

the cipher configuration m2mb response identifier

M2MB_LWM2M_FOTA_CFG_RES 

the fota configuration m2mb response identifier

M2MB_LWM2M_CIPHER_CFG_READ_RES 

the cipher configuration read m2mb response identifier

M2MB_LWM2M_FOTA_CFG_READ_RES 

the fota configuration read m2mb response identifier

M2MB_LWM2M_FOTA_ACK_RES 

the fota ack m2mb response identifier

M2MB_LWM2M_FOTA_STATE_RES 

the fota state m2mb response identifier

M2MB_LWM2M_ODIS_RES 

the odis m2mb response identifier

M2MB_LWM2M_EXIST_RES 

the exist check response identifier

M2MB_LWM2M_GET_LIST_NUM_RES 

the elements number for LIST command identifier

M2MB_LWM2M_LIST_RES 

the list check response identifier

M2MB_LWM2M_CUST_RES 

the customization response identifier

M2MB_LWM2M_GET_REG_NUM_RES 

the elements number for REG command identifier

M2MB_LWM2M_REG_RES 

the reg response identifier

M2MB_LWM2M_OBJSET_RES 

the object set response identifier

M2MB_LWM2M_OBJGET_RES 

the object get response identifier

M2MB_LWM2M_CFG_RES 

the cfg response identifier

◆ M2MB_LWM2M_FOTA_ACK_E

Enumerator
M2MB_LWM2M_FOTA_ACK_ALL 

acks the required fota operation regardless of its type

M2MB_LWM2M_FOTA_ACK_MAX_NUM 

first invalid code; every successive insertions should be above this symbol

◆ M2MB_LWM2M_FOTA_MODE_E

the ciphers supported by the m2mb lwm2m

the fota modes supported by the m2mb lwm2m

Enumerator
M2MB_LWM2M_FOTA_MODE_DEFAULT 

default mode, no acks required

M2MB_LWM2M_FOTA_MODE_ACK_DWL 

acked download, ack required for download operation only

M2MB_LWM2M_FOTA_MODE_ACK_UPD 

ack update mode, ack required for update operation only

M2MB_LWM2M_FOTA_MODE_ACK_ALL 

ack all mode, ack required for all operations

M2MB_LWM2M_FOTA_MODE_REJECT 

reject the fota request

M2MB_LWM2M_FOTA_MODE_MAX_NUM 

first invalid code; every successive insertions should be above this symbol

◆ M2MB_LWM2M_FOTA_TOUT_ACTION_E

the fota timeout actions supported by the m2mb lwm2m

Enumerator
M2MB_LWM2M_FOTA_TOUT_ACTION_RESET_SM 

FOTA state machine is reset after the timeout period

M2MB_LWM2M_FOTA_TOUT_ACTION_ACK 

ack is automatically sent after the timeout period

M2MB_LWM2M_FOTA_TOUT_ACTION_MAX_NUM 

first invalid code; every successive insertions should be above this symbol

◆ M2MB_LWM2M_INFO_ID_E

general client event info

Enumerator
M2MB_LWM2M_INFO_FOTA_REBOOT 

the device will be rebooted to complete a FOTA update

M2MB_LWM2M_INFO_DEVICE_REBOOT 

the device will be rebooted

M2MB_LWM2M_INFO_RESOURCE_EXECUTE 

an executable resource has been called

M2MB_LWM2M_INFO_FORCE_EXIT 

the client will be forcefully disabled

M2MB_LWM2M_INFO_CLIENT_DISABLED 

all servers deregistered and client effectively disabled

M2MB_LWM2M_INFO_REG_FAILURE 

a server failed to complete the registration

◆ M2MB_LWM2M_KEY_ACTION_E

Enumerator
M2MB_LWM2M_KEY_CREATE 

to inject the keys

M2MB_LWM2M_KEY_DELETE_EP_NAME 

to delete the Endpoint Name

M2MB_LWM2M_KEY_DELETE_ID_AND_SECRET 

to delete the Identity and the Secret Key

M2MB_LWM2M_KEY_DELETE_ALL 

to delete all of the above

M2MB_LWM2M_KEY_MAX_ACTION 

max action value

◆ M2MB_LWM2M_NFY_STATE_E

Enumerator
M2MB_LWM2M_NFY_STATE_MISSING 

indicates a missing ack. Notify not confirmed by the LwM2M Server

M2MB_LWM2M_NFY_STATE_ACK_RECEIVED 

indicates that the notify has been received by the LwM2M Server.

M2MB_LWM2M_NFY_STATE_MAX_NUM 

Reserved value

◆ M2MB_LWM2M_REG_ACTION_E

the actions set

Enumerator
M2MB_LWM2M_REG_ACTION_FORCE_DEREG 

deregister from the given server request

M2MB_LWM2M_REG_ACTION_FORCE_REG 

registration towards the given server request

M2MB_LWM2M_REG_ACTION_UPDATE_REG 

update registration towards the given server request

M2MB_LWM2M_REG_ACTION_GET_SRV_INFO 

retrive the server registration status request

M2MB_LWM2M_REG_ACTION_MAX_NUM 

pls insert any further value above M2MB_LWM2M_REG_ACTION_MAX_NUM

◆ M2MB_LWM2M_REG_ERROR_CODE_E

Enumerator
M2MB_LWM2M_REG_SUCCESS 

operation successful

M2MB_LWM2M_REG_ALREADY_REGISTERED 

already registered to server code

M2MB_LWM2M_REG_ALREADY_DEREGISTERED 

already deregistered to server code

M2MB_LWM2M_REG_SERVER_NOT_FOUND 

server not found code

M2MB_LWM2M_REG_CLIENT_DISABLED 

client disabled code

M2MB_LWM2M_REG_MAX_NUM 

pls insert any further value above M2MB_LWM2M_REG_MAX_NUM

◆ M2MB_LWM2M_REG_STATUS_E

the server operation requests set

Enumerator
M2MB_LWM2M_REG_STATUS_DEREGISTERED 

deregistered status

M2MB_LWM2M_REG_STATUS_SUSPENDED 

suspended status

M2MB_LWM2M_REG_STATUS_REGISTERED 

registered status

M2MB_LWM2M_REG_STATUS_MAX_NUM 

pls insert any further value above M2MB_LWM2M_REG_STATUS_MAX_NUM

◆ M2MB_LWM2M_RESULT_E

Enumerator
M2MB_LWM2M_RES_FAIL_AGENT_UNAVAILABLE 

the agent unavailable error code

◆ ODIS_PARAMETERS_E

the parameters set for +ODIS command

Enumerator
ODIS_HOST_DEVICE_ID 

Unique host device identifier

ODIS_HOST_DEVICE_MANUFACTURER 

host device manufacturer

ODIS_HOST_DEVICE_MODEL 

host device model

ODIS_HOST_DEVICE_SW_VERSION 

host device software version

ODIS_HOST_INSTANCE_ID 

Odis instance identifier

ODIS_HOST_PARAM_MAX_NUMBER 

pls insert any further value above ODIS_HOST_PARAM_MAX_NUMBER

◆ REG_PARAMETERS_E

the parameters set for #LWM2MREG command

Enumerator
REG_PARAMETERS_AGENT_ID 

agent identifier

REG_PARAMETERS_SERVER_ID 

short server identifier

REG_PARAMETERS_ACTION_ID 

action identifier

REG_PARAM_MAX_NUMBER 

pls insert any further value above REG_PARAM_MAX_NUMBER

Function Documentation

◆ m2mb_lwm2m_ack()

M2MB_RESULT_E m2mb_lwm2m_ack ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_ACK_REQ_T ack 
)

m2mb_lwm2m_ack informs LwM2M client about network availability

m2mb_lwm2m_ack allows the user to acknowledge client's request for network availability. It has to be issued in case of client enabled in "M2MB_LWM2M_MODE_ACK" mode. An ACK will be required after enable, disable, sms_push, notify and upd_reg events.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]ack_paramspointer to a structure containing the parameters required for the acknowledge. In particular it contains a boolean that authorizes/denies the transaction.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_ack( h, ack_params );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
switch( event )
{
//...
case M2MB_LWM2M_CONN_REQ_IND:
{
printf( "Connection request on APN %d, reason %d", resp->apnclass, resp->reason );
if( apn_class_is_registered )
{
M2MB_LWM2M_ACK_REQ_T ack_params = { M2MB_LWM2M_ACTION_ACK, 0 };
retVal = m2mb_lwm2m_ack( h, &ack_params );
if( retVal == M2MB_RESULT_SUCCESS )
{
// Ack sent. The client will go on and will issue another callback at registration completion
}
}
else
{
// Activate it, BUT NOT WITHIN THE CALLBACK!!! It is issued by agent's task.
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
M2MB_LWM2M_ENABLE_REQ_T pars = { M2MB_LWM2M_MODE_ACK, 1, 2, 5 };
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
retVal = m2mb_lwm2m_enable( h, &pars );
if ( retVal == M2MB_RESULT_SUCCESS )
{
// ... Wait for registration request callback
// ... Interaction whith the LwM2M client
}
}

◆ m2mb_lwm2m_agent_config()

M2MB_RESULT_E m2mb_lwm2m_agent_config ( M2MB_LWM2M_HANDLE  h,
UINT16  agentID 
)

m2mb_lwm2m_agent_config propagates the specified client for a specific operation (such as read, write or execute resource)

m2mb_lwm2m_agent_config is used to inform the LwM2M state machine to refer the required operation (which can be a #LWM2MW, #LWM2MR, #LWM2ME or #LWM2MSTS) to the agent specified by the AT command. It should be used before invoking the m2mb function. No callback is called.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]agentIDa structure defining the URI specified by the user (only object ID and object instance ID are managed).
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_agent_config( h, agentID );

int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 4; // Reboot executable resource
m2mb_lwm2m_agent_config( h, agentID );
// the exec is executed for the Telit agent
retVal = m2mb_lwm2m_exec( h, &uri );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_exec request succeeded" );
}
}

◆ m2mb_lwm2m_cfg()

M2MB_RESULT_E m2mb_lwm2m_cfg ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_CFG_PARAM_T cfgReq 
)

m2mb_lwm2m_cfg sets or retrieves the lwm2m configuration value related to a given parameter

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]cfgReqthe cfg required data, expressed in the M2MB_LWM2M_CFG_PARAM_T type.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_cfg( h, cfgReq );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
M2MB_LWM2M_CFG_RES_T *resp = ( M2MB_LWM2M_CFG_RES_T * )resp_struct;
if( resp != NULL )
{
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
memset( &cfgReq, 0, sizeof( M2MB_LWM2M_CFG_RES_T ) );
cfgReq.agentId = agentID;
cfg.paramId = 0; // setting DTLS timeout
cfgReq.actionId = M2MB_LWM2M_CFG_ACTIONID_SET ;
cfgReq.value = 60; // a generic value
//...
m2mb_lwm2m_agent_config( h, agentID );
if( m2mb_lwm2m_cfg( h, &regReq ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_cfg request succeeded" );
}
else
{
printf( "m2mb_lwm2m_cfg request failed" );
}
}

◆ m2mb_lwm2m_cipher_cfg()

M2MB_RESULT_E m2mb_lwm2m_cipher_cfg ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_CIPHER_CFG_REQ_T cfg_params 
)

m2mb_lwm2m_cipher_cfg sets and stores the cipher configuration.

m2mb_lwm2m_cipher_cfg allows the user to set the cipher during runtime. The function is non-blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_CIPHER_CFG_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_CIPHER_CFG_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]cfg_paramsa structure containing the cipher to be used specified by the user.
Returns
M2MB_RESULT_SUCCESS in case of success
a value of M2MB_RESULT_E in case of errors
Note

m2mb_lwm2m_cipher_cfg( h, cfg_params );

// WARNING: do not place blocking actions within callback, it would block the lwm2m agent task!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_cipher_cfg
M2MB_LWM2M_FOTA_CIPHER_RES_T *resp = ( M2MB_LWM2M_CIPHER_CFG_RES_T * )resp_struct;
if( resp != NULL )
{
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Setting Cipher config succeeded" );
// code
}
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent ID
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
//setting Default cipher
//cfg_params.mode = M2MB_LWM2M_CIPHER_MODE_DEFAULT;
//setting ECDH based cipher
cfg_params.mode = M2MB_LWM2M_CIPHER_MODE_ECDH;
m2mb_lwm2m_agent_config( h, agentID );
retVal = m2mb_lwm2m_cipher_cfg( h, &cfg_params );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_cipher_cfg request succeeded" );
}
}

◆ m2mb_lwm2m_cipher_cfg_read()

M2MB_RESULT_E m2mb_lwm2m_cipher_cfg_read ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_CIPHER_CFG_ITEM_T cipherCfgData,
UINT8  maxItemsNumber 
)

m2mb_lwm2m_cipher_cfg_read reads the cipher configuration for all the active clients.

m2mb_lwm2m_cipher_cfg_read allows the user to read the cipher setting configured for all the active clients. The function is non-blocking. This means that the function returns immediately, but the response data is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_CIPHER_CFG_READ_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_CIPHER_CFG_READ_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]cipherCfgDatapointer to a M2MB_LWM2M_CIPHER_CFG_ITEM_T structure array that will be filled with the cipher setting info related to the active clients.
[in]maxItemsNumberthe maximum M2MB_LWM2M_CIPHER_CFG_ITEM_T elements number that will be filled with the fota mode info.
Returns
a value from M2MB_RESULT_E
Note

m2mb_lwm2m_cipher_cfg_read( h, cipherCfgData, maxItemsNumber );

#define MAX_ITEM_NUM_FOR_CIPHER_CFG_READ ( 2 ) //max num of cipher cfg items to be read
// WARNING: do not place blocking actions within callback, it would block the lwm2m agent task!
void myCallback( M2MB_LWM2M_HANDLE h,
UINT16 resp_size,
void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
// event in response to the m2mb_lwm2m_cipher_cfg_read
if( resp != NULL )
{
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Cipher configuations read succeeded" );
// code
}
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
M2MB_LWM2M_CIPHER_CFG_ITEM_T cipherCfgData[MAX_ITEM_NUM_FOR_CIPHER_CFG_READ];
UINT8 maxItemNum = MAX_ITEM_NUM_FOR_CIPHER_CFG_READ;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
retVal = m2mb_lwm2m_cipher_cfg_read( h, &fotaCfgData, maxItemNum );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_cipher_cfg_read request succeeded" );
}
}

◆ m2mb_lwm2m_cust()

M2MB_RESULT_E m2mb_lwm2m_cust ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_CUST_PARAM_T custReq 
)

m2mb_lwm2m_cust stores the customization data.

m2mb_lwm2m_cust is intended to store the customization data. The function is not blocking. In case of success, nothing is returned; instead, the callback defined in m2mb_lwm2m_init is configured to receive the required data through the M2MB_LWM2M_CUST_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_CUST_RES_T type. In case of fatal error (example: client not ready), the function returns with a failure code and no callback is issued. In case of successful operation, the chosen customization will be applied after the next power-cycle.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]custReqthe cust required data, expressed in the M2MB_LWM2M_CUST_PARAM_T type.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
The command is executed by the Telit LwM2M client task, therefore that client should be active (not skipped).

m2mb_lwm2m_cust( h, custReq );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h,
UINT16 resp_size,
void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
M2MB_LWM2M_CUST_RES_T *resp = ( M2MB_LWM2M_CUST_RES_T * )resp_struct;
if( resp != NULL )
{
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
UINT32 dataLength = strlen( "DCM" );
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
memset( requiredData, 0, sizeof( M2MB_LWM2M_CUST_PARAM_T ) );
requiredData.data.buffer = ( CHAR * ) m2mb_os_calloc( dataLength * sizeof( CHAR ) );
if( requiredData.data.buffer != NULL )
{
requiredData.data.dataSize = dataLength;
memcpy( cust.data.buffer, atpParam->item[CUST_PARAMETERS], dataLength );
if( m2mb_lwm2m_cust( h, &requiredData ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_cust request succeeded" );
}
else
{
printf( "m2mb_lwm2m_cust request failed" );
}
m2mb_os_free( requiredData.data.buffer );
requiredData.data.buffer = NULL;
}
}

◆ m2mb_lwm2m_deinit()

M2MB_RESULT_E m2mb_lwm2m_deinit ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_deinit deinitializes LwM2M service for current client.

m2mb_lwm2m_deinit deinitializes LwM2M service for current client freeing the handle passed as first parameter. Calling the m2mb_sms_deinit is useful after using the LwM2M service in order to free memory space.

Parameters
[in]hthe handle to the LwM2M service, that will be deinitialized by the function.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_deinit( &h );

M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//... use LwM2M APIs ...
retVal = m2mb_lwm2m_deinit( h );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_deinit succeeded" );
}

◆ m2mb_lwm2m_disable()

M2MB_RESULT_E m2mb_lwm2m_disable ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_disable triggers LwM2M client deregistration.

m2mb_lwm2m_disable starts the procedure for LwM2M client deregistration. It is non-blocking, so it returns immediately with an error code. If it returns successfully the deregistration result is provided through the callback defined by the user. If the client was enabled in M2MB_LWM2M_MODE_ACK mode, a call to m2mb_lwm2m_ack() is be required in order to assure network availability. The actual result of the API is returned through the callback with M2MB_LWM2M_DISABLE_RES event.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_disable( h );

M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
retVal = m2mb_lwm2m_enable( h, &pars );
if ( retVal == M2MB_RESULT_SUCCESS )
{
// ... Interaction with the LwM2M client
retVal = m2mb_lwm2m_disable( h );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_disable succeeded" );
}
}

◆ m2mb_lwm2m_enable()

M2MB_RESULT_E m2mb_lwm2m_enable ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_ENABLE_REQ_T en_params 
)

m2mb_lwm2m_enable starts LwM2M client registration

m2mb_lwm2m_enable starts the procedure for LwM2M client registration. It is non-blocking, so it returns immediately with an error code. It may fail if some basic conditions are not satisfied (PDP context not activated). If it returns successfully the registration result is provided through the callback defined by the user. If called in M2MB_LWM2M_MODE_ACK mode, a call to m2mb_lwm2m_ack() is be required in order to assure network availability. The actual result of the API is returned through the callback with M2MB_LWM2M_ENABLE_RES event.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]en_paramsa structure defining some mandatory parameters, such as apnclass.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_enable( h, params );

M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
// Set enable parameters. For example:
// pars.apnclass = 1;
retVal = m2mb_lwm2m_enable( h, &pars );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_enable succeeded" );
}

◆ m2mb_lwm2m_exec()

M2MB_RESULT_E m2mb_lwm2m_exec ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri 
)

m2mb_lwm2m_exec executes the LwM2M resource at the given URI

m2mb_lwm2m_exec executes the LwM2M resource at the URI specified by parameter 'uri', performing an operation equivalent to an execution from server side. The function returns immediately, and the result of the required operation is sent along with the callback defined in m2mb_lwm2m_init. In case of fatal error (example: client not ready), the function fails immediately and no callback is issued.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI of the resource to be executed. If the resource is not executable, an error is raised by the callback.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_execute( h, uri, );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_EXEC_RES:
{
M2MB_LWM2M_EXEC_RES_T *resp = ( M2MB_LWM2M_EXEC_RES_T * )resp_struct;
printf( "Exec result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 4; // Reboot executable resource
retVal = m2mb_lwm2m_exec( h, &uri );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_exec request succeeded" );
}
}

◆ m2mb_lwm2m_exist()

M2MB_RESULT_E m2mb_lwm2m_exist ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri 
)

m2mb_lwm2m_exist returns the existence or not for a given uri/agent

m2mb_lwm2m_exist returns the LwM2M resource at the uri specified by parameter 'uri', performing an operation equivalent to a read from server side. The function returns immediately, and the result of the required operation is sent along with the callback defined in m2mb_lwm2m_init. According to this, the exist result is made available in the memory area defined by the m2mb's user after a little delay. In case of fatal error (example: client not ready), the function fails immediately and no callback is issued. In case of successful operation, the given uri data (if inserted) and the boolean reporting whether the uri/agent is existent or not are copied in the buffer passed by the user. In case the user is interested in an agent existence query, the uri should be passed and it should be filled with uri.uriLen = M2MB_LWM2M_URI_0_FIELDS. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_exist.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the uri of the resource to be investigated.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
The objects from Connection Statistics (/7) are allowed to be investigated, therefore a query for objects <7 results in a failure. The given uri and agent are returned with the M2MB_LWM2M_EXIST_RES_T structure.

m2mb_lwm2m_exist( h, uri );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{
printf( "Exist result %d", resp->result );
if( resp->result == M2M_LWM2M_RES_SUCCESS )
{
// Manage result value
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
// query of the uri /11/1/4/0 for agent 0 (Telit)
uri.uriLen = M2MB_LWM2M_URI_4_FIELDS;
uri.obj = 11;
uri.objInst = 1;
uri.resource = 4;
uri.resourceInst = 0;
m2mb_lwm2m_agent_config( h, agentID );
retVal = m2mb_lwm2m_exist( h, &uri );
if( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_exist request succeeded" );
}
}

◆ m2mb_lwm2m_fota_ack()

M2MB_RESULT_E m2mb_lwm2m_fota_ack ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_FOTA_ACK_REQ_T ack_params 
)

m2mb_lwm2m_fota_ack sends the ack for the required operation.

m2mb_lwm2m_fota_ack allows the user to acknoledge (and authorize) the current fota operation (i.e.: download or delta application). The function is non-blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_FOTA_ACK_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_FOTA_ACK_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]ack_paramsa structure containing the ack information specified by the user.
Returns
M2MB_RESULT_SUCCESS in case of success
a value of M2MB_RESULT_E in case of errors
Note

m2mb_lwm2m_fota_ack( h, ack_params );

// WARNING: do not place blocking actions within callback, it would block the lwm2m agent task!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_fota_ack
if( resp != NULL )
{
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Fota config succeeded" );
// code
}
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent ID
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
fotaAckParams.action = M2MB_LWM2M_FOTA_ACTION_ACK;
m2mb_lwm2m_agent_config( h, agentID );
retVal = m2mb_lwm2m_fota_ack( h, &fotaAckParams );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_fota_ack request succeeded" );
}
}

◆ m2mb_lwm2m_fota_cfg()

M2MB_RESULT_E m2mb_lwm2m_fota_cfg ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_FOTA_CFG_REQ_T cfg_params 
)

m2mb_lwm2m_fota_cfg sets and stores the fota mode.

m2mb_lwm2m_fota_cfg allows the user to set the proper fota modality by requiring an 'ack' to proceed with the delta download or to proceed with the delta application, or to confirm both download and update. The function is non-blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_FOTA_CFG_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_FOTA_CFG_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]cfg_paramsa structure containing the fota mode info specified by the user.
Returns
M2MB_RESULT_SUCCESS in case of success
a value of M2MB_RESULT_E in case of errors
Note

m2mb_lwm2m_fota_cfg( h, cfg_params );

// WARNING: do not place blocking actions within callback, it would block the lwm2m agent task!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_fota_cfg
if( resp != NULL )
{
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Fota config succeeded" );
// code
}
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent ID
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
cfg_params.mode = M2MB_LWM2M_FOTA_MODE_ALL_ACKED;
m2mb_lwm2m_agent_config( h, agentID );
retVal = m2mb_lwm2m_fota_cfg( h, &cfg_params );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_fota_cfg request succeeded" );
}
}

◆ m2mb_lwm2m_fota_cfg_read()

M2MB_RESULT_E m2mb_lwm2m_fota_cfg_read ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_FOTA_CFG_ITEM_T fotaCfgData,
UINT8  maxItemsNumber 
)

m2mb_lwm2m_fota_cfg_read reads the fota mode for all the active clients.

m2mb_lwm2m_fota_cfg_read allows the user to read the fota mode configured for all the active clients. The function is non-blocking. This means that the function returns immediately, but the response data is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_FOTA_CFG_READ_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_FOTA_CFG_READ_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]fotaCfgDatapointer to a M2MB_LWM2M_FOTA_CFG_ITEM_T structure array that will be filled with the fota mode info related to the active clients.
[in]maxItemsNumberthe maximum M2MB_LWM2M_FOTA_CFG_ITEM_T elements number that will be filled with the fota mode info.
Returns
a value from M2MB_RESULT_E
Note

m2mb_lwm2m_fota_cfg_read( h, fotaCfgData, maxItemsNumber );

#define MAX_ITEM_NUM_FOR_FOTA_CFG_READ ( 2 ) //max num of fota cfg items to be read
// WARNING: do not place blocking actions within callback, it would block the lwm2m agent task!
void myCallback( M2MB_LWM2M_HANDLE h,
UINT16 resp_size,
void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
// event in response to the m2mb_lwm2m_fota_cfg_read
if( resp != NULL )
{
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Fota configuations read succeeded" );
// code
}
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
M2MB_LWM2M_FOTA_CFG_ITEM_T fotaCfgData[MAX_ITEM_NUM_FOR_FOTA_CFG_READ];
UINT8 maxItemNum = MAX_ITEM_NUM_FOR_FOTA_CFG_READ;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
retVal = m2mb_lwm2m_fota_cfg_read( h, &fotaCfgData, maxItemNum );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_fota_cfg_read request succeeded" );
}
}

◆ m2mb_lwm2m_fota_status()

M2MB_RESULT_E m2mb_lwm2m_fota_status ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_FOTA_STATE_T fotaStateData 
)

m2mb_lwm2m_fota_status returns the fota data for the spcified LwM2M client.

m2mb_lwm2m_fota_status allows the user to acquire the client data related to the FOTA operations, in terms of current status and data exposed to the LwM2M server; moreover, in case of acknowledged FOTA configuration (i.e.: see m2mb_lwm2m_fota_cfg API), the data will contain also a valid 'ACK' time expiring, in case the client is waiting for an 'ACK'. The function is non-blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_FOTA_STATE_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_FOTA_STATE_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]fotaStateDatapointer to a structure containing the internal FOTA management data.
Returns
M2MB_RESULT_SUCCESS in case of success
a value of M2MB_RESULT_E in case of errors
Note

m2mb_lwm2m_fota_status( h, fotaStateData );

// WARNING: do not place blocking actions within callback, it would block the lwm2m agent task!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{
// event in response to the m2mb_lwm2m_fota_status
if( resp != NULL )
{
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Fota status read succeeded" );
// code
}
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
M2MB_LWM2M_FOTA_STATE_T fotaStateParams;
UINT16 agentID = 0; // Telit agent ID
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
m2mb_lwm2m_agent_config( h, agentID );
retVal = m2mb_lwm2m_fota_status( h, &fotaStateParams );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_fota_status request succeeded" );
}
}

◆ m2mb_lwm2m_get()

M2MB_RESULT_E m2mb_lwm2m_get ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
void *  outbuf,
UINT16  outbuflen 
)

m2mb_lwm2m_get reads the value of a LwM2M resource at module side

m2mb_lwm2m_get allows the user to read, at module side, the value of a resource, at the URI specified by parameter 'uri', which is defined as write-only by LwM2M protocol. It also allows the read-back of the value set with m2mb_lwm2m_set() API. The function returns immediately, and the result of the required operation is sent along with the callback defined in m2mb_lwm2m_init. In case of fatal error (example: client not ready), the function fails immediately and no callback is issued. In case of successful get, data is copied within the buffer passed by the user.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI of the resource to be get. Only a defined set of whitelisted URIs can be accepted by this function. If the resource is not included in this set an error is raised by the callback. The list of whitelisted URIs is: <TODO: add list of whitelisted URIs>
[in]outbufan user defined buffer to which the data will be copied.
[in]outbuflenthe size of the user defined buffer to which the data will be copied.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_get( h, uri, buf, len );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_GET_RES:
{
M2MB_LWM2M_GET_RES_T *resp = ( M2MB_LWM2M_GET_RES_T * )resp_struct;
printf( "Get result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR *buf = ( CHAR * )m2mb_os_malloc( 50 );
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 17; // Device type resource
retVal = m2mb_lwm2m_get( h, &uri, buf, 50 );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_get request succeeded" );
}
}

◆ m2mb_lwm2m_get_list_entries()

M2MB_RESULT_E m2mb_lwm2m_get_list_entries ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_get_list_entries returns the overall number of elements, expressed in M2MB_LWM2M_LIST_ELEMENT_RES_T units, necessary to specify all the objects/instances currently defined for a client.

m2mb_lwm2m_get_list_entry should be used to calculate the right dimension of the array needed for the m2mb_lwm2m_list. Using this function, the user is able to retrieve the number of the M2MB_LWM2M_LIST_ELEMENT_RES_T entries necessary to describe all the objects/instances pairs defined for a given client context; with it, the user is able to allocate the proper memory size. Since a single object could have more instances associated, every object instance is counted separately. Thus, m2mb_lwm2m_get_list_entries returns the overall entries (of M2MB_LWM2M_LIST_ELEMENT_RES_T type) that contain a valid object/object instance pair currently supported by the client. The function is not blocking. In case of success, nothing is returned; instead, the callback is configured to receive the required data through the M2MB_LWM2M_GET_LIST_NUM_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_GET_LIST_NUM_RES_T type. In case of fatal error (example: client not ready), the function returns a failure code and no callback event is issued. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_get_list_entries.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
It is suggested to call the m2mb_lwm2m_get_list_entries before the m2mb_lwm2m_list, in order to calculate the right array data dimension and avoid either having the result truncated or wasting memory.

m2mb_lwm2m_get_list_entries( h );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{
if( resp != NULL )
{
printf( "Getting list entries result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Overall items number is %d", resp->listEntries);
// code ...
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
m2mb_lwm2m_agent_config( h, agentID );
if( m2mb_lwm2m_get_list_entries( h ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_get_list_entries request succeeded" );
}
else
{
printf( "m2mb_lwm2m_get_list_entries request failed" );
}
}

◆ m2mb_lwm2m_get_reg_entries()

M2MB_RESULT_E m2mb_lwm2m_get_reg_entries ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_get_reg_entries returns the overall number of elements, expressed in M2MB_LWM2M_REG_ELEMENT_RES_T units, needed to specify all the information currently stored for the server data, when calling the m2mb_lwm2m_reg with M2MB_LWM2M_REG_ACTION_GET_SRV_INFO action.

m2mb_lwm2m_get_reg_entries should be used to calculate the right dimension of the array needed for the m2mb_lwm2m_reg. Using this function, the user is able to retrieve the number of the M2MB_LWM2M_REG_ELEMENT_RES_T entries needed to describe all the data stored for either a single server or the entire set of them a given client context; with it, the user is able to allocate the proper memory size.

The function is not blocking. In case of success, nothing is returned; instead, the callback is configured to receive the required data through the M2MB_LWM2M_GET_REG_NUM_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_GET_REG_NUM_RES_T type. In case of errors (example: client not ready), the function returns a failure code and no callback event is issued. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_get_reg_entries.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
This function has sense only when calling m2mb_lwm2m_get_reg with M2MB_LWM2M_REG_ACTION_GET_SRV_INFO action. In this case, it is suggested to call the m2mb_lwm2m_get_reg_entries before the m2mb_lwm2m_reg, in order to calculate the right array data dimension and avoid either having the result truncated or wasting memory.

m2mb_lwm2m_get_reg_entries( h );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
if( resp != NULL )
{
printf( "Getting reg entries result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Overall items number is %d", resp->regEntries);
// code ...
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
m2mb_lwm2m_agent_config( h, agentID );
if( m2mb_lwm2m_get_reg_entries( h ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_get_reg_entries request succeeded" );
}
else
{
printf( "m2mb_lwm2m_get_reg_entries request failed" );
}
}

◆ m2mb_lwm2m_get_resource_type()

M2MB_RESULT_E m2mb_lwm2m_get_resource_type ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
UINT16 *  resType 
)

m2mb_lwm2m_get_resource_type propagates the resource type for a required resource.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI specified by the user.
[in]outbufan user defined buffer in which the response will be stored. The buffer is returned in the callback event.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_get_resource_type( h, uri, resType );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_GET_TYPE_RES:
{ // event in response to the m2mb_lwm2m_get_resource_type
printf( "Returning resource type: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
printf( "Resource type is: %d", resp->resType );
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 resType = 0;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 33211; // Telit Services Management
uri.objInst = 0;
uri.resource = 0; // service enable resource
m2mb_lwm2m_agent_config( h, agentID );
retVal = m2mb_lwm2m_get_resource_type( h, &uri , &resType );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_get_resource_type request succeeded" );
}
}

◆ m2mb_lwm2m_get_stat()

M2MB_RESULT_E m2mb_lwm2m_get_stat ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_get_stat reads the current status of the LwM2M client

m2mb_lwm2m_get_stat reads the current status of the LwM2M client, allowing the user to know what action is currently performed and to retrieve piece of informations such as the remaining time before the following registration update.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function. The function returns immediately, and the user defined callback is issued whenever the status information is ready.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_get_stat( h );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_GET_STAT_RES:
{
printf( "Get stat result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
retVal = m2mb_lwm2m_get_stat( h );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_get_stat request succeeded" );
}
}

◆ m2mb_lwm2m_init()

M2MB_RESULT_E m2mb_lwm2m_init ( M2MB_LWM2M_HANDLE *  h,
m2mb_lwm2m_ind_callback  cb,
void *  cb_user_param 
)

m2mb_lwm2m_init initializes, for current client, the capability to interact with LwM2M agent.

m2mb_lwm2m_init initializes the LwM2M handle for current client, returning the handle that must be passed as first parameter for all interactions with LwM2M agent. Calling the m2mb_lwm2m_init is mandatory before using any other LwM2M API.

WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!

Parameters
[in]*hthe handle to the LwM2M service, that will be initialized by the function.
[in]cbthe callback that will be called if an event or an error happens.
[in]*cb_user_parama pointer to generic user data that will be returned as it is in the callback.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_init( &h, myCallback, myUserdata );

void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
//my code
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_init succeeded" );
}
}

◆ m2mb_lwm2m_injkeys()

M2MB_RESULT_E m2mb_lwm2m_injkeys ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_KEY_ACTION_E  action,
M2MB_LWM2M_KEYS_T keys 
)

m2mb_lwm2m_injkeys allows to inject or delete Endpoint Name and Keys for a given agent.

m2mb_lwm2m_injkeys allows to inject or delete Endpoint Name and Keys for a given agent. The new credentials will take effect at the next module reboot. The function is asynchronous. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_INJKEYS_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_RES_T type.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]actionthe action to execute.
[in]keyspointer to the M2MB_LWM2M_KEYS_T struct allocated by the caller containing the EP name and Keys to inject (empty when deleting).
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_injkeys( h, action, keys );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_INJKEYS_RES:
{ // event in response to the m2mb_lwm2m_injkeys
M2MB_LWM2M_RES_T *resp = ( M2MB_LWM2M_RES_T * )resp_struct;
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
printf( "m2mb_lwm2m_injkeys OK" );
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
strcpy( keys.endpoint_name, "my_ep_name" );
strcpy( keys.identity, "00112233445566778899AABBCCDDEEFF" );
strcpy( keys.secret_key, "FFEEDDCCBBAA99887766554433221100" );
m2mb_lwm2m_agent_config( h, agentID );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_injkeys request succeeded" );
}
}

◆ m2mb_lwm2m_list()

M2MB_RESULT_E m2mb_lwm2m_list ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_LIST_ELEMENT_RES_T listPointer,
UINT16  listSize 
)

m2mb_lwm2m_list returns all the objects/instances defined for a client

m2mb_lwm2m_list returns the list of objects and object instances currently supported by the client, expressed in M2MB_LWM2M_LIST_ELEMENT_RES_T items. The function is not blocking. In case of success, nothing is returned; instead, the callback defined in m2mb_lwm2m_init is configured to receive the required data through the M2MB_LWM2M_LIST_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_LIST_RES_T type. In case of fatal error (example: client not ready), the function returns with a failure core and no callback is issued. In case of successful operation, all the objects and object instances pairs are returned as consecutive elements of M2MB_LWM2M_LIST_ELEMENT_RES_T type, and the written entries is also returned on the M2MB_LWM2M_LIST_RES_T data structure. In case of successful operation but with an insufficient list size, the returned list is truncated to the last entry possibly contained in the given size's array, and the M2MB_LWM2M_LIST_RES_T parameter

Parameters
isTruncatedis set to TRUE. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_list.
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[out]listPointerthe pointer to the memory region that will be filled with the objects/instances, expressed in elements of M2MB_LWM2M_LIST_ELEMENT_RES_T type.
[in]listSizethe size of the memory area pointed by
listPointer,expressedin M2MB_LWM2M_LIST_ELEMENT_RES_T elements.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
Although the m2mb_lwm2m_get_list_entries is not strictly necessary, its use is strongly suggested in order to calculate the right array data dimension.

m2mb_lwm2m_list( h, listPointer, listSize );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{
M2MB_LWM2M_LIST_RES_T *resp = ( M2MB_LWM2M_LIST_RES_T * )resp_struct;
if( resp != NULL )
{
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
// for simplicity, the example is for retrieving max 15 elements from the list of objects/object instances defined
// for the Telit LwM2M agent. In order to minimize the memory occupied by pList dynamic allocation, please refer
// to m2mb_lwm2m_get_entries function
UINT16 listSize = 15;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
m2mb_lwm2m_agent_config( h, agentID );
if( pList != NULL )
{
if( m2mb_lwm2m_list( h, &list, listSize ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_list request succeeded" );
}
else
{
printf( "m2mb_lwm2m_list request failed" );
}
}
}

◆ m2mb_lwm2m_mon()

M2MB_RESULT_E m2mb_lwm2m_mon ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
M2MB_LWM2M_MON_REQ_T mon_params 
)

m2mb_lwm2m_mon sets the monitoring status an LwM2M resource at module side

m2mb_lwm2m_mon allows the user to enable or disable the monitoring of resource changes. The changes can occur both from AT command side (#LWM2MW or #LWM2MSET) or from a server request. The function is asynchronous. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_MON_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_MON_RES_T type. The user is allowed to enable the object monitoring and it will be advised of each resource change in this object with an URC. The object to be monitored should be specified by parameter inserting it in the parameter 'uri', although only the object identifier field in 'uri' is currently taken into account.

Once the monitoring is activated, each resource change will generate an event that should be managed in the same callback. This event is the M2MB_LWM2M_MON_INFO_IND; in this case, it is reported the uri of the resource that has changed; resp_struct must be cast to the M2MB_LWM2M_MON_INFO_IND_T type.

Please notice that, in case of full monitoring list retrieve, the list is returned as a M2MB_LWM2M_OBJ_URI_T array of MAX_MONITOR_LIST_COUNT elements; only the ObjectID field will contain data; please notice that object '0' (Security) is not monitorable, so its value in this list indicates an empty item.

In case of fatal error (example: not enough heap memory for internal use), the function fails immediately and no callback is issued.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI of the resource to be monitored. Only the object identifier is currently used, although with further developments it could be extended the monitoring to single object instances and single resource identifiers (and consequently the URCs will be restricted to a minor set of data). Nevertheless, the full URI originating the resource change is reported in the URC.
[in]mon_paramsa structure that contains the enable/disable action request, and the operation mode to be performed (set a new object to be monitored, or read the full list of objects under monitoring.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
Monitoring events will be issued also when the changing resource operations (e.g. write, set) are performed by the client itself with m2mb APIs.

m2mb_lwm2m_mon( h, uri, mon );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_MON_RES:
{ // event in response to the m2mb_lwm2m_mon
M2MB_LWM2M_MON_RES_T *resp = ( M2MB_LWM2M_MON_RES_T * )resp_struct;
printf( "Resource change monitor setting result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
case M2MB_LWM2M_MON_INFO_IND:
{ // event that brings a resource change information
// code; i.e.:
// uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
// the last one in the printf below
if( pInfo->uri.uriLen == 4 )
{
printf( "resource changed: /%d/%d/%d/%d,
pInfo->uri.obj
pInfo->uri.objInst,
pInfo->uri.resource,
pInfo->uri.resourceInst );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
M2MB_LWM2M_OBJ_URI_T uri;
M2MB_LWM2M_MON_REQ_T mon;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
// setting a new monitoring for object 3
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 0;
mon.action = M2MB_LWM2M_MON_ENABLE;
mon.mode = M2MB_LWM2M_MON_MODE_SET_CMD;
retVal = m2mb_lwm2m_mon( h, &uri, &mon );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_mon request succeeded" );
}
//...
// reading the full monitoring list
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 0; // Device object
uri.objInst = 0;
uri.resource = 0;
mon.action = M2MB_LWM2M_MON_DISABLE;
mon.mode = M2MB_LWM2M_MON_MODE_READ_CMD;
retVal = m2mb_lwm2m_mon( h, &uri, &mon );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_mon request succeeded" );
}
}

◆ m2mb_lwm2m_newinst()

M2MB_RESULT_E m2mb_lwm2m_newinst ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
M2MB_LWM2M_NEW_INST_REQ_T new_inst_params 
)

m2mb_lwm2m_newinst creates a specified instance for a specified object

m2mb_lwm2m_newinst allows the user to create an instance for a specified object, filling all its resources with their proper default values (0 for numeric types, "" for strings) according to the resource types. The function is asynchronous. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_NEW_INST_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_NEW_INST_RES_T type. The user can create a new object instance only when the LwM2M client is up and running.

In case of fatal error (example: not enough heap memory for internal use), the function fails immediately and no callback is issued.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI specified by the user (only object ID and object instance ID are managed).
[in]new_inst_paramsa structure that contains the agent specified by the user. Currently only Telit agent is fully supported. The parameter is a M2MB_LWM2M_NEW_INST_REQ_T handler.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note

m2mb_lwm2m_newinst( h, uri, new_inst_params );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_NEW_INST_RES:
{ // event in response to the m2mb_lwm2m_newinst
printf( "Creating object instance specified: result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
M2MB_LWM2M_NEW_INST_REQ_T new_inst_params;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
// setting a new instance 21 for object 33205
uri.uriLen = M2MB_LWM2M_URI_2_FIELDS; // currently not managed
uri.obj = 33205;
uri.objInst = 21;
uri.resource = 0; // even if specified, this field will be forced to 0
uri.resourceInst = 0; // even if specified, this field will be forced to 0
new_inst_params.agent = 0; // Telit agent
retVal = m2mb_lwm2m_newinst( h, &uri, &new_inst_params );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_newinst request succeeded" );
}
}

◆ m2mb_lwm2m_nfy_ack_list()

M2MB_RESULT_E m2mb_lwm2m_nfy_ack_list ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uriList,
UINT8  listElementsNumber 
)

m2mb_lwm2m_nfy_ack_list retrieves the list for Notify Ack reporting

m2mb_lwm2m_nfy_ack_list allows the user to retrieve the list for Notify Ack reporting.

The function is not blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_NFYACK_LIST_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_NFYACK_LIST_RES_T type.

Once the Notify Ack reporting is enabled, each change of a resource (whose URI has been previously added in the list by using the m2mb_lwm2m_nfy_ack_uri) will generate an event (M2MB_LWM2M_NFYACK_INFO_IND) that should be managed in the same callback. The M2MB_LWM2M_NFYACK_INFO_IND event reports the URI of the resource that has changed; resp_struct must be cast to the M2MB_LWM2M_NFYACK_INFO_IND_T type.

In case of fatal error (example: not enough heap memory for internal use), the function fails immediately and no callback is issued.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uriLista pointer to the preallocated array of M2MB_LWM2M_OBJ_URI_T elements to be filled with the list elements.
[in]listElementsNumberthe number of M2MB_LWM2M_OBJ_URI_T elements the uriList has been allocated of.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
m2mb_lwm2m_agent_config has to be previously called, in order to configure the agent the request will be related to

m2mb_lwm2m_nfy_ack_list( h, uriList, listElementsNumber );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_NFYACK_STATUS_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_status
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "current status for Notify Ack reporting is %s", ( ( resp->enabled == TRUE ) ? ( "ENABLED" ) : ( "DISABLED" ) ) );
}
break;
}
case M2MB_LWM2M_NFYACK_URI_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_uri
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "m2mb_lwm2m_nfy_ack_uri response OK" );
}
break;
}
case M2MB_LWM2M_NFYACK_LIST_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_list
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "m2mb_lwm2m_nfy_ack_list read %hu elements", nfyAckListResponse->listElementsNumber );
}
break;
}
//...
case M2MB_LWM2M_NFYACK_INFO_IND:
{ // event that brings a Notify Ack information
// code; i.e.:
// uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
// the last one in the printf below
if( ( pInfo ) && ( pInfo->uri.uriLen == 3 ) )
{
printf( "#LWM2MNFYACK: agentId %hu, SSID %hu, uri \"/%hu/%hu/%hu\", %s",
pInfo->agent,
pInfo->shServerId,
pInfo->uri.obj,
pInfo->uri.objInst,
pInfo->uri.resource,
( pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED ) ? ( "ACK RECEIVED" ) : ( "ACK NOT RECEIVED" ) );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
BOOLEAN set = TRUE;
BOOLEAN enable = TRUE;
BOOLEAN add = TRUE;
M2MB_LWM2M_OBJ_URI_T uri = { 0 };
UINT8 listElements = 6;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
//configuring agent Telit
retVal = m2mb_lwm2m_agent_config( h, agentID );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_agent_config request succeeded" );
}
//adding an URI to the list
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 0;
uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
retVal = m2mb_lwm2m_nfy_ack_uri( h, add, &uri );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_uri request succeeded" );
}
//trying to read the URI list
uriList = ( M2MB_LWM2M_OBJ_URI_T * ) m2mb_os_calloc( listElements * sizeof( M2MB_LWM2M_OBJ_URI_T ) );
retVal = m2mb_lwm2m_nfy_ack_list( h, uriList, listElements );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_list request succeeded" );
}
//setting the status to ENABLED
retVal = m2mb_lwm2m_nfy_ack_status( h, set, enable );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_status request succeeded" );
}
}

◆ m2mb_lwm2m_nfy_ack_status()

M2MB_RESULT_E m2mb_lwm2m_nfy_ack_status ( M2MB_LWM2M_HANDLE  h,
BOOLEAN  set,
BOOLEAN  enable 
)

m2mb_lwm2m_nfy_ack_status sets or gets the flag to enable or disable Notify Ack reporting

m2mb_lwm2m_nfy_ack_status allows the user to enable or disable the reporting of Acknowledgments sent by a server that receives a Notify message for a resource under observation. The function is not blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_NFYACK_STATUS_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_NFYACK_STATUS_RES_T type.

Once the Notify Ack reporting is enabled, each change of a resource (whose URI has been previously added in the list by using the m2mb_lwm2m_nfy_ack_uri) will generate an event (M2MB_LWM2M_NFYACK_INFO_IND) that should be managed in the same callback. The M2MB_LWM2M_NFYACK_INFO_IND event reports the URI of the resource that has changed; resp_struct must be cast to the M2MB_LWM2M_NFYACK_INFO_IND_T type.

In case of fatal error (example: not enough heap memory for internal use), the function fails immediately and no callback is issued.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]setwhether a set (if TRUE) or get (if FALSE) request has to be performed.
[in]enableBOOLEAN variable that enables (if TRUE) or disables (if FALSE) the Notify Ack reporting when set is TRUE.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
m2mb_lwm2m_agent_config has to be previously called, in order to configure the agent the request will be related to

m2mb_lwm2m_nfy_ack_status( h, set, enable );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_NFYACK_STATUS_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_status
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "current status for Notify Ack reporting is %s", ( ( resp->enabled == TRUE ) ? ( "ENABLED" ) : ( "DISABLED" ) ) );
}
break;
}
//...
case M2MB_LWM2M_NFYACK_INFO_IND:
{ // event that brings a Notify Ack information
// code; i.e.:
// uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
// the last one in the printf below
if( ( pInfo ) && ( pInfo->uri.uriLen == 3 ) )
{
printf( "#LWM2MNFYACK: agentId %hu, SSID %hu, uri \"/%hu/%hu/%hu\", %s",
pInfo->agent,
pInfo->shServerId,
pInfo->uri.obj,
pInfo->uri.objInst,
pInfo->uri.resource,
( pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED ) ? ( "ACK RECEIVED" ) : ( "ACK NOT RECEIVED" ) );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
BOOLEAN set = TRUE;
BOOLEAN enable = TRUE;
BOOLEAN add = TRUE;
M2MB_LWM2M_OBJ_URI_T uri = { 0 };
UINT8 listElements = 6;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
//configuring agent Telit
retVal = m2mb_lwm2m_agent_config( h, agentID );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_agent_config request succeeded" );
}
//setting the status to ENABLED
retVal = m2mb_lwm2m_nfy_ack_status( h, set, enable );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_status request succeeded" );
}
}

◆ m2mb_lwm2m_nfy_ack_uri()

M2MB_RESULT_E m2mb_lwm2m_nfy_ack_uri ( M2MB_LWM2M_HANDLE  h,
BOOLEAN  add,
M2MB_LWM2M_OBJ_URI_T uri 
)

m2mb_lwm2m_nfy_ack_uri adds or removes a resource URI to the list for Notify Ack reporting

m2mb_lwm2m_nfy_ack_uri allows the user to add or remove a resource URI to the list for Notify Ack reporting; if that resource is under observation and its URI is in this list, the Notify Ack will be reported. The function is not blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_NFYACK_URI_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_NFYACK_URI_RES_T type.

Once the Notify Ack reporting is enabled, each change of a resource (whose URI has been previously added in the list by using the m2mb_lwm2m_nfy_ack_uri) will generate an event (M2MB_LWM2M_NFYACK_INFO_IND) that should be managed in the same callback. The M2MB_LWM2M_NFYACK_INFO_IND event reports the URI of the resource that has changed; resp_struct must be cast to the M2MB_LWM2M_NFYACK_INFO_IND_T type.

In case of fatal error (example: not enough heap memory for internal use), the function fails immediately and no callback is issued.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]addwhether an add (if TRUE) or remove (if FALSE) request has to be performed.
[in]uria pointer to the preallocated structure that defines the URI of the item to add (or remove).
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
m2mb_lwm2m_agent_config has to be previously called, in order to configure the agent the request will be related to

m2mb_lwm2m_nfy_ack_uri( h, add, uri );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_NFYACK_STATUS_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_status
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "current status for Notify Ack reporting is %s", ( ( resp->enabled == TRUE ) ? ( "ENABLED" ) : ( "DISABLED" ) ) );
}
break;
}
case M2MB_LWM2M_NFYACK_URI_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_uri
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "m2mb_lwm2m_nfy_ack_uri response OK" );
}
break;
}
case M2MB_LWM2M_NFYACK_LIST_RES:
{ // event in response to the m2mb_lwm2m_nfy_ack_list
if( ( resp ) && ( resp->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "m2mb_lwm2m_nfy_ack_list read %hu elements", nfyAckListResponse->listElementsNumber );
}
break;
}
//...
case M2MB_LWM2M_NFYACK_INFO_IND:
{ // event that brings a Notify Ack information
// code; i.e.:
// uriLen value is the number of valid fields of the URI, starting from the 1st and going towards
// the last one in the printf below
if( ( pInfo ) && ( pInfo->uri.uriLen == 3 ) )
{
printf( "#LWM2MNFYACK: agentId %hu, SSID %hu, uri \"/%hu/%hu/%hu\", %s",
pInfo->agent,
pInfo->shServerId,
pInfo->uri.obj,
pInfo->uri.objInst,
pInfo->uri.resource,
( pInfo->nfyState == M2MB_LWM2M_NFY_STATE_ACK_RECEIVED ) ? ( "ACK RECEIVED" ) : ( "ACK NOT RECEIVED" ) );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
BOOLEAN set = TRUE;
BOOLEAN enable = TRUE;
BOOLEAN add = TRUE;
M2MB_LWM2M_OBJ_URI_T uri = { 0 };
UINT8 listElements = 6;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
//configuring agent Telit
retVal = m2mb_lwm2m_agent_config( h, agentID );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_agent_config request succeeded" );
}
//adding an URI to the list
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 0;
uri.resourceInst = 0; // better set it to 0, even if M2MB_LWM2M_URI_3_FIELDS
retVal = m2mb_lwm2m_nfy_ack_uri( h, add, &uri );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_uri request succeeded" );
}
//trying to read the URI list
uriList = ( M2MB_LWM2M_OBJ_URI_T * ) m2mb_os_calloc( listElements * sizeof( M2MB_LWM2M_OBJ_URI_T ) );
retVal = m2mb_lwm2m_nfy_ack_list( h, uriList, listElements );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_list request succeeded" );
}
//setting the status to ENABLED
retVal = m2mb_lwm2m_nfy_ack_status( h, set, enable );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_nfy_ack_status request succeeded" );
}
}

◆ m2mb_lwm2m_objget()

M2MB_RESULT_E m2mb_lwm2m_objget ( M2MB_LWM2M_HANDLE  h,
const M2MB_LWM2M_OBJGET_PARAM_T objGetReq,
CHAR *  objGetRespString,
UINT16  objGetRespSize 
)

m2mb_lwm2m_objget reads a Lwm2m object/object instance/resource.

m2mb_lwm2m_objset performs a read operation on a specified Lwm2m object, object instance or resource (as in CoAP GET method). The data is presented using a json string in accordance with the format defined in Lwm2m specification, see section 6.4.4 of OMA Lwm2m specification ver. 1.0.2 (Data Formats for Transferring Resource Information - JSON). The function is not blocking. In case of success, nothing is returned; instead, the callback defined in m2mb_lwm2m_init is configured to receive the required data through the M2MB_LWM2M_OBJGET_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_OBJGET_RES_T type. In case of errors (example: client not ready), the function returns with a failure code and no callback is issued. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_objget.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]objGetReqthe pointer to the data useful to manage the m2mb_lwm2m_objget.
[out]objGetRespStringpointer to a preallocated buffer that will contain the operation response
[in]objGetRespSizesize of the objGetRespString buffer
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.

m2mb_lwm2m_objget( h, objSetReq );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
if( resp != NULL )
{
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
UINT16 objGetRespSize = 7680; //size of the buffer where to write the response
CHAR* objGetRespString = ( CHAR* ) m2mb_os_calloc( objGetRespSize * sizeof( CHAR ) );
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
memset( &objGetReq, 0, sizeof( M2MB_LWM2M_OBJGET_PARAM_T ) );
// write objGetReq.uri (M2MB_LWM2M_URI_0_FIELDS and M2MB_LWM2M_URI_4_FIELDS are not allowed in
// objGetReq.uri.uriLen)
objGetReq.agentId = agentID;
//...
m2mb_lwm2m_agent_config( h, agentID );
if( m2mb_lwm2m_objget( h, &objGetReq, objGetRespString, objGetRespSize ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_objget request succeeded" );
}
else
{
printf( "m2mb_lwm2m_objget request failed" );
}
}

◆ m2mb_lwm2m_objset()

M2MB_RESULT_E m2mb_lwm2m_objset ( M2MB_LWM2M_HANDLE  h,
const M2MB_LWM2M_OBJSET_PARAM_T objSetReq 
)

m2mb_lwm2m_objset updates one or more resources of a Lwm2m object instance.

m2mb_lwm2m_objset performs a write operation on a specified Lwm2m object instance, updating the object instance as in the partial update or (CoAP POST method). The data is provided by the caller using a json string in accordance with the format defined in Lwm2m specification, see section 6.4.4 of OMA Lwm2m specification ver. 1.0.2 (Data Formats for Transferring Resource Information - JSON). The function is not blocking. In case of success, nothing is returned; instead, the callback defined in m2mb_lwm2m_init is configured to receive the required data through the M2MB_LWM2M_OBJSET_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_OBJSET_RES_T type. In case of errors (example: client not ready), the function returns with a failure code and no callback is issued. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_objset.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]objSetReqthe pointer to the data useful to manage the m2mb_lwm2m_objset.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.

m2mb_lwm2m_objset( h, objSetReq );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
if( resp != NULL )
{
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
memset( &objSetReq, 0, sizeof( M2MB_LWM2M_OBJSET_PARAM_T ) );
// write objSetReq.objectId and objSetReq.objectInstanceID
// write the json to objSetReq.dataString and fill objSetReq.dataStringSize accordingly
// objSetReq.dataStringSize includes the string terminator
//...
m2mb_lwm2m_agent_config( h, agentID );
if( m2mb_lwm2m_objset( h, &objSetReq ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_objset request succeeded" );
}
else
{
printf( "m2mb_lwm2m_objset request failed" );
}
}

◆ m2mb_lwm2m_odis()

M2MB_RESULT_E m2mb_lwm2m_odis ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_odis allows the user to store the odis data set into nv memory.

m2mb_lwm2m_odis allows the user to store the odis data set into nv memory by using the AT&T LwM2M client. The odis data managed by this function is written in the instance '0'.

The function is not blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_ODIS_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_ODIS_RES_T type.

Parameters
[in]hthe LwM2M service handler, previously initialized by the m2mb_lwm2m_init function.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
before calling the m2mb_lwm2m_odis, the odis data should be stored on a temporary memory placement by calling the m2mb_lwm2m_odis_config for each parameter. It is recommended to clean the temporary memory area with the m2mb_lwm2m_odis_reset just after the m2mb_lwm2m_odis invokation, whether it succeeds or not.

m2mb_lwm2m_odis( h );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_nfy_ack_status
M2MB_LWM2M_ODIS_RES_T *odisResponse = ( M2MB_LWM2M_ODIS_RES_T * )resp_struct;
if( ( odisResponse != NULL ) && ( odisResponse->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "#M2MB_ODIS succeeded" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR hostDeviceId[] = "host_device";
CHAR hostManufacturerId[] = "host_manufacturer";
CHAR hostModelId[] = "host_model";
CHAR hostSwVersion[] = "host_software_version";
//...
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
// odis data collection
hostDeviceId ) == M2MB_RESULT_SUCCESS )
{
hostManufacturerId ) == M2MB_RESULT_SUCCESS )
{
hostModelId ) == M2MB_RESULT_SUCCESS )
{
hostSwVersion ) == M2MB_RESULT_SUCCESS )
{
//executing the m2mb for ODIS command
retVal = m2mb_lwm2m_odis( h );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_odis request succeeded" );
}
}
}
}
}
// resetting the odis memory area in the handler
}

◆ m2mb_lwm2m_odis_config()

M2MB_RESULT_E m2mb_lwm2m_odis_config ( M2MB_LWM2M_HANDLE  h,
ODIS_PARAMETERS_E  odis_item,
CHAR *  odis_data 
)

m2mb_lwm2m_odis_config is in charge of filling the selected otis item with the given data.

m2mb_lwm2m_odis_config should be called once for each odis parameter.

Parameters
[in]hthe LwM2M service handler, previously initialized by the m2mb_lwm2m_init function.
[in]odis_itemthe item to be saved, expressed with the ODIS_PARAMETERS_E type.
[in]odis_datathe data to be saved in the temporary odis_item memory buffer, expressed as a terminated string.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
in order to have the m2mb_lwm2m_odis successful, the m2mb_lwm2m_odis_config should always be invoked once for each parameter for the odis parameter storing cycle. Since the m2mb_lwm2m_odis_config could only work on clean memory, it is recommended to clean the temporary memory area invoking the m2mb_lwm2m_odis_reset just after the m2mb_lwm2m_odis execution, whether it succeeds or not. Provided that the m2mb_lwm2m_odis_reset is non executed immediately after the m2mb_lwm2m_odis, in case of setting the odis parameters for a second or successive time, m2mb_lwm2m_odis_reset may also be invoked before the m2mb_lwm2m_odis_config invokations. For a code example, please see the code section below.

m2mb_lwm2m_odis_config( h, odis_item, odis_data );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_nfy_ack_status
M2MB_LWM2M_ODIS_RES_T *odisResponse = ( M2MB_LWM2M_ODIS_RES_T * )resp_struct;
if( ( odisResponse != NULL ) && ( odisResponse->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "#M2MB_ODIS succeeded" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR hostDeviceId[] = "host_device";
CHAR hostManufacturerId[] = "host_manufacturer";
CHAR hostModelId[] = "host_model";
CHAR hostSwVersion[] = "host_software_version";
UINT8 odisInstance = 1; // acting on Odis instance 1
//...
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
// odis data collection
hostDeviceId ) == M2MB_RESULT_SUCCESS )
{
hostManufacturerId ) == M2MB_RESULT_SUCCESS )
{
hostModelId ) == M2MB_RESULT_SUCCESS )
{
hostSwVersion ) == M2MB_RESULT_SUCCESS )
{
//executing the m2mb for ODIS command
retVal = m2mb_lwm2m_odis_set( h, odisInstance );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_odis_set request succeeded" );
}
}
}
}
}
// resetting the odis memory area in the handler
}

◆ m2mb_lwm2m_odis_reset()

M2MB_RESULT_E m2mb_lwm2m_odis_reset ( M2MB_LWM2M_HANDLE  h)

m2mb_lwm2m_odis_reset is in charge of resetting the handler data fields reserved for odis.

handler data fields reserved for odis should be reset after their use in odis storing or before any successive odis configuration. Resetting the handler data filled will result in freeing its dedicated amount of allocated memory.

Parameters
[in]hthe LwM2M service handler, previously initialized by the m2mb_lwm2m_init function.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
the temporary memory for odis is internally clean during the module initialization. In the sequence to configure the odis parameters before the odis storing, the m2mb_lwm2m_odis_reset should always be invoked after the first odis storing (m2mb_lwm2m_odis) or before the m2mb_lwm2m_odis_config calls in case of successive odis setting, since the m2mb_lwm2m_odis_config could succeed only working on a clean memory. Please notice that it is not mandatory to invoke the m2mb_lwm2m_odis_reset before the very first odis configuration. For a code example, please see the code section below.

m2mb_lwm2m_odis_reset( h );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_nfy_ack_status
M2MB_LWM2M_ODIS_RES_T *odisResponse = ( M2MB_LWM2M_ODIS_RES_T * )resp_struct;
if( ( odisResponse != NULL ) && ( odisResponse->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "#M2MB_ODIS succeeded" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR hostDeviceId[] = "host_device";
CHAR hostManufacturerId[] = "host_manufacturer";
CHAR hostModelId[] = "host_model";
CHAR hostSwVersion[] = "host_software_version";
UINT8 odisInstance = 0; // acting on Odis instance 0
//...
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
// odis data collection
hostDeviceId ) == M2MB_RESULT_SUCCESS )
{
hostManufacturerId ) == M2MB_RESULT_SUCCESS )
{
hostModelId ) == M2MB_RESULT_SUCCESS )
{
hostSwVersion ) == M2MB_RESULT_SUCCESS )
{
//executing the m2mb for ODIS command
retVal = m2mb_lwm2m_odis_set( h, odisInstance );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_odis_set request succeeded" );
}
}
}
}
}
// resetting the odis memory area in the handler
}

◆ m2mb_lwm2m_odis_set()

M2MB_RESULT_E m2mb_lwm2m_odis_set ( M2MB_LWM2M_HANDLE  h,
UINT8  odis_instance 
)

m2mb_lwm2m_odis_set allows the user to store the odis data set into the given instance in nv memory.

m2mb_lwm2m_odis_set allows the user to store the odis data set into nv memory by using the AT&T LwM2M client.

The function is not blocking. This means that the function returns immediately, but the response information is received in the callback previously set by the m2mb_lwm2m_init function. The event received in the callback is M2MB_LWM2M_ODIS_RES. In this case the resp_struct must be cast to the M2MB_LWM2M_ODIS_RES_T type.

Parameters
[in]hthe LwM2M service handler, previously initialized by the m2mb_lwm2m_init function.
[in]odis_instancethe given Odis instance.
Returns
returns M2MB_RESULT_SUCCESS on success, a different value on error.
Note
before calling the m2mb_lwm2m_odis_set, the odis data should be stored on a temporary memory placement by calling the m2mb_lwm2m_odis_config for each parameter. It is recommended to clean the temporary memory area with the m2mb_lwm2m_odis_reset just after the m2mb_lwm2m_odis_set invokation, whether it succeeds or not.

m2mb_lwm2m_odis_set( h, odis_instance );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{ // event in response to the m2mb_lwm2m_nfy_ack_status
M2MB_LWM2M_ODIS_RES_T *odisResponse = ( M2MB_LWM2M_ODIS_RES_T * )resp_struct;
if( ( odisResponse != NULL ) && ( odisResponse->result == M2MB_LWM2M_RES_SUCCESS ) )
{
// code
printf( "#M2MB_ODIS succeeded" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR hostDeviceId[] = "host_device";
CHAR hostManufacturerId[] = "host_manufacturer";
CHAR hostModelId[] = "host_model";
CHAR hostSwVersion[] = "host_software_version";
UINT8 odisInstance = 1; // acting on Odis instance 1
//...
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
// odis data collection
hostDeviceId ) == M2MB_RESULT_SUCCESS )
{
hostManufacturerId ) == M2MB_RESULT_SUCCESS )
{
hostModelId ) == M2MB_RESULT_SUCCESS )
{
hostSwVersion ) == M2MB_RESULT_SUCCESS )
{
//executing the m2mb for ODIS command
retVal = m2mb_lwm2m_odis_set( h, odisInstance );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_odis_set request succeeded" );
}
}
}
}
}
// resetting the odis memory area in the handler
}

◆ m2mb_lwm2m_read()

M2MB_RESULT_E m2mb_lwm2m_read ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
void *  outbuf,
UINT16  outbuflen 
)

m2mb_lwm2m_read reads the LwM2M resource at the given URI

m2mb_lwm2m_read reads the LwM2M resource at the URI specified by parameter 'uri', performing an operation equivalent to a read from server side. The function returns immediately, and the result of the required operation is sent along with the callback defined in m2mb_lwm2m_init. According to this, the read result is made available in the memory area defined by the m2mb's user after a little delay. In case of fatal error (example: client not ready), the function fails immediately and no callback is issued. In case of successful read, data is copied in the buffer passed by the user.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI of the resource to be read. If the resource is not readable, an error is raised by the callback.
[in]outbufan user defined buffer in which the response will be stored.
[in]outbuflenthe size of the user defined buffer in which the response will be stored.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
It is worth noting that for 'float' and 'int' types, the client could manage sizes up to 64 bits length; therefore, to avoid problems of memory overlapping, in case of float data type the user should pass inbuf and inbuflen parameters sized for a double float, and in case of integer data type the user should pass inbuf and inbuflen parameters sized for a INT64.

m2mb_lwm2m_read( h, uri, buf, len );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_READ_RES:
{
M2MB_LWM2M_READ_RES_T *resp = ( M2MB_LWM2M_READ_RES_T * )resp_struct;
printf( "Read result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR *buf = ( CHAR * )m2mb_os_malloc( 50 );
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3;
uri.objInst = 0;
uri.resource = 0;
retVal = m2mb_lwm2m_read( h, &uri, buf, 50 );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_read request succeeded" );
}
}

◆ m2mb_lwm2m_reg()

M2MB_RESULT_E m2mb_lwm2m_reg ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_REG_PARAM_T regReq,
M2MB_LWM2M_REG_ELEMENT_RES_T listPointer,
UINT16  listSize 
)

m2mb_lwm2m_reg manages the user connection request for the specified server.

m2mb_lwm2m_reg manages the given action for the specified server; if the actionId is M2MB_LWM2M_REG_ACTION_GET_SRV_INFO and the serverId pointer is set to NULL, the function retrieves the info for all the servers associated to the queried agent. If the serverId is specified by the user, it retrieves only the info for that server. The result of the action M2MB_LWM2M_REG_ACTION_GET_SRV_INFO is expressed in an array of M2MB_LWM2M_REG_ELEMENT_RES_T items. All the other actions need the serverId to be specified. The function is not blocking. In case of success, nothing is returned; instead, the callback defined in m2mb_lwm2m_init is configured to receive the required data through the M2MB_LWM2M_REG_RES event. In this case the resp_struct must be cast to the M2MB_LWM2M_REG_RES_T type. In case of errors (example: client not ready), the function returns with a failure code and no callback is issued. In case of successful operation, if the specified the action is M2MB_LWM2M_REG_ACTION_GET_SRV_INFO, all the servers data is returned as consecutive elements of M2MB_LWM2M_REG_ELEMENT_RES_T type, and the written entries is also returned on the M2MB_LWM2M_REG_RES_T data structure. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_reg.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]regReqthe pointer to the data useful to manage the m2mb_lwm2m_reg.
[out]listPointerin case the required action is M2MB_LWM2M_REG_ACTION_GET_SRV_INFO, it is the pointer to the memory region that will be filled with the M2MB_LWM2M_REG_ELEMENT_RES_T elements, expressed in elements of M2MB_LWM2M_REG_ELEMENT_RES_T type. In case of different actions, it can be set to NULL.
[in]listSizein case the required action is M2MB_LWM2M_REG_ACTION_GET_SRV_INFO, it is the size of the memory area pointed by
listPointer,expressedin M2MB_LWM2M_REG_ELEMENT_RES_T elements. In case of different actions, it can be set to 0.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
Although the m2mb_lwm2m_get_reg_entries is not strictly necessary, its use is strongly suggested in case the action required is M2MB_LWM2M_REG_ACTION_GET_SRV_INFO, in order to calculate the right array data dimension.

m2mb_lwm2m_reg( h, regRequest, listPointer, listSize );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct,
void *userdata )
{
switch( event )
{
//...
{
M2MB_LWM2M_REG_RES_T *resp = ( M2MB_LWM2M_REG_RES_T * )resp_struct;
if( resp != NULL )
{
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// Manage result value
}
}
else
{
printf( "invalid pointer received" );
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
UINT16 agentID = 0; // Telit agent
// for simplicity, the example is for retrieving max 2 elements from the list of server data defined
// for the Telit LwM2M multiserver agent. In order to minimize the memory occupied by pList dynamic
// allocation, please refer to m2mb_lwm2m_get_reg_entries function
UINT16 listSize = 2;
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
memset( &regReq, 0, sizeof( M2MB_LWM2M_REG_PARAM_T ) );
regReq.agentId = agentID;
regReq.serverId = NULL; // requires the entire list of servers data to be returned
//...
m2mb_lwm2m_agent_config( h, agentID );
if( pList != NULL )
{
if( m2mb_lwm2m_reg( h, &regReq, &list, listSize ) == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_reg request succeeded" );
}
else
{
printf( "m2mb_lwm2m_reg request failed" );
}
}
}

◆ m2mb_lwm2m_set()

M2MB_RESULT_E m2mb_lwm2m_set ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
void *  inbuf,
UINT16  inbuflen 
)

m2mb_lwm2m_set sets the value of a LwM2M resource at module side

m2mb_lwm2m_set allows the user to drive, at module side, the value of a resource, at the URI specified by parameter 'uri', which is defined as read-only by LwM2M protocol. This value will be shown to any following read from server side or through m2mb_lwm2m_read(). The function returns immediately, and the result of the required operation is sent along with the callback defined in m2mb_lwm2m_init. In case of fatal error (example: client not ready), the function fails immediately and no callback is issued. In case of successful set, data is copied from the buffer passed by the user. Values set through this API can be read back by means of m2mb_lwm2m_get() API.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI of the resource to be written. Only a defined set of whitelisted URIs can be accepted by this function. If the resource is not included in this set (meaning that the resource value, even if read only, is automatically obtained by the agent and cannot be driven by the user), an error is raised by the callback. The list of whitelisted URIs is: <TODO: add list of whitelisted URIs>
[in]inbufan user defined buffer from which the data will be copied.
[in]inbuflenthe size of the user defined buffer from which the data will be copied.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
Please notice that changes on any resource during the bootstrap should be avoided, in order to not override the server bootstrap configuration.

m2mb_lwm2m_set( h, uri, buf, len );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_SET_RES:
{
M2MB_LWM2M_SET_RES_T *resp = ( M2MB_LWM2M_SET_RES_T * )resp_struct;
printf( "Set result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR *buf = ( CHAR * )m2mb_os_malloc( 50 );
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 3; // Device object
uri.objInst = 0;
uri.resource = 17; // Device type resource
strcpy( buf, "CustomDeviceType" );
retVal = m2mb_lwm2m_set( h, &uri, buf, strlen( buf ) );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_set request succeeded" );
}
}

◆ m2mb_lwm2m_sts()

M2MB_RESULT_E m2mb_lwm2m_sts ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_STS_URI_T reqStsStructure 
)

m2mb_lwm2m_sts sets the next server address

m2mb_lwm2m_sts allows either setting the next server address loaded by the LwM2M client or restoring a previously server chosen. The server address will be used at the next module reboot. This function should be used only for certification purposes, where the certification tests server differs from the ordinary one. m2mb_lwm2m_agent_config should always be called before the m2mb_lwm2m_sts.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function. The function returns immediately, and the user defined callback is issued whenever the status information is ready.
[in]reqStsStructurepointer to the LwM2M structure that contains the information needed for #LWM2MSTS command managing
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
field uriLen on M2MB_LWM2M_STS_URI_T structure is currently unmanaged, and it is left for future purposes. stsReq.uriLen should only be set to M2MB_LWM2M_URI_1_FIELDS or M2MB_LWM2M_URI_2_FIELDS for setting a STS server; M2MB_LWM2M_URI_1_FIELDS means that the server specified is not a bootstrap server; M2MB_LWM2M_URI_2_FIELDS allows the user to specify if the the next connection to the server is a bootstrap one (by inserting stsReq.bootstrapRequest set to 1) or not (by inserting stsReq.bootstrapRequest set to 0). Please notice that inserting M2MB_LWM2M_URI_2_FIELDS and stsReq.bootstrapRequest set to 0 is equivalent to setting M2MB_LWM2M_URI_1_FIELDS, since in this case the server is declared as factory bootstrapped. stsReq.uriLen could also be set to M2MB_LWM2M_URI_MAX_NUM to remove a formerly set STS server; in this case the unique parameter to be set should be the the M2MB LWM2M handler; the URI fields will be ignored even if they bring valid values. m2mb_lwm2m_sts( h, reqStsStructure );
// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_STS_RES:
{
M2MB_LWM2M_STS_RES_T *resp = ( M2MB_LWM2M_STS_RES_T * )resp_struct;
printf( "Sts command result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR stringValue[ MY_MAX_STRING_LENGTH ];
UINT16 agentID = 0; // Telit agent
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
m2mb_lwm2m_agent_config( h, agentID );
// setting a user defined server via STS command
memset( &stsReq, 0, sizeof( M2MB_LWM2M_STS_URI_T ) );
memset( stringValue, 0, sizeof( stringValue ) );
strcpy( stringValue, "coaps://myUrlToBePointed:5684" );
stsReq.data = stringValue;
stsReq.dataLen = strlen( stringValue );
stsReq.bootstrapRequest = 1; // must be 1 for requiring a Bootstrap, 0 for direct DM connection
// stsReq.uriLen must be M2MB_LWM2M_URI_1_FIELDS or M2MB_LWM2M_URI_2_FIELDS for STS command setting.
// M2MB_LWM2M_URI_2_FIELDS is the correct choice in this example.
stsReq.uriLen = M2MB_LWM2M_URI_2_FIELDS;
retVal = m2mb_lwm2m_sts( lwm2mTestHndl, &stsReq );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_sts request succeeded" );
}
//...
// resetting the former STS
memset( stsReq, 0, sizeof( M2MB_LWM2M_STS_URI_T ) );
stsReq.uriLen = M2MB_LWM2M_URI_MAX_NUM;
retVal = m2mb_lwm2m_sts( lwm2mTestHndl, &stsReq );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_sts request succeeded" );
}
//...
// setting a tabled STS server
memset( stsReq, 0, sizeof( M2MB_LWM2M_STS_URI_T ) );
stsReq.serverTableId = 0;
stsReq.uriLen = M2MB_LWM2M_URI_0_FIELDS;
retVal = m2mb_lwm2m_sts( lwm2mTestHndl, &stsReq );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_sts request succeeded" );
}
}

◆ m2mb_lwm2m_write()

M2MB_RESULT_E m2mb_lwm2m_write ( M2MB_LWM2M_HANDLE  h,
M2MB_LWM2M_OBJ_URI_T uri,
void *  inbuf,
UINT16  inbuflen 
)

m2mb_lwm2m_write writes the LwM2M resource at the given URI

m2mb_lwm2m_write writes the LwM2M resource at the URI specified by parameter 'uri', performing an operation equivalent to a write from server side. The function returns immediately, and the result of the required operation is sent along with the callback defined in m2mb_lwm2m_init. In case of fatal error (example: client not ready), the function fails immediately and no callback is issued. In case of successful write, data is copied from the buffer passed by the user.

Parameters
[in]hthe handle to the LwM2M service, previously initialized by the m2mb_lwm2m_init function.
[in]uria structure defining the URI of the resource to be written. If the resource is not writable, an error is raised by the callback.
[in]inbufan user defined buffer from which the data will be copied.
[in]inbuflenthe size of the user defined buffer from which the data will be copied.
Returns
M2MB_RESULT_SUCCESS on success, a different value on error.
Note
Please notice that in case of float data type, the user should pass inbuf and inbuflen parameters sized for a double float. Please notice that changes on any resource during the bootstrap should be avoided, in order to not override the server bootstrap configuration.

m2mb_lwm2m_write( h, uri, buf, len );

// WARNING: do not place blocking action within callback, since it is issued by the agent's task!!!
void myCallback( M2MB_LWM2M_HANDLE h, M2MB_LWM2M_EVENT_E event, UINT16 resp_size, void *resp_struct, void *userdata )
{
switch( event )
{
//...
case M2MB_LWM2M_WRITE_RES:
{
printf( "Write result %d", resp->result );
if( resp->result == M2MB_LWM2M_RES_SUCCESS )
{
// code
}
break;
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_LWM2M_HANDLE h;
struct myStruct myUserdata;
CHAR *buf = ( CHAR * )m2mb_os_malloc( 50 );
retVal = m2mb_lwm2m_init( &h, myCallback, ( void* )myUserdata );
//...
uri.uriLen = M2MB_LWM2M_URI_3_FIELDS;
uri.obj = 10000;
uri.objInst = 1;
uri.resource = 7;
strcpy( buf, "stringValue" );
retVal = m2mb_lwm2m_write( h, &uri, buf, strlen( buf ) );
if ( retVal == M2MB_RESULT_SUCCESS )
{
printf( "m2mb_lwm2m_write request succeeded" );
}
}
m2mb_lwm2m_get_stat
M2MB_RESULT_E m2mb_lwm2m_get_stat(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_get_stat reads the current status of the LwM2M client
M2MB_LWM2M_CUST_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:1020
M2MB_LWM2M_FOTA_ACK_REQ_T
the m2mb_lwm2m_fota_ack request data structure
Definition: m2mb_lwm2m.h:825
M2MB_LWM2M_CIPHER_MODE_ECDH
Definition: m2mb_lwm2m.h:246
ODIS_HOST_DEVICE_MANUFACTURER
Definition: m2mb_lwm2m.h:326
M2MB_LWM2M_ENABLE_REQ_T
Definition: m2mb_lwm2m.h:442
M2MB_LWM2M_LIST_ELEMENT_RES_T
the single entry involved in the m2mb_lwm2m_list operation
m2mb_os_free
M2MB_OS_RESULT_E m2mb_os_free(void *pMem)
Free allocated memory.
m2mb_lwm2m_odis_set
M2MB_RESULT_E m2mb_lwm2m_odis_set(M2MB_LWM2M_HANDLE h, UINT8 odis_instance)
m2mb_lwm2m_odis_set allows the user to store the odis data set into the given instance in nv memory.
M2MB_LWM2M_MON_INFO_IND_T
Definition: m2mb_lwm2m.h:649
M2MB_LWM2M_FOTA_CFG_READ_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:814
m2mb_lwm2m_get_resource_type
M2MB_RESULT_E m2mb_lwm2m_get_resource_type(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, UINT16 *resType)
m2mb_lwm2m_get_resource_type propagates the resource type for a required resource.
M2MB_LWM2M_OBJGET_RES_T
the m2mb_lwm2m_objget response data structure
M2MB_LWM2M_KEYS_T::identity
CHAR identity[M2MB_LWM2M_DTLS_PSK_MAX_KEY_LEN+1]
Definition: m2mb_lwm2m.h:491
M2MB_LWM2M_LIST_RES
Definition: m2mb_lwm2m.h:102
M2MB_LWM2M_CUST_PARAM_T::paramId
M2MB_LWM2M_CUST_PARAM_ID_E paramId
Definition: m2mb_lwm2m.h:1010
M2MB_LWM2M_DATA_TYPE_STRING
Definition: m2mb_lwm2m.h:418
M2MB_LWM2M_FOTA_ACK_RES_T
the m2mb_lwm2m_fota_ack response data structure
Definition: m2mb_lwm2m.h:834
M2MB_LWM2M_CFG_RES_T
the m2mb_lwm2m_cfg response data structure
M2MB_LWM2M_NFYACK_INFO_IND_T::nfyState
M2MB_LWM2M_NFY_STATE_E nfyState
Definition: m2mb_lwm2m.h:716
M2MB_LWM2M_FOTA_CFG_RES
Definition: m2mb_lwm2m.h:93
M2MB_LWM2M_NFYACK_LIST_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:699
m2mb_lwm2m_exist
M2MB_RESULT_E m2mb_lwm2m_exist(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri)
m2mb_lwm2m_exist returns the existence or not for a given uri/agent
M2MB_LWM2M_MON_RES_T
Definition: m2mb_lwm2m.h:641
M2MB_LWM2M_KEYS_T
Definition: m2mb_lwm2m.h:488
M2MB_LWM2M_GET_REG_NUM_RES_T
the m2mb_lwm2m_get_list_entries response data structure
M2MB_LWM2M_REG_RES_T
the m2mb_lwm2m_reg response data structure
m2mb_lwm2m_get
M2MB_RESULT_E m2mb_lwm2m_get(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *outbuf, UINT16 outbuflen)
m2mb_lwm2m_get reads the value of a LwM2M resource at module side
M2MB_LWM2M_FOTA_STATE_RES
Definition: m2mb_lwm2m.h:97
m2mb_lwm2m_enable
M2MB_RESULT_E m2mb_lwm2m_enable(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_ENABLE_REQ_T *en_params)
m2mb_lwm2m_enable starts LwM2M client registration
M2MB_LWM2M_OBJSET_RES_T
the m2mb_lwm2m_objset response data structure
m2mb_lwm2m_cipher_cfg_read
M2MB_RESULT_E m2mb_lwm2m_cipher_cfg_read(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CIPHER_CFG_ITEM_T *cipherCfgData, UINT8 maxItemsNumber)
m2mb_lwm2m_cipher_cfg_read reads the cipher configuration for all the active clients.
m2mb_lwm2m_objset
M2MB_RESULT_E m2mb_lwm2m_objset(M2MB_LWM2M_HANDLE h, const M2MB_LWM2M_OBJSET_PARAM_T *objSetReq)
m2mb_lwm2m_objset updates one or more resources of a Lwm2m object instance.
m2mb_lwm2m_get_reg_entries
M2MB_RESULT_E m2mb_lwm2m_get_reg_entries(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_get_reg_entries returns the overall number of elements, expressed in M2MB_LWM2M_REG_ELEMEN...
M2MB_LWM2M_FOTA_CFG_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:758
m2mb_lwm2m_objget
M2MB_RESULT_E m2mb_lwm2m_objget(M2MB_LWM2M_HANDLE h, const M2MB_LWM2M_OBJGET_PARAM_T *objGetReq, CHAR *objGetRespString, UINT16 objGetRespSize)
m2mb_lwm2m_objget reads a Lwm2m object/object instance/resource.
m2mb_lwm2m_ack
M2MB_RESULT_E m2mb_lwm2m_ack(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_ACK_REQ_T *ack)
m2mb_lwm2m_ack informs LwM2M client about network availability
M2MB_LWM2M_FOTA_STATE_RES_TAG
Definition: m2mb_lwm2m.h:907
M2MB_LWM2M_FOTA_CFG_ITEM_T
Definition: m2mb_lwm2m.h:783
M2MB_LWM2M_REG_PARAM_T
the m2mb_lwm2m_reg request data structure
M2MB_LWM2M_EXIST_RES_T
the m2mb_lwm2m_exist request data structure
Definition: m2mb_lwm2m.h:980
m2mb_lwm2m_fota_ack
M2MB_RESULT_E m2mb_lwm2m_fota_ack(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_ACK_REQ_T *ack_params)
m2mb_lwm2m_fota_ack sends the ack for the required operation.
M2MB_LWM2M_GET_STAT_RES_T
Definition: m2mb_lwm2m.h:570
M2MB_LWM2M_OBJ_URI_T
Definition: m2mb_lwm2m.h:457
M2MB_LWM2M_ODIS_RES
Definition: m2mb_lwm2m.h:99
M2MB_LWM2M_CUST_PARAM_T::data
M2MB_LWM2M_CUST_DATA_T data
Definition: m2mb_lwm2m.h:1011
M2MB_LWM2M_CFG_RES
Definition: m2mb_lwm2m.h:124
m2mb_lwm2m_fota_cfg_read
M2MB_RESULT_E m2mb_lwm2m_fota_cfg_read(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_CFG_ITEM_T *fotaCfgData, UINT8 maxItemsNumber)
m2mb_lwm2m_fota_cfg_read reads the fota mode for all the active clients.
M2MB_LWM2M_CIPHER_CFG_READ_RES
Definition: m2mb_lwm2m.h:94
m2mb_lwm2m_newinst
M2MB_RESULT_E m2mb_lwm2m_newinst(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, M2MB_LWM2M_NEW_INST_REQ_T *new_inst_params)
m2mb_lwm2m_newinst creates a specified instance for a specified object
m2mb_lwm2m_deinit
M2MB_RESULT_E m2mb_lwm2m_deinit(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_deinit deinitializes LwM2M service for current client.
M2MB_LWM2M_CUST_RES
Definition: m2mb_lwm2m.h:103
m2mb_lwm2m_disable
M2MB_RESULT_E m2mb_lwm2m_disable(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_disable triggers LwM2M client deregistration.
M2MB_LWM2M_NFY_STATE_ACK_RECEIVED
Definition: m2mb_lwm2m.h:300
m2mb_lwm2m_odis_config
M2MB_RESULT_E m2mb_lwm2m_odis_config(M2MB_LWM2M_HANDLE h, ODIS_PARAMETERS_E odis_item, CHAR *odis_data)
m2mb_lwm2m_odis_config is in charge of filling the selected otis item with the given data.
M2MB_LWM2M_EXEC_RES_T
Definition: m2mb_lwm2m.h:548
M2MB_LWM2M_READ_RES_T
Definition: m2mb_lwm2m.h:529
M2MB_LWM2M_CUST_PARAM_T
the m2mb_lwm2m_cust request data structure
Definition: m2mb_lwm2m.h:1008
M2MB_LWM2M_NEW_INST_REQ_T
Definition: m2mb_lwm2m.h:655
M2MB_LWM2M_FOTA_ACK_RES
Definition: m2mb_lwm2m.h:96
M2MB_LWM2M_REG_ELEMENT_RES_T
the single entry involved in the m2mb_lwm2m_reg operation
M2MB_LWM2M_LIST_RES_T
the m2mb_lwm2m_list response data structure
M2MB_LWM2M_CONN_REQ_IND_T
Definition: m2mb_lwm2m.h:591
m2mb_lwm2m_get_list_entries
M2MB_RESULT_E m2mb_lwm2m_get_list_entries(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_get_list_entries returns the overall number of elements, expressed in M2MB_LWM2M_LIST_ELEM...
M2MB_LWM2M_GET_LIST_NUM_RES
Definition: m2mb_lwm2m.h:101
M2MB_LWM2M_NFYACK_INFO_IND_T
Definition: m2mb_lwm2m.h:711
m2mb_lwm2m_write
M2MB_RESULT_E m2mb_lwm2m_write(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
m2mb_lwm2m_write writes the LwM2M resource at the given URI
m2mb_lwm2m_cipher_cfg
M2MB_RESULT_E m2mb_lwm2m_cipher_cfg(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CIPHER_CFG_REQ_T *cfg_params)
m2mb_lwm2m_cipher_cfg sets and stores the cipher configuration.
M2MB_LWM2M_CUST_DATA_T::dataType
M2MB_LWM2M_DATA_TYPE_E dataType
Definition: m2mb_lwm2m.h:1000
M2MB_LWM2M_CIPHER_CFG_RES_T
the m2mb_lwm2m_cipher_cfg response data structure
Definition: m2mb_lwm2m.h:745
m2mb_os_malloc
void * m2mb_os_malloc(UINT32 size)
Allocates bytes of memory.
M2MB_LWM2M_OBJSET_PARAM_T
the m2mb_lwm2m_objset request data structure
M2MB_LWM2M_ODIS_RES_T
the m2mb_lwm2m_odis response data structure
Definition: m2mb_lwm2m.h:968
M2MB_LWM2M_WRITE_RES_T
Definition: m2mb_lwm2m.h:538
M2MB_LWM2M_GET_TYPE_RES_T
Definition: m2mb_lwm2m.h:584
M2MB_LWM2M_CIPHER_CFG_RES
Definition: m2mb_lwm2m.h:92
M2MB_LWM2M_CUST_DATA_T::buffer
void * buffer
Definition: m2mb_lwm2m.h:999
M2MB_LWM2M_NFYACK_INFO_IND_T::agent
UINT16 agent
Definition: m2mb_lwm2m.h:714
m2mb_lwm2m_list
M2MB_RESULT_E m2mb_lwm2m_list(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_LIST_ELEMENT_RES_T *listPointer, UINT16 listSize)
m2mb_lwm2m_list returns all the objects/instances defined for a client
m2mb_lwm2m_cust
M2MB_RESULT_E m2mb_lwm2m_cust(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CUST_PARAM_T *custReq)
m2mb_lwm2m_cust stores the customization data.
ODIS_HOST_DEVICE_SW_VERSION
Definition: m2mb_lwm2m.h:328
M2MB_LWM2M_EXIST_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:982
M2MB_LWM2M_NEW_INST_RES_T
Definition: m2mb_lwm2m.h:660
m2mb_lwm2m_injkeys
M2MB_RESULT_E m2mb_lwm2m_injkeys(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_KEY_ACTION_E action, M2MB_LWM2M_KEYS_T *keys)
m2mb_lwm2m_injkeys allows to inject or delete Endpoint Name and Keys for a given agent.
m2mb_lwm2m_set
M2MB_RESULT_E m2mb_lwm2m_set(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *inbuf, UINT16 inbuflen)
m2mb_lwm2m_set sets the value of a LwM2M resource at module side
M2MB_LWM2M_FOTA_ACK_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:836
m2mb_lwm2m_fota_status
M2MB_RESULT_E m2mb_lwm2m_fota_status(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_STATE_T *fotaStateData)
m2mb_lwm2m_fota_status returns the fota data for the spcified LwM2M client.
M2MB_LWM2M_OBJGET_PARAM_T
the m2mb_lwm2m_objget request data structure
m2mb_os_calloc
void * m2mb_os_calloc(UINT32 size)
Allocates bytes of memory and init space with 0.
M2MB_LWM2M_RES_T
Definition: m2mb_lwm2m.h:501
M2MB_LWM2M_ACK_REQ_T
Definition: m2mb_lwm2m.h:451
M2MB_LWM2M_KEYS_T::endpoint_name
CHAR endpoint_name[M2MB_LWM2M_MAX_ENDPOINT_NAME_LEN+1]
Definition: m2mb_lwm2m.h:490
M2MB_LWM2M_GET_RES_T
Definition: m2mb_lwm2m.h:562
M2MB_LWM2M_NFYACK_INFO_IND_T::uri
M2MB_LWM2M_OBJ_URI_T uri
Definition: m2mb_lwm2m.h:713
M2MB_LWM2M_EXIST_RES
Definition: m2mb_lwm2m.h:100
m2mb_lwm2m_reg
M2MB_RESULT_E m2mb_lwm2m_reg(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_REG_PARAM_T *regReq, M2MB_LWM2M_REG_ELEMENT_RES_T *listPointer, UINT16 listSize)
m2mb_lwm2m_reg manages the user connection request for the specified server.
M2MB_LWM2M_REG_RES
Definition: m2mb_lwm2m.h:105
M2MB_LWM2M_OBJSET_RES
Definition: m2mb_lwm2m.h:122
M2MB_LWM2M_CUST_DATA_T::dataSize
SIZE_T dataSize
Definition: m2mb_lwm2m.h:1001
M2MB_LWM2M_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:503
M2MB_LWM2M_CIPHER_CFG_READ_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:798
M2MB_LWM2M_FOTA_CFG_READ_RES_T
Definition: m2mb_lwm2m.h:812
M2MB_LWM2M_ODIS_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:970
M2MB_LWM2M_CUST_PARAM_ID_CARRIER
Definition: m2mb_lwm2m.h:340
M2MB_LWM2M_EVENT_E
M2MB_LWM2M_EVENT_E
Definition: m2mb_lwm2m.h:73
m2mb_lwm2m_nfy_ack_uri
M2MB_RESULT_E m2mb_lwm2m_nfy_ack_uri(M2MB_LWM2M_HANDLE h, BOOLEAN add, M2MB_LWM2M_OBJ_URI_T *uri)
m2mb_lwm2m_nfy_ack_uri adds or removes a resource URI to the list for Notify Ack reporting
M2MB_LWM2M_KEY_CREATE
Definition: m2mb_lwm2m.h:312
M2MB_LWM2M_SET_RES_T
Definition: m2mb_lwm2m.h:554
M2MB_LWM2M_REG_ACTION_GET_SRV_INFO
Definition: m2mb_lwm2m.h:381
M2MB_LWM2M_GET_LIST_NUM_RES_T
the m2mb_lwm2m_get_list_entries response data structure
M2MB_LWM2M_FOTA_CFG_READ_RES
Definition: m2mb_lwm2m.h:95
M2MB_LWM2M_STS_RES_T
Definition: m2mb_lwm2m.h:579
m2mb_lwm2m_odis_reset
M2MB_RESULT_E m2mb_lwm2m_odis_reset(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_odis_reset is in charge of resetting the handler data fields reserved for odis.
M2MB_LWM2M_FOTA_CFG_RES_T
the m2mb_lwm2m_fota_cfg response data structure
Definition: m2mb_lwm2m.h:756
M2MB_LWM2M_NFYACK_STATUS_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:674
m2mb_lwm2m_odis
M2MB_RESULT_E m2mb_lwm2m_odis(M2MB_LWM2M_HANDLE h)
m2mb_lwm2m_odis allows the user to store the odis data set into nv memory.
m2mb_lwm2m_mon
M2MB_RESULT_E m2mb_lwm2m_mon(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, M2MB_LWM2M_MON_REQ_T *mon_params)
m2mb_lwm2m_mon sets the monitoring status an LwM2M resource at module side
M2MB_LWM2M_FOTA_STATE_T
the m2mb_lwm2m_fota_state data structure
m2mb_lwm2m_agent_config
M2MB_RESULT_E m2mb_lwm2m_agent_config(M2MB_LWM2M_HANDLE h, UINT16 agentID)
m2mb_lwm2m_agent_config propagates the specified client for a specific operation (such as read,...
M2MB_LWM2M_NFYACK_URI_RES_T
Definition: m2mb_lwm2m.h:685
ODIS_HOST_DEVICE_ID
Definition: m2mb_lwm2m.h:325
M2MB_LWM2M_NFYACK_STATUS_RES_T
Definition: m2mb_lwm2m.h:672
m2mb_lwm2m_cfg
M2MB_RESULT_E m2mb_lwm2m_cfg(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_CFG_PARAM_T *cfgReq)
m2mb_lwm2m_cfg sets or retrieves the lwm2m configuration value related to a given parameter
M2MB_LWM2M_NFYACK_URI_RES_T::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:687
ODIS_HOST_DEVICE_MODEL
Definition: m2mb_lwm2m.h:327
m2mb_lwm2m_sts
M2MB_RESULT_E m2mb_lwm2m_sts(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_STS_URI_T *reqStsStructure)
m2mb_lwm2m_sts sets the next server address
m2mb_lwm2m_read
M2MB_RESULT_E m2mb_lwm2m_read(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri, void *outbuf, UINT16 outbuflen)
m2mb_lwm2m_read reads the LwM2M resource at the given URI
M2MB_LWM2M_CIPHER_CFG_ITEM_T
Definition: m2mb_lwm2m.h:769
M2MB_LWM2M_NFYACK_STATUS_RES_T::enabled
BOOLEAN enabled
Definition: m2mb_lwm2m.h:676
m2mb_lwm2m_nfy_ack_status
M2MB_RESULT_E m2mb_lwm2m_nfy_ack_status(M2MB_LWM2M_HANDLE h, BOOLEAN set, BOOLEAN enable)
m2mb_lwm2m_nfy_ack_status sets or gets the flag to enable or disable Notify Ack reporting
M2MB_LWM2M_KEYS_T::secret_key
CHAR secret_key[M2MB_LWM2M_DTLS_PSK_MAX_KEY_LEN+1]
Definition: m2mb_lwm2m.h:492
M2MB_LWM2M_GET_REG_NUM_RES
Definition: m2mb_lwm2m.h:104
M2MB_LWM2M_CUST_RES_T
the m2mb_lwm2m_cust response data structure
Definition: m2mb_lwm2m.h:1018
m2mb_lwm2m_fota_cfg
M2MB_RESULT_E m2mb_lwm2m_fota_cfg(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_FOTA_CFG_REQ_T *cfg_params)
m2mb_lwm2m_fota_cfg sets and stores the fota mode.
M2MB_LWM2M_FOTA_STATE_RES_TAG::result
M2MB_LWM2M_RESULT_E result
Definition: m2mb_lwm2m.h:909
M2MB_LWM2M_OBJGET_RES
Definition: m2mb_lwm2m.h:123
m2mb_lwm2m_nfy_ack_list
M2MB_RESULT_E m2mb_lwm2m_nfy_ack_list(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uriList, UINT8 listElementsNumber)
m2mb_lwm2m_nfy_ack_list retrieves the list for Notify Ack reporting
m2mb_lwm2m_init
M2MB_RESULT_E m2mb_lwm2m_init(M2MB_LWM2M_HANDLE *h, m2mb_lwm2m_ind_callback cb, void *cb_user_param)
m2mb_lwm2m_init initializes, for current client, the capability to interact with LwM2M agent.
M2MB_LWM2M_CFG_ACTIONID_SET
Definition: m2mb_lwm2m.h:1078
M2MB_LWM2M_CIPHER_CFG_READ_RES_T
Definition: m2mb_lwm2m.h:796
M2MB_LWM2M_STS_URI_T
Definition: m2mb_lwm2m.h:472
m2mb_lwm2m_exec
M2MB_RESULT_E m2mb_lwm2m_exec(M2MB_LWM2M_HANDLE h, M2MB_LWM2M_OBJ_URI_T *uri)
m2mb_lwm2m_exec executes the LwM2M resource at the given URI
M2MB_LWM2M_NFYACK_INFO_IND_T::shServerId
UINT16 shServerId
Definition: m2mb_lwm2m.h:715
M2MB_LWM2M_NFYACK_LIST_RES_T
Definition: m2mb_lwm2m.h:697