Hi All,

I found some strange behaviours of code (basically there are bugs, but I found 
work arounds...)
This is needs to be documented somewhere as best practice of coding.
Where can this information be placed?


1)      C++ API

When handling request data, e.g. getting values from the supplied payload one 
should not use

rep.getValue("id", value) , this returns an Boolean and should not update the 
content value when the "id" is not there

But this is incorrect when using vector, it assigns 0....

Instead use rep.hasAttribute("id") to check if the id is in the payload.

If it is there, then handle it with getValue...

2)      C++ API
Avoid to return errors on POST when having vectors.
e.g. when an error has to be returned due to that an property being updated in 
an POST but it is marked readOnly
then the device can crash. To avoid this the readOnly optional properties can 
be removed.
For example remove readOnly params like: "precision", "maximumsaturation" from 
oic.r.colour.chroma
Note that the crash does not occur when no vectors are being used. E.g. no 
vectors : no issues.


Kind Regards,
Wouter

_______________________________________________
iotivity-dev mailing list
iotivity-dev@lists.iotivity.org
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to