All the OCF property should be written as lower case.
So, change the key name of attributes.
second patch include,
removed duplicated NS_QUERY_CONSUMERID.
Change-Id: I2fcc76fac003e805ad19edb0d7ee10c659218b5f
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14657
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
}
OC::OCRepresentation rep;
- rep.setValue("providerId", providerID);
- rep.setValue("messageId", id);
+ rep.setValue("providerid", providerID);
+ rep.setValue("messageid", id);
rep.setValue("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("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("messageid")
+ && rep.getValue<int>("messageid") != 1)
{
- m_messageFunc(int(rep.getValue<int>("messageId")),
+ m_messageFunc(int(rep.getValue<int>("messageid")),
std::string(rep.getValueToString("title")),
- std::string(rep.getValueToString("contentText")),
+ std::string(rep.getValueToString("contenttext")),
std::string(rep.getValueToString("source")));
- if (rep.getValue<int>("messageId") == 3)
+ if (rep.getValue<int>("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>("state")), int(rep.getValue<int>("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("subcontrollability", m_accepter);
+ rep.setValue("messageuri", msgUri);
+ rep.setValue("syncuri", syncUri);
+ rep.setValue("topicuri", topicUri);
+ rep.setValue("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("topicname", topicState.first);
+ topic.setValue("topicstate", (int) topicState.second);
topicArr.push_back(topic);
}
);
rep.setValue<std::vector<OC::OCRepresentation>>
- ("topicList", topicArr);
+ ("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 << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
response->setResourceRepresentation(m_syncRep);
{
auto receivePayload =
requests->getResourceRepresentation()
- .getValue<std::vector<OC::OCRepresentation>>("topicList");
+ .getValue<std::vector<OC::OCRepresentation>>("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("topicname"));
if (tmp != m_allowedTopicList.end())
{
- tmp->second = (TopicAllowState) rep.getValue<int>("topicState");
+ tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
}
}
);
{
OC::OCRepresentation rep;
std::string providerId = "123456789012345678901234567890123456";
- rep.setValue<int>("messageId", (int)messageType::NS_ALLOW);
- rep.setValue("providerId", providerId);
+ rep.setValue<int>("messageid", (int)messageType::NS_ALLOW);
+ rep.setValue("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<int>("messageid", id);
m_syncRep.setValue("state", (int)1);
- m_syncRep.setValue("providerId", providerId);
+ m_syncRep.setValue("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<int>("messageid", id);
m_syncRep.setValue("state", (int)2);
- m_syncRep.setValue("providerId", providerId);
+ m_syncRep.setValue("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<int>("messageid", id);
m_messageRep.setValue("title", title);
- m_messageRep.setValue("contentText", content);
- m_messageRep.setValue("providerId", providerId);
+ m_messageRep.setValue("contenttext", content);
+ m_messageRep.setValue("providerid", providerId);
}
void setTopics(const NS_TopicList &topics)
// NOTIOBJ //
#define NOTIOBJ_TITLE_KEY "title"
#define NOTIOBJ_ID_KEY "id"
-#define NOTOOBJ_CONTENT_KEY "contentText"
+#define NOTOOBJ_CONTENT_KEY "contenttext"
#define DISCOVERY_TAG "NS_PROVIDER_DISCOVERY"
#define SUBSCRIPTION_TAG "NS_PROVIDER_SUBSCRIPTION"
#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 "consumerid"
+#define NS_QUERY_PROVIDER_ID "providerid"
#define NS_QUERY_INTERFACE "if"
#define NS_QUERY_ID_SIZE 10
#define VERSION "1.2.1"
#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_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_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_DATETIME "datetime"
#define NS_ATTRIBUTE_TTL "ttl"
-#define NS_ATTRIBUTE_ICON_IMAGE "iconImage"
+#define NS_ATTRIBUTE_ICON_IMAGE "iconimage"
typedef enum eConnectionState
{
typedef struct\r
{\r
OCResourceHandle handle;\r
- char * id;\r
+ uint64_t messageId;\r
char providerId[NS_UUID_STRING_SIZE];\r
char * state;\r
} NSSyncResource;\r
}
else if (strcmp(uri, NS_COLLECTION_SYNC_URI) == 0)
{
- NotificationSyncResource.id = NULL;
+ NotificationSyncResource.messageId = 0;
(NotificationSyncResource.providerId)[0] = '\0';
NotificationSyncResource.state = NULL;
NotificationSyncResource.handle = NULL;
}
OC::OCRepresentation rep;
- rep.setValue("providerId", providerID);
- rep.setValue("messageId", id);
+ rep.setValue("providerid", providerID);
+ rep.setValue("messageid", id);
rep.setValue("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("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("messageid")
+ && rep.getValue<int>("messageid") != 1)
{
- m_messageFunc(int(rep.getValue<int>("messageId")),
+ m_messageFunc(int(rep.getValue<int>("messageid")),
std::string(rep.getValueToString("title")),
- std::string(rep.getValueToString("contentText")),
+ std::string(rep.getValueToString("contenttext")),
std::string(rep.getValueToString("source")));
- if(rep.getValue<int>("messageId") == 3)
+ if(rep.getValue<int>("messageid") == 3)
{
m_topicResource->get(std::string("oic.wk.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>("state")), int(rep.getValue<int>("messageid")));
}
}
OC::OCRepresentation postRep;
std::vector<OC::OCRepresentation> topicArr =
- rep.getValue<std::vector<OC::OCRepresentation>>("topicList");
+ rep.getValue<std::vector<OC::OCRepresentation>>("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("topicname", topic.getValueToString("topicname"));
+ postTopic.setValue("topicstate", (int) topic.getValue<int>("topicstate"));
postTopicArr.push_back(topic);
}
postRep.setValue<std::vector<OC::OCRepresentation>>
- ("topicList", postTopicArr);
+ ("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("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("subcontrollability", m_accepter);
+ rep.setValue("messageuri", msgUri);
+ rep.setValue("syncuri", syncUri);
+ rep.setValue("topicuri", topicUri);
+ rep.setValue("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("topicname", topicState.first);
+ topic.setValue("topicstate", (int) topicState.second);
topicArr.push_back(topic);
}
);
rep.setValue<std::vector<OC::OCRepresentation>>
- ("topicList", topicArr);
+ ("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 << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
response->setResourceRepresentation(m_syncRep);
{
auto receivePayload =
requests->getResourceRepresentation()
- .getValue<std::vector<OC::OCRepresentation>>("topicList");
+ .getValue<std::vector<OC::OCRepresentation>>("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("topicname"));
if (tmp != m_allowedTopicList.end())
{
- tmp->second = (TopicAllowState) rep.getValue<int>("topicState");
+ tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
}
}
);
{
OC::OCRepresentation rep;
std::string providerId = "123456789012345678901234567890123456";
- rep.setValue<int>("messageId", (int)messageType::NS_ALLOW);
- rep.setValue("providerId", providerId);
+ rep.setValue<int>("messageid", (int)messageType::NS_ALLOW);
+ rep.setValue("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<int>("messageid", id);
m_syncRep.setValue("state", (int)1);
- m_syncRep.setValue("providerId", providerId);
+ m_syncRep.setValue("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<int>("messageid", id);
m_syncRep.setValue("state", (int)2);
- m_syncRep.setValue("providerId", providerId);
+ m_syncRep.setValue("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<int>("messageid", id);
m_messageRep.setValue("title", title);
- m_messageRep.setValue("contentText", content);
- m_messageRep.setValue("providerId", providerId);
+ m_messageRep.setValue("contenttext", content);
+ m_messageRep.setValue("providerid", providerId);
}
void setTopics(const NS_TopicList & topics)