Displaying and editing the complex value types for attributes.
[platform/upstream/iotivity.git] / service / simulator / src / simulator_manager.cpp
index 001cbb3..4b10c14 100644 (file)
@@ -49,7 +49,7 @@ std::shared_ptr<SimulatorResource> SimulatorManager::createResource(
     VALIDATE_INPUT(configPath.empty(), "Empty path!")
 
     std::shared_ptr<SimulatorResource> resource =
-            SimulatorResourceFactory::getInstance()->createResource(configPath);
+        SimulatorResourceFactory::getInstance()->createResource(configPath);
     if (!resource)
         throw SimulatorException(SIMULATOR_ERROR, "Failed to create resource!");
     return resource;
@@ -62,7 +62,7 @@ std::vector<std::shared_ptr<SimulatorResource>> SimulatorManager::createResource
     VALIDATE_INPUT(!count, "Count is zero!")
 
     std::vector<std::shared_ptr<SimulatorResource>> resources =
-            SimulatorResourceFactory::getInstance()->createResource(configPath, count);
+                SimulatorResourceFactory::getInstance()->createResource(configPath, count);
     if (!resources.size())
         throw SimulatorException(SIMULATOR_ERROR, "Failed to create resource!");
     return resources;
@@ -133,7 +133,7 @@ void SimulatorManager::findResource(const std::string &resourceType,
                      CT_DEFAULT, findCallback);
 }
 
-void SimulatorManager::getDeviceInfo(DeviceInfoCallback callback)
+void SimulatorManager::getDeviceInfo(const std::string &host, DeviceInfoCallback callback)
 {
     VALIDATE_CALLBACK(callback)
 
@@ -149,14 +149,11 @@ void SimulatorManager::getDeviceInfo(DeviceInfoCallback callback)
         callback(deviceInfo);
     }, std::placeholders::_1, callback);
 
-    std::ostringstream uri;
-    uri << OC_MULTICAST_PREFIX << OC_RSRVD_DEVICE_URI;
-
     typedef OCStackResult (*GetDeviceInfo)(const std::string &, const std::string &,
                                            OCConnectivityType, OC::FindDeviceCallback);
 
-    invokeocplatform(static_cast<GetDeviceInfo>(OC::OCPlatform::getDeviceInfo), "",
-                     uri.str(), CT_DEFAULT, deviceCallback);
+    invokeocplatform(static_cast<GetDeviceInfo>(OC::OCPlatform::getDeviceInfo), host.c_str(),
+                     "/oic/d", CT_DEFAULT, deviceCallback);
 }
 
 void SimulatorManager::setDeviceInfo(const std::string &deviceName)
@@ -171,7 +168,7 @@ void SimulatorManager::setDeviceInfo(const std::string &deviceName)
                      ocDeviceInfo);
 }
 
-void SimulatorManager::getPlatformInfo(PlatformInfoCallback callback)
+void SimulatorManager::getPlatformInfo(const std::string &host, PlatformInfoCallback callback)
 {
     VALIDATE_CALLBACK(callback)
 
@@ -194,14 +191,11 @@ void SimulatorManager::getPlatformInfo(PlatformInfoCallback callback)
         callback(platformInfo);
     }, std::placeholders::_1, callback);
 
-    std::ostringstream uri;
-    uri << OC_MULTICAST_PREFIX << OC_RSRVD_PLATFORM_URI;
-
     typedef OCStackResult (*GetPlatformInfo)(const std::string &, const std::string &,
             OCConnectivityType, OC::FindPlatformCallback);
 
-    invokeocplatform(static_cast<GetPlatformInfo>(OC::OCPlatform::getPlatformInfo), "",
-                     uri.str(), CT_DEFAULT, platformCallback);
+    invokeocplatform(static_cast<GetPlatformInfo>(OC::OCPlatform::getPlatformInfo), host.c_str(),
+                     "/oic/p", CT_DEFAULT, platformCallback);
 }
 
 void SimulatorManager::setPlatformInfo(PlatformInfo &platformInfo)