}
OC::OCRepresentation rep;
- rep.setValue("providerid", providerID);
- rep.setValue("messageid", id);
- rep.setValue("state", type);
+ rep.setValue("x.org.iotivity.ns.providerid", providerID);
+ rep.setValue("x.org.iotivity.ns.messageid", id);
+ rep.setValue("x.org.iotivity.ns.state", type);
m_syncResource->post(rep, OC::QueryParamsMap(), &onPost, OC::QualityOfService::LowQos);
}
{
OC::QueryParamsMap map;
- map.insert(std::pair<std::string, std::string>(std::string("consumerid"),
+ map.insert(std::pair<std::string, std::string>(std::string("x.org.iotivity.ns.consumerid"),
std::string("123456789012345678901234567890123456")));
try
std::shared_ptr<OC::OCResource> )
{
- if (rep.getUri() == "/notification/message" && rep.hasAttribute("messageid")
- && rep.getValue<int>("messageid") != 1)
+ if (rep.getUri() == "/notification/message" && rep.hasAttribute("x.org.iotivity.ns.messageid")
+ && rep.getValue<int>("x.org.iotivity.ns.messageid") != 1)
{
- m_messageFunc(int(rep.getValue<int>("messageid")),
- std::string(rep.getValueToString("title")),
- std::string(rep.getValueToString("contenttext")),
- std::string(rep.getValueToString("source")));
- if (rep.getValue<int>("messageid") == 3)
+ m_messageFunc(int(rep.getValue<int>("x.org.iotivity.ns.messageid")),
+ std::string(rep.getValueToString("x.org.iotivity.ns.title")),
+ std::string(rep.getValueToString("x.org.iotivity.ns.contenttext")),
+ std::string(rep.getValueToString(".x.org.iotivity.ns.source")));
+ if (rep.getValue<int>("x.org.iotivity.ns.messageid") == 3)
{
m_topicResource->get(OC::QueryParamsMap(),
std::bind(&NSConsumerSimulator::onTopicGet, this, std::placeholders::_1,
}
else if (rep.getUri() == "/notification/sync")
{
- m_syncFunc(int(rep.getValue<int>("state")), int(rep.getValue<int>("messageid")));
+ 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*/,
std::string syncUri = m_notificationUri + m_syncUri;
std::string topicUri = m_notificationUri + m_topicUri;
std::string providerId = "123456789012345678901234567890123456";
- rep.setValue("subcontrollability", m_accepter);
- rep.setValue("messageuri", msgUri);
- rep.setValue("syncuri", syncUri);
- rep.setValue("topicuri", topicUri);
- rep.setValue("providerid", providerId);
+ rep.setValue("x.org.iotivity.ns.subcontrollability", m_accepter);
+ rep.setValue("x.org.iotivity.ns.messageuri", msgUri);
+ rep.setValue("x.org.iotivity.ns.syncuri", syncUri);
+ rep.setValue("x.org.iotivity.ns.topicuri", topicUri);
+ rep.setValue("x.org.iotivity.ns.providerid", providerId);
}
else if (type == requestType::NS_SYNC)
{
[& topicArr](const NS_TopicState & topicState)
{
OC::OCRepresentation topic;
- topic.setValue("topicname", topicState.first);
- topic.setValue("topicstate", (int) topicState.second);
+ topic.setValue("x.org.iotivity.ns.topicname", topicState.first);
+ topic.setValue("x.org.iotivity.ns.topicstate", (int) topicState.second);
topicArr.push_back(topic);
}
);
rep.setValue<std::vector<OC::OCRepresentation>>
- ("topiclist", topicArr);
+ ("x.org.iotivity.ns.topiclist", topicArr);
}
else
{
m_syncRep = requests->getResourceRepresentation();
std::cout << "Receive POST for Sync" << std::endl;
- std::cout << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
- std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
+ std::cout << "provider Id : " << m_syncRep.getValueToString("x.org.iotivity.ns.providerid") << std::endl;
+ std::cout << "Sync State : " << m_syncRep.getValueToString("x.org.iotivity.ns.state") << std::endl;
response->setResourceRepresentation(m_syncRep);
{
auto receivePayload =
requests->getResourceRepresentation()
- .getValue<std::vector<OC::OCRepresentation>>("topiclist");
+ .getValue<std::vector<OC::OCRepresentation>>("x.org.iotivity.ns.topiclist");
std::for_each (receivePayload.begin(), receivePayload.end(),
[this](const OC::OCRepresentation & rep)
{
- auto tmp = m_allowedTopicList.find(rep.getValueToString("topicname"));
+ auto tmp = m_allowedTopicList.find(rep.getValueToString("x.org.iotivity.ns.topicname"));
if (tmp != m_allowedTopicList.end())
{
- tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
+ tmp->second = (TopicAllowState) rep.getValue<int>("x.org.iotivity.ns.topicstate");
}
}
);
{
OC::OCRepresentation rep;
std::string providerId = "123456789012345678901234567890123456";
- rep.setValue<int>("messageid", (int)messageType::NS_ALLOW);
- rep.setValue("providerid", providerId);
+ rep.setValue<int>("x.org.iotivity.ns.messageid", (int)messageType::NS_ALLOW);
+ rep.setValue("x.org.iotivity.ns.providerid", providerId);
auto response = std::make_shared<OC::OCResourceResponse>();
response->setRequestHandle(requests->getRequestHandle());
void sendRead(const uint64_t &id)
{
std::string providerId = "123456789012345678901234567890123456";
- m_syncRep.setValue<int>("messageid", id);
- m_syncRep.setValue("state", (int)1);
- m_syncRep.setValue("providerid", providerId);
+ m_syncRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+ m_syncRep.setValue("x.org.iotivity.ns.state", (int)1);
+ m_syncRep.setValue("x.org.iotivity.ns.providerid", providerId);
OC::OCPlatform::notifyAllObservers(m_syncHandle);
}
void sendDismiss(const uint64_t &id)
{
std::string providerId = "123456789012345678901234567890123456";
- m_syncRep.setValue<int>("messageid", id);
- m_syncRep.setValue("state", (int)2);
- m_syncRep.setValue("providerid", providerId);
+ m_syncRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+ m_syncRep.setValue("x.org.iotivity.ns.state", (int)2);
+ m_syncRep.setValue("x.org.iotivity.ns.providerid", providerId);
OC::OCPlatform::notifyAllObservers(m_syncHandle);
}
void setMessage(const uint64_t &id, const std::string &title, const std::string &content)
{
std::string providerId = "123456789012345678901234567890123456";
- m_messageRep.setValue<int>("messageid", id);
- m_messageRep.setValue("title", title);
- m_messageRep.setValue("contenttext", content);
- m_messageRep.setValue("providerid", providerId);
+ m_messageRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+ m_messageRep.setValue("x.org.iotivity.ns.title", title);
+ m_messageRep.setValue("x.org.iotivity.ns.contenttext", content);
+ m_messageRep.setValue("x.org.iotivity.ns.providerid", providerId);
}
void setTopics(const NS_TopicList &topics)
#define THREAD_COUNT 5
// NOTIOBJ //
-#define NOTIOBJ_TITLE_KEY "title"
-#define NOTIOBJ_ID_KEY "id"
-#define NOTOOBJ_CONTENT_KEY "contenttext"
+#define NOTIOBJ_TITLE_KEY "x.org.iotivity.ns.title"
+#define NOTIOBJ_ID_KEY "x.org.iotivity.ns.id"
+#define NOTOOBJ_CONTENT_KEY "x.org.iotivity.ns.contenttext"
#define DISCOVERY_TAG "NS_PROVIDER_DISCOVERY"
#define SUBSCRIPTION_TAG "NS_PROVIDER_SUBSCRIPTION"
#define NS_INTERFACE_READ "oic.if.r"
#define NS_INTERFACE_READWRITE "oic.if.rw"
-#define NS_INTERFACE_BASELINE "oic.if.baseline"
+#define NS_INTERFACE_BASELINE "oic.if.baseline"
#define NS_ROOT_URI "/notification"
#define NS_COLLECTION_MESSAGE_URI "/notification/message"
#define NS_QUERY_SEPARATOR "&;"
#define NS_KEY_VALUE_DELIMITER "="
-#define NS_QUERY_CONSUMER_ID "consumerid"
-#define NS_QUERY_PROVIDER_ID "providerid"
+#define NS_QUERY_CONSUMER_ID "x.org.iotivity.ns.consumerid"
+#define NS_QUERY_PROVIDER_ID "x.org.iotivity.ns.providerid"
#define NS_QUERY_INTERFACE "if"
#define NS_QUERY_ID_SIZE 10
#define NS_RD_PUBLISH_QUERY "/oic/rd?rt=oic.wk.rdpub"
#ifdef WITH_MQ
-#define NS_ATTRIBUTE_MQ_MESSAGE "message"
-#define NS_ATTIRBUTE_MQ_TOPICLIST "topiclist"
+#define NS_ATTRIBUTE_MQ_MESSAGE "x.org.iotivity.ns.message"
+#define NS_ATTIRBUTE_MQ_TOPICLIST "x.org.iotivity.ns.topiclist"
#endif
#define NS_VERIFY_NOT_NULL_V(obj) \
#define VERSION "1.2.0"
-#define NS_ATTRIBUTE_VERSION "version"
-#define NS_ATTRIBUTE_POLICY "subcontrollability"
-#define NS_ATTRIBUTE_MESSAGE "messageuri"
-#define NS_ATTRIBUTE_SYNC "syncuri"
-#define NS_ATTRIBUTE_TOPIC "topicuri"
-#define NS_ATTRIBUTE_MESSAGE_ID "messageid"
-#define NS_ATTRIBUTE_PROVIDER_ID "providerid"
-#define NS_ATTRIBUTE_CONSUMER_ID "consumerid"
-#define NS_ATTRIBUTE_TOPIC_LIST "topiclist"
-#define NS_ATTRIBUTE_TOPIC_NAME "topicname"
-#define NS_ATTRIBUTE_TOPIC_SELECTION "topicstate"
-#define NS_ATTRIBUTE_TITLE "title"
-#define NS_ATTRIBUTE_TEXT "contenttext"
-#define NS_ATTRIBUTE_SOURCE "source"
-#define NS_ATTRIBUTE_STATE "state"
-#define NS_ATTRIBUTE_DEVICE "device"
-#define NS_ATTRIBUTE_TYPE "type"
-#define NS_ATTRIBUTE_DATETIME "datetime"
-#define NS_ATTRIBUTE_TTL "ttl"
-#define NS_ATTRIBUTE_ICON_IMAGE "iconimage"
+#define NS_ATTRIBUTE_VERSION "x.org.iotivity.ns.version"
+#define NS_ATTRIBUTE_POLICY "x.org.iotivity.ns.subcontrollability"
+#define NS_ATTRIBUTE_MESSAGE "x.org.iotivity.ns.messageuri"
+#define NS_ATTRIBUTE_SYNC "x.org.iotivity.ns.syncuri"
+#define NS_ATTRIBUTE_TOPIC "x.org.iotivity.ns.topicuri"
+#define NS_ATTRIBUTE_MESSAGE_ID "x.org.iotivity.ns.messageid"
+#define NS_ATTRIBUTE_PROVIDER_ID "x.org.iotivity.ns.providerid"
+#define NS_ATTRIBUTE_CONSUMER_ID "x.org.iotivity.ns.consumerid"
+#define NS_ATTRIBUTE_TOPIC_LIST "x.org.iotivity.ns.topiclist"
+#define NS_ATTRIBUTE_TOPIC_NAME "x.org.iotivity.ns.topicname"
+#define NS_ATTRIBUTE_TOPIC_SELECTION "x.org.iotivity.ns.topicstate"
+#define NS_ATTRIBUTE_TITLE "x.org.iotivity.ns.title"
+#define NS_ATTRIBUTE_TEXT "x.org.iotivity.ns.contenttext"
+#define NS_ATTRIBUTE_SOURCE "x.org.iotivity.ns.source"
+#define NS_ATTRIBUTE_STATE "x.org.iotivity.ns.state"
+#define NS_ATTRIBUTE_DEVICE "x.org.iotivity.ns.device"
+#define NS_ATTRIBUTE_TYPE "x.org.iotivity.ns.type"
+#define NS_ATTRIBUTE_DATETIME "x.org.iotivity.ns.datetime"
+#define NS_ATTRIBUTE_TTL "x.org.iotivity.ns.ttl"
+#define NS_ATTRIBUTE_ICON_IMAGE "x.org.iotivity.ns.iconimage"
typedef enum eConnectionState
{
}
OC::OCRepresentation rep;
- rep.setValue("providerid", providerID);
- rep.setValue("messageid", id);
- rep.setValue("state", type);
+ rep.setValue("x.org.iotivity.ns.providerid", providerID);
+ rep.setValue("x.org.iotivity.ns.messageid", id);
+ rep.setValue("x.org.iotivity.ns.state", type);
m_syncResource->post(rep, OC::QueryParamsMap(), &onPost, OC::QualityOfService::LowQos);
}
std::shared_ptr<OC::OCResource> resource)
{
OC::QueryParamsMap map;
- map.insert(std::pair<std::string,std::string>(std::string("consumerid"),
+ map.insert(std::pair<std::string,std::string>(std::string("x.org.iotivity.ns.consumerid"),
std::string("123456789012345678901234567890123456")));
try
const OC::OCRepresentation &rep , const int & /*eCode*/, const int &,
std::shared_ptr<OC::OCResource> )
{
- if (rep.getUri() == "/notification/message" && rep.hasAttribute("messageid")
- && rep.getValue<int>("messageid") != 1)
+ if (rep.getUri() == "/notification/message" && rep.hasAttribute("x.org.iotivity.ns.messageid")
+ && rep.getValue<int>("x.org.iotivity.ns.messageid") != 1)
{
- m_messageFunc(int(rep.getValue<int>("messageid")),
- std::string(rep.getValueToString("title")),
- std::string(rep.getValueToString("contenttext")),
- std::string(rep.getValueToString("source")));
+ m_messageFunc(int(rep.getValue<int>("x.org.iotivity.ns.messageid")),
+ std::string(rep.getValueToString("x.org.iotivity.ns.title")),
+ std::string(rep.getValueToString("x.org.iotivity.ns.contenttext")),
+ std::string(rep.getValueToString("x.org.iotivity.ns.source")));
- if(rep.getValue<int>("messageid") == 3)
+ if(rep.getValue<int>("x.org.iotivity.ns.messageid") == 3)
{
m_topicResource->get(std::string("x.org.iotivity.notification"),
std::string("oic.if.baseline"), OC::QueryParamsMap(),
}
else if (rep.getUri() == "/notification/sync")
{
- m_syncFunc(int(rep.getValue<int>("state")), int(rep.getValue<int>("messageid")));
+ m_syncFunc(int(rep.getValue<int>("x.org.iotivity.ns.state")), int(rep.getValue<int>("x.org.iotivity.ns.messageid")));
}
}
OC::OCRepresentation postRep;
std::vector<OC::OCRepresentation> topicArr =
- rep.getValue<std::vector<OC::OCRepresentation>>("topiclist");
+ rep.getValue<std::vector<OC::OCRepresentation>>("x.org.iotivity.ns.topiclist");
std::vector<OC::OCRepresentation> postTopicArr;
OC::OCRepresentation topic = *it;
OC::OCRepresentation postTopic;
- postTopic.setValue("topicname", topic.getValueToString("topicname"));
- postTopic.setValue("topicstate", (int) topic.getValue<int>("topicstate"));
+ 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);
}
postRep.setValue<std::vector<OC::OCRepresentation>>
- ("topiclist", postTopicArr);
+ ("x.org.iotivity.ns.topiclist", postTopicArr);
OC::QueryParamsMap map;
- map.insert(std::pair<std::string,std::string>(std::string("consumerid"),
+ 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);
}
std::string syncUri = m_notificationUri + m_syncUri;
std::string topicUri = m_notificationUri + m_topicUri;
std::string providerId = "123456789012345678901234567890123456";
- rep.setValue("subcontrollability", m_accepter);
- rep.setValue("messageuri", msgUri);
- rep.setValue("syncuri", syncUri);
- rep.setValue("topicuri", topicUri);
- rep.setValue("providerid", providerId);
+ rep.setValue("x.org.iotivity.ns.subcontrollability", m_accepter);
+ rep.setValue("x.org.iotivity.ns.messageuri", msgUri);
+ rep.setValue("x.org.iotivity.ns.syncuri", syncUri);
+ rep.setValue("x.org.iotivity.ns.topicuri", topicUri);
+ rep.setValue("x.org.iotivity.ns.providerid", providerId);
}
else if (type == requestType::NS_SYNC)
{
[& topicArr](const NS_TopicState & topicState)
{
OC::OCRepresentation topic;
- topic.setValue("topicname", topicState.first);
- topic.setValue("topicstate", (int) topicState.second);
+ topic.setValue("x.org.iotivity.ns.topicname", topicState.first);
+ topic.setValue("x.org.iotivity.ns.topicstate", (int) topicState.second);
topicArr.push_back(topic);
}
);
rep.setValue<std::vector<OC::OCRepresentation>>
- ("topiclist", topicArr);
+ ("x.org.iotivity.ns.topiclist", topicArr);
}
else
{
m_syncRep = requests->getResourceRepresentation();
std::cout << "Receive POST for Sync" << std::endl;
- std::cout << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
- std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
+ std::cout << "provider Id : " << m_syncRep.getValueToString("x.org.iotivity.ns.providerid") << std::endl;
+ std::cout << "Sync State : " << m_syncRep.getValueToString("x.org.iotivity.ns.state") << std::endl;
response->setResourceRepresentation(m_syncRep);
{
auto receivePayload =
requests->getResourceRepresentation()
- .getValue<std::vector<OC::OCRepresentation>>("topiclist");
+ .getValue<std::vector<OC::OCRepresentation>>("x.org.iotivity.ns.topiclist");
std::for_each (receivePayload.begin(), receivePayload.end(),
[this](const OC::OCRepresentation & rep)
{
- auto tmp = m_allowedTopicList.find(rep.getValueToString("topicname"));
+ auto tmp = m_allowedTopicList.find(rep.getValueToString("x.org.iotivity.ns.topicname"));
if (tmp != m_allowedTopicList.end())
{
- tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
+ tmp->second = (TopicAllowState) rep.getValue<int>("x.org.iotivity.ns.topicstate");
}
}
);
{
OC::OCRepresentation rep;
std::string providerId = "123456789012345678901234567890123456";
- rep.setValue<int>("messageid", (int)messageType::NS_ALLOW);
- rep.setValue("providerid", providerId);
+ rep.setValue<int>("x.org.iotivity.ns.messageid", (int)messageType::NS_ALLOW);
+ rep.setValue("x.org.iotivity.ns.providerid", providerId);
auto response = std::make_shared<OC::OCResourceResponse>();
response->setRequestHandle(requests->getRequestHandle());
void sendRead(const uint64_t & id)
{
std::string providerId = "123456789012345678901234567890123456";
- m_syncRep.setValue<int>("messageid", id);
- m_syncRep.setValue("state", (int)1);
- m_syncRep.setValue("providerid", providerId);
+ m_syncRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+ m_syncRep.setValue("x.org.iotivity.ns.state", (int)1);
+ m_syncRep.setValue("x.org.iotivity.ns.providerid", providerId);
OC::OCPlatform::notifyAllObservers(m_syncHandle);
}
void sendDismiss(const uint64_t & id)
{
std::string providerId = "123456789012345678901234567890123456";
- m_syncRep.setValue<int>("messageid", id);
- m_syncRep.setValue("state", (int)2);
- m_syncRep.setValue("providerid", providerId);
+ m_syncRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+ m_syncRep.setValue("x.org.iotivity.ns.state", (int)2);
+ m_syncRep.setValue("x.org.iotivity.ns.providerid", providerId);
OC::OCPlatform::notifyAllObservers(m_syncHandle);
}
void setMessage(const uint64_t & id, const std::string & title, const std::string & content)
{
std::string providerId = "123456789012345678901234567890123456";
- m_messageRep.setValue<int>("messageid", id);
- m_messageRep.setValue<std::string>("title", title);
- m_messageRep.setValue<std::string>("contenttext", content);
- m_messageRep.setValue<std::string>("providerid", providerId);
+ m_messageRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+ m_messageRep.setValue<std::string>("x.org.iotivity.ns.title", title);
+ m_messageRep.setValue<std::string>("x.org.iotivity.ns.contenttext", content);
+ m_messageRep.setValue<std::string>("x.org.iotivity.ns.providerid", providerId);
}
void setTopics(const NS_TopicList & topics)