Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Change-Id: I49a447949b66e536744382881a946af6d007d904
CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01,
} connection_cellular_subscriber_id_e;
CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01,
} connection_cellular_subscriber_id_e;
+typedef enum
+{
+ CONNECTION_SUPPORTED_FEATURE_TELEPHONY,
+ CONNECTION_SUPPORTED_FEATURE_WIFI,
+ CONNECTION_SUPPORTED_FEATURE_TETHERING_BLUETOOTH,
+ CONNECTION_SUPPORTED_FEATURE_ETHERNET,
+ CONNECTION_SUPPORTED_FEATURE_MAX,
+} connection_supported_feature_e;
+
+#if !defined TIZEN_TV
#define CHECK_FEATURE_SUPPORTED(...) \
do { \
int rv = _connection_check_feature_supported(__VA_ARGS__, NULL); \
if( rv != CONNECTION_ERROR_NONE ) \
return rv; \
} while(0)
#define CHECK_FEATURE_SUPPORTED(...) \
do { \
int rv = _connection_check_feature_supported(__VA_ARGS__, NULL); \
if( rv != CONNECTION_ERROR_NONE ) \
return rv; \
} while(0)
+#else
+#define CHECK_FEATURE_SUPPORTED(...)
+#endif
#define CONNECTION_LOG(log_level, format, args...) \
do { \
#define CONNECTION_LOG(log_level, format, args...) \
do { \
static __thread struct _profile_list_s profile_iterator = {0, 0, NULL};
static __thread struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
static __thread GSList *managed_idler_list = NULL;
static __thread struct _profile_list_s profile_iterator = {0, 0, NULL};
static __thread struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
static __thread GSList *managed_idler_list = NULL;
+static __thread bool connection_is_feature_checked[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
+static __thread bool connection_feature_supported[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
bool _connection_is_created(void)
{
bool _connection_is_created(void)
{
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_NONE;
}
+bool __libnet_check_feature_supported(const char *key, connection_supported_feature_e feature)
+{
+ if(!connection_is_feature_checked[feature]) {
+ if(system_info_get_platform_bool(key, &connection_feature_supported[feature]) < 0) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature getting from System Info");
+ set_last_result(CONNECTION_ERROR_OPERATION_FAILED);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+ connection_is_feature_checked[feature] = true;
+ }
+ return connection_feature_supported[feature];
+}
+
int _connection_check_feature_supported(const char *feature_name, ...)
{
va_list list;
const char *key;
int _connection_check_feature_supported(const char *feature_name, ...)
{
va_list list;
const char *key;
- bool value, feature_supported = false;
+ bool value = false;
+ bool feature_supported = false;
va_start(list, feature_name);
key = feature_name;
while(1) {
va_start(list, feature_name);
key = feature_name;
while(1) {
- if(system_info_get_platform_bool(key, &value) < 0) {
- CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature getting from System Info");
- set_last_result(CONNECTION_ERROR_OPERATION_FAILED);
- return CONNECTION_ERROR_OPERATION_FAILED;
+ if((strcmp(key, TELEPHONY_FEATURE) == 0)){
+ value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_TELEPHONY);
+ }
+ if((strcmp(key, WIFI_FEATURE) == 0)){
+ value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_WIFI);
+ if((strcmp(key, TETHERING_BLUETOOTH_FEATURE) == 0)){
+ value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_TETHERING_BLUETOOTH);
+ }
+ if((strcmp(key, ETHERNET_FEATURE) == 0)){
+ value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_ETHERNET);
+ }
+
SECURE_CONNECTION_LOG(CONNECTION_INFO, "%s feature is %s", key, (value?"true":"false"));
feature_supported |= value;
key = va_arg(list, const char *);
SECURE_CONNECTION_LOG(CONNECTION_INFO, "%s feature is %s", key, (value?"true":"false"));
feature_supported |= value;
key = va_arg(list, const char *);