Update change log and spec for wrt-plugins-tizen_0.4.48-1
[platform/framework/web/wrt-plugins-tizen.git] / src / Systeminfo / JSDeviceCapabilitiesInfo.cpp
index 4bce852..e2117d7 100755 (executable)
@@ -31,6 +31,8 @@
 
 #define MAXBUFSIZE 256
 #define DEVICE_PROFILE "MOBILE_FULL"
+#define DUID_KEY_STRING 28
+#define DUID_BUFFER_SIZE 100
 
 namespace DeviceAPI {
 namespace Systeminfo {
@@ -682,6 +684,23 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
             }
             return convert.toJSValueRef(deviceCapabilitiesInfo->sipVoip);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DUID)) {
+            FILE *fp = NULL;
+            char duid[DUID_BUFFER_SIZE] = {0,};
+            fp = fopen("/opt/usr/etc/system_info_cache.ini", "r");
+
+            if(fp == NULL) {
+                LoggerD("fail file open.");
+                return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
+            }
+
+            while(fgets(duid, DUID_BUFFER_SIZE-1, fp)) {
+                if (strncmp(duid, "http://tizen.org/system/duid", DUID_KEY_STRING) == 0) {
+                    LoggerD("duid : " << duid);
+                    deviceCapabilitiesInfo->duid = duid;                    
+                    break;
+                }
+            }
+            fclose(fp);
             return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_ROCOGNITION)) {
             bool speechRecognition = false;