On ter?a-feira, 19 de julho de 2016 07:49:52 PDT ??? wrote:
> Dear IoTivity CSDK API developers,
>
> Currentyl I'm working on designing resource model for a device.
> And found there're 4 APIs in csdk which helps us to insert
> string/boolean/int_64/double/object array type value into the payload.
> I found this API works okey, however, it is very difficult for me to
> understand the API only with the API description. Therefore, I will be
> appreciated if anyone from the CSDK API developers could share us the light
> on these question. :)
> 1."WHAT IS THE *dimension* input parameter is?
> ex) bool OCRepPayloadGetPropObjectArray(const OCRepPayload*
> payload, const char* name, OCRepPayload*** array, size_t
> dimensions[MAX_REP_ARRAY_DEPTH]);
This is an output parameter. It will contain the dimensions of the array that
was copied into the array output parameter.
If, on output, dimensions is { 5, 2, 1 }, that means you have a two-
dimensional array of 5x2, for a total of 10 elements. If the value is {100, 1,
1}, then you have a one-dimensional array of 100 elements. And so forth.
> 2. What is the *OFFICIALLY* supporting complexity or depth of contents
> formation in the payload? ex) {
There's no limit in the spec, as far as I can tell. The implementation is
limited to three-dimensional arrays.
Also note that your example is not a multi-dimensional array, but one in which
the arrays contains maps/objects, each of which counts as a single item,
however many nested items they may contain. For example:
[
{"content": [ 100 elements here ] },
{"content": [ 200 elements here ] }
]
That's still a one-dimensional array containing 2 elements.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center