anjay
|
Go to the source code of this file.
Functions | |
bool | anjay_attr_storage_is_modified (anjay_t *anjay) |
void | anjay_attr_storage_purge (anjay_t *anjay) |
avs_error_t | anjay_attr_storage_persist (anjay_t *anjay, avs_stream_t *out_stream) |
avs_error_t | anjay_attr_storage_restore (anjay_t *anjay, avs_stream_t *in_stream) |
int | anjay_attr_storage_set_object_attrs (anjay_t *anjay, anjay_ssid_t ssid, anjay_oid_t oid, const anjay_dm_oi_attributes_t *attrs) |
int | anjay_attr_storage_set_instance_attrs (anjay_t *anjay, anjay_ssid_t ssid, anjay_oid_t oid, anjay_iid_t iid, const anjay_dm_oi_attributes_t *attrs) |
int | anjay_attr_storage_set_resource_attrs (anjay_t *anjay, anjay_ssid_t ssid, anjay_oid_t oid, anjay_iid_t iid, anjay_rid_t rid, const anjay_dm_r_attributes_t *attrs) |
int | anjay_attr_storage_set_resource_instance_attrs (anjay_t *anjay, anjay_ssid_t ssid, anjay_oid_t oid, anjay_iid_t iid, anjay_rid_t rid, anjay_riid_t riid, const anjay_dm_r_attributes_t *attrs) |
Automatic Attribute Storage module.
This feature is enabled using the ANJAY_WITH_ATTR_STORAGE
compile-time feature macro. It makes it possible to automatically manage attributes for LwM2M Objects, their instances and resources.
In accordance to the LwM2M specification, there are three levels on which attributes may be stored:
If at least one of either read or write handlers is provided in a given object for a given level, attribute handling on that level will not be altered, but instead any calls will be directly forwarded to the original handlers.
If both read and write handlers are left as NULL in a given object for a given level, attribute storage will be handled by the Attribute Storage module instead, implementing both handlers.
bool anjay_attr_storage_is_modified | ( | anjay_t * | anjay | ) |
Checks whether the attribute storage has been modified since last successful call to anjay_attr_storage_persist or anjay_attr_storage_restore.
avs_error_t anjay_attr_storage_persist | ( | anjay_t * | anjay, |
avs_stream_t * | out_stream | ||
) |
Dumps all set attributes to the out_stream
.
anjay | Anjay instance. |
out_stream | Stream to write to. |
void anjay_attr_storage_purge | ( | anjay_t * | anjay | ) |
Removes all attributes from all entities, leaving the Attribute Storage in an empty state.
anjay | Anjay instance. |
avs_error_t anjay_attr_storage_restore | ( | anjay_t * | anjay, |
avs_stream_t * | in_stream | ||
) |
Attempts to restore attribute storage from specified in_stream
.
Note: before attempting restoration, the Attribute Storage is cleared, so no previously set attributes will be retained. In particular, if restore fails, then the Attribute Storage will be completely cleared and anjay_attr_storage_is_modified will return true
.
anjay | Anjay instance. |
in_stream | Stream to read from. |
NOTE: if restorations fails, then the Attribute Storage will be untouched.
int anjay_attr_storage_set_instance_attrs | ( | anjay_t * | anjay, |
anjay_ssid_t | ssid, | ||
anjay_oid_t | oid, | ||
anjay_iid_t | iid, | ||
const anjay_dm_oi_attributes_t * | attrs | ||
) |
Sets Instance level attributes for the specified ssid
.
anjay | Anjay object to operate on. |
ssid | SSID for which given Attributes shall be set (must be a valid SSID corresponding to one of the non-Bootstrap LwM2M Servers). |
oid | Object ID for which given Attributes shall be set. |
iid | Instance ID for which given Attributes shall be set. |
attrs | Attributes to be set (MUST NOT be NULL). |
NOTE: This function will fail if the object has instance_read_default_attrs or instance_write_default_attrs handler implemented.
int anjay_attr_storage_set_object_attrs | ( | anjay_t * | anjay, |
anjay_ssid_t | ssid, | ||
anjay_oid_t | oid, | ||
const anjay_dm_oi_attributes_t * | attrs | ||
) |
Sets Object level attributes for the specified ssid
.
anjay | Anjay object to operate on. |
ssid | SSID for which given Attributes shall be set (must be a valid SSID corresponding to one of the non-Bootstrap LwM2M Servers). |
oid | Object ID for which given Attributes shall be set. |
attrs | Attributes to be set (MUST NOT be NULL). |
NOTE: This function will fail if the object has object_read_default_attrs or object_write_default_attrs handler implemented.
int anjay_attr_storage_set_resource_attrs | ( | anjay_t * | anjay, |
anjay_ssid_t | ssid, | ||
anjay_oid_t | oid, | ||
anjay_iid_t | iid, | ||
anjay_rid_t | rid, | ||
const anjay_dm_r_attributes_t * | attrs | ||
) |
Sets Resource level attributes for the specified ssid
.
anjay | Anjay object to operate on. |
ssid | SSID for which given Attributes shall be set (must be a valid SSID corresponding to one of the non-Bootstrap LwM2M Servers). |
oid | Object ID owning the specified Instance. |
iid | Instance ID owning the specified Resource. |
rid | Resource ID for which given Attributes shall be set. |
attrs | Attributes to be set (MUST NOT be NULL). |
NOTE: This function will fail if the object has resource_read_attrs or resource_write_attrs handler implemented.
int anjay_attr_storage_set_resource_instance_attrs | ( | anjay_t * | anjay, |
anjay_ssid_t | ssid, | ||
anjay_oid_t | oid, | ||
anjay_iid_t | iid, | ||
anjay_rid_t | rid, | ||
anjay_riid_t | riid, | ||
const anjay_dm_r_attributes_t * | attrs | ||
) |
Sets Resource Instance level attributes for the specified ssid
.
anjay | Anjay object to operate on. |
ssid | SSID for which given Attributes shall be set (must be a valid SSID corresponding to one of the non-Bootstrap LwM2M Servers). |
oid | Object ID owning the specified Instance. |
iid | Instance ID owning the specified Resource. |
rid | Resource ID owning the specified Resource Instance. |
riid | Resource Instance ID for which given Attributes shall be set. |
attrs | Attributes to be set (MUST NOT be NULL). |
NOTE: This function will fail if the object has resource_read_attrs or resource_write_attrs handler implemented.