ADD_DEFINITIONS(-DTIZEN_WLAN_USE_P2P_INTERFACE)
ENDIF(TIZEN_WLAN_USE_P2P_INTERFACE)
-IF(TIZEN_P2P_ENABLE)
- ADD_DEFINITIONS(-DTIZEN_P2P_ENABLE)
-ENDIF(TIZEN_P2P_ENABLE)
-
-IF(TIZEN_TETHERING_ENABLE)
- ADD_DEFINITIONS(-DTIZEN_TETHERING_ENABLE)
-ENDIF(TIZEN_TETHERING_ENABLE)
-
IF(TIZEN_CAPTIVE_PORTAL)
ADD_DEFINITIONS(-DTIZEN_CAPTIVE_PORTAL)
SET(SRCS ${SRCS} src/utils/network-accessibility.c)
#endif
#include <glib.h>
+#include <stdbool.h>
#include "wifi.h"
#include "plugin.h"
#define MAX_SIZE_ERROR_BUFFER 256
+#define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet"
+#define TETHERING_FEATURE "http://tizen.org/feature/network.tethering"
+#define WIFI_DIRECT_FEATURE "http://tizen.org/feature/network.wifi.direct"
+
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.119
+Version: 1.1.120
Release: 2
Group: System/Network
License: Apache-2.0
%if 0%{?model_build_feature_wlan_concurrent_mode}
-DWLAN_CONCURRENT_MODE=1 \
%endif
-%if ! 0%{?model_build_feature_wlan_p2p_disable}
- -DTIZEN_P2P_ENABLE=1 \
-%endif
-%if ! 0%{?model_build_feature_network_tethering_disable}
- -DTIZEN_TETHERING_ENABLE=1 \
-%endif
%if 0%{?model_build_feature_wlan_wearable} == 1
-DTIZEN_WEARABLE=1 \
-DTIZEN_CAPTIVE_PORTAL=1 \
static GMainLoop *main_loop = NULL;
-#define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet"
-
/*Poll the ethernet Cable Plug-in /Plug-out status at every 1000 ms*/
#define ETH_POLLING_TIME 1000
{
int ret;
int check_ethernet_monitor_timer = 0;
- bool ethernet_feature_supported = FALSE;
umask(0077);
if (TIZEN_TV && emulator_is_emulated() == FALSE)
__netconfig_set_ether_macaddr();
- if (!system_info_get_platform_bool(ETHERNET_FEATURE, ðernet_feature_supported)) {
- if (ethernet_feature_supported == TRUE) {
- /* 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,
- &check_ethernet_monitor_timer);
- }
- } else {
- ERR("Error - Feature getting from System Info");
+ if (netconfig_check_feature_supported(ETHERNET_FEATURE)) {
+ /* 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,
+ &check_ethernet_monitor_timer);
}
netconfig_plugin_init();
gboolean netconfig_is_wifi_direct_on(void)
{
-#if defined TIZEN_P2P_ENABLE
+ if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ return FALSE;
+
int wifi_direct_state = 0;
netconfig_vconf_get_int(VCONFKEY_WIFI_DIRECT_STATE, &wifi_direct_state);
DBG("Wi-Fi direct mode %d", wifi_direct_state);
return (wifi_direct_state != 0) ? TRUE : FALSE;
-#else
- return FALSE;
-#endif
}
gboolean netconfig_is_wifi_tethering_on(void)
{
-#if defined TIZEN_TETHERING_ENABLE
- int wifi_tethering_state = 0;
-
- netconfig_vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &wifi_tethering_state);
- DBG("Wi-Ti tethering mode %d", wifi_tethering_state);
- if ((wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI)
- || (wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP)) {
- DBG("Mobile AP is on");
- return TRUE;
+ if (netconfig_check_feature_supported(TETHERING_FEATURE)) {
+ int wifi_tethering_state = 0;
+
+ netconfig_vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &wifi_tethering_state);
+ DBG("Wi-Ti tethering mode %d", wifi_tethering_state);
+ if ((wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI)
+ || (wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP)) {
+ DBG("Mobile AP is on");
+ return TRUE;
+ }
}
-#endif
+
DBG("Mobile AP is off");
return FALSE;
}
gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context)
{
-#if defined TIZEN_P2P_ENABLE
+ if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE)) {
+ wifi_complete_launch_direct(wifi, context);
+ return FALSE;
+ }
+
int ret = 0;
DBG("Launch Wi-Fi direct daemon");
wifi_complete_launch_direct(wifi, context);
return TRUE;
-#else
- wifi_complete_launch_direct(wifi, context);
- return FALSE;
-#endif
}
int execute_mdnsd_script(char* op)
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);
static int __netconfig_p2p_firmware_start(void)
{
-#if defined TIZEN_P2P_ENABLE
+ if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ return -ENODEV;
+
int rv = 0;
const char *path = WLAN_DRIVER_SCRIPT;
char *const args[] = { "/usr/bin/wlan.sh", "p2p", NULL };
DBG("Successfully loaded p2p device driver");
return 0;
-#else
- return -ENODEV;
-#endif
}
static int __netconfig_p2p_firmware_stop(void)
{
-#if defined TIZEN_P2P_ENABLE
+ if (!netconfig_check_feature_supported(WIFI_DIRECT_FEATURE))
+ return -ENODEV;
+
int rv = 0;
const char *path = WLAN_DRIVER_SCRIPT;
char *const args[] = { "/usr/bin/wlan.sh", "stop", NULL };
DBG("Successfully removed p2p device driver");
return 0;
-#else
- return -ENODEV;
-#endif
}
static int __netconfig_softap_firmware_start(void)
{
-#if defined TIZEN_TETHERING_ENABLE
+ if (!netconfig_check_feature_supported(TETHERING_FEATURE))
+ return -ENODEV;
+
int rv = 0;
const char *path = WLAN_DRIVER_SCRIPT;
char *const args[] = { "/usr/bin/wlan.sh", "softap", NULL };
DBG("Successfully loaded softap device driver");
return 0;
-#else
- return -ENODEV;
-#endif
}
static int __netconfig_softap_firmware_stop(void)
{
-#if defined TIZEN_TETHERING_ENABLE
+ if (!netconfig_check_feature_supported(TETHERING_FEATURE))
+ return -ENODEV;
+
int rv = 0;
const char *path = WLAN_DRIVER_SCRIPT;
char *const args[] = { "/usr/bin/wlan.sh", "stop", NULL };
DBG("Successfully removed softap device driver");
return 0;
-#else
- return -ENODEV;
-#endif
}
static int __netconfig_wifi_firmware_start(enum netconfig_wifi_firmware type)
#if defined WLAN_CONCURRENT_MODE
if (type == NETCONFIG_WIFI_STA)
netconfig_interface_up(WIFI_IFNAME);
-#if defined TIZEN_P2P_ENABLE
- else if (type == NETCONFIG_WIFI_P2P)
+ else if (netconfig_check_feature_supported(WIFI_DIRECT_FEATURE)
+ && type == NETCONFIG_WIFI_P2P)
netconfig_interface_up(WLAN_P2P_IFACE_NAME);
#endif
-#endif
return -EALREADY;
}