From 0b3816146d279795b3d05b1e827b0e8de5f3a67f Mon Sep 17 00:00:00 2001 From: Nam KwanWoo Date: Mon, 8 Apr 2013 20:51:53 +0900 Subject: [PATCH] add new key SYSTEM_INFO_KEY_TETHERING_SUPPORTED Change-Id: I37051c0b6645af12aefd5bb6740373d4a4deb8c5 --- include/system_info.h | 1 + include/system_info_private.h | 1 + packaging/capi-system-info.spec | 2 +- src/system_info.c | 6 ++++++ src/system_info_device.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/include/system_info.h b/include/system_info.h index 9def527..0a37d3a 100644 --- a/include/system_info.h +++ b/include/system_info.h @@ -99,6 +99,7 @@ typedef enum { SYSTEM_INFO_KEY_SMS_SUPPORTED, /**< Indicates whether the device supports SMS */ SYSTEM_INFO_KEY_CBS_SUPPORTED, /**< Indicates whether the device supports CBS */ SYSTEM_INFO_KEY_NFC_RESERVED_PUSH_SUPPORTED, /**< Indicates whether the device supports nfc-reserved push */ + SYSTEM_INFO_KEY_TETHERING_SUPPORTED, /**< Indicates whether the device supports tethering */ } system_info_key_e; /** diff --git a/include/system_info_private.h b/include/system_info_private.h index 57f5d11..4180dbd 100644 --- a/include/system_info_private.h +++ b/include/system_info_private.h @@ -115,6 +115,7 @@ int system_info_get_build_time(system_info_key_e key, system_info_data_type_e da int system_info_get_mms_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_sms_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_cbs_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); +int system_info_get_tethering_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_nfc_reserved_push_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_value_from_xml(char *xml_file_path, char *model, char *id_field, char **value); diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec index 22d4f66..e9848dc 100644 --- a/packaging/capi-system-info.spec +++ b/packaging/capi-system-info.spec @@ -1,7 +1,7 @@ #sbs-git:slp/api/system-info capi-system-info 0.1.0 63d15bafa590ee9de869c8a8ade712e06828e5c3 Name: capi-system-info Summary: A System Information library in SLP C API -Version: 0.1.10 +Version: 0.1.11 Release: 0 Group: System/Libraries License: Apache License, Version 2.0 and IEFT RFC Collection diff --git a/src/system_info.c b/src/system_info.c index bbf7973..c06264b 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -430,6 +430,12 @@ system_info_s system_info_table[] = { system_info_get_nfc_reserved_push_supported }, +{ + /**< Indicates whether the device supports tethering */ + SYSTEM_INFO_KEY_TETHERING_SUPPORTED, + SYSTEM_INFO_DATA_TYPE_BOOL, + system_info_get_tethering_supported +}, { SYSTEM_INFO_MAX, -1, NULL diff --git a/src/system_info_device.c b/src/system_info_device.c index d866851..a916ab1 100644 --- a/src/system_info_device.c +++ b/src/system_info_device.c @@ -88,6 +88,7 @@ #define CAM_VIDEO_SEC_FILE_PATH "/usr/etc/mmfw_camcorder_dev_video_sec.ini" #define NFC_INFO_FILE_PATH "/etc/config/nfc/sysinfo-nfc-ug.xml" +#define TETHERING_INFO_FILE_PATH "/etc/config/connectivity/sysinfo-tethering.xml" static char *FRONT_CAM_PATH; static char *BACK_CAM_PATH; @@ -1001,6 +1002,34 @@ int system_info_get_cp_interface(system_info_key_e key, system_info_data_type_e return SYSTEM_INFO_ERROR_NONE; } +int system_info_get_tethering_supported(system_info_key_e key, system_info_data_type_e data_type, void **value) +{ + bool *supported; + char *string = NULL; + char *model = "default"; + + supported = (bool *)value; + + if (access(TETHERING_INFO_FILE_PATH, R_OK)) { + *supported = false; + return SYSTEM_INFO_ERROR_NONE; + } + + if (system_info_get_value_from_xml(TETHERING_INFO_FILE_PATH, model, "tethering-support", &string)) { + LOGE("cannot get tethering-support info from %s!!!", TETHERING_INFO_FILE_PATH); + return SYSTEM_INFO_ERROR_IO_ERROR; + } + + if (!strcmp(string, "true") || !strcmp(string, "TRUE")) + *supported = true; + else + *supported = false; + + free(string); + + return SYSTEM_INFO_ERROR_NONE; +} + int system_info_get_nfc_reserved_push_supported(system_info_key_e key, system_info_data_type_e data_type, void **value) { bool *supported; -- 2.7.4