OCPayload base;
char* uri;
OCPlatformInfo info;
- char* rt;
+ OCStringLL* rt;
OCStringLL* interfaces;
} OCPlatformPayload;
if (payload->rt)
{
OIC_LOG(level, PL_TAG, "\tResource Types:");
- OIC_LOG_V(level, PL_TAG, "\t\t%s", payload->rt);
+ for (OCStringLL *strll = payload->rt; strll; strll = strll->next)
+ {
+ OIC_LOG_V(level, PL_TAG, "\t\t%s", strll->value);
+ }
}
if (payload->interfaces)
{
return NULL;
}
payload->interfaces->value = OICStrdup(OC_RSRVD_INTERFACE_READ);
- payload->rt = OICStrdup(OC_RSRVD_RESOURCE_TYPE_PLATFORM);
+ payload->rt = (OCStringLL*)OICCalloc(1, sizeof(OCStringLL));
+ if (!payload->rt)
+ {
+ return NULL;
+ }
+ payload->rt->value = OICStrdup(OC_RSRVD_RESOURCE_TYPE_PLATFORM);
payload->info = *platformInfo;
return payload;
}
payload->base.type = PAYLOAD_TYPE_PLATFORM;
- payload->rt = OICStrdup(OC_RSRVD_RESOURCE_TYPE_PLATFORM);
+ OCResourcePayloadAddStringLL(&payload->rt, OC_RSRVD_RESOURCE_TYPE_PLATFORM);
OCResourcePayloadAddStringLL(&payload->interfaces, OC_RSRVD_INTERFACE_DEFAULT);
OCResourcePayloadAddStringLL(&payload->interfaces, OC_RSRVD_INTERFACE_READ);
}
OICFree(payload->uri);
OCPlatformInfoDestroy(&payload->info);
- OICFree(payload->rt);
+ OCFreeOCStringLL(payload->rt);
OCFreeOCStringLL(payload->interfaces);
OICFree(payload);
}
// Resource type
if (payload->rt)
{
- err |= ConditionalAddTextStringToMap(&repMap, OC_RSRVD_RESOURCE_TYPE,
- sizeof(OC_RSRVD_RESOURCE_TYPE) - 1, payload->rt);
+ err |= OCStringLLJoin(&repMap, OC_RSRVD_RESOURCE_TYPE, payload->rt);
VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding resource type.");
}
OCStackResult ret = OC_STACK_INVALID_PARAM;
CborError err = CborNoError;
OCPlatformInfo info = {0};
- char* rt = NULL;
+ OCStringLL* rt = NULL;
OCStringLL* interfaces = NULL;
OCPlatformPayload* out = NULL;
if(cbor_value_is_valid(&repVal))
{
- err = cbor_value_dup_text_string(&repVal, &rt, &len, NULL);
+ err = OCParseStringLL(rootValue, OC_RSRVD_RESOURCE_TYPE, &rt);
VERIFY_CBOR_SUCCESS(TAG, err, "Failed to find resource type in the platform payload");
}
std::string(payload->info.systemTime) :
std::string();
- if (payload->rt)
+ for (OCStringLL *strll = payload->rt; strll; strll = strll->next)
{
- rep.addResourceType(payload->rt);
+ rep.addResourceType(strll->value);
}
for (OCStringLL *strll = payload->interfaces; strll; strll = strll->next)
{
EXPECT_STREQ(time1, platform->info.systemTime);
EXPECT_STREQ(OC_RSRVD_INTERFACE_DEFAULT, platform->interfaces->value);
EXPECT_STREQ(OC_RSRVD_INTERFACE_READ, platform->interfaces->next->value);
- EXPECT_STREQ(OC_RSRVD_RESOURCE_TYPE_PLATFORM, platform->rt);
+ EXPECT_STREQ(OC_RSRVD_RESOURCE_TYPE_PLATFORM, platform->rt->value);
uint8_t* cborData;
size_t cborSize;
EXPECT_STREQ(platform->info.supportUrl, platform->info.supportUrl);
EXPECT_STREQ(platform->info.systemTime, platform2->info.systemTime);
EXPECT_STREQ(platform->interfaces->value, platform2->interfaces->value);
- EXPECT_STREQ(platform->rt, platform2->rt);
+ EXPECT_STREQ(platform->rt->value, platform2->rt->value);
OCPayloadDestroy((OCPayload*)platform);