本文整理汇总了C++中OCRepresentation::numberOfAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ OCRepresentation::numberOfAttributes方法的具体用法?C++ OCRepresentation::numberOfAttributes怎么用?C++ OCRepresentation::numberOfAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCRepresentation
的用法示例。
在下文中一共展示了OCRepresentation::numberOfAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOGD
/*
* Class: org_iotivity_base_OcRepresentation
* Method: size
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_iotivity_base_OcRepresentation_size
(JNIEnv *env, jobject thiz)
{
LOGD("OcRepresentation_size");
OCRepresentation *rep = JniOcRepresentation::getOCRepresentationPtr(env, thiz);
if (!rep) return -1;
return static_cast<jint>(rep->numberOfAttributes());
}
示例2: onGet
void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
{
try
{
if(eCode == OC_STACK_OK)
{
dlog_print(DLOG_INFO, LOG_TAG, "GET request was successful %s", rep.getUri().c_str());
std::cout << "Attributes : " << rep.numberOfAttributes() << std::endl;
typedef std::map<std::string, int>::iterator it_type;
for(it_type iterator = intprops.begin(); iterator != intprops.end(); iterator++) {
std::cout << "Key : " << iterator->first << " Value = "<<rep[iterator->first]<<std::endl;
iterator->second = rep[iterator->first];
}
typedef std::map<std::string, double>::iterator itd_type;
for(itd_type iterator = doubleprops.begin(); iterator != doubleprops.end(); iterator++) {
std::cout << "Key : " << iterator->first << " Value = "<<rep[iterator->first]<<std::endl;
iterator->second = rep[iterator->first];
}
rvidata r;
r.lt = rep["leftTemperature"];
r.rt = rep["rightTemperature"];
r.lhs = rep["leftSeatHeat"];
r.rhs = rep["rightSeatHeat"];
r.fs = rep["fanSpeed"];
r.fd = rep["fanDown"];
r.fr = rep["fanRight"];
r.fu = rep["fanUp"];
r.fac = rep["fanAC"];
r.fa = rep["fanAuto"];
r.fr = rep["fanRecirc"];
r.dm = rep["defrostMax"];
r.df = rep["defrostFront"];
r.dr = rep["defrostRear"];
send_message(&r);
}
else
{
dlog_print(DLOG_INFO, LOG_TAG, "GET request was UNsuccessful");
}
}
catch(std::exception& e)
{
std::cout << "Exception: " << e.what() << " in onPut" << std::endl;
}
}