Modify the term "Diagnostics" to "Maintenance" in file names
authorJihun Ha <jihun.ha@samsung.com>
Tue, 8 Sep 2015 01:03:05 +0000 (10:03 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Tue, 8 Sep 2015 13:59:52 +0000 (13:59 +0000)
ThingsDignostics and DiagnosticsCollection files are renamed to
ThingsMaintenance and MaintenanceCollection files.

Update properties of Configuration resource

"Device Name" and "Location Name" properties are added and "SystemTime" property
is removed.

Change-Id: I0f4028aea14997a6a35ae5660671e47aedb2b67b
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2394
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Abhishek Pandey <abhi.siso@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
15 files changed:
service/things-manager/sampleapp/linux/configuration/ConfigurationCollection.cpp
service/things-manager/sampleapp/linux/configuration/ConfigurationCollection.h
service/things-manager/sampleapp/linux/configuration/FactorySetCollection.cpp
service/things-manager/sampleapp/linux/configuration/MaintenanceCollection.cpp [moved from service/things-manager/sampleapp/linux/configuration/DiagnosticsCollection.cpp with 99% similarity]
service/things-manager/sampleapp/linux/configuration/MaintenanceCollection.h [moved from service/things-manager/sampleapp/linux/configuration/DiagnosticsCollection.h with 99% similarity]
service/things-manager/sampleapp/linux/configuration/SConscript
service/things-manager/sampleapp/linux/configuration/bootstrapserver.cpp [changed mode: 0644->0755]
service/things-manager/sampleapp/linux/configuration/con-client.cpp
service/things-manager/sampleapp/linux/configuration/con-server.cpp
service/things-manager/sampleapp/tizen/ConServerApp/inc/configurationresource.h [changed mode: 0644->0755]
service/things-manager/sampleapp/tizen/ConServerApp/src/configurationresource.cpp [changed mode: 0644->0755]
service/things-manager/sdk/inc/ThingsConfiguration.h
service/things-manager/sdk/inc/ThingsMaintenance.h [moved from service/things-manager/sdk/inc/ThingsDiagnostics.h with 100% similarity]
service/things-manager/sdk/src/ThingsConfiguration.cpp [changed mode: 0644->0755]
service/things-manager/sdk/src/ThingsMaintenance.cpp [moved from service/things-manager/sdk/src/ThingsDiagnostics.cpp with 99% similarity]

index 4f3f2b9..a01b3c6 100755 (executable)
@@ -61,15 +61,22 @@ void ConfigurationResource::setConfigurationRepresentation(OCRepresentation& rep
 {
     string value;
 
+    if (rep.getValue("n", value))
+    {
+        m_deviceName = value;
+        std::cout << "\t\t\t\t" << "m_deviceName: " << m_deviceName << std::endl;
+    }
+
     if (rep.getValue("loc", value))
     {
         m_location = value;
         std::cout << "\t\t\t\t" << "m_location: " << m_location << std::endl;
     }
 
-    if (rep.getValue("st", value))
+    if (rep.getValue("locn", value))
     {
-        std::cout << "\t\t\t\t" << "SystemTime is not allowed to be written." << std::endl;
+        m_locationName = value;
+        std::cout << "\t\t\t\t" << "m_locationName: " << m_locationName << std::endl;
     }
 
     if (rep.getValue("c", value))
@@ -87,8 +94,9 @@ void ConfigurationResource::setConfigurationRepresentation(OCRepresentation& rep
 
 OCRepresentation ConfigurationResource::getConfigurationRepresentation()
 {
+    m_configurationRep.setValue("n", m_deviceName);
     m_configurationRep.setValue("loc", m_location);
-    m_configurationRep.setValue("st", m_systemTime);
+    m_configurationRep.setValue("locn", m_locationName);
     m_configurationRep.setValue("c", m_currency);
     m_configurationRep.setValue("r", m_region);
 
@@ -102,8 +110,9 @@ std::string ConfigurationResource::getUri()
 
 void ConfigurationResource::factoryReset()
 {
+    m_deviceName = defaultDeviceName;
     m_location = defaultLocation;
-    m_systemTime = defaultSystemTime;
+    m_locationName = defaultLocationName;
     m_currency = defaultCurrency;
     m_region = defaultRegion;
 }
index 9b3e864..e40b6bd 100755 (executable)
@@ -38,8 +38,9 @@ typedef std::function<
 static std::string defaultConURI = "/oic/con";
 static std::string defaultConResourceType = "oic.wk.con";
 
+extern std::string defaultDeviceName;
 extern std::string defaultLocation;
-extern std::string defaultSystemTime;
+extern std::string defaultLocationName;
 extern std::string defaultCurrency;
 extern std::string defaultRegion;
 
@@ -48,8 +49,9 @@ class ConfigurationResource
 public:
     // Configuration members
     std::string m_configurationUri;
+    std::string m_deviceName;
     std::string m_location;
-    std::string m_systemTime;
+    std::string m_locationName;
     std::string m_currency;
     std::string m_region;
     std::vector< std::string > m_configurationTypes;
@@ -60,14 +62,16 @@ public:
 public:
     /// Constructor
     ConfigurationResource() :
-            m_location(defaultLocation), m_systemTime(defaultSystemTime), m_currency(
-                    defaultCurrency), m_region(defaultRegion)
+            m_deviceName(defaultDeviceName), m_location(defaultLocation),
+                m_locationName(defaultLocationName), m_currency(defaultCurrency),
+                m_region(defaultRegion)
     {
         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("st", m_deviceName);
         m_configurationRep.setValue("loc", m_location);
-        m_configurationRep.setValue("st", m_systemTime);
+        m_configurationRep.setValue("locn", m_locationName);
         m_configurationRep.setValue("c", m_currency);
         m_configurationRep.setValue("r", m_region);
         m_configurationRep.setUri(m_configurationUri);
index aa8689e..bab6112 100755 (executable)
@@ -72,15 +72,22 @@ void FactorySetResource::setFactorySetRepresentation(OCRepresentation& rep)
 {
     string value;
 
+    if (rep.getValue("n", value))
+    {
+        m_deviceName = value;
+        std::cout << "\t\t\t\t" << "m_deviceName: " << m_deviceName << std::endl;
+    }
+
     if (rep.getValue("loc", value))
     {
         m_location = value;
         std::cout << "\t\t\t\t" << "m_location: " << m_location << std::endl;
     }
 
-    if (rep.getValue("st", value))
+    if (rep.getValue("locn", value))
     {
-        std::cout << "\t\t\t\t" << "SystemTime is not allowed to be written." << std::endl;
+        m_locationName = value;
+        std::cout << "\t\t\t\t" << "m_locationName: " << m_locationName << std::endl;
     }
 
     if (rep.getValue("c", value))
@@ -98,8 +105,9 @@ void FactorySetResource::setFactorySetRepresentation(OCRepresentation& rep)
 
 OCRepresentation FactorySetResource::getFactorySetRepresentation()
 {
+    m_configurationRep.setValue("n", m_deviceName);
     m_configurationRep.setValue("loc", m_location);
-    m_configurationRep.setValue("st", m_systemTime);
+    m_configurationRep.setValue("locn", m_locationName);
     m_configurationRep.setValue("c", m_currency);
     m_configurationRep.setValue("r", m_region);
 
@@ -46,7 +46,7 @@ class MaintenanceResource
 {
 public:
 
-    // diagnostics members
+    // Maintenance members
     std::string m_maintenanceUri;
     std::string m_factoryReset;
     std::string m_reboot;
index 962b7f2..7285e13 100644 (file)
@@ -53,7 +53,7 @@ if 'rt' in linux_sample_env.get('LIBS'):
 ######################################################################
 #build sampleapp
 ######################################################################
-conserver = linux_sample_env.Program('con-server', ['ConfigurationCollection.cpp', 'DiagnosticsCollection.cpp', 'FactorySetCollection.cpp', 'con-server.cpp'])
+conserver = linux_sample_env.Program('con-server', ['ConfigurationCollection.cpp', 'MaintenanceCollection.cpp', 'FactorySetCollection.cpp', 'con-server.cpp'])
 conclient = linux_sample_env.Program('con-client', 'con-client.cpp')
 bootstrapserver = linux_sample_env.Program('bootstrapserver', 'bootstrapserver.cpp')
 Alias("ConServerApp", conserver)
old mode 100644 (file)
new mode 100755 (executable)
index a1548e6..0b2f4f2
@@ -37,11 +37,11 @@ bool prepareResponse(std::shared_ptr< OCResourceRequest > request);
 OCStackResult sendResponse(std::shared_ptr< OCResourceRequest > pRequest);
 OCEntityHandlerResult entityHandlerBootstrap(std::shared_ptr< OCResourceRequest > request);
 
-#define DefaultRegion "Seoul, Korea"
-#define DefaultSystemTime "00:00:00"
+#define DefaultDeviceName "Legacy Device"
 #define DefaultLocation "37.256616, 127.052806"
+#define DefaultLocationName "Living Room"
 #define DefaultCurrency "Won"
-
+#define DefaultRegion "Seoul, Korea"
 
 class BootstrapResource
 {
@@ -88,10 +88,11 @@ public:
 
     OCRepresentation getBootstrapRepresentation()
     {
-        m_bootstrapRep.setValue< std::string >("r", DefaultRegion);
-        m_bootstrapRep.setValue< std::string >("st", DefaultSystemTime);
+        m_bootstrapRep.setValue< std::string >("n", DefaultDeviceName);
         m_bootstrapRep.setValue< std::string >("loc", DefaultLocation);
+        m_bootstrapRep.setValue< std::string >("locn", DefaultLocationName);
         m_bootstrapRep.setValue< std::string >("c", DefaultCurrency);
+        m_bootstrapRep.setValue< std::string >("r", DefaultRegion);
 
         return m_bootstrapRep;
     }
index 9786ca6..a7a67e9 100755 (executable)
@@ -29,7 +29,7 @@
 #include "OCApi.h"
 //#include "ThingsManager.h"
 #include "ThingsConfiguration.h"
-#include "ThingsDiagnostics.h"
+#include "ThingsMaintenance.h"
 #include "GroupManager.h"
 
 using namespace OC;
@@ -116,10 +116,12 @@ void onUpdate(const HeaderOptions& headerOptions, const OCRepresentation& rep, c
 
     std::cout << "\tResource URI: " << rep.getUri() << std::endl;
 
+    if (rep.hasAttribute("n"))
+        std::cout << "\t\tDeviceName:" << rep.getValue< std::string >("n") << std::endl;
     if (rep.hasAttribute("loc"))
         std::cout << "\t\tLocation:" << rep.getValue< std::string >("loc") << std::endl;
-    if (rep.hasAttribute("st"))
-        std::cout << "\t\tSystemTime:" << rep.getValue< std::string >("st") << std::endl;
+    if (rep.hasAttribute("locn"))
+        std::cout << "\t\tLocationName:" << rep.getValue< std::string >("locn") << std::endl;
     if (rep.hasAttribute("c"))
         std::cout << "\t\tCurrency:" << rep.getValue< std::string >("c") << std::endl;
     if (rep.hasAttribute("r"))
@@ -139,10 +141,12 @@ void onGet(const HeaderOptions& headerOptions, const OCRepresentation& rep, cons
 
     std::cout << "\tResource URI: " << rep.getUri() << std::endl;
 
+    if (rep.hasAttribute("n"))
+        std::cout << "\t\tDeviceName:" << rep.getValue< std::string >("n") << std::endl;
     if (rep.hasAttribute("loc"))
         std::cout << "\t\tLocation:" << rep.getValue< std::string >("loc") << std::endl;
-    if (rep.hasAttribute("st"))
-        std::cout << "\t\tSystemTime:" << rep.getValue< std::string >("st") << std::endl;
+    if (rep.hasAttribute("locn"))
+        std::cout << "\t\tLocationName:" << rep.getValue< std::string >("locn") << std::endl;
     if (rep.hasAttribute("c"))
         std::cout << "\t\tCurrency:" << rep.getValue< std::string >("c") << std::endl;
     if (rep.hasAttribute("r"))
@@ -446,8 +450,8 @@ int main(int argc, char* argv[])
             }
             else if (g_Steps == 4)
             {
-                ConfigurationName name = "r";
-                ConfigurationValue value = "U.S.A (new region)";
+                ConfigurationName name = "n";
+                ConfigurationValue value = "OIC Device";
 
                 if(g_configurationCollection == NULL)
                 {
index 4d1ee17..136b22f 100755 (executable)
@@ -28,9 +28,9 @@
 #include "OCPlatform.h"
 #include "OCApi.h"
 #include "ThingsConfiguration.h"
-#include "ThingsDiagnostics.h"
+#include "ThingsMaintenance.h"
 #include "ConfigurationCollection.h"
-#include "DiagnosticsCollection.h"
+#include "MaintenanceCollection.h"
 #include "FactorySetCollection.h"
 
 using namespace OC;
@@ -44,9 +44,11 @@ pthread_mutex_t mutex_lock = PTHREAD_MUTEX_INITIALIZER;
 // Default system configuration value's variables
 // The variable's names should be same as the names of "extern" variables defined in
 // "ConfigurationResource.h"
+
+std::string defaultDeviceName;
 std::string defaultLocation;
+std::string defaultLocationName;
 std::string defaultRegion;
-std::string defaultSystemTime;
 std::string defaultCurrency;
 
 //static ThingsManager* g_thingsmanager;
@@ -231,13 +233,15 @@ void onBootstrap(const HeaderOptions& headerOptions, const OCRepresentation& rep
     std::cout << "\n\nGET request was successful" << std::endl;
     std::cout << "\tResource URI: " << rep.getUri() << std::endl;
 
+    defaultDeviceName = rep.getValue< std::string >("n");
+    defaultLocation = rep.getValue< std::string >("loc");
+    defaultLocationName = rep.getValue< std::string >("locn");
     defaultRegion = rep.getValue< std::string >("r");
-    defaultSystemTime = rep.getValue< std::string >("st");
     defaultCurrency = rep.getValue< std::string >("c");
-    defaultLocation = rep.getValue< std::string >("loc");
 
+    std::cout << "\tSystemTime : " << defaultDeviceName << std::endl;
     std::cout << "\tLocation : " << defaultLocation << std::endl;
-    std::cout << "\tSystemTime : " << defaultSystemTime << std::endl;
+    std::cout << "\tLocationName : " << defaultLocationName << std::endl;
     std::cout << "\tCurrency : " << defaultCurrency << std::endl;
     std::cout << "\tRegion : " << defaultRegion << std::endl;
 
@@ -253,7 +257,7 @@ int main()
 
     OCPlatform::Configure(cfg);
     g_thingsConf = new ThingsConfiguration();
-    //g_thingsDiag = new ThingsDiagnostics();
+    //g_thingsDiag = new ThingsMaintenance();
     //**************************************************************
 
     if (getuid() != 0)
old mode 100644 (file)
new mode 100755 (executable)
index 14bfd8b..9464c11
@@ -37,7 +37,7 @@ static std::string defaultURIPrefix = "/oic/con";
 static std::string defaultResourceTypePrefix = "oic.con";
 
 extern std::string defaultLocation;
-extern std::string defaultSystemTime;
+extern std::string defaultDeviceName;
 extern std::string defaultCurrency;
 extern std::string defaultRegion;
 
old mode 100644 (file)
new mode 100755 (executable)
index 529a13f..daf72ed
@@ -31,7 +31,7 @@ using namespace OC;
 
 // Constructor
 ConfigurationResource::ConfigurationResource() :
-    m_location(defaultLocation), m_systemTime(defaultSystemTime), m_currency(
+    m_location(defaultLocation), m_systemTime(defaultDeviceName), m_currency(
         defaultCurrency), m_region(defaultRegion)
 {
     m_configurationUri = "/oic/con"; // URI of the resource
@@ -124,7 +124,7 @@ std::string ConfigurationResource::getUri()
 void ConfigurationResource::factoryReset()
 {
     m_location = defaultLocation;
-    m_systemTime = defaultSystemTime;
+    m_systemTime = defaultDeviceName;
     m_currency = defaultCurrency;
     m_region = defaultRegion;
 }
index a45326d..517fdc9 100755 (executable)
@@ -97,7 +97,7 @@ namespace OIC
         std::string getJSON();
     };
 
-#define NUMCONFUNIT 5
+#define NUMCONFUNIT 6
     typedef std::string ConfigurationName;
     typedef std::string ConfigurationValue;
 
old mode 100644 (file)
new mode 100755 (executable)
index 9c68645..d148b29
@@ -73,9 +73,10 @@ namespace OIC
         ConfigurationUnitInfo unit[] =
         {
         { "all", "All attributes", "/oic/con" },
-        { "r", "Region", "/oic/con" },
-        { "st", "System Time", "/oic/con"},
+        { "n", "Device Name", "/oic/con"},
         { "loc", "Location", "/oic/con"},
+        { "locn", "Location Name", "/oic/con"},
+        { "r", "Region", "/oic/con" },
         { "c","Currency", "/oic/con" } };
 
         for (int i = 0; i < NUMCONFUNIT; i++)
@@ -27,7 +27,7 @@
 #include <OCPlatform.h>
 #include <cstdlib>
 
-#include "ThingsDiagnostics.h"
+#include "ThingsMaintenance.h"
 
 using namespace OC;