Anjay Lite
Loading...
Searching...
No Matches
device_object.h File Reference
#include <anj/init.h>
#include <anj/core.h>
#include <anj/dm/core.h>

Go to the source code of this file.

Data Structures

struct  anj_dm_device_object_init_t
 
struct  anj_dm_device_obj_t
 

Macros

#define ANJ_DM_DEVICE_ERR_CODE_RES_INST_MAX_COUNT   1
 

Typedefs

typedef void anj_dm_reboot_callback_t(void *arg, anj_t *anj)
 

Functions

int anj_dm_device_obj_install (anj_t *anj, anj_dm_device_obj_t *device_obj, anj_dm_device_object_init_t *obj_init)
 

Macro Definition Documentation

◆ ANJ_DM_DEVICE_ERR_CODE_RES_INST_MAX_COUNT

#define ANJ_DM_DEVICE_ERR_CODE_RES_INST_MAX_COUNT   1

Typedef Documentation

◆ anj_dm_reboot_callback_t

typedef void anj_dm_reboot_callback_t(void *arg, anj_t *anj)

Callback function type for handling the LwM2M Reboot resource (/3/0/4).

This function is invoked when the Reboot resource is executed by the LwM2M server. The user is expected to perform a system reboot after this callback returns.

Note
The Execute operation may be sent as a Confirmable message, so it is recommended to delay the reboot until the response is successfully sent.
Parameters
argOpaque argument passed to the callback.
anjAnjay object reporting the status change.

Function Documentation

◆ anj_dm_device_obj_install()

int anj_dm_device_obj_install ( anj_t anj,
anj_dm_device_obj_t device_obj,
anj_dm_device_object_init_t obj_init 
)

Installs device object (/3) in DM.

Example usage:

static int reboot_cb(void *arg, anj_t *anj) {
// perform reboot
}
...
anj_dm_device_obj_t dev_obj;
.manufacturer = "manufacturer",
.model_number = "model_number",
.serial_number = "serial_number",
.firmware_version = "firmware_version",
.reboot_handler = reboot_cb
};
anj_dm_device_obj_install(&anj, &dev_obj, &dev_obj_init);
struct anj_struct anj_t
Definition defs.h:133
int anj_dm_device_obj_install(anj_t *anj, anj_dm_device_obj_t *device_obj, anj_dm_device_object_init_t *obj_init)
Definition device_object.h:59
const char * manufacturer
Definition device_object.h:61
Parameters
anjAnjay object to operate on.
device_objPointer to a device object structure. Must be non-NULL.
obj_initPointer to a device object's initialization structure. Must be non-NULL.
Returns
non-zero value on error (i.e. object is already installed), 0 otherwise.