fixed the jira IOT-742 Temperature Resource Creation Fail
authorChaJiwon <jw_wonny.cha@samsung.com>
Fri, 25 Sep 2015 04:24:08 +0000 (13:24 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Fri, 25 Sep 2015 07:27:03 +0000 (07:27 +0000)
- modify temperature resourceType
 (core.TemperatrueSensor -> oic.r.temperaturesensor)

Change-Id: Icbb9402055ae09e2e732a85a31ef1e1a81c46b44
Signed-off-by: ChaJiwon <jw_wonny.cha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3077
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/resource-encapsulation/examples/linux/SampleResourceClient.cpp
service/resource-encapsulation/examples/linux/SampleResourceServer.cpp

index 1f9db08..9fb178d 100644 (file)
@@ -416,7 +416,7 @@ void discoverResource()
     switch (processUserInput())
     {
     case REQUEST_TEMP:
-        resourceType = "core.TemperatureSensor";
+        resourceType = "oic.r.temperaturesensor";
         break;
     case REQUEST_LIGHT:
         resourceType = "core.light";
index 983b375..2097b03 100644 (file)
@@ -50,7 +50,7 @@ constexpr int QUIT = 3;
 
 
 std::string resourceUri = "/a/TempSensor";
-std::string resourceType = "core.TemperatureSensor";
+std::string resourceType = "oic.r.temperaturesensor";
 std::string resourceInterface = "oic.if.";
 std::string attributeKey = "Temperature";
 int isPresenceOn = PRESENCE_ON;
@@ -145,7 +145,7 @@ void initServer()
     {
     case REQUEST_TEMP:
         resourceUri = "/a/TempSensor";
-        resourceType = "core.TemperatureSensor";
+        resourceType = "oic.r.temperaturesensor";
         break;
     case REQUEST_LIGHT:
         resourceUri = "/a/light";
@@ -301,7 +301,7 @@ void process()
 
     while(true)
     {
-        if(resourceType == "core.TemperatureSensor")
+        if(resourceType == "oic.r.temperaturesensor")
         {
             displayControlTemperatureMenu();
             if (selectControlTemperatureMenu() == QUIT) return;
@@ -320,15 +320,15 @@ int main(void)
     {
         process();
         server = NULL;
+
+        if(isPresenceOn == PRESENCE_ON)
+        {
+            stopPresence();
+        }
     }
     catch (const std::exception& e)
     {
         std::cout << "main exception  : " << e.what() << std::endl;
     }
-
-    if(isPresenceOn == PRESENCE_ON)
-    {
-        stopPresence();
-    }
     std::cout << "Stopping the Server" << std::endl;
 }