Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / protocol-plugin / sample-app / tizen / PPMSampleApp / src / ppmsampleapp.cpp
index 54f9b03..5383695 100644 (file)
@@ -127,7 +127,8 @@ void onObserve(const HeaderOptions headerOptions, const OCRepresentation &rep,
         sprintf(buf, "name: = %s<br>", myfan.m_name.c_str());
         strcat(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
 
         if (observe_count() > 30)
@@ -147,7 +148,8 @@ void onObserve(const HeaderOptions headerOptions, const OCRepresentation &rep,
         sprintf(buf, "onObserve Response error:  = %d<br>", eCode);
         strcpy(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
         std::exit(-1);
     }
@@ -182,7 +184,8 @@ void onPost2(const HeaderOptions &headerOptions, const OCRepresentation &rep, co
             sprintf(buf, "name: = %s<br>", myfan.m_name.c_str());
             strcat(temp_string, buf);
             m_ThreadContext.log = temp_string;
-            ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+            dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+            ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                                   &m_ThreadContext);
         }
 
@@ -200,7 +203,8 @@ void onPost2(const HeaderOptions &headerOptions, const OCRepresentation &rep, co
         sprintf(buf, "onPost Response error:  = %d<br>", eCode);
         strcpy(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
         std::exit(-1);
     }
@@ -235,7 +239,8 @@ void onPost(const HeaderOptions &headerOptions, const OCRepresentation &rep, con
             sprintf(buf, "name: = %s<br>", myfan.m_name.c_str());
             strcat(temp_string, buf);
             m_ThreadContext.log = temp_string;
-            ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+            dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+            ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                                   &m_ThreadContext);
         }
 
@@ -257,7 +262,8 @@ void onPost(const HeaderOptions &headerOptions, const OCRepresentation &rep, con
         sprintf(buf, "onPost Response error:  = %d<br>", eCode);
         strcpy(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
         std::exit(-1);
     }
@@ -306,7 +312,8 @@ void onPut(const HeaderOptions &headerOptions, const OCRepresentation &rep, cons
         sprintf(buf, "name: = %s<br>", myfan.m_name.c_str());
         strcat(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
 
         putFanRepresentation(curFanResource);
@@ -317,7 +324,8 @@ void onPut(const HeaderOptions &headerOptions, const OCRepresentation &rep, cons
         sprintf(buf, "onPut Response error:  = %d<br>", eCode);
         strcpy(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
         std::exit(-1);
     }
@@ -370,7 +378,8 @@ void onFanGet(const HeaderOptions &headerOptions, const OCRepresentation &rep, c
         sprintf(buf, "name: = %s<br>", myfan.m_name.c_str());
         strcat(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
 
         putFanRepresentation(curFanResource);
@@ -381,7 +390,8 @@ void onFanGet(const HeaderOptions &headerOptions, const OCRepresentation &rep, c
         sprintf(buf, "onGET Response error:  = %d<br>", eCode);
         strcpy(temp_string, buf);
         m_ThreadContext.log = temp_string;
-        ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+        dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+        ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                               &m_ThreadContext);
         std::exit(-1);
     }
@@ -434,7 +444,7 @@ void foundResourceFan(std::shared_ptr<OCResource> resource)
             // Get the resource types
             std::cout << "\tList of resource types: " << std::endl;
             strcat(temp_string, "List of resource types: <br>");
-            for (auto & resourceTypes : resource->getResourceTypes())
+            for (auto &resourceTypes : resource->getResourceTypes())
             {
                 std::cout << "\t\t" << resourceTypes << std::endl;
                 sprintf(buf, "%s<br>", resourceTypes.c_str());
@@ -443,7 +453,7 @@ void foundResourceFan(std::shared_ptr<OCResource> resource)
 
             // Get the resource interfaces
             std::cout << "\tList of resource interfaces: " << std::endl;
-            for (auto & resourceInterfaces : resource->getResourceInterfaces())
+            for (auto &resourceInterfaces : resource->getResourceInterfaces())
             {
                 std::cout << "\t\t" << resourceInterfaces << std::endl;
                 sprintf(buf, "%s<br>", resourceInterfaces.c_str());
@@ -458,7 +468,8 @@ void foundResourceFan(std::shared_ptr<OCResource> resource)
                 putFanRepresentation(curFanResource);
             }
             m_ThreadContext.log = temp_string;
-            ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+            dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+            ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                                   &m_ThreadContext);
         }
         else
@@ -467,7 +478,8 @@ void foundResourceFan(std::shared_ptr<OCResource> resource)
             std::cout << "Resource is invalid" << std::endl;
             strcpy(temp_string, "Resource is invalid");
             m_ThreadContext.log = temp_string;
-            ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+            dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+            ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                                   &m_ThreadContext);
         }
 
@@ -521,7 +533,8 @@ send_msg_clicked_cb(void *data , Evas_Object *obj , void *event_info)
                 sprintf(buf, "value ID = %s<br>", user_plugin[i].getID().c_str());
                 strcat(temp_string, buf);
                 m_ThreadContext.log = temp_string;
-                ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+                dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+                ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                                       &m_ThreadContext);
                 std::cout << "value Name = " << user_plugin[i].getName() << std::endl;
                 std::cout << "value ID = " << user_plugin[i].getID() << std::endl;
@@ -532,7 +545,8 @@ send_msg_clicked_cb(void *data , Evas_Object *obj , void *event_info)
             strcpy(temp_string, "start fan Plugin<br>");
             strcat(temp_string, "fan Plugin is getting started. Please wait...<br>");
             m_ThreadContext.log = temp_string;
-            ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateCallbackLog,
+            dlog_print(DLOG_INFO, LOG_TAG, " %s", m_ThreadContext.log);
+            ecore_main_loop_thread_safe_call_sync((void *( *)(void *))updateCallbackLog,
                                                   &m_ThreadContext);
             m_pm->startPlugins("ResourceType", "oic.fan");
             sleep(2);
@@ -542,7 +556,7 @@ send_msg_clicked_cb(void *data , Evas_Object *obj , void *event_info)
 
             // Find fan resources
             std::ostringstream requestURI;
-            requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.fan";
+            requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.fan";
             OCPlatform::findResource("", requestURI.str(), OC_ALL, &foundResourceFan);
             std::cout << "Finding Resource... " << std::endl;
         }