capability: add device_name capability 84/162984/1
authorSooyoung Ha <yoosah.ha@samsung.com>
Wed, 29 Nov 2017 07:11:13 +0000 (16:11 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Wed, 29 Nov 2017 07:11:13 +0000 (16:11 +0900)
The device_name is the value of VCONFKEY_SETAPPL_DEVICE_NAME_STR
vconf key.

Change-Id: Ic0204387a2e9362e5d095e1191170218a291b90a
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
src/sdb.c
src/sdb.h
src/services.c

index 51f6b7e..079d9fc 100644 (file)
--- a/src/sdb.c
+++ b/src/sdb.c
@@ -1909,6 +1909,21 @@ static void init_capabilities(void) {
     }
 
 
+    // Device name
+    value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+    if(value) {
+        snprintf(g_capabilities.device_name, sizeof(g_capabilities.device_name),
+                "%s", value);
+        if (value != NULL) {
+            free(value);
+        }
+    } else {
+        snprintf(g_capabilities.device_name, sizeof(g_capabilities.device_name),
+                "%s", UNKNOWN);
+        D("fail to get the Device name:%d\n", errno);
+    }
+
+
     // Platform version
     ret = system_info_get_platform_string("http://tizen.org/feature/platform.version", &value);
     if (ret != SYSTEM_INFO_ERROR_NONE) {
index 43a3bfe..b9fe393 100644 (file)
--- a/src/sdb.h
+++ b/src/sdb.h
@@ -289,6 +289,7 @@ typedef struct platform_capabilities
     char vendor_name[CAPBUF_ITEMSIZE];          // vendor name (ex. Tizen)
     char sdk_toolpath[CAPBUF_L_ITEMSIZE];       // sdk tool path
     char can_launch[CAPBUF_L_ITEMSIZE];         // target name
+    char device_name[CAPBUF_ITEMSIZE];          // device name
 
     char platform_version[CAPBUF_ITEMSIZE];     // platform version (ex. 2.3.0)
     char product_version[CAPBUF_ITEMSIZE];      // product version (ex. 1.0)
index b8fd31a..180ce77 100644 (file)
@@ -1047,6 +1047,23 @@ static void get_capability(int fd, void *cookie) {
     offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE,
             "can_launch", g_capabilities.can_launch);
 
+    // Device name
+    char* value = NULL;
+    value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+    if(value) {
+        snprintf(g_capabilities.device_name, sizeof(g_capabilities.device_name),
+                "%s", value);
+        if (value != NULL) {
+            free(value);
+        }
+    } else {
+        snprintf(g_capabilities.device_name, sizeof(g_capabilities.device_name),
+                "%s", UNKNOWN);
+        D("fail to get the Device name:%d\n", errno);
+    }
+    offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE,
+            "device_name", g_capabilities.device_name);
+
     // Platform version
     offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE,
             "platform_version", g_capabilities.platform_version);