本文整理汇总了C++中OCRepresentation::setDevAddr方法的典型用法代码示例。如果您正苦于以下问题:C++ OCRepresentation::setDevAddr方法的具体用法?C++ OCRepresentation::setDevAddr怎么用?C++ OCRepresentation::setDevAddr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCRepresentation
的用法示例。
在下文中一共展示了OCRepresentation::setDevAddr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseRDResponseCallback
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;
}
示例2: parseGetSetCallback
OCRepresentation parseGetSetCallback(OCClientResponse* clientResponse)
{
if(clientResponse->payload == nullptr ||
(
clientResponse->payload->type != PAYLOAD_TYPE_DEVICE &&
clientResponse->payload->type != PAYLOAD_TYPE_PLATFORM &&
clientResponse->payload->type != PAYLOAD_TYPE_REPRESENTATION
)
)
{
//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())
{
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;
}