{
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))
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);
void ConfigurationResource::factoryReset()
{
+ m_deviceName = defaultDeviceName;
m_location = defaultLocation;
- m_systemTime = defaultSystemTime;
+ m_locationName = defaultLocationName;
m_currency = defaultCurrency;
m_region = defaultRegion;
}
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;
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;
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);
{
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))
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);
#include "OCPlatform.h"
#include "OCApi.h"
-#include "DiagnosticsCollection.h"
+#include "MaintenanceCollection.h"
using namespace OC;
using namespace std;
{
public:
- // diagnostics members
+ // Maintenance members
std::string m_maintenanceUri;
std::string m_factoryReset;
std::string m_reboot;
######################################################################
#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)
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
{
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;
}
#include "OCApi.h"
//#include "ThingsManager.h"
#include "ThingsConfiguration.h"
-#include "ThingsDiagnostics.h"
+#include "ThingsMaintenance.h"
#include "GroupManager.h"
using namespace OC;
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"))
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"))
}
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)
{
#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;
// 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;
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;
OCPlatform::Configure(cfg);
g_thingsConf = new ThingsConfiguration();
- //g_thingsDiag = new ThingsDiagnostics();
+ //g_thingsDiag = new ThingsMaintenance();
//**************************************************************
if (getuid() != 0)
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;
// 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
void ConfigurationResource::factoryReset()
{
m_location = defaultLocation;
- m_systemTime = defaultSystemTime;
+ m_systemTime = defaultDeviceName;
m_currency = defaultCurrency;
m_region = defaultRegion;
}
std::string getJSON();
};
-#define NUMCONFUNIT 5
+#define NUMCONFUNIT 6
typedef std::string ConfigurationName;
typedef std::string ConfigurationValue;
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++)
#include <OCPlatform.h>
#include <cstdlib>
-#include "ThingsDiagnostics.h"
+#include "ThingsMaintenance.h"
using namespace OC;