}
OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourcePtr,
- OCRepPayload** payload, OCDevAddr *devAddr)
+ OCRepPayload** payload, OCDevAddr *devAddr, bool includeBaselineProps)
{
size_t dimensions[MAX_REP_ARRAY_DEPTH] = { 0 };
OCRepPayload *tempPayload = NULL;
goto exit;
}
- if (!OCRepPayloadSetUri(tempPayload, resourcePtr->uri))
+ if(includeBaselineProps)
{
- OIC_LOG(ERROR, TAG, "Failed to set payload URI");
- ret = OC_STACK_ERROR;
- goto exit;
- }
-
- resType = resourcePtr->rsrcType;
- while (resType)
- {
- if (!OCRepPayloadAddResourceType(tempPayload, resType->resourcetypename))
+ resType = resourcePtr->rsrcType;
+ while (resType)
{
- OIC_LOG(ERROR, TAG, "Failed at add resource type");
- ret = OC_STACK_ERROR;
- goto exit;
+ if (!OCRepPayloadAddResourceType(tempPayload, resType->resourcetypename))
+ {
+ OIC_LOG(ERROR, TAG, "Failed at add resource type");
+ ret = OC_STACK_ERROR;
+ goto exit;
+ }
+ resType = resType->next;
}
- resType = resType->next;
- }
- resInterface = resourcePtr->rsrcInterface;
- while (resInterface)
- {
- if (!OCRepPayloadAddInterface(tempPayload, resInterface->name))
+ resInterface = resourcePtr->rsrcInterface;
+ while (resInterface)
{
- OIC_LOG(ERROR, TAG, "Failed to add interface");
- ret = OC_STACK_ERROR;
- goto exit;
+ if (!OCRepPayloadAddInterface(tempPayload, resInterface->name))
+ {
+ OIC_LOG(ERROR, TAG, "Failed to add interface");
+ ret = OC_STACK_ERROR;
+ goto exit;
+ }
+ resInterface = resInterface->next;
}
- resInterface = resInterface->next;
}
+
if (!OCRepPayloadSetPropString(tempPayload, OC_RSRVD_INTROSPECTION_NAME, OC_RSRVD_INTROSPECTION_NAME_VALUE))
{
OIC_LOG(ERROR, TAG, "Failed to set Name property.");
{
// Received request for introspection
OCResource *resourcePtr = FindResourceByUri(OC_RSRVD_INTROSPECTION_URI_PATH);
+ bool includeBaselineProps = interfaceQuery
+ && (0 == strcmp(interfaceQuery, OC_RSRVD_INTERFACE_DEFAULT));
VERIFY_PARAM_NON_NULL(TAG, resourcePtr, "Introspection URI not found.");
- discoveryResult = BuildIntrospectionResponseRepresentation(resourcePtr, (OCRepPayload **)&payload, &request->devAddr);
+ discoveryResult = BuildIntrospectionResponseRepresentation(resourcePtr,
+ (OCRepPayload **)&payload,
+ &request->devAddr,
+ includeBaselineProps);
OIC_LOG(INFO, TAG, "Request is for Introspection");
}
else if (OC_INTROSPECTION_PAYLOAD_URI == virtualUriInRequest)