#define TETHERING_FEATURE "http://tizen.org/feature/network.tethering"
#define WIFI_DIRECT_FEATURE "http://tizen.org/feature/network.wifi.direct"
+typedef enum {
+ NETCONFIG_SUPPORTED_FEATURE_ETHERNET = 0,
+ NETCONFIG_SUPPORTED_FEATURE_TETHERING,
+ NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT,
+ NETCONFIG_SUPPORTED_FEATURE_MAX,
+} netconfig_supported_feature_e;
+
+bool netconfig_check_feature_supported(netconfig_supported_feature_e feature);
+
gboolean netconfig_check_passphrase(const gchar *service, const char *passphrase);
GKeyFile *netconfig_keyfile_load(const char *pathname);
void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname);
gboolean __netconfig_wifi_get_sim_authdata(Wifi *wifi,
GDBusMethodInvocation *context, struct wifi_authentication_data **data);
-bool netconfig_check_feature_supported(const char *feature);
void netconfig_plugin_init();
void netconfig_plugin_deinit();
gboolean netconfig_get_headed_plugin_flag();
Name: net-config
Summary: TIZEN Network Configuration service
-Version: 1.1.120
+Version: 1.1.121
Release: 2
Group: System/Network
License: Apache-2.0
if (TIZEN_TV && emulator_is_emulated() == FALSE)
__netconfig_set_ether_macaddr();
- if (netconfig_check_feature_supported(ETHERNET_FEATURE)) {
+ if (netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_ETHERNET)) {
/* Register the callback to check the ethernet Plug-in /Plug-out Status */
check_ethernet_monitor_timer = g_timeout_add(ETH_POLLING_TIME,
__net_ethernet_cable_status_polling_callback,
static struct netconfig_headed_plugin_t *headed_plugin;
static struct netconfig_telephony_plugin_t *telephony_plugin;
+static bool is_feature_checked[NETCONFIG_SUPPORTED_FEATURE_MAX] = {0, };
+static bool feature_supported[NETCONFIG_SUPPORTED_FEATURE_MAX] = {0, };
+
gboolean netconfig_check_passphrase(const gchar *service, const char *passphrase)
{
gsize length;
gboolean netconfig_is_wifi_direct_on(void)
{
- if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
return FALSE;
int wifi_direct_state = 0;
gboolean netconfig_is_wifi_tethering_on(void)
{
- if (netconfig_check_feature_supported(TETHERING_FEATURE)) {
+ if (netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING)) {
int wifi_tethering_state = 0;
netconfig_vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &wifi_tethering_state);
gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context)
{
- if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE)) {
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT)) {
wifi_complete_launch_direct(wifi, context);
return FALSE;
}
return profile;
}
-bool netconfig_check_feature_supported(const char *feature)
-{
- bool is_supported = false;
-
- if (!system_info_get_platform_bool(feature, &is_supported)) {
- if (is_supported != TRUE)
- DBG("%s is not supported", feature);
- else
- DBG("%s is supported", feature);
- } else {
- ERR("Error - Feature getting from System Info");
- }
-
- return is_supported;
-}
-
void netconfig_plugin_init()
{
handle_headed = dlopen(HEADED_PLUGIN_FILEPATH, RTLD_NOW);
return netconfig_plugin_telephony_enabled;
}
+bool netconfig_check_feature_supported(netconfig_supported_feature_e feature)
+{
+ const char *key = NULL;
+
+ if (!is_feature_checked[feature]) {
+ switch (feature) {
+ case NETCONFIG_SUPPORTED_FEATURE_ETHERNET:
+ key = ETHERNET_FEATURE;
+ break;
+ case NETCONFIG_SUPPORTED_FEATURE_TETHERING:
+ key = TETHERING_FEATURE;
+ break;
+ case NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT:
+ key = WIFI_DIRECT_FEATURE;
+ break;
+ default:
+ ERR("Uknown feature");
+ return false;
+ }
+
+ if (system_info_get_platform_bool(key, &feature_supported[feature]) < 0) {
+ ERR("Get feature is failed");
+ return false;
+ }
+ is_feature_checked[feature] = true;
+ }
+ return feature_supported[feature];
+}
static int __netconfig_p2p_firmware_start(void)
{
- if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
return -ENODEV;
int rv = 0;
static int __netconfig_p2p_firmware_stop(void)
{
- if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
return -ENODEV;
int rv = 0;
static int __netconfig_softap_firmware_start(void)
{
- if (!netconfig_check_feature_supported(TETHERING_FEATURE))
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING))
return -ENODEV;
int rv = 0;
static int __netconfig_softap_firmware_stop(void)
{
- if (!netconfig_check_feature_supported(TETHERING_FEATURE))
+ if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING))
return -ENODEV;
int rv = 0;
#if defined WLAN_CONCURRENT_MODE
if (type == NETCONFIG_WIFI_STA)
netconfig_interface_up(WIFI_IFNAME);
- else if (netconfig_check_feature_supported(WIFI_DIRECT_FEATURE)
- && type == NETCONFIG_WIFI_P2P)
+ else if (netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT)) &&
+ type == NETCONFIG_WIFI_P2P)
netconfig_interface_up(WLAN_P2P_IFACE_NAME);
#endif
return -EALREADY;