From 4de990f9ff7947c325d56338dbf2ed4f6e6d57ae Mon Sep 17 00:00:00 2001 From: "arya.k" Date: Mon, 28 Sep 2015 17:08:15 +0530 Subject: [PATCH] Fix for bug IOT-758 Change-Id: I7f9300a9a10d3f2d5bb774fc51ea51c62bdaf49a Signed-off-by: arya.k Reviewed-on: https://gerrit.iotivity.org/gerrit/3203 Reviewed-by: Abhishek Pandey Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- .../NestedAttributeClientApp/src/reclient.cpp | 6 +- .../examples/tizen/RESampleClientApp/.cproject | 1029 ++++++++++---------- .../tizen/RESampleClientApp/src/reclient.cpp | 13 +- .../tizen/RESampleServerApp/inc/reserver.h | 6 +- .../tizen/RESampleServerApp/src/recontainer.cpp | 6 +- .../tizen/RESampleServerApp/src/reserver.cpp | 5 + 6 files changed, 539 insertions(+), 526 deletions(-) diff --git a/service/resource-encapsulation/examples/tizen/NestedAttributeClientApp/src/reclient.cpp b/service/resource-encapsulation/examples/tizen/NestedAttributeClientApp/src/reclient.cpp index 0a896ea..1af212e 100644 --- a/service/resource-encapsulation/examples/tizen/NestedAttributeClientApp/src/reclient.cpp +++ b/service/resource-encapsulation/examples/tizen/NestedAttributeClientApp/src/reclient.cpp @@ -178,7 +178,7 @@ void onResourceDiscovered(std::shared_ptr foundResource cond.notify_all(); } -void onRemoteAttributesReceivedCallback(const RCSResourceAttributes &attributes) +void onRemoteAttributesReceived(const RCSResourceAttributes &attributes, int) { dlog_print(DLOG_INFO, LOG_TAG, "#### onRemoteAttributesReceivedCallback callback"); @@ -229,7 +229,7 @@ static void getAttributeFromRemoteServer(void *data, Evas_Object *obj, void *eve { if (checkResource) { - resource->getRemoteAttributes(&onRemoteAttributesReceivedCallback); + resource->getRemoteAttributes(&onRemoteAttributesReceived); } else { @@ -248,7 +248,7 @@ static void setAttributeToRemoteServer(int fanSpeed, int airSpeed) if (checkResource) { resource->setRemoteAttributes(setAttribute, - &onRemoteAttributesReceivedCallback); + &onRemoteAttributesReceived); } else { diff --git a/service/resource-encapsulation/examples/tizen/RESampleClientApp/.cproject b/service/resource-encapsulation/examples/tizen/RESampleClientApp/.cproject index 1190711..810973b 100644 --- a/service/resource-encapsulation/examples/tizen/RESampleClientApp/.cproject +++ b/service/resource-encapsulation/examples/tizen/RESampleClientApp/.cproject @@ -1,516 +1,519 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/service/resource-encapsulation/examples/tizen/RESampleClientApp/src/reclient.cpp b/service/resource-encapsulation/examples/tizen/RESampleClientApp/src/reclient.cpp index 0d61537..bfd0755 100644 --- a/service/resource-encapsulation/examples/tizen/RESampleClientApp/src/reclient.cpp +++ b/service/resource-encapsulation/examples/tizen/RESampleClientApp/src/reclient.cpp @@ -46,8 +46,7 @@ constexpr int QUIT_INPUT = 3; std::shared_ptr resource; const std::string defaultKey = "Temperature"; -const std::string resourceType = "?rt=core.TemperatureSensor"; -const std::string targetUri = OC_RSRVD_WELL_KNOWN_URI + resourceType; +const std::string resourceType = "oic.r.temperaturesensor"; std::mutex mtx; std::condition_variable cond; @@ -159,9 +158,9 @@ void onCacheUpdated(const RCSResourceAttributes &attributes) &logMessage); } -void onRemoteAttributesReceivedCallback(const RCSResourceAttributes &attributes) +void onRemoteAttributesReceived(const RCSResourceAttributes& attributes, int) { - dlog_print(DLOG_INFO, LOG_TAG, "#### onRemoteAttributesReceivedCallback callback"); + dlog_print(DLOG_INFO, LOG_TAG, "#### onRemoteAttributesReceived entry"); string logMessage = "Remote Attribute Updated :
"; @@ -257,7 +256,7 @@ static void getAttributeFromRemoteServer(void *data, Evas_Object *obj, void *eve { if (checkResource) { - resource->getRemoteAttributes(&onRemoteAttributesReceivedCallback); + resource->getRemoteAttributes(&onRemoteAttributesReceived); } else { @@ -276,7 +275,7 @@ static void setAttributeToRemoteServer(int setTemperature) if (checkResource) { resource->setRemoteAttributes(setAttribute, - &onRemoteAttributesReceivedCallback); + &onRemoteAttributesReceived); } else { @@ -481,7 +480,7 @@ void discoverResource() { dlog_print(DLOG_INFO, LOG_TAG, "#### Wait 2 seconds until discovered"); - RCSDiscoveryManager::getInstance()->discoverResource(RCSAddress::multicast(), targetUri, + RCSDiscoveryManager::getInstance()->discoverResourceByType(RCSAddress::multicast(), resourceType, &onResourceDiscovered); std::unique_lock lck(mtx); diff --git a/service/resource-encapsulation/examples/tizen/RESampleServerApp/inc/reserver.h b/service/resource-encapsulation/examples/tizen/RESampleServerApp/inc/reserver.h index 7e86554..a8386d1 100644 --- a/service/resource-encapsulation/examples/tizen/RESampleServerApp/inc/reserver.h +++ b/service/resource-encapsulation/examples/tizen/RESampleServerApp/inc/reserver.h @@ -33,10 +33,14 @@ typedef int ReturnValue; constexpr int DEFALUT_VALUE = 0; +constexpr int PRESENCE_ON = 1; +constexpr int PRESENCE_OFF = 2; + 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; enum class Control { diff --git a/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/recontainer.cpp b/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/recontainer.cpp index 86e4e7c..24ed43e 100644 --- a/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/recontainer.cpp +++ b/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/recontainer.cpp @@ -322,7 +322,8 @@ static void addHueBundle(void *data, Evas_Object *obj, void *event_info) { std::map bundleParams; container->addBundle("oic.bundle.hueSample", "", - "/opt/usr/apps/org.tizen.resampleserver/lib/libHueBundle.so", bundleParams); + "/opt/usr/apps/org.tizen.resampleserver/lib/libHueBundle.so", + "hueSample", bundleParams); logMessage += "HUE Bundle added
"; } else @@ -348,7 +349,8 @@ static void addBMIBundle(void *data, Evas_Object *obj, void *event_info) { std::map bundleParams; container->addBundle("oic.bundle.BMISensor", "", - "/opt/usr/apps/org.tizen.resampleserver/lib/libBMISensorBundle.so", bundleParams); + "/opt/usr/apps/org.tizen.resampleserver/lib/libBMISensorBundle.so", + "BMISensor", bundleParams); logMessage += "BMI Bundle added
"; } else diff --git a/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/reserver.cpp b/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/reserver.cpp index 47aac09..6f837c5 100644 --- a/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/reserver.cpp +++ b/service/resource-encapsulation/examples/tizen/RESampleServerApp/src/reserver.cpp @@ -73,6 +73,11 @@ static void onDestroy() server = NULL; string logMessage = "SERVER DESTROYED"; + if(isPresenceOn == PRESENCE_ON) + { + OCPlatform::stopPresence(); + } + dlog_print(DLOG_INFO, LOG_TAG, "#### %s", logMessage.c_str()); ecore_main_loop_thread_safe_call_sync((void * ( *)(void *))updateGroupLog, &logMessage); -- 2.7.4