Typedef anjay_dm_list_instances_t

Typedef Documentation

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.

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.

Param anjay:

Anjay object to operate on.

Param obj_ptr:

Object definition pointer, as passed to anjay_register_object .

Param ctx:

Context through which the Instance IDs shall be returned, see anjay_dm_emit .

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.