- return result;
- }
- }
-#ifdef RD_CLIENT
- OCRepresentation parseRDResponseCallback(OCClientResponse* clientResponse)
- {
- if (nullptr == clientResponse || nullptr == clientResponse->payload ||
- PAYLOAD_TYPE_RD != clientResponse->payload->type)
- {
- return OCRepresentation();
- }
-
- MessageContainer oc;
- oc.setPayload(clientResponse->payload);
-
- std::vector<OCRepresentation>::const_iterator it = oc.representations().begin();
- if (it == oc.representations().end())
- {
- return OCRepresentation();
- }
-
- // first one is considered the root, everything else is considered a child of this one.
- OCRepresentation root = *it;
- root.setDevAddr(clientResponse->devAddr);
- root.setUri(clientResponse->resourceUri);
- ++it;
-
- std::for_each(it, oc.representations().end(),
- [&root](const OCRepresentation& repItr)
- {root.addChild(repItr);});
- return root;
-
- }
-
- OCStackApplicationResult publishResourceToRDCallback(void* ctx, OCDoHandle /*handle*/,
- OCClientResponse* clientResponse)
- {
- ServerCallbackContext::PublishContext* context =
- static_cast<ServerCallbackContext::PublishContext*>(ctx);