Function anj_core_data_model_changed

Function Documentation

void anj_core_data_model_changed(anj_t *anj, const anj_uri_path_t *path, anj_core_change_type_t change_type)

Informs the library that the application has modified the data model.

This function must be called whenever the application itself changes any Object, Instance, or Resource in the data model — i.e., when the change is not a direct result of an operation initiated by the LwM2M Server.

Typical examples where this function MUST be called:

  • ANJ_CORE_CHANGE_TYPE_VALUE_CHANGED — a Resource or Resource Instance value was modified by the application logic (not by a Write/Execute from the Server). This may trigger a LwM2M Notify message.

    • Special case: if the Lifetime Resource of the Server object (Object ID: ANJ_OBJ_ID_SERVER) is changed, this will additionally trigger a registration update with the new lifetime value.

  • ANJ_CORE_CHANGE_TYPE_ADDED — the application created a new Object Instance or Resource Instance. This may trigger a Notify, and for new Object Instances also a registration update.

  • ANJ_CORE_CHANGE_TYPE_DELETED — the application removed an Object Instance or Resource Instance. This removes associated observations and attributes, and for Object Instances also triggers a registration update.

Warning

Do not call this for changes that are a direct result of LwM2M Server operations (e.g., after a Write or Create request). Such cases are handled internally by the library.

Parameters:
  • anj – Anjay object.

  • path – Pointer to the path of the changed Resource or affected Instance.

  • change_type – Type of change; see anj_core_change_type_t.