// 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(),
}
- OCStackApplicationResult listenCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult listenCallback(void* ctx, OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::ListenContext* context =
return OC_STACK_KEEP_TRANSACTION;
}
- ListenOCContainer container(clientWrapper, clientResponse->devAddr,
- reinterpret_cast<OCDiscoveryPayload*>(clientResponse->payload));
- // loop to ensure valid construction of all resources
- for(auto resource : container.Resources())
- {
- std::thread exec(context->callback, resource);
- exec.detach();
+ try{
+ ListenOCContainer container(clientWrapper, clientResponse->devAddr,
+ reinterpret_cast<OCDiscoveryPayload*>(clientResponse->payload));
+ // loop to ensure valid construction of all resources
+ for(auto resource : container.Resources())
+ {
+ std::thread exec(context->callback, resource);
+ exec.detach();
+ }
+ }
+ catch (std::exception &e){
+ oclog() << "Exception in listCallback, ignoring response: "
+ << e.what() << std::flush;
}
return result;
}
- OCStackApplicationResult listenDeviceCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult listenDeviceCallback(void* ctx,
+ OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::DeviceListenContext* context =
}
}
- OCStackApplicationResult getResourceCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult getResourceCallback(void* ctx,
+ OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::GetContext* context =
}
- OCStackApplicationResult setResourceCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult setResourceCallback(void* ctx,
+ OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::SetContext* context =
{
MessageContainer ocInfo;
ocInfo.addRepresentation(rep);
+ for(const OCRepresentation& r : rep.getChildren())
+ {
+ ocInfo.addRepresentation(r);
+ }
+
return reinterpret_cast<OCPayload*>(ocInfo.getPayload());
}
return result;
}
- OCStackApplicationResult deleteResourceCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult deleteResourceCallback(void* ctx,
+ OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::DeleteContext* context =
OCStackResult InProcClientWrapper::DeleteResource(
const OCDevAddr& devAddr,
const std::string& uri,
- const HeaderOptions& headerOptions, DeleteCallback& callback, QualityOfService QoS)
+ const HeaderOptions& headerOptions,
+ DeleteCallback& callback,
+ QualityOfService /*QoS*/)
{
if(!callback)
{
return result;
}
- OCStackApplicationResult observeResourceCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult observeResourceCallback(void* ctx,
+ OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::ObserveContext* context =
OCStackResult InProcClientWrapper::CancelObserveResource(
OCDoHandle handle,
- const std::string& host, // unused
- const std::string& uri, // unused
+ const std::string& /*host*/,
+ const std::string& /*uri*/,
const HeaderOptions& headerOptions,
QualityOfService QoS)
{
return result;
}
- OCStackApplicationResult subscribePresenceCallback(void* ctx, OCDoHandle handle,
+ OCStackApplicationResult subscribePresenceCallback(void* ctx,
+ OCDoHandle /*handle*/,
OCClientResponse* clientResponse)
{
ClientCallbackContext::SubscribePresenceContext* context =