Typedef anjay_dm_resource_reset_t

Typedef Documentation

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.

Param anjay:

Anjay Object to operate on.

Param obj_ptr:

Object definition pointer, as passed to anjay_register_object .

Param iid:

Object Instance ID.

Param rid:

ID of the Resource to reset.

Return:

This handler should return:

  • 0 on success,

  • a negative value in case of error. If it returns one of ANJAY_ERR_ constants, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.