From: Sooyoung Ha Date: Wed, 29 Nov 2017 07:11:13 +0000 (+0900) Subject: capability: add device_name capability X-Git-Tag: submit/tizen/20171207.085311~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a1e3202ff61949f61eb6de69ddc53f5126f6f03;p=sdk%2Ftarget%2Fsdbd.git capability: add device_name capability The device_name is the value of VCONFKEY_SETAPPL_DEVICE_NAME_STR vconf key. Change-Id: Ic0204387a2e9362e5d095e1191170218a291b90a Signed-off-by: Sooyoung Ha --- diff --git a/src/sdb.c b/src/sdb.c index 51f6b7e..079d9fc 100644 --- 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) { diff --git a/src/sdb.h b/src/sdb.h index 43a3bfe..b9fe393 100644 --- 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) diff --git a/src/services.c b/src/services.c index b8fd31a..180ce77 100644 --- a/src/services.c +++ b/src/services.c @@ -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);