Merge branch 'windows-port'
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / linux / SimpleClientServer / ocserver.cpp
index 13cf61b..970565a 100644 (file)
@@ -34,6 +34,7 @@
 #include <pthread.h>
 #endif
 #include <array>
+#include "oic_malloc.h"
 #include <getopt.h>
 #include "ocstack.h"
 #include "logger.h"
@@ -85,7 +86,7 @@ const char *supportUrl = "mySupportUrl";
 const char *version = "myVersion";
 const char *systemTime = "2015-05-15T11.04";
 const char *specVersion = "myDeviceSpecVersion";
-const char* dataModleVersion = "myDeviceModleVersion";
+const char *dataModelVersions = "myDeviceModelVersions";
 
 // Entity handler should check for resourceTypeName and ResourceInterface in order to GET
 // the existence of a known resource
@@ -826,7 +827,7 @@ void DeleteDeviceInfo()
 {
     free (deviceInfo.deviceName);
     free (deviceInfo.specVersion);
-    free (deviceInfo.dataModleVersion);
+    OCFreeOCStringLL (deviceInfo.dataModelVersions);
 }
 
 bool DuplicateString(char** targetString, const char* sourceString)
@@ -930,7 +931,7 @@ OCStackResult SetPlatformInfo(const char* platformID, const char *manufacturerNa
     return OC_STACK_ERROR;
 }
 
-OCStackResult SetDeviceInfo(const char* deviceName, const char* specVersion, const char* dataModleVersion)
+OCStackResult SetDeviceInfo(const char* deviceName, const char* specVersion, const char* dataModelVersions)
 {
     if(!DuplicateString(&deviceInfo.deviceName, deviceName))
     {
@@ -940,7 +941,9 @@ OCStackResult SetDeviceInfo(const char* deviceName, const char* specVersion, con
     {
         return OC_STACK_ERROR;
     }
-    if(!DuplicateString(&deviceInfo.dataModleVersion, dataModleVersion))
+    OCFreeOCStringLL(deviceInfo.dataModelVersions);
+    deviceInfo.dataModelVersions = OCCreateOCStringLL(dataModelVersions);
+    if (!deviceInfo.dataModelVersions)
     {
         return OC_STACK_ERROR;
     }
@@ -1064,7 +1067,7 @@ int main(int argc, char* argv[])
         exit (EXIT_FAILURE);
     }
 
-    registrationResult = SetDeviceInfo(deviceName, specVersion, dataModleVersion);
+    registrationResult = SetDeviceInfo(deviceName, specVersion, dataModelVersions);
 
     if (registrationResult != OC_STACK_OK)
     {