char *uri;
/** Resource Type */
- char *type;
+ OCStringLL *type;
/** Interface */
OCStringLL *interface;
}
if (payload->type)
{
- OIC_LOG_V(level, PL_TAG, "\tResource Type: %s", payload->type);
+ for (OCStringLL *strll = payload->type; strll; strll = strll->next)
+ {
+ OIC_LOG_V(level, PL_TAG, "\tResource Type: %s", strll->value);
+ }
}
OIC_LOG(level, PL_TAG, "\tInterface:");
for (OCStringLL *itf = payload->interface; itf; itf = itf->next)
OICFree(payload->sid);
OICFree(payload->baseURI);
OICFree(payload->uri);
- OICFree(payload->type);
+ OCFreeOCStringLL(payload->type);
OICFree(payload->name);
OCFreeOCStringLL(payload->interface);
OCDiscoveryResourceDestroy(payload->resources);
VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting device id");
// Insert Resource Type
- err |= ConditionalAddTextStringToMap(&rootMap, OC_RSRVD_RESOURCE_TYPE,
- sizeof(OC_RSRVD_RESOURCE_TYPE) - 1, payload->type);
+ err |= OCStringLLJoin(&rootMap, OC_RSRVD_RESOURCE_TYPE, payload->type);
VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting RT");
// Insert interfaces
err = cbor_value_map_find_value(&rootMap, OC_RSRVD_RESOURCE_TYPE, &curVal);
if (cbor_value_is_valid(&curVal))
{
- err = cbor_value_dup_text_string(&curVal, &(out->type), &len, NULL);
+ err = OCParseStringLL(&rootMap, OC_RSRVD_RESOURCE_TYPE, &out->type);
VERIFY_CBOR_SUCCESS(TAG, err, "to find base uri value");
}
discPayload->name = OICStrdup(savedDeviceInfo.deviceName);
VERIFY_NON_NULL(discPayload->name, ERROR, OC_STACK_NO_MEMORY);
}
- discPayload->type = OICStrdup(OC_RSRVD_RESOURCE_TYPE_RES);
+ discPayload->type = (OCStringLL*)OICCalloc(1, sizeof(OCStringLL));
VERIFY_NON_NULL(discPayload->type, ERROR, OC_STACK_NO_MEMORY);
+ discPayload->type->value = OICStrdup(OC_RSRVD_RESOURCE_TYPE_RES);
+ VERIFY_NON_NULL(discPayload->type->value, ERROR, OC_STACK_NO_MEMORY);
OCResourcePayloadAddStringLL(&discPayload->interface, OC_RSRVD_INTERFACE_LL);
OCResourcePayloadAddStringLL(&discPayload->interface, OC_RSRVD_INTERFACE_DEFAULT);
VERIFY_NON_NULL(discPayload->interface, ERROR, OC_STACK_NO_MEMORY);