IF(TIZEN_WEARABLE)
ADD_DEFINITIONS(-DTIZEN_WEARABLE)
- SET(WEARABLE_REQUIRED_PKGS "weconn")
ENDIF(TIZEN_WEARABLE)
IF(TIZEN_TELEPHONY_ENABLE)
#define MAX_SIZE_ERROR_BUFFER 256
-#if defined TIZEN_WEARABLE
-typedef enum {
- WC_POPUP_TYPE_SESSION_OVERLAPPED,
- WC_POPUP_TYPE_WIFI_CONNECTED,
- WC_POPUP_TYPE_CAPTIVE_PORTAL,
- WC_POPUP_TYPE_WIFI_RESTRICT
-}netconfig_wcpopup_type_e;
-#endif
-
GKeyFile *netconfig_keyfile_load(const char *pathname);
void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname);
int netconfig_send_restriction_to_net_popup(const char *title,
const char *type, const char *restriction);
void netconfig_set_system_event(const char * sys_evt, const char * evt_key, const char * evt_val);
-#if defined TIZEN_WEARABLE
-int wc_launch_syspopup(netconfig_wcpopup_type_e type);
-int wc_launch_popup(netconfig_wcpopup_type_e type);
-#endif
void netconfig_set_vconf_int(const char * key, int value);
void netconfig_set_vconf_str(const char * key, const char * value);
int netconfig_vconf_get_int(const char * key, int *value);
Name: net-config
Summary: TIZEN Network Configuration service
-Version: 1.1.76
+Version: 1.1.77
Release: 2
Group: System/Network
License: Apache-2.0
-DTIZEN_TETHERING_ENABLE=1 \
%endif
%if "%{profile}" == "mobile"
- -DTIZEN_TELEPHONY_ENABLE=1 \
+ -DTIZEN_TELEPHONY_ENABLE=1 \
-DTIZEN_WLAN_BOARD_SPRD=1 \
%else
%if "%{profile}" == "tv"
{
DBG("Driver session overlapped handling!");
ERR("WPS PBC SESSION OVERLAPPED");
-#if defined TIZEN_WEARABLE
- wc_launch_syspopup(WC_POPUP_TYPE_SESSION_OVERLAPPED);
+#if defined TIZEN_WEARABLE
+ return;
#else
netconfig_send_message_to_net_popup("WPS Error",
"wps session overlapped", "popup", NULL);
*
*/
-#if defined TIZEN_WEARABLE
-#include <aul.h>
-#endif
#include <app.h>
#include <errno.h>
#include <vconf.h>
#include "neterror.h"
#include "wifi-state.h"
-#define WC_POPUP_EXTRA_DATA_KEY "http://tizen.org/appcontrol/data/connection_type"
#define MAC_INFO_FILEPATH tzplatform_mkpath(TZ_SYS_ETC, "/.mac.info")
#define MAC_ADDRESS_MAX_LEN 18
else
return;
-#if defined TIZEN_WEARABLE
- if (aul_app_is_running("org.tizen.wifi") > 0) {
- DBG("wifi app is running");
- return;
- }
-#else
int wifi_ug_state;
netconfig_vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &wifi_ug_state);
if (wifi_ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND)
return;
-#endif
DBG("Register device picker timer with %d milliseconds", NETCONFIG_WIFI_DEVICE_PICKER_INTERVAL);
netconfig_start_timer(NETCONFIG_WIFI_DEVICE_PICKER_INTERVAL, __netconfig_wifi_try_device_picker, NULL, &timer_id);
bundle_free(b);
}
-#if defined TIZEN_WEARABLE
-int wc_launch_syspopup(netconfig_wcpopup_type_e type)
-{
- int ret;
- bundle* b;
- char *ssid = NULL;
-
- b = bundle_create();
- if (!b) {
- ERR("Failed to create bundle");
- return -1;
- }
-
- switch (type) {
- case WC_POPUP_TYPE_SESSION_OVERLAPPED:
- bundle_add(b, "event-type", "wps-session-overlapped");
- break;
- case WC_POPUP_TYPE_WIFI_CONNECTED:
- ssid = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME);
- if (ssid == NULL) {
- ERR("Failed to get connected ap ssid");
- ssid = g_strdup(" ");
- }
- bundle_add(b, "event-type", "wifi-connected");
- bundle_add(b, "ssid", ssid);
- if (ssid)
- g_free(ssid);
- break;
- case WC_POPUP_TYPE_WIFI_RESTRICT:
- bundle_add(b, "event-type", "wifi-restrict");
- break;
- default:
- ERR("Popup is not supported[%d]", type);
- bundle_free(b);
- return -1;
- }
-
- ret = syspopup_launch("wc-syspopup", b);
- if (ret < 0)
- ERR("Failed to launch syspopup");
-
- bundle_free(b);
- return ret;
-}
-
-int wc_launch_popup(netconfig_wcpopup_type_e type)
-{
- int ret;
- app_control_h app_control = NULL;
-
- ret = app_control_create(&app_control);
- if (ret != APP_CONTROL_ERROR_NONE) {
- ERR("Failed to create appcontrol[%d]", ret);
- return -1;
- }
-
- switch (type) {
- case WC_POPUP_TYPE_CAPTIVE_PORTAL:
- app_control_add_extra_data(app_control, WC_POPUP_EXTRA_DATA_KEY, "captive-portal");
- break;
- default:
- ERR("Popup is not supported[%d]", type);
- app_control_destroy(app_control);
- return -1;
- }
-
- app_control_set_app_id(app_control, "com.samsung.weconn-popup");
- ret = app_control_send_launch_request(app_control, NULL, NULL);
- if (ret != APP_CONTROL_ERROR_NONE) {
- DBG("failed appcontrol launch request [%d]", ret);
- app_control_destroy(app_control);
- return -1;
- }
-
- app_control_destroy(app_control);
-
- return 0;
-}
-#endif
-
void netconfig_set_vconf_int(const char * key, int value)
{
int ret = 0;
#if defined TIZEN_WEARABLE
static gboolean is_portal_msg_shown = FALSE;
-static guint portal_msg_timer = 0;
#endif
struct poll_timer_data {
return FALSE;
}
-#if defined TIZEN_WEARABLE
-static gboolean __netconfig_display_portal_msg(gpointer data)
-{
- DBG("");
- wc_launch_popup(WC_POPUP_TYPE_CAPTIVE_PORTAL);
-
- netconfig_stop_timer(&portal_msg_timer);
-
- return FALSE;
-}
-#endif
-
static void __netconfig_wifi_portal_login_timer_start(struct poll_timer_data
*data)
{
is_monitor_notifier_registered = TRUE;
}
-#if defined TIZEN_WEARABLE
- if (is_portal_msg_shown) {
- net_connman_agent_complete_request_browser(connman_agent, context);
- return TRUE;
- }
-
- is_portal_msg_shown = TRUE;
- netconfig_start_timer_seconds(4, __netconfig_display_portal_msg, NULL, &portal_msg_timer);
-#else
ret = netconfig_send_notification_to_net_popup(NETCONFIG_ADD_PORTAL_NOTI, ssid);
-#endif
timer_data.time_elapsed = 0;
__netconfig_wifi_portal_login_timer_start(&timer_data);
#define WLAN_SUPPLICANT_SCRIPT "/usr/sbin/wpa_supp.sh"
#define P2P_SUPPLICANT_SCRIPT "/usr/sbin/p2p_supp.sh"
-#if defined TIZEN_WEARABLE
-#include <weconn.h>
-static weconn_h weconn_handle = NULL;
-#endif
-
#define VCONF_WIFI_OFF_STATE_BY_AIRPLANE "file/private/wifi/wifi_off_by_airplane"
#define VCONF_WIFI_OFF_STATE_BY_RESTRICTED "file/private/wifi/wifi_off_by_restricted"
#define VCONF_WIFI_OFF_STATE_BY_EMERGENCY "file/private/wifi/wifi_off_by_emergency"
int err = 0;
int wifi_use;
int ps_mode;
- enum netconfig_wifi_tech_state wifi_tech_state;
- weconn_service_state_e weconn_state;
-
- wifi_tech_state = wifi_state_get_technology_state();
- if (wifi_tech_state >= NETCONFIG_WIFI_TECH_POWERED)
- return -EALREADY;
-
- err = weconn_get_service_state(weconn_handle, W_SERVICE_TYPE_BT,
- &weconn_state);
- if (err == 0 && weconn_state == W_SERVICE_STATE_CONNECTED) {
- WARN("Not permitted Wi-Fi on");
- return -EPERM;
- }
if (netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use) < 0) {
ERR("Fail to get VCONF_WIFI_WEARABLE_WIFI_USE");
return err;
}
-static void __weconn_service_state_changed_cb(weconn_service_state_e state, void *user_data)
-{
- if (state == W_SERVICE_STATE_CONNECTED) {
- DBG("SAP is connected");
- if (wifi_state > VCONFKEY_WIFI_OFF)
- wifi_power_off();
- } else if (state == W_SERVICE_STATE_DISCONNECTED) {
- DBG("SAP is disconnected");
- wifi_power_on_wearable(FALSE);
- }
-}
-
-static int _weconn_set_state_changed_cb(int service_type, void *user_data)
-{
- int ret;
-
- if (weconn_handle) {
- weconn_destroy(weconn_handle);
- weconn_handle = NULL;
- }
-
- ret = weconn_create(&weconn_handle);
- if (ret < 0) {
- ERR("Failed weconn_create(%d)", ret);
- return -1;
- }
-
- ret = weconn_set_service_state_change_cb(weconn_handle, __weconn_service_state_changed_cb, service_type, user_data);
- if (ret < 0) {
- ERR("Failed weconn_set_service_state_change_cb(%d)", ret);
- return -1;
- }
-
- return 0;
-}
-
static void __wearable_wifi_use_changed_cb(keynode_t* node, void* user_data)
{
int wifi_state;
int wifi_use = 1;
- gboolean wifi_restrict = FALSE;
if (netconfig_vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state) < 0) {
ERR("Fail to get VCONFKEY_WIFI_STATE");
WARN("Wi-Fi is already turned on");
return;
}
-
- wifi_restrict = netconfig_is_wifi_allowed();
- if (wifi_restrict == FALSE) {
- DBG("launch wifi restrict popup");
- netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 0);
- wc_launch_syspopup(WC_POPUP_TYPE_WIFI_RESTRICT);
- } else {
- wifi_power_on_wearable(TRUE);
- }
+ wifi_power_on_wearable(TRUE);
} else {
ERR("## wifi use [OFF]");
if (wifi_state == VCONFKEY_WIFI_OFF) {
int err = 0;
int wifi_use = 1;
wifi_tech_state_e tech_state;
- weconn_service_state_e weconn_state;
tech_state = wifi_state_get_technology_state();
if (tech_state >= NETCONFIG_WIFI_TECH_POWERED)
return -EALREADY;
- err = weconn_get_service_state(weconn_handle, W_SERVICE_TYPE_BT, &weconn_state);
- if (err == 0 && weconn_state == W_SERVICE_STATE_CONNECTED) {
- WARN("Not permitted Wi-Fi on");
- return -EPERM;
- }
-
if (netconfig_vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use) < 0) {
ERR("Fail to get VCONF_WIFI_WEARABLE_WIFI_USE");
return -EIO;
}
#if defined TIZEN_WEARABLE
- _weconn_set_state_changed_cb(W_SERVICE_TYPE_BT, NULL);
vconf_notify_key_changed(VCONF_WIFI_WEARABLE_WIFI_USE, __wearable_wifi_use_changed_cb, NULL);
#if defined TIZEN_TELEPHONY_ENABLE
if (new_state == NETCONFIG_WIFI_CONNECTED) {
_wifi_state_connected_activation();
-#if defined TIZEN_WEARABLE
- wc_launch_syspopup(WC_POPUP_TYPE_WIFI_CONNECTED);
-#endif
}
}
void wifi_state_set_connected_essid(void)
{
__set_wifi_connected_essid();
-#if defined TIZEN_WEARABLE
- wc_launch_syspopup(WC_POPUP_TYPE_WIFI_CONNECTED);
-#endif
}
void wifi_state_get_connected_essid(gchar **essid)