Merge branch 'master' into windows-port
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / linux / SimpleClientServer / ocserver.cpp
index a51c118..13cf61b 100644 (file)
@@ -84,6 +84,8 @@ const char *platformVersion = "myPlatformVersion";
 const char *supportUrl = "mySupportUrl";
 const char *version = "myVersion";
 const char *systemTime = "2015-05-15T11.04";
+const char *specVersion = "myDeviceSpecVersion";
+const char* dataModleVersion = "myDeviceModleVersion";
 
 // Entity handler should check for resourceTypeName and ResourceInterface in order to GET
 // the existence of a known resource
@@ -823,6 +825,8 @@ void DeletePlatformInfo()
 void DeleteDeviceInfo()
 {
     free (deviceInfo.deviceName);
+    free (deviceInfo.specVersion);
+    free (deviceInfo.dataModleVersion);
 }
 
 bool DuplicateString(char** targetString, const char* sourceString)
@@ -926,12 +930,20 @@ OCStackResult SetPlatformInfo(const char* platformID, const char *manufacturerNa
     return OC_STACK_ERROR;
 }
 
-OCStackResult SetDeviceInfo(const char* deviceName)
+OCStackResult SetDeviceInfo(const char* deviceName, const char* specVersion, const char* dataModleVersion)
 {
     if(!DuplicateString(&deviceInfo.deviceName, deviceName))
     {
         return OC_STACK_ERROR;
     }
+    if(!DuplicateString(&deviceInfo.specVersion, specVersion))
+    {
+        return OC_STACK_ERROR;
+    }
+    if(!DuplicateString(&deviceInfo.dataModleVersion, dataModleVersion))
+    {
+        return OC_STACK_ERROR;
+    }
     return OC_STACK_OK;
 }
 
@@ -1052,7 +1064,7 @@ int main(int argc, char* argv[])
         exit (EXIT_FAILURE);
     }
 
-    registrationResult = SetDeviceInfo(deviceName);
+    registrationResult = SetDeviceInfo(deviceName, specVersion, dataModleVersion);
 
     if (registrationResult != OC_STACK_OK)
     {