If an application does not set oic.wk.d, set in savedDeviceInfo to get proper response for GET message.
Change-Id: I028b821ffe29b467d0ecc2add9a7a6ebfff5e72d
Signed-off-by: Habib Virji <habib.virji@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9309
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dwarkaprasad Dayama <dwarka.dayama@samsung.com>
Reviewed-by: Mushfiqul Islam <i.mushfiq@samsung.com>
if (info.types)
{
savedDeviceInfo.types = CloneOCStringLL(info.types);
+ OCStringLL *type = info.types;
+ bool found = false;
+ while (type)
+ {
+ if (type && type->value && 0 == strcmp(type->value, OC_RSRVD_RESOURCE_TYPE_DEVICE))
+ {
+ found = true;
+ }
+ type = type->next;
+ }
+ if (!found)
+ {
+ // Append the oic.wk.d at the start of rt link parameter value.
+ OCStringLL *dest = (OCStringLL*)OICCalloc (1, sizeof (OCStringLL));
+ if (!dest)
+ {
+ DeleteDeviceInfo();
+ return OC_STACK_NO_MEMORY;
+ }
+ dest->value = OICStrdup (OC_RSRVD_RESOURCE_TYPE_DEVICE);
+ if (!dest->value)
+ {
+ DeleteDeviceInfo();
+ return OC_STACK_NO_MEMORY;
+ }
+ dest->next = savedDeviceInfo.types;
+ savedDeviceInfo.types = dest;
+ }
if(!savedDeviceInfo.types && info.types)
{
DeleteDeviceInfo();