Typedef anjay_dm_list_resources_t

Typedef Documentation

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.

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.

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 ctx:

Context through which the Resource IDs shall be returned, see anjay_dm_emit_res .

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.