anjay
|
Go to the source code of this file.
Data Structures | |
struct | anjay_dm_oi_attributes_t |
struct | anjay_dm_r_attributes_t |
struct | anjay_dm_handlers_t |
struct | anjay_dm_object_def_struct |
struct | anjay_resource_observation_status_t |
Macros | |
#define | ANJAY_DM_OID_SECURITY 0 |
#define | ANJAY_DM_OID_SERVER 1 |
#define | ANJAY_DM_OID_ACCESS_CONTROL 2 |
#define | ANJAY_DM_OID_DEVICE 3 |
#define | ANJAY_DM_OID_FIRMWARE_UPDATE 5 |
#define | ANJAY_ATTRIB_INTEGER_NONE (-1) |
#define | ANJAY_ATTRIB_PERIOD_NONE ANJAY_ATTRIB_INTEGER_NONE |
#define | ANJAY_ATTRIB_DOUBLE_NONE (NAN) |
#define | ANJAY_ATTRIB_VALUE_NONE ANJAY_ATTRIB_DOUBLE_NONE |
#define | ANJAY_MAX_OBSERVATION_SERVERS_REPORTED_NUMBER 0 |
#define | ANJAY_ACCESS_MASK_READ (1U << 0) |
#define | ANJAY_ACCESS_MASK_WRITE (1U << 1) |
#define | ANJAY_ACCESS_MASK_EXECUTE (1U << 2) |
#define | ANJAY_ACCESS_MASK_DELETE (1U << 3) |
#define | ANJAY_ACCESS_MASK_CREATE (1U << 4) |
#define | ANJAY_ACCESS_MASK_FULL |
#define | ANJAY_ACCESS_MASK_NONE 0 |
#define | ANJAY_ACCESS_LIST_OWNER_BOOTSTRAP UINT16_MAX |
Enumerations | |
enum | anjay_dm_con_attr_t { ANJAY_DM_CON_ATTR_NONE = -1 , ANJAY_DM_CON_ATTR_NON = 0 , ANJAY_DM_CON_ATTR_CON = 1 } |
enum | anjay_security_mode_t { ANJAY_SECURITY_PSK = 0 , ANJAY_SECURITY_RPK = 1 , ANJAY_SECURITY_CERTIFICATE = 2 , ANJAY_SECURITY_NOSEC = 3 , ANJAY_SECURITY_EST = 4 } |
enum | anjay_sms_security_mode_t { ANJAY_SMS_SECURITY_DTLS_PSK = 1 , ANJAY_SMS_SECURITY_SECURE_PACKET = 2 , ANJAY_SMS_SECURITY_NOSEC = 3 } |
Functions | |
int | anjay_dm_list_instances_SINGLE (anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_dm_list_ctx_t *ctx) |
int | anjay_dm_transaction_NOOP (anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) |
int | anjay_notify_changed (anjay_t *anjay, anjay_oid_t oid, anjay_iid_t iid, anjay_rid_t rid) |
int | anjay_notify_instances_changed (anjay_t *anjay, anjay_oid_t oid) |
anjay_resource_observation_status_t | anjay_resource_observation_status (anjay_t *anjay, anjay_oid_t oid, anjay_iid_t iid, anjay_rid_t rid) |
int | anjay_register_object (anjay_t *anjay, const anjay_dm_object_def_t *const *def_ptr) |
int | anjay_unregister_object (anjay_t *anjay, const anjay_dm_object_def_t *const *def_ptr) |
bool | anjay_binding_mode_valid (const char *binding_mode) |
Variables | |
const anjay_dm_oi_attributes_t | ANJAY_DM_OI_ATTRIBUTES_EMPTY |
const anjay_dm_r_attributes_t | ANJAY_DM_R_ATTRIBUTES_EMPTY |
#define ANJAY_ACCESS_LIST_OWNER_BOOTSTRAP UINT16_MAX |
#define ANJAY_ACCESS_MASK_CREATE (1U << 4) |
#define ANJAY_ACCESS_MASK_DELETE (1U << 3) |
#define ANJAY_ACCESS_MASK_EXECUTE (1U << 2) |
#define ANJAY_ACCESS_MASK_FULL |
#define ANJAY_ACCESS_MASK_NONE 0 |
#define ANJAY_ACCESS_MASK_READ (1U << 0) |
#define ANJAY_ACCESS_MASK_WRITE (1U << 1) |
#define ANJAY_ATTRIB_DOUBLE_NONE (NAN) |
A value indicating that the Less Than/Greater Than/Step attribute is not set
#define ANJAY_ATTRIB_INTEGER_NONE (-1) |
A value indicating that the Min/Max Period or Maximum Historical Queue attribute is not set
#define ANJAY_ATTRIB_PERIOD_NONE ANJAY_ATTRIB_INTEGER_NONE |
An alias for ANJAY_ATTRIB_INTEGER_NONE
#define ANJAY_ATTRIB_VALUE_NONE ANJAY_ATTRIB_DOUBLE_NONE |
An alias for ANJAY_ATTRIB_DOUBLE_NONE
#define ANJAY_DM_OID_ACCESS_CONTROL 2 |
#define ANJAY_DM_OID_DEVICE 3 |
#define ANJAY_DM_OID_FIRMWARE_UPDATE 5 |
#define ANJAY_DM_OID_SECURITY 0 |
#define ANJAY_DM_OID_SERVER 1 |
#define ANJAY_MAX_OBSERVATION_SERVERS_REPORTED_NUMBER 0 |
Maximum number of servers observing a Resource reported in anjay_resource_observation_status_t structure.
typedef uint16_t anjay_access_mask_t |
typedef int anjay_dm_instance_create_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid) |
A handler that creates an Object Instance.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Instance ID to create, chosen either by the server or the library. An ID that has been previously checked (using anjay_dm_list_instances_t) to not be PRESENT is guaranteed to be passed. |
typedef int anjay_dm_instance_read_default_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_ssid_t ssid, anjay_dm_oi_attributes_t *out) |
A handler that returns default attributes set for the Object Instance.
anjay | Anjay object to operate on. | |
obj_ptr | Object definition pointer, as passed to anjay_register_object . | |
iid | Checked Object Instance ID. | |
ssid | Short Server ID of the server requesting the operation. | |
[out] | out | Returned attributes. |
typedef int anjay_dm_instance_remove_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid) |
A handler that removes an Object Instance with given Instance ID.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Checked Object Instance ID. |
typedef int anjay_dm_instance_reset_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid) |
A handler that shall reset Object Instance to its default (after creational) state.
Note: if this handler is not implemented, then non-partial write on the Object Instance (iid
) will not succeed.
anjay | Anjay Object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Instance ID to reset. |
typedef int anjay_dm_instance_write_default_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_ssid_t ssid, const anjay_dm_oi_attributes_t *attrs) |
A handler that sets default attributes for the Object Instance.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Checked Object Instance ID. |
ssid | Short Server ID of the server requesting the operation. |
attrs | Attributes to set for the Object Instance. |
typedef int anjay_dm_list_instances_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_dm_list_ctx_t *ctx) |
A handler that enumerates all Object Instances for the Object.
The library will not attempt to call anjay_dm_instance_remove_t or anjay_dm_instance_create_t handlers inside the anjay_dm_emit calls performed from this handler, so the implementation is free to use iteration state that would be invalidated by such calls.
CAUTION: Aside from the note above, the library MAY call other data model handlers for the same Object from within the anjay_dm_emit call. Please make sure that your code is able to handle this - e.g. avoid calling anjay_dm_emit with a non-recursive object-scope mutex locked.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
ctx | Context through which the Instance IDs shall be returned, see anjay_dm_emit . |
Instance listing handlers MUST always return Instance IDs in a strictly ascending, sorted order. Failure to do so will result in an error being sent to the LwM2M server or passed down to internal routines that called this handler.
typedef int anjay_dm_list_resource_instances_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_dm_list_ctx_t *ctx) |
A handler that enumerates all Resource Instances of a Multiple Resource, called only if the Resource is PRESENT and is of either ANJAY_DM_RES_RM, ANJAY_DM_RES_WM or ANJAY_DM_RES_RWM kind (as returned by anjay_dm_list_resources_t).
The library will not attempt to call anjay_dm_resource_write_t or anjay_dm_resource_reset_t handlers inside the anjay_dm_emit calls performed from this handler, so the implementation is free to use iteration state that would be invalidated by such calls.
CAUTION: Aside from the note above, the library MAY call other data model handlers for the same Object from within the anjay_dm_emit call. Please make sure that your code is able to handle this - e.g. avoid calling anjay_dm_emit with a non-recursive object-scope mutex locked.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | Resource ID. |
ctx | Context through which the Resource Instance IDs shall be returned, see anjay_dm_emit . |
Resource instance listing handlers MUST always return Resource Instance IDs in a strictly ascending, sorted order. Failure to do so will result in an error being sent to the LwM2M server or passed down to internal routines that called this handler.
typedef int anjay_dm_list_resources_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_dm_resource_list_ctx_t *ctx) |
A handler that enumerates SUPPORTED Resources for an Object Instance, called only if the Object Instance is PRESENT (has recently been returned via anjay_dm_list_instances_t).
CAUTION: The library MAY call other data model handlers for the same Object from within the anjay_dm_emit_res call. Please make sure that your code is able to handle this - e.g. avoid calling anjay_dm_emit_res with a non-recursive object-scope mutex locked.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
ctx | Context through which the Resource IDs shall be returned, see anjay_dm_emit_res . |
Resource listing handlers MUST always return Resource IDs in a strictly ascending, sorted order. Failure to do so will result in an error being sent to the LwM2M server or passed down to internal routines that called this handler.
typedef struct anjay_dm_object_def_struct anjay_dm_object_def_t |
typedef int anjay_dm_object_read_default_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_ssid_t ssid, anjay_dm_oi_attributes_t *out) |
A handler that returns default attribute values set for the Object.
anjay | Anjay object to operate on. | |
obj_ptr | Object definition pointer, as passed to anjay_register_object . | |
ssid | Short Server ID of the server requesting the operation. | |
[out] | out | Attributes struct to be filled by the handler. |
typedef int anjay_dm_object_write_default_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_ssid_t ssid, const anjay_dm_oi_attributes_t *attrs) |
A handler that sets default attribute values for the Object.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
ssid | Short Server ID of the server requesting the operation. |
attrs | Attributes struct to be set for the Object. |
typedef int anjay_dm_resource_execute_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_execute_ctx_t *ctx) |
A handler that performs the Execute action on given Resource, called only if the Resource is PRESENT and of the ANJAY_DM_RES_E kind (as returned by anjay_dm_list_resources_t).
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | Resource ID. |
ctx | Execute context to read the execution arguments from, using the anjay_execute_get_* function family. |
typedef int anjay_dm_resource_instance_read_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_riid_t riid, anjay_ssid_t ssid, anjay_dm_r_attributes_t *out) |
A handler that returns Resource Instance attributes.
anjay | Anjay object to operate on. | |
obj_ptr | Object definition pointer, as passed to anjay_register_object . | |
iid | Object Instance ID. | |
rid | Resource ID. | |
riid | Resource Instance ID. | |
ssid | Short Server ID of the LwM2M Server issuing the request. | |
[out] | out | Returned Resource attributes. |
typedef int anjay_dm_resource_instance_write_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_riid_t riid, anjay_ssid_t ssid, const anjay_dm_r_attributes_t *attrs) |
A handler that sets attributes for given Resource Instance.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | Resource ID. |
riid | Resource Instance ID. |
ssid | Short Server ID of the LwM2M Server issuing the request. |
attrs | Attributes to set for this Resource. |
typedef int anjay_dm_resource_read_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_ssid_t ssid, anjay_dm_r_attributes_t *out) |
A handler that returns Resource attributes.
anjay | Anjay object to operate on. | |
obj_ptr | Object definition pointer, as passed to anjay_register_object . | |
iid | Object Instance ID. | |
rid | Resource ID. | |
ssid | Short Server ID of the LwM2M Server issuing the request. | |
[out] | out | Returned Resource attributes. |
typedef int anjay_dm_resource_read_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_riid_t riid, anjay_output_ctx_t *ctx) |
A handler that reads the Resource or Resource Instance value, called only if the Resource is PRESENT and is one of the ANJAY_DM_RES_R, ANJAY_DM_RES_RW, ANJAY_DM_RES_RM or ANJAY_DM_RES_RWM kinds (as returned by anjay_dm_list_resources_t).
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | Resource ID. |
riid | Resource Instance ID, or ANJAY_ID_INVALID in case of a Single Resource. |
ctx | Output context to write the resource value to using the anjay_ret_* function family. |
NOTE: One of the anjay_ret_*
functions MUST be called in this handler before returning successfully. Failure to do so will result in 5.00 Internal Server Error being sent to the server.
NOTE: This handler will only be called with riid
set to a valid value if the Resource Instance is PRESENT (has recently been returned via anjay_dm_list_resource_instances_t).
a negative value in case of error. If it returns one of ANJAY_ERR_ constants, it will be used as a hint for the CoAP response code to use. The library may decide to override the returned value in case of a more specific internal error (e.g. 4.06 Not Acceptable in response to an invalid Accept option).
Note that the CoAP response sent by the library will always be valid. If the value returned is a negative number that is not any of the ANJAY_ERR_ constant, the normal fallback response is 5.00 Internal Server Error.
typedef int anjay_dm_resource_reset_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid) |
A handler that shall reset a Resource to its default (after creational) state. In particular, for any writeable optional resource, it shall remove it; for any writeable mandatory Multiple Resource, it shall remove all its instances.
NOTE: If this handler is not implemented for a Multiple Resource, then non-partial write on it will not succeed.
NOTE: In the current version of Anjay, this handler is only ever called on Multiple Resources. It is REQUIRED so that after calling this handler, any Multiple Resource is either not PRESENT, or PRESENT, but contain zero Resource Instances.
anjay | Anjay Object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | ID of the Resource to reset. |
typedef int anjay_dm_resource_write_attrs_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_ssid_t ssid, const anjay_dm_r_attributes_t *attrs) |
A handler that sets attributes for given Resource.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | Resource ID. |
ssid | Short Server ID of the LwM2M Server issuing the request. |
attrs | Attributes to set for this Resource. |
typedef int anjay_dm_resource_write_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_riid_t riid, anjay_input_ctx_t *ctx) |
A handler that writes the Resource value, called only if the Resource is SUPPORTED and not of the ANJAY_DM_RES_E kind (as returned by anjay_dm_list_resources_t). Note that it may be called on nominally read-only Resources if the write is performed by the Bootstrap Server.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
iid | Object Instance ID. |
rid | Resource ID. |
riid | Resource Instance ID, or ANJAY_ID_INVALID in case of a Single Resource. |
ctx | Input context to read the resource value from using the anjay_get_* function family. |
NOTE: This handler will only be called with riid
set to a valid value if the Resource has been verified to be a Multiple Resource (as returned by anjay_dm_list_resources_t).
typedef int anjay_dm_transaction_begin_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) |
A handler that is called when there is a request that might modify an Object and fail. Such situation often requires to rollback changes, and this handler shall implement logic that prepares for possible failure in the future.
Handlers listed below are NOT called without beginning transaction in the first place (note that if an Object does not implement transaction handlers, then it will not be possible to perform operations listed below):
Note: if an error occurs during a transaction (i.e. after successful call of this function) then the rollback handler anjay_dm_transaction_rollback_t will be executed by the library.
anjay | Anjay object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
typedef int anjay_dm_transaction_commit_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) |
A handler that is called after transaction is finished. If it fails then anjay_dm_transaction_rollback_t handler must be called by the user code if it is necessary.
NOTE: If this function fails, the data model will be left in an inconsistent state. For this reason, it may return an error value if and only if a fatal, unpredictable and irrecoverable error (e.g. physical write error) occurs. All other errors (such as invalid object state) shall be reported via anjay_dm_transaction_validate_t .
anjay | Anjay Object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
typedef int anjay_dm_transaction_rollback_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) |
A handler that is called whenever there is a need to restore previous Object state during a transaction or during committing a transaction.
anjay | Anjay Object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
typedef int anjay_dm_transaction_validate_t(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) |
A handler that is called after transaction is finished, but before anjay_dm_transaction_commit_t is called. It is used to check whether the commit operation may be successfully performed.
Any validation of the object's state shall be performed in this function, rather than in the commit handler. If there is a need to commit changes to multiple objects at once, this handler is called on all modified objects first, to avoid potential inconsistencies that may arise from a failing commit operation.
Returning success from this handler means that the corresponding commit function shall subsequently execute successfully. The commit handler may nevertheless fail, but if and only if a fatal, unpredictable and irrecoverable error (e.g. physical write error) occurs.
anjay | Anjay Object to operate on. |
obj_ptr | Object definition pointer, as passed to anjay_register_object . |
enum anjay_dm_con_attr_t |
bool anjay_binding_mode_valid | ( | const char * | binding_mode | ) |
Checks whether the passed string is a valid LwM2M Binding Mode.
"U"
, "S"
, "US"
, "UQ"
, "SQ"
, "UQS"
, false in any other case. int anjay_dm_list_instances_SINGLE | ( | anjay_t * | anjay, |
const anjay_dm_object_def_t *const * | obj_ptr, | ||
anjay_dm_list_ctx_t * | ctx | ||
) |
Convenience function to use as the list_instances handler in Single Instance objects.
Implements a valid iteration that returns a single Instance ID: 0.
int anjay_dm_transaction_NOOP | ( | anjay_t * | anjay, |
const anjay_dm_object_def_t *const * | obj_ptr | ||
) |
Stub handler that can be substituted for any transaction operation. Does nothing. It is NOT recommended for production usage.
int anjay_notify_changed | ( | anjay_t * | anjay, |
anjay_oid_t | oid, | ||
anjay_iid_t | iid, | ||
anjay_rid_t | rid | ||
) |
Notifies the library that the value of given Resource changed. It may trigger a LwM2M Notify message, update server connections and perform other tasks, as required for the specified Resource.
Needs to be called for any Resource after its value is changed by means other than LwM2M.
Note that it should not be called after a Write performed by the LwM2M server.
anjay | Anjay object to operate on. |
oid | Object ID of the changed Resource. |
iid | Object Instance ID of the changed Resource. |
rid | Resource ID of the changed Resource. |
int anjay_notify_instances_changed | ( | anjay_t * | anjay, |
anjay_oid_t | oid | ||
) |
Notifies the library that the set of Instances existing in a given Object changed. It may trigger a LwM2M Notify message, update server connections and perform other tasks, as required for the specified Object ID.
Needs to be called for each Object, after an Instance is created or removed by means other than LwM2M.
Note that it should not be called after a Create or Delete performed by the LwM2M server.
anjay | Anjay object to operate on. |
oid | Object ID of the changed Object. |
int anjay_register_object | ( | anjay_t * | anjay, |
const anjay_dm_object_def_t *const * | def_ptr | ||
) |
Registers the Object in the data model, making it available for access by the LwM2M Servers.
NOTE: def_ptr
MUST stay valid up to and including the corresponding anjay_delete or anjay_unregister_object call.
anjay | Anjay object to operate on. |
def_ptr | Pointer to the Object definition struct. The exact value passed to this function will be forwarded to all data model handler calls. |
anjay_resource_observation_status_t anjay_resource_observation_status | ( | anjay_t * | anjay, |
anjay_oid_t | oid, | ||
anjay_iid_t | iid, | ||
anjay_rid_t | rid | ||
) |
Gets information whether and how a given Resource is observed. See anjay_resource_observation_status_t for details.
NOTE: This API is a companion to anjay_notify_changed. There is no analogous API that would be a companion to anjay_notify_instances_changed. Any changes to set of instances of any LwM2M Object MUST be considered observed at all times and notified as soon as possible.
anjay | Anjay object to operate on. |
oid | Object ID of the Resource to check. |
iid | Object Instance ID of the Resource to check. |
rid | Resource ID of the Resource to check. |
NOTE: This function may be used to implement notifications for Resources that require active polling by the client application. A naive implementation could look more or less like this (pseudocode):
status = anjay_resource_observation_status(anjay, oid, iid, rid); if (status.is_observed && current_time >= last_check_time + status.min_period) { new_value = read_resource_value(); if (new_value != old_value) { anjay_notify_changed(anjay, oid, iid, rid); } last_check_time = current_time; }
However, please note that such implementation may not be strictly conformant to the LwM2M specification. For example, in the following case:
[time] –|-----—|-*---—|--> | - intervals between resource reads |<---—>| * - point in time when underlying state min_period actually changes
the specification would require the notification to be sent exactly at the time of the (*) event, but with this naive implementation, will be delayed until the next (|).
int anjay_unregister_object | ( | anjay_t * | anjay, |
const anjay_dm_object_def_t *const * | def_ptr | ||
) |
Unregisters an Object in the data model, so that it is no longer available for access by the LwM2M Servers.
def_ptr
MUST be a pointer previously passed to anjay_register_object for the same anjay
object.
After a successful unregister, any resources used by the actual object may be safely freed up.
NOTE: This function MUST NOT be called from within any data model handler callback function (i.e. any of the anjay_dm_handlers_t members). Doing so is undefined behavior.
anjay | Anjay object to operate on. |
def_ptr | Pointer to the Object definition struct. |
def_ptr
does not correspond to any known registered object.
|
extern |
Convenience Object/Object Instance attributes constant, filled with "attribute not set" values
|
extern |
Convenience Resource attributes constant, filled with "attribute not set" values