+ m_syncFunc(int(rep.getValue<int>("x.org.iotivity.ns.state")), int(rep.getValue<int>("x.org.iotivity.ns.messageid")));
+ }
+ }
+
+ void onTopicGet(const OC::HeaderOptions &/*headerOption*/,
+ const OC::OCRepresentation & rep , const int /*eCode*/,
+ std::shared_ptr<OC::OCResource> /*resource*/)
+ {
+
+ if(!isTopicPost)
+ {
+ isTopicPost = true;
+ OC::OCRepresentation postRep;
+
+ std::vector<OC::OCRepresentation> topicArr =
+ rep.getValue<std::vector<OC::OCRepresentation>>("x.org.iotivity.ns.topiclist");
+
+ std::vector<OC::OCRepresentation> postTopicArr;
+
+ for(std::vector<OC::OCRepresentation>::iterator it = topicArr.begin();
+ it != topicArr.end(); ++it)
+ {
+ /* std::cout << *it; ... */
+ OC::OCRepresentation topic = *it;
+ OC::OCRepresentation postTopic;
+
+ postTopic.setValue("x.org.iotivity.ns.topicname", topic.getValueToString("x.org.iotivity.ns.topicname"));
+ postTopic.setValue("x.org.iotivity.ns.topicstate", (int) topic.getValue<int>("x.org.iotivity.ns.topicstate"));
+
+ postTopicArr.push_back(topic);
+
+// std::cout << "tName : " << tName << std::endl;
+// std::cout << "tState : " << tState << std::endl;
+ }
+
+ postRep.setValue<std::vector<OC::OCRepresentation>>
+ ("x.org.iotivity.ns.topiclist", postTopicArr);
+
+ OC::QueryParamsMap map;
+ map.insert(std::pair<std::string,std::string>(std::string("x.org.iotivity.ns.consumerid"),
+ std::string("123456789012345678901234567890123456")));
+ m_topicResource->post(postRep, map, &onPost, OC::QualityOfService::LowQos);