Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wakaama-dev] feedback on read object API

I recently updated my code (https://github.com/sbernard31/lualwm2m) to be compliant with the new object API. (with lwm2m_tlv_t struct)

I found the read API a bit confusing because output parameters are also use as input parameters.

static uint8_t prv_read(uint16_t instanceId, int * numDataP,
        lwm2m_tlv_t ** dataArrayP, lwm2m_object_t * objectP)

Currently, numDataP and dataArrayP are output parameters but must be used as input to know how to fill it.

if (*numDataP) == 0  we want all the data
else we want just one data with the id (dataArrayP)->id

Maybe this could be clearer to add an input parameter resourceId.

if resourceId == -1 we want all data
else we want the resource with the given resourceId

Simon


Back to the top