#include "wifi-agent.h"
#include "wifi-power.h"
#include "wifi-state.h"
+#include "wifi-indicator.h"
#include "wifi-scan.h"
#include "wifi-bssid-scan.h"
#include "wifi-background-scan.h"
#define CONNMAN_SIGNAL_DEVICE_CHANGED "DeviceChanged"
#define CONNMAN_SIGNAL_DEVICE_DETECTED "DeviceDetected"
#define SIGNAL_NAME_OWNER_CHANGED "NameOwnerChanged"
+#define NETCONFIG_SIGNAL_VCONF_CHANGED "VconfChanged"
+
#define MAX_SIG_LEN 64
-#define TOTAL_CONN_SIGNALS 6
+#define TOTAL_CONN_SIGNALS 7
#define MAX_SOCKET_OPEN_RETRY 5
typedef enum {
#if defined TIZEN_DEBUG_ENABLE
static int dumpservice_subscription_id = 0;
#endif
+static int netconfig_subscription_id = 0;
typedef void (*supplicant_signal_cb)(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
if (value != NULL) {
netconfig_set_default_ipaddress(value);
- vconf_set_str(VCONFKEY_NETWORK_IP, value);
+ netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, value, TRUE);
g_variant_builder_add(builder, "{sv}", "IPv4Address",
g_variant_new_string(value));
} else if (old_ip != NULL && strlen(old_ip) > 0) {
- vconf_set_str(VCONFKEY_NETWORK_IP, "");
+ netconfig_set_vconf_str(VCONFKEY_NETWORK_IP, "",TRUE);
g_variant_builder_add(builder, "{sv}", "IPv4Address",
g_variant_new_string(""));
}
if (value != NULL) {
netconfig_set_default_ipaddress6(value);
- vconf_set_str(VCONFKEY_NETWORK_IP6, value);
+ netconfig_set_vconf_str(VCONFKEY_NETWORK_IP6, value, TRUE);
g_variant_builder_add(builder, "{sv}", "IPv6Address",
g_variant_new_string(value));
} else if (old_ip6 != NULL && strlen(old_ip6) > 0) {
- vconf_set_str(VCONFKEY_NETWORK_IP6, "");
+ netconfig_set_vconf_str(VCONFKEY_NETWORK_IP6, "", TRUE);
g_variant_builder_add(builder, "{sv}", "IPv6Address",
g_variant_new_string(""));
}
} else if (g_strcmp0(key, "Powered") == 0) {
bvalue = g_variant_get_boolean(var);
DBG("Powered [%d]", bvalue);
- wifi_state_update_power_state(svalue, bvalue);
+ if (svalue)
+ wifi_state_update_power_state(svalue, bvalue);
} else if (g_strcmp0(key, "Connected") == 0) {
bvalue = g_variant_get_boolean(var);
DBG("Connected [%d]", bvalue);
- wifi_state_set_connected(svalue, bvalue);
- if (bvalue == TRUE)
- wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_CONNECTED);
- else
- wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_POWERED);
+ if (svalue) {
+ wifi_state_set_connected(svalue, bvalue);
+ if (bvalue == TRUE)
+ wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_CONNECTED);
+ else
+ wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_POWERED);
+ }
}
}
g_variant_iter_free(iter);
struct sock_data *sd = NULL;
gchar *pf = NULL;
int idx = 0;
+ unsigned char strength = 0;
const char *interface_name = NULL;
if (path == NULL || param == NULL)
if (g_strcmp0(property, "ready") == 0 || g_strcmp0(property, "online") == 0) {
netconfig_update_default_profile();
- wifi_state_set_service_state(interface_name, NETCONFIG_WIFI_CONNECTED);
+ wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_CONNECTED);
} else if (g_strcmp0(property, "failure") == 0 ||
g_strcmp0(property, "disconnect") == 0 || g_strcmp0(property, "idle") == 0) {
if (g_strcmp0(property, "failure") == 0)
- wifi_state_set_service_state(interface_name, NETCONFIG_WIFI_FAILURE);
+ wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_FAILURE);
else
- wifi_state_set_service_state(interface_name, NETCONFIG_WIFI_IDLE);
+ wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_IDLE);
if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
g_free(property);
} else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) {
if (g_strcmp0(property, "association") == 0)
- wifi_state_set_service_state(interface_name, NETCONFIG_WIFI_ASSOCIATION);
+ wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_ASSOCIATION);
else
- wifi_state_set_service_state(interface_name, NETCONFIG_WIFI_CONFIGURATION);
+ wifi_state_set_service_state(interface_name, path, NETCONFIG_WIFI_CONFIGURATION);
if (g_strcmp0(path, netconfig_get_default_profile()) != 0) {
g_free(property);
if (netconfig_is_wifi_profile(path) || netconfig_is_ethernet_profile(path)) {
if (g_strcmp0(property, "ready") == 0) {
+ if (g_strcmp0(path, netconfig_get_default_profile()) == 0
+ && netconfig_get_default_is_internet())
+ netconfig_set_default_is_internet(FALSE);
+
for (idx = 0; idx < MAX_SOCKET_OPEN_RETRY; idx++) {
sd = start_ip_conflict_mon();
if (sd != NULL)
break;
}
} else if (g_strcmp0(property, "online") == 0) {
- // do nothing
+ if (g_strcmp0(path, netconfig_get_default_profile()) == 0)
+ netconfig_set_default_is_internet(TRUE);
} else {
stop_ip_conflict_mon();
}
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
netconfig_set_default_proxy(value);
- vconf_set_str(VCONFKEY_NETWORK_PROXY, value);
+ netconfig_set_vconf_str(VCONFKEY_NETWORK_PROXY, value, TRUE);
g_variant_builder_add(builder, "{sv}", "ProxyAddress",
g_variant_new_string(value));
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
netconfig_set_default_proxy("");
- vconf_set_str(VCONFKEY_NETWORK_PROXY, "");
+ netconfig_set_vconf_str(VCONFKEY_NETWORK_PROXY, "", TRUE);
g_variant_builder_add(builder, "{sv}", "ProxyAddress",
g_variant_new_string(""));
goto done;
__netconfig_extract_ipv6_signal_data(variant, path);
+ } else if (g_strcmp0(sigvalue, "Strength") == 0) {
+ strength = g_variant_get_byte(variant);
+
+ netconfig_wifi_indicator_update(interface_name, path, strength - 120);
} else if (g_strcmp0(sigvalue, "Error") == 0) {
g_variant_get(variant, "s", &property);
INFO("[%s] Property : %s", sigvalue, property);
|| g_strcmp0(property, "connect-failed") == 0
|| g_strcmp0(property, "login-failed") == 0
|| g_strcmp0(property, "auth-failed") == 0
+ || g_strcmp0(property, "assoc-failed") == 0
|| g_strcmp0(property, "invalid-key") == 0) {
INFO("start dump");
/* If clatd is terminated unexpectedly, reset and enable clat service. */
if (NETCONFIG_CELLULAR_ONLINE == cellular_state_get_service_state())
netconfig_clatd_reset();
+ } else if (g_strcmp0(name, SUPPLICANT_SERVICE) == 0 && *new == '\0') {
+ DBG("Supplicant destroyed: name %s, old %s, new %s", name, old, new);
+ __mark_supplicant_stopped();
}
g_free(name);
g_free(old);
return;
}
+static void _dbus_vconf_changed_cb(GDBusConnection *conn,
+ const gchar *Name, const gchar *path, const gchar *interface,
+ const gchar *sig, GVariant *param, gpointer user_data)
+{
+ gchar *key = NULL;
+ gchar *type = NULL;
+ gchar *str_val = NULL;
+ int int_val = 0;
+
+ if (param == NULL)
+ return;
+
+ g_variant_get(param, "(sssi)", &key, &type, &str_val, &int_val);
+
+ if (!key || key[0] == '\0')
+ goto done;
+
+ DBG("VconfChanged key: %s, type: %s, str_val: %s, int_val: %d",
+ key, type, str_val, int_val);
+
+ if (g_strcmp0(type, "string") == 0 && str_val)
+ vconf_set_str(key, str_val);
+ else if (g_strcmp0(type, "int") == 0)
+ vconf_set_int(key, int_val);
+ else if (g_strcmp0(type, "bool") == 0)
+ vconf_set_bool(key, int_val);
+
+done:
+ g_free(key);
+ g_free(type);
+ g_free(str_val);
+}
+
static void _scan_changed_cb(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data)
{
char *interface_name = NULL;
- interface_name = __supplicant_get_interface_name(path, interface);
+ interface_name = __supplicant_get_interface_name(path, SUPPLICANT_IFACE_INTERFACE);
if (interface_name == NULL)
return;
_supplicant_dpp_conf_obj,
};
+void register_gdbus_signal_container(void)
+{
+ GDBusConnection *connection = NULL;
+ connection = netdbus_get_connection();
+
+ if (connection == NULL) {
+ ERR("Failed to get GDbus Connection");
+ return;
+ }
+
+ netconfig_subscription_id = g_dbus_connection_signal_subscribe(
+ connection,
+ NETCONFIG_SERVICE,
+ NETCONFIG_NETWORK_INTERFACE,
+ NETCONFIG_SIGNAL_VCONF_CHANGED,
+ NETCONFIG_NETWORK_PATH,
+ NULL,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ _dbus_vconf_changed_cb,
+ NULL,
+ NULL);
+
+ INFO("Successfully register host net-config DBus signal filter");
+}
+
void register_gdbus_signal(void)
{
GDBusConnection *connection = NULL;
NULL,
NULL);
+ conn_subscription_ids[6] = g_dbus_connection_signal_subscribe(
+ connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_INTERFACE_DBUS,
+ SIGNAL_NAME_OWNER_CHANGED,
+ NULL,
+ SUPPLICANT_SERVICE,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ _dbus_name_changed_cb,
+ NULL,
+ NULL);
+
INFO("Successfully register clat DBus signal filters");
for (sig = SIG_INTERFACE_REMOVED; sig < SIG_MAX; sig++) {
netconfig_update_default();
}
+void deregister_gdbus_signal_container(void)
+{
+ GDBusConnection *connection = NULL;
+
+ connection = netdbus_get_connection();
+ if (!connection) {
+ ERR("Already de-registered. Nothing to be done");
+ return;
+ }
+
+ if (netconfig_subscription_id)
+ g_dbus_connection_signal_unsubscribe(connection,
+ netconfig_subscription_id);
+}
+
void deregister_gdbus_signal(void)
{
GDBusConnection *connection = NULL;