return result;
}
+OCStackResult HandleBatchResponse(char *requestUri, OCRepPayload **payload)
+{
+ if (requestUri && *payload)
+ {
+ char *interfaceName = NULL;
+ char *rtTypeName = NULL;
+ char *uriQuery = NULL;
+ char *uriWithoutQuery = NULL;
+ if (OC_STACK_OK == getQueryFromUri(requestUri, &uriQuery, &uriWithoutQuery))
+ {
+ if (OC_STACK_OK == ExtractFiltersFromQuery(uriQuery, &interfaceName, &rtTypeName))
+ {
+ if (0 == strcmp(OC_RSRVD_INTERFACE_BATCH, interfaceName))
+ {
+ char *uri = (*payload)->uri;
+ if (uri && 0 != strcmp(uriWithoutQuery, uri))
+ {
+ OCRepPayload *newPayload = OCRepPayloadCreate();
+ if (newPayload)
+ {
+ OCRepPayloadSetUri(newPayload, uri);
+ newPayload->next = *payload;
+ *payload = newPayload;
+ }
+ }
+ }
+ }
+ }
+ OICFree(interfaceName);
+ OICFree(rtTypeName);
+ OICFree(uriQuery);
+ OICFree(uriWithoutQuery);
+ return OC_STACK_OK;
+ }
+ return OC_STACK_INVALID_PARAM;
+}
+
void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* responseInfo)
{
OIC_LOG(DEBUG, TAG, "Enter OCHandleResponse");
#endif
}
}
+ if (response->payload && response->payload->type == PAYLOAD_TYPE_REPRESENTATION)
+ {
+ HandleBatchResponse(cbNode->requestUri, (OCRepPayload **)&response->payload);
+ }
OCStackApplicationResult appFeedback = cbNode->callBack(cbNode->context,
cbNode->handle,
)
)
{
- //OCPayloadDestroy(clientResponse->payload);
return OCRepresentation();
}
MessageContainer oc;
oc.setPayload(clientResponse->payload);
- //OCPayloadDestroy(clientResponse->payload);
std::vector<OCRepresentation>::const_iterator it = oc.representations().begin();
if (it == oc.representations().end())
}
// 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;
+ 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 listenCallback(void* ctx, OCDoHandle /*handle*/,
{
ClientCallbackContext::GetContext* context =
static_cast<ClientCallbackContext::GetContext*>(ctx);
-
OCRepresentation rep;
HeaderOptions serverHeaderOptions;
OCStackResult result = clientResponse->result;
OCStackResult result;
ClientCallbackContext::GetContext* ctx =
new ClientCallbackContext::GetContext(callback);
+
OCCallbackData cbdata;
- cbdata.context = static_cast<void*>(ctx),
+ cbdata.context = static_cast<void*>(ctx);
cbdata.cb = getResourceCallback;
cbdata.cd = [](void* c){delete (ClientCallbackContext::GetContext*)c;};
-
std::string uri = assembleSetResourceUri(resourceUri, queryParams);
auto cLock = m_csdkLock.lock();