[TIZEN] Removed things manager class dependency from TIZEN SDK and used its component...
authorarya.k <arya.kumar@samsung.com>
Thu, 10 Sep 2015 04:54:06 +0000 (10:24 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 10 Sep 2015 05:38:53 +0000 (05:38 +0000)
Updated tizen sample applications to removed things manager class dependency.

Enabled things manager library build for tizen.

Change-Id: I30db7102d6598103c46b3044fff1e218acded6c5
Signed-off-by: arya.k <arya.kumar@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2401
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
14 files changed:
service/things-manager/SConscript
service/things-manager/sampleapp/tizen/ConServerApp/.cproject
service/things-manager/sampleapp/tizen/ConServerApp/inc/configurationresource.h
service/things-manager/sampleapp/tizen/ConServerApp/inc/conserverapp.h
service/things-manager/sampleapp/tizen/ConServerApp/inc/diagnosticsresource.h
service/things-manager/sampleapp/tizen/ConServerApp/inc/factorysetresource.h
service/things-manager/sampleapp/tizen/ConServerApp/src/configurationresource.cpp
service/things-manager/sampleapp/tizen/ConServerApp/src/conserverapp.cpp
service/things-manager/sampleapp/tizen/ConServerApp/src/diagnosticsresource.cpp
service/things-manager/sampleapp/tizen/ConServerApp/src/factorysetresource.cpp
service/things-manager/sampleapp/tizen/TMSampleApp/.cproject
service/things-manager/sampleapp/tizen/TMSampleApp/inc/tmsampleapp.h
service/things-manager/sampleapp/tizen/TMSampleApp/src/configuration.cpp
service/things-manager/sampleapp/tizen/TMSampleApp/src/group.cpp

index bb602b6..e1c65aa 100644 (file)
@@ -56,7 +56,7 @@ if target_os == 'android':
 
 
 # Remove it if the conversion for Android and Tizen platform is done
-if target_os == 'linux':
+if target_os in ['linux', 'tizen']:
    tgm_src = env.Glob('sdk/src/*.cpp', '../../extlibs/timer/timer.c')
    tgmsdk_static = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
    tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
index b7c81d1..b6463c5 100644 (file)
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\sdk\inc&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\sdk\src&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\include&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\c_common&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\csdk\stack\include&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\csdk\logger\include&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\csdk\occoap\include&quot;"/>
index 9464c11..7c3a424 100755 (executable)
 
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "ThingsManager.h"
 
 #pragma once
 
+#define DEFAULT_LOCATION "loc"
+#define DEFAULT_SYSTIME "st"
+#define DEFAULT_CURRENCY "c"
+#define DEFAULT_REGION "r"
+
 using namespace OC;
 
 typedef std::function<OCEntityHandlerResult(std::shared_ptr< OCResourceRequest > request)>
 ResourceEntityHandler;
 
-static std::string defaultURIPrefix = "/oic/con";
-static std::string defaultResourceTypePrefix = "oic.con";
+static std::string defaultConURI = "/oic/con";
+static std::string defaultConResourceType = "oic.wk.con";
 
 extern std::string defaultLocation;
-extern std::string defaultDeviceName;
+extern std::string defaultSystemTime;
 extern std::string defaultCurrency;
 extern std::string defaultRegion;
 
index 6943ae6..35a604e 100644 (file)
 #define __DIAGNOSTICS_RESOURCE_H__
 
 #include <functional>
+#include <thread>
+#include <string>
 
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "ThingsManager.h"
 
 #pragma once
 
@@ -37,32 +38,32 @@ static std::string defaultFactoryReset = "false";
 static std::string defaultReboot = "false";
 static std::string defaultStartStatCollection = "false";
 
-class DiagnosticsResource
+class MaintenanceResource
 {
     public:
-        // Diagnostics members
-        std::string m_diagnosticsUri;
+        // Maintenance members
+        std::string m_maintenanceUri;
         std::string m_factoryReset;
         std::string m_reboot;
         std::string m_startStatCollection;
-        std::vector< std::string > m_diagnosticsTypes;
-        std::vector< std::string > m_diagnosticsInterfaces;
-        OCResourceHandle m_diagnosticsHandle;
-        OCRepresentation m_diagnosticsRep;
+        std::vector< std::string > m_maintenanceTypes;
+        std::vector< std::string > m_maintenanceInterfaces;
+        OCResourceHandle m_maintenanceHandle;
+        OCRepresentation m_maintenanceRep;
 
     public:
 
-        DiagnosticsResource();
+        MaintenanceResource();
 
         void createResource(ResourceEntityHandler callback);
 
-        void setDiagnosticsRepresentation(OCRepresentation &rep);
+        void setMaintenanceRepresentation(OCRepresentation &rep);
 
-        OCRepresentation getDiagnosticsRepresentation();
+        OCRepresentation getMaintenanceRepresentation();
 
         std::string getUri();
 
-        void diagnosticsMonitor(int second);
+        void maintenanceMonitor(int second);
 
         std::function< void() > factoryReset;
 
index daf72ed..a025e96 100755 (executable)
 
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "ThingsManager.h"
 
 using namespace OC;
 
 // Constructor
 ConfigurationResource::ConfigurationResource() :
-    m_location(defaultLocation), m_systemTime(defaultDeviceName), m_currency(
+    m_location(defaultLocation), m_systemTime(defaultSystemTime), m_currency(
         defaultCurrency), m_region(defaultRegion)
 {
-    m_configurationUri = "/oic/con"; // URI of the resource
-    m_configurationTypes.push_back("oic.con"); // resource type name
+    m_configurationUri = defaultConURI; // URI of the resource
+    m_configurationTypes.push_back(defaultConResourceType); // resource type name
     m_configurationInterfaces.push_back(DEFAULT_INTERFACE); // resource interface
-    m_configurationRep.setValue("loc", m_location);
-    m_configurationRep.setValue("st", m_systemTime);
-    m_configurationRep.setValue("c", m_currency);
-    m_configurationRep.setValue("r", m_region);
+    m_configurationRep.setValue(DEFAULT_LOCATION, m_location);
+    m_configurationRep.setValue(DEFAULT_SYSTIME, m_systemTime);
+    m_configurationRep.setValue(DEFAULT_CURRENCY, m_currency);
+    m_configurationRep.setValue(DEFAULT_REGION, m_region);
     m_configurationRep.setUri(m_configurationUri);
     m_configurationRep.setResourceTypes(m_configurationTypes);
     m_configurationRep.setResourceInterfaces(m_configurationInterfaces);
-    m_configurationHandle = NULL;
+    m_configurationHandle = nullptr;
 }
 
 // Creates a ConfigurationResource
@@ -75,29 +74,29 @@ void ConfigurationResource::createResource(ResourceEntityHandler callback)
 
 void ConfigurationResource::setConfigurationRepresentation(OCRepresentation &rep)
 {
-    string value;
+    std::string value;
 
-    if (rep.getValue("loc", value))
+    if (rep.getValue(DEFAULT_LOCATION, value))
     {
         m_location = value;
         dlog_print(DLOG_INFO, "ConfigurationResource", "#### m_location: %s",
                    m_location.c_str());
     }
 
-    if (rep.getValue("st", value))
+    if (rep.getValue(DEFAULT_SYSTIME, value))
     {
         dlog_print(DLOG_INFO, "ConfigurationResource", "#### SystemTime is not"
                    "allowed to be written");
     }
 
-    if (rep.getValue("c", value))
+    if (rep.getValue(DEFAULT_CURRENCY, value))
     {
         m_currency = value;
         dlog_print(DLOG_INFO, "ConfigurationResource", "#### m_currency: %s",
                    m_currency.c_str());
     }
 
-    if (rep.getValue("r", value))
+    if (rep.getValue(DEFAULT_REGION, value))
     {
         m_region = value;
         dlog_print(DLOG_INFO, "ConfigurationResource", "#### m_region: %s",
@@ -107,10 +106,10 @@ void ConfigurationResource::setConfigurationRepresentation(OCRepresentation &rep
 
 OCRepresentation ConfigurationResource::getConfigurationRepresentation()
 {
-    m_configurationRep.setValue("loc", m_location);
-    m_configurationRep.setValue("st", m_systemTime);
-    m_configurationRep.setValue("c", m_currency);
-    m_configurationRep.setValue("r", m_region);
+    m_configurationRep.setValue(DEFAULT_LOCATION, m_location);
+    m_configurationRep.setValue(DEFAULT_SYSTIME, m_systemTime);
+    m_configurationRep.setValue(DEFAULT_CURRENCY, m_currency);
+    m_configurationRep.setValue(DEFAULT_REGION, m_region);
 
     return m_configurationRep;
 }
@@ -124,7 +123,7 @@ std::string ConfigurationResource::getUri()
 void ConfigurationResource::factoryReset()
 {
     m_location = defaultLocation;
-    m_systemTime = defaultDeviceName;
+    m_systemTime = defaultSystemTime;
     m_currency = defaultCurrency;
     m_region = defaultRegion;
 }
@@ -133,7 +132,7 @@ void ConfigurationResource::factoryReset()
 void ConfigurationResource::deleteResource()
 {
     // Unregister the resource
-    if (NULL != m_configurationHandle)
+    if (nullptr != m_configurationHandle)
     {
         OCPlatform::unregisterResource(m_configurationHandle);
     }
index c58825f..0361109 100644 (file)
 #include <tizen.h>
 #include <pthread.h>
 
+#include "ThingsConfiguration.h"
+#include "ThingsMaintenance.h"
 #include "configurationresource.h"
 #include "diagnosticsresource.h"
 #include "factorysetresource.h"
 
-using namespace std;
 using namespace OC;
 using namespace OIC;
 
@@ -41,7 +42,7 @@ std::string defaultRegion;
 std::string defaultSystemTime;
 std::string defaultCurrency;
 
-static ThingsManager *g_thingsmanager;
+static ThingsConfiguration *g_thingsConf;
 
 const int SUCCESS_RESPONSE = 0;
 
@@ -53,7 +54,7 @@ OCStackResult sendResponseForResource(std::shared_ptr< OCResourceRequest > pRequ
 OCEntityHandlerResult entityHandlerForResource(std::shared_ptr< OCResourceRequest > request);
 
 ConfigurationResource *myConfigurationResource;
-DiagnosticsResource *myDiagnosticsResource;
+MaintenanceResource *myMaintenanceResource;
 FactorySetResource *myFactorySetResource;
 
 typedef std::function< void(OCRepresentation &) > putFunc;
@@ -83,10 +84,10 @@ getFunc getGetFunction(std::string uri)
         res = std::bind(&ConfigurationResource::getConfigurationRepresentation,
                         myConfigurationResource);
     }
-    else if (uri == myDiagnosticsResource->getUri())
+    else if (uri == myMaintenanceResource->getUri())
     {
-        res = std::bind(&DiagnosticsResource::getDiagnosticsRepresentation,
-                        myDiagnosticsResource);
+        res = std::bind(&MaintenanceResource::getMaintenanceRepresentation,
+                        myMaintenanceResource);
     }
 
     return res;
@@ -101,10 +102,10 @@ putFunc getPutFunction(std::string uri)
         res = std::bind(&ConfigurationResource::setConfigurationRepresentation,
                         myConfigurationResource, std::placeholders::_1);
     }
-    else if (uri == myDiagnosticsResource->getUri())
+    else if (uri == myMaintenanceResource->getUri())
     {
-        res = std::bind(&DiagnosticsResource::setDiagnosticsRepresentation,
-                        myDiagnosticsResource, std::placeholders::_1);
+        res = std::bind(&MaintenanceResource::setMaintenanceRepresentation,
+                        myMaintenanceResource, std::placeholders::_1);
     }
 
     return res;
@@ -231,14 +232,20 @@ OCEntityHandlerResult entityHandlerForResource(std::shared_ptr< OCResourceReques
 // Updates the log in the UI
 void *updateLog(void *data)
 {
-    string *log = (string *)data;
-    //Show the log
-    elm_entry_entry_append(log_entry, log->c_str());
-    elm_entry_cursor_end_set(log_entry);
+    std::string *log = (std::string *)data;
 
-    dlog_print(DLOG_INFO, LOG_TAG, "%s", log->c_str());
+    if (nullptr == log)
+    {
+        dlog_print(DLOG_INFO, LOG_TAG, "#### No log !!!!");
+    }
+    else
+    {
+        //Show the log
+        elm_entry_entry_append(log_entry, log->c_str());
+        elm_entry_cursor_end_set(log_entry);
+        dlog_print(DLOG_INFO, LOG_TAG, "%s", log->c_str());
+    }
     dlog_print(DLOG_INFO, LOG_TAG, "#### updateLog exit!!!!");
-
     return NULL;
 }
 
@@ -253,10 +260,12 @@ void deleteResources()
 {
     if (NULL != myConfigurationResource)
         myConfigurationResource->deleteResource();
-    if (NULL != myDiagnosticsResource)
-        myDiagnosticsResource->deleteResource();
+    if (NULL != myMaintenanceResource)
+        myMaintenanceResource->deleteResource();
     if (NULL != myFactorySetResource)
         myFactorySetResource->deleteResource();
+
+    delete g_thingsConf;
 }
 
 static void
@@ -288,10 +297,10 @@ void onBootStrapCallback(const HeaderOptions &headerOptions, const OCRepresentat
     logMessage += "GET request was successful<br>";
     logMessage += "URI : " + rep.getUri() + "<br>";
 
-    defaultRegion = rep.getValue< std::string >("r");
-    defaultSystemTime = rep.getValue< std::string >("st");
-    defaultCurrency = rep.getValue< std::string >("c");
-    defaultLocation = rep.getValue< std::string >("loc");
+    defaultRegion = rep.getValue< std::string >(DEFAULT_REGION);
+    defaultSystemTime = rep.getValue< std::string >(DEFAULT_SYSTIME);
+    defaultCurrency = rep.getValue< std::string >(DEFAULT_CURRENCY);
+    defaultLocation = rep.getValue< std::string >(DEFAULT_LOCATION);
 
     logMessage += "Location : " + defaultLocation + "<br>";
     logMessage += "SystemTime : " + defaultSystemTime + "<br>";
@@ -309,7 +318,15 @@ void onBootStrapCallback(const HeaderOptions &headerOptions, const OCRepresentat
 static void
 doBootStrap_cb(void *data , Evas_Object *obj , void *event_info)
 {
-    OCStackResult result = g_thingsmanager->doBootstrap(&onBootStrapCallback);
+
+    if (NULL  == g_thingsConf)
+    {
+        dlog_print(DLOG_ERROR, LOG_TAG, "#### doBootstrap returned g_thingsConf NULL check");
+        return;
+    }
+
+    OCStackResult result = g_thingsConf->doBootstrap(&onBootStrapCallback);
+
     if (OC_STACK_OK == result)
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### doBootstrap returned OC_STACK_OK");
@@ -331,13 +348,13 @@ createConfResource_cb(void *data , Evas_Object *obj , void *event_info)
         myConfigurationResource = new ConfigurationResource();
         myConfigurationResource->createResource(&entityHandlerForResource);
 
-        myDiagnosticsResource = new DiagnosticsResource();
-        myDiagnosticsResource->createResource(&entityHandlerForResource);
+        myMaintenanceResource = new MaintenanceResource();
+        myMaintenanceResource->createResource(&entityHandlerForResource);
 
         myFactorySetResource = new FactorySetResource();
         myFactorySetResource->createResource(&entityHandlerForResource);
 
-        myDiagnosticsResource->factoryReset = std::function < void()
+        myMaintenanceResource->factoryReset = std::function < void()
                                               > (std::bind(&ConfigurationResource::factoryReset,
                                                       myConfigurationResource));
 
@@ -464,7 +481,7 @@ app_create(void *data)
     // Configure the OCPlatform
     configure_platform();
 
-    g_thingsmanager = new ThingsManager();
+    g_thingsConf = new ThingsConfiguration();
 
     return true;
 }
index fca08f6..0a48056 100644 (file)
 
 #include <functional>
 #include <dlog.h>
+#include <thread>
+#include <string>
 
 #include "conserverapp.h"
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "ThingsManager.h"
 
-extern string logMessage;
+using namespace OC;
+
+extern std::string logMessage;
 
 extern void *updateLog(void *);
 
-using namespace OC;
+static std::string defaultMntURI = "/oic/mnt";
+static std::string defaultMntResourceType = "oic.wk.mnt";
 
 // Constructor
-DiagnosticsResource::DiagnosticsResource() :
+MaintenanceResource::MaintenanceResource() :
     m_factoryReset(defaultFactoryReset), m_reboot(defaultReboot),
     m_startStatCollection(defaultStartStatCollection)
 {
-    m_diagnosticsUri = "/oic/diag"; // URI of the resource
-    m_diagnosticsTypes.push_back("oic.diag"); // resource type name
-    m_diagnosticsInterfaces.push_back(DEFAULT_INTERFACE); // resource interface
-    m_diagnosticsRep.setValue("fr", m_factoryReset);
-    m_diagnosticsRep.setValue("rb", m_reboot);
-    m_diagnosticsRep.setValue("ssc", m_startStatCollection);
-    m_diagnosticsRep.setUri(m_diagnosticsUri);
-    m_diagnosticsRep.setResourceTypes(m_diagnosticsTypes);
-    m_diagnosticsRep.setResourceInterfaces(m_diagnosticsInterfaces);
-    m_diagnosticsHandle = NULL;
+    m_maintenanceUri = defaultMntURI; // URI of the resource
+    m_maintenanceTypes.push_back(defaultMntResourceType); // resource type name
+    m_maintenanceInterfaces.push_back(DEFAULT_INTERFACE); // resource interface
+    m_maintenanceRep.setValue("fr", m_factoryReset);
+    m_maintenanceRep.setValue("rb", m_reboot);
+    m_maintenanceRep.setValue("ssc", m_startStatCollection);
+    m_maintenanceRep.setUri(m_maintenanceUri);
+    m_maintenanceRep.setResourceTypes(m_maintenanceTypes);
+    m_maintenanceRep.setResourceInterfaces(m_maintenanceInterfaces);
+    m_maintenanceHandle = NULL;
 }
 
 // Creates a DiagnosticResource
-void DiagnosticsResource::createResource(ResourceEntityHandler callback)
+void MaintenanceResource::createResource(ResourceEntityHandler callback)
 {
     using namespace OC::OCPlatform;
 
     if (NULL == callback)
     {
-        dlog_print(DLOG_INFO, "DiagnosticsResource", "#### Callback should be binded");
+        dlog_print(DLOG_INFO, "MaintenanceResource", "#### Callback should be binded");
         return;
     }
 
     // This will internally create and register the resource
-    OCStackResult result = registerResource(m_diagnosticsHandle, m_diagnosticsUri,
-                                            m_diagnosticsTypes[0], m_diagnosticsInterfaces[0],
+    OCStackResult result = registerResource(m_maintenanceHandle, m_maintenanceUri,
+                                            m_maintenanceTypes[0], m_maintenanceInterfaces[0],
                                             callback, OC_DISCOVERABLE | OC_OBSERVABLE);
 
     if (OC_STACK_OK != result)
     {
-        dlog_print(DLOG_INFO, "DiagnosticsResource", "#### Resource creation"
-                   "(configuration) was unsuccessful");
+        dlog_print(DLOG_INFO, "MaintenanceResource", "#### Resource creation"
+                   "(maintenance) was unsuccessful");
         return;
     }
 
-    thread exec(
+    std::thread exec(
         std::function< void(int second) >(
-            std::bind(&DiagnosticsResource::diagnosticsMonitor, this,
+            std::bind(&MaintenanceResource::maintenanceMonitor, this,
                       std::placeholders::_1)), 1);
     exec.detach();
 
-    dlog_print(DLOG_INFO, "DiagnosticsResource", "#### Diagnostics Resource is Created");
+    dlog_print(DLOG_INFO, "MaintenanceResource", "#### maintenance Resource is Created");
 }
 
-void DiagnosticsResource::setDiagnosticsRepresentation(OCRepresentation &rep)
+void MaintenanceResource::setMaintenanceRepresentation(OCRepresentation &rep)
 {
-    string value;
+    std::string value;
 
     if (rep.getValue("fr", value))
     {
         m_factoryReset = value;
-        dlog_print(DLOG_INFO, "DiagnosticsResource", "#### m_factoryReset: %s",
+        dlog_print(DLOG_INFO, "MaintenanceResource", "#### m_factoryReset: %s",
                    m_factoryReset.c_str());
     }
 
     if (rep.getValue("rb", value))
     {
         m_reboot = value;
-        dlog_print(DLOG_INFO, "DiagnosticsResource", "#### m_reboot: %s", m_reboot.c_str());
+        dlog_print(DLOG_INFO, "MaintenanceResource", "#### m_reboot: %s", m_reboot.c_str());
     }
 
     if (rep.getValue("ssc", value))
     {
         m_startStatCollection = value;
-        dlog_print(DLOG_INFO, "DiagnosticsResource", "#### m_startStatCollection: %s",
+        dlog_print(DLOG_INFO, "MaintenanceResource", "#### m_startStatCollection: %s",
                    m_startStatCollection.c_str());
     }
 }
 
-OCRepresentation DiagnosticsResource::getDiagnosticsRepresentation()
+OCRepresentation MaintenanceResource::getMaintenanceRepresentation()
 {
-    m_diagnosticsRep.setValue("fr", m_factoryReset);
-    m_diagnosticsRep.setValue("rb", m_reboot);
-    m_diagnosticsRep.setValue("ssc", m_startStatCollection);
+    m_maintenanceRep.setValue("fr", m_factoryReset);
+    m_maintenanceRep.setValue("rb", m_reboot);
+    m_maintenanceRep.setValue("ssc", m_startStatCollection);
 
-    return m_diagnosticsRep;
+    return m_maintenanceRep;
 }
 
-std::string DiagnosticsResource::getUri()
+std::string MaintenanceResource::getUri()
 {
-    return m_diagnosticsUri;
+    return m_maintenanceUri;
 }
 
 // Handles the Reboot and FactoryReset request
-void DiagnosticsResource::diagnosticsMonitor(int second)
+void MaintenanceResource::maintenanceMonitor(int second)
 {
     while (1)
     {
@@ -132,11 +136,11 @@ void DiagnosticsResource::diagnosticsMonitor(int second)
         if (m_reboot == "true")
         {
             int res;
-            dlog_print(DLOG_INFO, "DiagnosticsResource", "#### Reboot will be soon...");
+            dlog_print(DLOG_INFO, "MaintenanceResource", "#### Reboot will be soon...");
             m_reboot = defaultReboot;
             res = system("sudo reboot"); // System reboot
 
-            dlog_print(DLOG_INFO, "DiagnosticsResource", "#### return: %d", res);
+            dlog_print(DLOG_INFO, "MaintenanceResource", "#### return: %d", res);
 
             logMessage = "----------------------------<br>";
             logMessage += "*** System Reboot Success ***<br>";
@@ -148,7 +152,7 @@ void DiagnosticsResource::diagnosticsMonitor(int second)
         }
         else if (m_factoryReset == "true")
         {
-            dlog_print(DLOG_INFO, "DiagnosticsResource", "#### Factory Reset will be soon...");
+            dlog_print(DLOG_INFO, "MaintenanceResource", "#### Factory Reset will be soon...");
             m_factoryReset = defaultFactoryReset;
             factoryReset();
         }
@@ -156,11 +160,11 @@ void DiagnosticsResource::diagnosticsMonitor(int second)
 }
 
 // Deletes the diagnostic resource which has been created using createResource()
-void DiagnosticsResource::deleteResource()
+void MaintenanceResource::deleteResource()
 {
     // Unregister the resource
-    if (NULL != m_diagnosticsHandle)
+    if (NULL != m_maintenanceHandle)
     {
-        OCPlatform::unregisterResource(m_diagnosticsHandle);
+        OCPlatform::unregisterResource(m_maintenanceHandle);
     }
 }
index fc2d666..3271609 100644 (file)
 
 #include <functional>
 #include <dlog.h>
+#include <string.h>
 
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "ThingsManager.h"
+#include "configurationresource.h"
 
 using namespace OC;
 
@@ -68,29 +69,29 @@ void FactorySetResource::createResource(ResourceEntityHandler callback)
 
 void FactorySetResource::setFactorySetRepresentation(OCRepresentation &rep)
 {
-    string value;
+    std::string value;
 
-    if (rep.getValue("loc", value))
+    if (rep.getValue(DEFAULT_LOCATION, value))
     {
         m_location = value;
         dlog_print(DLOG_INFO, "FactorySetResource", "#### m_location: %s",
                    m_location.c_str());
     }
 
-    if (rep.getValue("st", value))
+    if (rep.getValue(DEFAULT_SYSTIME, value))
     {
         dlog_print(DLOG_INFO, "FactorySetResource", "#### SystemTime is not"
                    "allowed to be written");
     }
 
-    if (rep.getValue("c", value))
+    if (rep.getValue(DEFAULT_CURRENCY, value))
     {
         m_currency = value;
         dlog_print(DLOG_INFO, "FactorySetResource", "#### m_currency: %s",
                    m_currency.c_str());
     }
 
-    if (rep.getValue("r", value))
+    if (rep.getValue(DEFAULT_REGION, value))
     {
         m_region = value;
         dlog_print(DLOG_INFO, "FactorySetResource", "#### m_region: %s",
@@ -100,10 +101,10 @@ void FactorySetResource::setFactorySetRepresentation(OCRepresentation &rep)
 
 OCRepresentation FactorySetResource::getFactorySetRepresentation()
 {
-    m_configurationRep.setValue("loc", m_location);
-    m_configurationRep.setValue("st", m_systemTime);
-    m_configurationRep.setValue("c", m_currency);
-    m_configurationRep.setValue("r", m_region);
+    m_configurationRep.setValue(DEFAULT_LOCATION, m_location);
+    m_configurationRep.setValue(DEFAULT_SYSTIME, m_systemTime);
+    m_configurationRep.setValue(DEFAULT_CURRENCY, m_currency);
+    m_configurationRep.setValue(DEFAULT_REGION, m_region);
 
     return m_configurationRep;
 }
index 94660c2..3558daf 100644 (file)
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\sdk\inc&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\sdk\src&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\include&quot;"/>
+                                    <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\c_common&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\csdk\stack\include&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\csdk\logger\include&quot;"/>
                                     <listOptionValue builtIn="false" value="&quot;..\..\..\..\..\..\resource\csdk\occoap\include&quot;"/>
index 851998e..8655eea 100644 (file)
@@ -29,7 +29,9 @@
 
 #include "OCPlatform.h"
 #include "OCApi.h"
-#include "ThingsManager.h"
+#include "GroupManager.h"
+#include "ThingsConfiguration.h"
+#include "ThingsMaintenance.h"
 
 
 #ifdef  LOG_TAG
 
 #define ELM_DEMO_EDJ "opt/usr/apps/org.tizen.tmsampleapp/res/ui_controls.edj"
 
+#define FINDGROUP_TIMEOUT 5
+#define FINDRESOURCE_TIMEOUT 6
+
+#define DEFAULT_LOCATION "loc"
+#define DEFAULT_SYSTIME "st"
+#define DEFAULT_CURRENCY "c"
+#define DEFAULT_REGION "r"
+
 void group_cb(void *data, Evas_Object *obj, void *event_info);
 void configuration_cb(void *data, Evas_Object *obj, void *event_info);
 
index ee434ed..ef1ee8d 100644 (file)
@@ -33,10 +33,10 @@ OCResourceHandle configurationFoundHandle = NULL;
 std::shared_ptr< OCResource > g_configurationCollection; // For a group of multiple resources
 std::shared_ptr< OCResource > g_configurationResource; // For a single resource
 
-OCResourceHandle diagnosticsCollectionHandle = NULL;
-OCResourceHandle diagnosticsFoundHandle = NULL;
-std::shared_ptr< OCResource > g_diagnosticsCollection; // For a group of multiple resources
-std::shared_ptr< OCResource > g_diagnosticsResource; // For a single resource
+OCResourceHandle maintenanceCollectionHandle = NULL;
+OCResourceHandle maintenanceFoundHandle = NULL;
+std::shared_ptr< OCResource > g_maintenanceCollection; // For a group of multiple resources
+std::shared_ptr< OCResource > g_maintenanceResource; // For a single resource
 
 OCResourceHandle setCollectionHandle = NULL;
 OCResourceHandle setFoundHandle = NULL;
@@ -53,16 +53,19 @@ static Evas_Object *log_entry = NULL;
 
 string CONFIGURATION_COLLECTION_RESOURCE_URI  = "/core/a/configuration/resourceset";
 string CONFIGURATION_COLLECTION_RESOURCE_TYPE = "core.configuration.resourceset";
-string DIAGNOSTIC_COLLECTION_RESOURCE_URI     = "/core/a/diagnostics/resourceset";
-string DIAGNOSTIC_COLLECTION_RESOURCE_TYPE    = "core.diagnostics.resourceset";
+string MAINTENANCE_COLLECTION_RESOURCE_URI     = "/core/a/maintenance/resourceset";
+string MAINTENANCE_COLLECTION_RESOURCE_TYPE    = "core.maintenance.resourceset";
 string FACTORYSET_COLLECTION_RESOURCE_URI     = "/core/a/factoryset/resourceset";
 string FACTORYSET_COLLECTION_RESOURCE_TYPE    = "core.factoryset.resourceset";
 
 string CONFIGURATION_RESOURCE_URI             = "/oic/con";
-string DIAGNOSTIC_RESOURCE_URI                = "/oic/diag";
+string MAINTENANCE_RESOURCE_URI                = "/oic/mnt";
 string FACTORYSET_RESOURCE_URI                = "/factorySet";
 
-ThingsManager *configthingsMgr = new ThingsManager();
+GroupManager *g_groupManager = new GroupManager();
+ThingsConfiguration *g_thingsConfig = new ThingsConfiguration();
+ThingsMaintenance *g_thingsMnt = new ThingsMaintenance();
+
 
 typedef struct region_popup
 {
@@ -105,8 +108,8 @@ void onFoundCollectionResource(std::vector< std::shared_ptr< OCResource > > reso
 
                 if (resource->uri() == CONFIGURATION_COLLECTION_RESOURCE_URI)
                     g_configurationCollection = resource;
-                else if (resource->uri() == DIAGNOSTIC_COLLECTION_RESOURCE_URI)
-                    g_diagnosticsCollection = resource;
+                else if (resource->uri() == MAINTENANCE_COLLECTION_RESOURCE_URI)
+                    g_maintenanceCollection = resource;
                 else if (resource->uri() == FACTORYSET_COLLECTION_RESOURCE_URI)
                     g_setCollection = resource;
                 else
@@ -192,22 +195,22 @@ void onFoundCandidateResource(std::vector< std::shared_ptr< OCResource > > resou
                                            "g_configurationResource is not null");
                             }
                         }
-                        else if (resource->uri() == DIAGNOSTIC_RESOURCE_URI &&
-                                 NULL != diagnosticsCollectionHandle)
+                        else if (resource->uri() == MAINTENANCE_RESOURCE_URI &&
+                                 NULL != maintenanceCollectionHandle)
                         {
-                            OCPlatform::bindResource(diagnosticsCollectionHandle,
+                            OCPlatform::bindResource(maintenanceCollectionHandle,
                                                      foundResourceHandle);
-                            diagnosticsFoundHandle = foundResourceHandle;
-                            if (NULL == g_diagnosticsResource)
+                            maintenanceFoundHandle = foundResourceHandle;
+                            if (NULL == g_maintenanceResource)
                             {
                                 dlog_print(DLOG_INFO, LOG_TAG,
-                                           "g_diagnosticsResource updated");
-                                g_diagnosticsResource = resource;
+                                           "g_maintenanceResource updated");
+                                g_maintenanceResource = resource;
                             }
                             else
                             {
                                 dlog_print(DLOG_INFO, LOG_TAG,
-                                           "g_diagnosticsResource is not null");
+                                           "g_maintenanceResource is not null");
                             }
                         }
                         else if (resource->uri() == FACTORYSET_RESOURCE_URI &&
@@ -273,25 +276,25 @@ static void onUpdateConfigurationsCallback(const HeaderOptions &headerOptions,
     string logMessage = "Resource URI: " + rep.getUri() + "<br>";
     dlog_print(DLOG_INFO, LOG_TAG, "#### Resource URI: %s", rep.getUri().c_str());
 
-    if (rep.hasAttribute("loc"))
+    if (rep.hasAttribute(DEFAULT_LOCATION))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### Location : %s",
                    rep.getValue< std::string >("loc").c_str());
         logMessage = logMessage + "Location : " + rep.getValue< std::string >("loc") + "<br>";
     }
-    if (rep.hasAttribute("st"))
+    if (rep.hasAttribute(DEFAULT_SYSTIME))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### SystemTime : %s",
                    rep.getValue< std::string >("st").c_str());
         logMessage = logMessage + "SystemTime : " + rep.getValue< std::string >("st") + "<br>";
     }
-    if (rep.hasAttribute("c"))
+    if (rep.hasAttribute(DEFAULT_CURRENCY))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### Currency : %s",
                    rep.getValue< std::string >("c").c_str());
         logMessage = logMessage + "Currency : " + rep.getValue< std::string >("c") + "<br>";
     }
-    if (rep.hasAttribute("r"))
+    if (rep.hasAttribute(DEFAULT_REGION))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### Region : %s",
                    rep.getValue< std::string >("r").c_str());
@@ -322,29 +325,29 @@ static void onGetConfigurationsCallback(const HeaderOptions &headerOptions,
     string logMessage = "Resource URI: " + rep.getUri() + "<br>";
     dlog_print(DLOG_INFO, LOG_TAG, "#### Resource URI: %s", rep.getUri().c_str());
 
-    if (rep.hasAttribute("loc"))
+    if (rep.hasAttribute(DEFAULT_LOCATION))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### Location : %s",
-                   rep.getValue< std::string >("loc").c_str());
-        logMessage = logMessage + "Location : " + rep.getValue< std::string >("loc") + "<br>";
+                   rep.getValue< std::string >(DEFAULT_LOCATION).c_str());
+        logMessage = logMessage + "Location : " + rep.getValue< std::string >(DEFAULT_LOCATION) + "<br>";
     }
-    if (rep.hasAttribute("st"))
+    if (rep.hasAttribute(DEFAULT_SYSTIME))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### SystemTime : %s",
-                   rep.getValue< std::string >("st").c_str());
-        logMessage = logMessage + "SystemTime : " + rep.getValue< std::string >("st") + "<br>";
+                   rep.getValue< std::string >(DEFAULT_SYSTIME).c_str());
+        logMessage = logMessage + "SystemTime : " + rep.getValue< std::string >(DEFAULT_SYSTIME) + "<br>";
     }
-    if (rep.hasAttribute("c"))
+    if (rep.hasAttribute(DEFAULT_CURRENCY))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### Currency : %s",
-                   rep.getValue< std::string >("c").c_str());
-        logMessage = logMessage + "Currency : " + rep.getValue< std::string >("c") + "<br>";
+                   rep.getValue< std::string >(DEFAULT_CURRENCY).c_str());
+        logMessage = logMessage + "Currency : " + rep.getValue< std::string >(DEFAULT_CURRENCY) + "<br>";
     }
-    if (rep.hasAttribute("r"))
+    if (rep.hasAttribute(DEFAULT_REGION))
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### Region : %s",
-                   rep.getValue< std::string >("r").c_str());
-        logMessage = logMessage + "Region : " + rep.getValue< std::string >("r") + "<br>";
+                   rep.getValue< std::string >(DEFAULT_REGION).c_str());
+        logMessage = logMessage + "Region : " + rep.getValue< std::string >(DEFAULT_REGION) + "<br>";
     }
 
     logMessage += "----------------------<br>";
@@ -466,23 +469,26 @@ static void findAllGroups(void *data, Evas_Object *obj, void *event_info)
     std::vector<string> resourceTypes;
     resourceTypes.push_back(CONFIGURATION_COLLECTION_RESOURCE_TYPE);
 
-    if (NULL != configthingsMgr)
+    if (NULL != g_groupManager)
     {
-        configthingsMgr->findCandidateResources(resourceTypes, &onFoundCollectionResource, 5);
+        g_groupManager->findCandidateResources(resourceTypes, &onFoundCollectionResource,
+                                               FINDGROUP_TIMEOUT);
     }
 
     resourceTypes.clear();
-    resourceTypes.push_back(DIAGNOSTIC_COLLECTION_RESOURCE_TYPE);
-    if (NULL != configthingsMgr)
+    resourceTypes.push_back(MAINTENANCE_COLLECTION_RESOURCE_TYPE);
+    if (NULL != g_groupManager)
     {
-        configthingsMgr->findCandidateResources(resourceTypes, &onFoundCollectionResource, 5);
+        g_groupManager->findCandidateResources(resourceTypes, &onFoundCollectionResource,
+                                               FINDGROUP_TIMEOUT);
     }
 
     resourceTypes.clear();
     resourceTypes.push_back(FACTORYSET_COLLECTION_RESOURCE_TYPE);
-    if (NULL != configthingsMgr)
+    if (NULL != g_groupManager)
     {
-        configthingsMgr->findCandidateResources(resourceTypes, &onFoundCollectionResource, 5);
+        g_groupManager->findCandidateResources(resourceTypes, &onFoundCollectionResource,
+                                               FINDGROUP_TIMEOUT);
     }
 
     dlog_print(DLOG_INFO, LOG_TAG, "#### calling findCandidateResources EXIT!!!!");
@@ -492,25 +498,28 @@ static void findAllResources(void *data, Evas_Object *obj, void *event_info)
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### calling findCandidateResources ENTRY!!!!");
     std::vector<string> resourceTypes;
-    resourceTypes.push_back("oic.con");
+    resourceTypes.push_back("oic.wk.con");
 
-    if (NULL != configthingsMgr)
+    if (NULL != g_groupManager)
     {
-        configthingsMgr->findCandidateResources(resourceTypes, &onFoundCandidateResource, 7);
+        g_groupManager->findCandidateResources(resourceTypes, &onFoundCandidateResource,
+                                               FINDRESOURCE_TIMEOUT);
     }
 
     resourceTypes.clear();
-    resourceTypes.push_back("oic.diag");
-    if (NULL != configthingsMgr)
+    resourceTypes.push_back("oic.wk.mnt");
+    if (NULL != g_groupManager)
     {
-        configthingsMgr->findCandidateResources(resourceTypes, &onFoundCandidateResource, 7);
+        g_groupManager->findCandidateResources(resourceTypes, &onFoundCandidateResource,
+                                               FINDRESOURCE_TIMEOUT);
     }
 
     resourceTypes.clear();
     resourceTypes.push_back("factorySet");
-    if (NULL != configthingsMgr)
+    if (NULL != g_groupManager)
     {
-        configthingsMgr->findCandidateResources(resourceTypes, &onFoundCandidateResource, 7);
+        g_groupManager->findCandidateResources(resourceTypes, &onFoundCandidateResource,
+                                               FINDRESOURCE_TIMEOUT);
     }
 
     dlog_print(DLOG_INFO, LOG_TAG, "#### calling findCandidateResources EXIT!!!!");
@@ -534,8 +543,10 @@ static void getConfiguration(void *data, Evas_Object *obj, void *event_info)
 
     try
     {
-        configthingsMgr->getConfigurations(g_configurationCollection, configurations,
-                                           &onGetConfigurationsCallback);
+        g_thingsConfig->getConfigurations(g_configurationCollection, configurations,
+                                          &onGetConfigurationsCallback);
+
+        isWaiting = 0;
     }
     catch (std::exception &e)
     {
@@ -571,7 +582,7 @@ static void updateConfiguration(std::string newRegionValue)
 
     try
     {
-        result = configthingsMgr->updateConfigurations(g_configurationCollection, configurations,
+        result = g_thingsConfig->updateConfigurations(g_configurationCollection, configurations,
                  &onUpdateConfigurationsCallback);
     }
     catch (std::exception &e)
@@ -594,7 +605,7 @@ static void updateConfiguration(std::string newRegionValue)
 static void factoryReset(void *data, Evas_Object *obj, void *event_info)
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### factoryReset ENTRY!!!!");
-    if (NULL == g_diagnosticsCollection || NULL == g_diagnosticsCollection.get())
+    if (NULL == g_maintenanceCollection || NULL == g_maintenanceCollection.get())
     {
         dlog_print(DLOG_ERROR, LOG_TAG, "Note that you first create a group to use this command");
         string logMessage = "FIRST CREATE GROUP <br>";
@@ -608,7 +619,7 @@ static void factoryReset(void *data, Evas_Object *obj, void *event_info)
 
     try
     {
-        result = configthingsMgr->factoryReset(g_diagnosticsCollection, &onFactoryReset);
+        result = g_thingsMnt->factoryReset(g_maintenanceCollection, &onFactoryReset);
     }
     catch (std::exception &e)
     {
@@ -630,7 +641,7 @@ static void factoryReset(void *data, Evas_Object *obj, void *event_info)
 static void reboot(void *data, Evas_Object *obj, void *event_info)
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### reboot ENTRY!!!!");
-    if (NULL == g_diagnosticsCollection || NULL == g_diagnosticsCollection.get())
+    if (NULL == g_maintenanceCollection || NULL == g_maintenanceCollection.get())
     {
         dlog_print(DLOG_INFO, LOG_TAG, "Note that you first create a group to use this command");
         string logMessage = "FIRST CREATE GROUP <br>";
@@ -644,7 +655,7 @@ static void reboot(void *data, Evas_Object *obj, void *event_info)
 
     try
     {
-        result = configthingsMgr->reboot(g_diagnosticsCollection, &onReboot);
+        result = g_thingsMnt->reboot(g_maintenanceCollection, &onReboot);
     }
     catch (std::exception &e)
     {
@@ -667,7 +678,7 @@ static void getListOfSupportedConfigurationUnits(void *data, Evas_Object *obj, v
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### getListOfSupportedConfigurationUnits ENTRY!!!!");
     string listOfSupportedConfigurationUnits =
-        configthingsMgr->getListOfSupportedConfigurationUnits();
+        g_thingsConfig->getListOfSupportedConfigurationUnits();
     dlog_print(DLOG_INFO, LOG_TAG, "#### List : %s", listOfSupportedConfigurationUnits.c_str());
 
     string logMessage;
@@ -684,9 +695,9 @@ static void onStartConfigure()
     createResourceCollection(CONFIGURATION_COLLECTION_RESOURCE_URI,
                              CONFIGURATION_COLLECTION_RESOURCE_TYPE,
                              configurationCollectionHandle);
-    createResourceCollection(DIAGNOSTIC_COLLECTION_RESOURCE_URI,
-                             DIAGNOSTIC_COLLECTION_RESOURCE_TYPE,
-                             diagnosticsCollectionHandle);
+    createResourceCollection(MAINTENANCE_COLLECTION_RESOURCE_URI,
+                             MAINTENANCE_COLLECTION_RESOURCE_TYPE,
+                             maintenanceCollectionHandle);
     createResourceCollection(FACTORYSET_COLLECTION_RESOURCE_URI,
                              FACTORYSET_COLLECTION_RESOURCE_TYPE,
                              setCollectionHandle);
@@ -699,7 +710,7 @@ static void onDestroyConfigure()
 
     deleteResource(configurationCollectionHandle, configurationFoundHandle);
 
-    deleteResource(diagnosticsCollectionHandle, diagnosticsFoundHandle);
+    deleteResource(maintenanceCollectionHandle, maintenanceFoundHandle);
 
     deleteResource(setCollectionHandle, setFoundHandle);
 
index 5bce243..cc19ca5 100644 (file)
@@ -44,7 +44,7 @@ OCResourceHandle foundResourceHandle = NULL;
 shared_ptr< OCResource > g_resource ;
 std::vector< string > lights;
 
-ThingsManager *groupThingsMgr = new ThingsManager();
+GroupManager *groupMgr = NULL;
 
 typedef struct datetime_popup
 {
@@ -92,7 +92,7 @@ void onPost(const HeaderOptions &headerOptions, const OCRepresentation &rep, con
         string plainText;
         if (rep.getValue("ActionSet", plainText))
         {
-            ActionSet *actionset = groupThingsMgr->getActionSetfromString(plainText);
+            ActionSet *actionset = groupMgr->getActionSetfromString(plainText);
             if (NULL != actionset)
             {
                 dlog_print(DLOG_INFO, LOG_TAG, "#### ACTIONSET NAME :: (%s)",
@@ -174,7 +174,7 @@ static void createActionSet_AllBulbOff()
     {
         if (g_resource)
         {
-            groupThingsMgr->addActionSet(g_resource, actionSet, onPut);
+            groupMgr->addActionSet(g_resource, actionSet, onPut);
         }
     }
     catch (std::exception &e)
@@ -232,7 +232,7 @@ static void createActionSet_AllBulbOn()
     {
         if (g_resource)
         {
-            groupThingsMgr->addActionSet(g_resource, actionSet, onPut);
+            groupMgr->addActionSet(g_resource, actionSet, onPut);
         }
     }
     catch (std::exception &e)
@@ -279,7 +279,7 @@ static void createRecursiveActionSet_AllBulbOn(void *data, Evas_Object *obj, voi
     }
     if (g_resource)
     {
-        groupThingsMgr->addActionSet(g_resource, allBulbOn, onPut);
+        groupMgr->addActionSet(g_resource, allBulbOn, onPut);
     }
 
     delete allBulbOn;
@@ -329,7 +329,7 @@ static void createScheduledActionSet_AllBulbOff(int date, int month, int year,
     }
     if (g_resource)
     {
-        groupThingsMgr->addActionSet(g_resource, allBulbOff, onPut);
+        groupMgr->addActionSet(g_resource, allBulbOff, onPut);
     }
 
     delete allBulbOff;
@@ -338,33 +338,33 @@ static void createScheduledActionSet_AllBulbOff(int date, int month, int year,
 
 static void scheduled_AllbulbOff(void *data, Evas_Object *obj, void *event_info)
 {
-    groupThingsMgr->executeActionSet(g_resource, "AllBulbOffScheduledCall", &onPost);
+    groupMgr->executeActionSet(g_resource, "AllBulbOffScheduledCall", &onPost);
 }
 
 static void scheduled_AllbulbOffEx(void *data, Evas_Object *obj, void *event_info)
 {
-    groupThingsMgr->executeActionSet(g_resource, "AllBulbOffScheduledCall", 10, &onPost);
+    groupMgr->executeActionSet(g_resource, "AllBulbOffScheduledCall", 10, &onPost);
 }
 
 static void cancelScheduled_AllBulbOff(void *data, Evas_Object *obj, void *event_info)
 {
-    groupThingsMgr->cancelActionSet(g_resource, "AllBulbOffScheduledCall", &onPost);
+    groupMgr->cancelActionSet(g_resource, "AllBulbOffScheduledCall", &onPost);
 }
 
 static void recursive_allBulbOn(void *data, Evas_Object *obj, void *event_info)
 {
-    groupThingsMgr->executeActionSet(g_resource, "AllBulbOnRecursiveCall", &onPost);
+    groupMgr->executeActionSet(g_resource, "AllBulbOnRecursiveCall", &onPost);
 }
 
 static void recursive_allBulbOnEx(void *data, Evas_Object *obj, void *event_info)
 {
-    groupThingsMgr->executeActionSet(g_resource, "AllBulbOnRecursiveCall", 10, &onPost);
+    groupMgr->executeActionSet(g_resource, "AllBulbOnRecursiveCall", 10, &onPost);
 }
 
 static void cancelRecursive_allBulbOn(void *data, Evas_Object *obj, void *event_info)
 {
 
-    groupThingsMgr->cancelActionSet(g_resource, "AllBulbOnRecursiveCall", &onPost);
+    groupMgr->cancelActionSet(g_resource, "AllBulbOnRecursiveCall", &onPost);
 }
 
 /* Method for executing the action Set AllBulbOff that we have created using
@@ -387,7 +387,7 @@ static void executeActionSetOff(void *data, Evas_Object *obj, void *event_info)
     {
         if (g_resource)
         {
-            groupThingsMgr->executeActionSet(g_resource, BULBOFF, &onPost);
+            groupMgr->executeActionSet(g_resource, BULBOFF, &onPost);
         }
     }
     catch (std::exception &e)
@@ -422,7 +422,7 @@ static void executeActionSetOn(void *data, Evas_Object *obj, void *event_info)
     {
         if (g_resource)
         {
-            groupThingsMgr->executeActionSet(g_resource, BULBON, &onPost);
+            groupMgr->executeActionSet(g_resource, BULBON, &onPost);
         }
     }
     catch (std::exception &e)
@@ -457,7 +457,7 @@ static void getActionSetOff(void *data, Evas_Object *obj, void *event_info)
     {
         if (g_resource)
         {
-            groupThingsMgr->getActionSet(g_resource, BULBOFF, &onPost);
+            groupMgr->getActionSet(g_resource, BULBOFF, &onPost);
         }
     }
     catch (std::exception &e)
@@ -488,7 +488,7 @@ static void getActionSetOn(void *data, Evas_Object *obj, void *event_info)
     {
         if (g_resource)
         {
-            groupThingsMgr->getActionSet(g_resource, BULBON, &onPost);
+            groupMgr->getActionSet(g_resource, BULBON, &onPost);
         }
     }
     catch (std::exception &e)
@@ -519,7 +519,7 @@ static void deleteActionSetOff(void *data, Evas_Object *obj, void *event_info)
     {
         if (g_resource)
         {
-            groupThingsMgr->deleteActionSet(g_resource, BULBOFF, &onPost);
+            groupMgr->deleteActionSet(g_resource, BULBOFF, &onPost);
         }
     }
     catch (std::exception &e)
@@ -554,7 +554,7 @@ static void deleteActionSetOn(void *data, Evas_Object *obj, void *event_info)
     {
         if (g_resource)
         {
-            groupThingsMgr->deleteActionSet(g_resource, BULBON, &onPost);
+            groupMgr->deleteActionSet(g_resource, BULBON, &onPost);
         }
     }
     catch (std::exception &e)
@@ -686,13 +686,16 @@ void foundResources(std::vector< std::shared_ptr< OC::OCResource > > listOfResou
 
 static void create_group()
 {
-    if (NULL != groupThingsMgr)
+
+    groupMgr = new GroupManager();
+
+    if (NULL != groupMgr)
     {
         dlog_print(DLOG_INFO, LOG_TAG, "#### calling findCandidateResources from "
                    "create_group!!!!");
         vector< string > types;
         types.push_back("core.light");
-        groupThingsMgr->findCandidateResources(types, &foundResources, 5);
+        groupMgr->findCandidateResources(types, &foundResources, FINDRESOURCE_TIMEOUT);
     }
 
     try
@@ -721,11 +724,12 @@ static void create_group()
 void findLightResource(void *data, Evas_Object *obj, void *event_info)
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### findLightResource ENTRY");
-    if (NULL != groupThingsMgr)
+    if (NULL != groupMgr)
     {
         vector< string > types;
         types.push_back("core.light");
-        OCStackResult result = groupThingsMgr->findCandidateResources(types, &foundResources, 5);
+        OCStackResult result = groupMgr->findCandidateResources(types, &foundResources,
+                               FINDRESOURCE_TIMEOUT);
         if (result == OC_STACK_OK)
         {
             dlog_print(DLOG_INFO, LOG_TAG, "#### create_group -- findCandidateResources :: "
@@ -743,11 +747,12 @@ void findLightResource(void *data, Evas_Object *obj, void *event_info)
 void observeBookMark(void *data, Evas_Object *obj, void *event_info)
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### observeBookMark ENTRY");
-    if (NULL != groupThingsMgr)
+    if (NULL != groupMgr)
     {
         vector< string > types;
         types.push_back("core.bookmark");
-        OCStackResult result = groupThingsMgr->findCandidateResources(types, &foundResources, 5);
+        OCStackResult result = groupMgr->findCandidateResources(types, &foundResources,
+                               FINDRESOURCE_TIMEOUT);
         if (OC_STACK_OK == result)
         {
             dlog_print(DLOG_INFO, LOG_TAG, "#### create_group - findCandidateResources :: "
@@ -805,6 +810,8 @@ static void onDestroy()
     {
         dlog_print(DLOG_ERROR, LOG_TAG, "Exception occured! (%s)", e.what());
     }
+
+    delete groupMgr;
 }
 
 static void createActionSet(void *data, Evas_Object *obj, void *event_info)
@@ -1066,17 +1073,12 @@ static void list_selected_cb(void *data, Evas_Object *obj, void *event_info)
 static void find_group()
 {
     dlog_print(DLOG_INFO, LOG_TAG, "#### findGroup ENTRY");
-    vector< string > resourceTypes;
-    resourceTypes.push_back(resourceTypeName);
-    OCStackResult result = groupThingsMgr->findGroup(resourceTypes, &foundResource);
-    if (OC_STACK_OK == result)
-    {
-        dlog_print(DLOG_INFO, LOG_TAG, "#### findGroup returned OC_STACK_OK");
-    }
-    else
-    {
-        dlog_print(DLOG_INFO, LOG_TAG, "#### findGroup failed");
-    }
+    std::string query = OC_RSRVD_WELL_KNOWN_URI;
+    query.append("?rt=");
+    query.append(resourceTypeName);
+
+    OCPlatform::findResource("", query, CT_DEFAULT, &foundResource);
+
     dlog_print(DLOG_INFO, LOG_TAG, "#### findGroup EXIT");
 }