diff options
-rwxr-xr-x | gsupplicant/gsupplicant.h | 2 | ||||
-rwxr-xr-x | gsupplicant/supplicant.c | 19 | ||||
-rwxr-xr-x | plugins/wifi.c | 23 | ||||
-rwxr-xr-x | src/network.c | 21 | ||||
-rwxr-xr-x | src/service.c | 4 |
5 files changed, 68 insertions, 1 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index f115c5e5..a33dab0f 100755 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -410,6 +410,8 @@ struct _GSupplicantCallbacks { void (*debug) (const char *str); void (*disconnect_reasoncode)(GSupplicantInterface *interface, int reasoncode); + void (*assoc_status_code)(GSupplicantInterface *interface, + int reasoncode); }; typedef struct _GSupplicantCallbacks GSupplicantCallbacks; diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index f3f2b403..b1232a5d 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -577,6 +577,19 @@ static void callback_disconnect_reason_code(GSupplicantInterface *interface, reason_code); } +static void callback_assoc_status_code(GSupplicantInterface *interface, + int status_code) +{ + if (!callbacks_pointer) + return; + + if (!callbacks_pointer->assoc_status_code) + return; + + callbacks_pointer->assoc_status_code(interface, status_code); + +} + static void remove_group(gpointer data) { GSupplicantGroup *group = data; @@ -2359,6 +2372,12 @@ static void interface_property(const char *key, DBusMessageIter *iter, dbus_message_iter_get_basic(iter, &reason_code); callback_disconnect_reason_code(interface, reason_code); } + } else if (g_strcmp0(key, "AssocStatusCode") == 0) { + int status_code; + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) { + dbus_message_iter_get_basic(iter, &status_code); + callback_assoc_status_code(interface, status_code); + } } else SUPPLICANT_DBG("key %s type %c", key, dbus_message_iter_get_arg_type(iter)); diff --git a/plugins/wifi.c b/plugins/wifi.c index b7e37a1b..116fa600 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -71,6 +71,7 @@ #define P2P_LISTEN_PERIOD 500 #define P2P_LISTEN_INTERVAL 2000 + static struct connman_technology *wifi_technology = NULL; static struct connman_technology *p2p_technology = NULL; @@ -134,6 +135,7 @@ struct wifi_data { bool allow_full_scan; #endif int disconnect_code; + int assoc_code; }; #if defined TIZEN_EXT @@ -2785,6 +2787,7 @@ static void interface_state(GSupplicantInterface *interface) connman_network_set_connected(network, true); wifi->disconnect_code = 0; + wifi->assoc_code = 0; break; case G_SUPPLICANT_STATE_DISCONNECTED: @@ -3577,12 +3580,29 @@ static void disconnect_reasoncode(GSupplicantInterface *interface, int reasoncode) { struct wifi_data *wifi = g_supplicant_interface_get_data(interface); - if (wifi != NULL) { wifi->disconnect_code = reasoncode; } } +static void assoc_status_code(GSupplicantInterface *interface, int status_code) +{ + struct wifi_data *wifi = g_supplicant_interface_get_data(interface); + +#if defined TIZEN_EXT + struct connman_network *network; +#endif + + if (wifi != NULL) { + wifi->assoc_code = status_code; + +#if defined TIZEN_EXT + network = wifi->network; + connman_network_set_assoc_status_code(network,status_code); +#endif + + } +} static const GSupplicantCallbacks callbacks = { .system_ready = system_ready, @@ -3607,6 +3627,7 @@ static const GSupplicantCallbacks callbacks = { .network_merged = network_merged, #endif .disconnect_reasoncode = disconnect_reasoncode, + .assoc_status_code = assoc_status_code, .debug = debug, }; diff --git a/src/network.c b/src/network.c index 546479c2..08b1319a 100755 --- a/src/network.c +++ b/src/network.c @@ -101,6 +101,7 @@ struct connman_network { char *keymgmt_type; bool rsn_mode; int disconnect_reason; + int assoc_status_code; void *wifi_vsie; unsigned int wifi_vsie_len; #endif @@ -2092,6 +2093,26 @@ int connman_network_get_disconnect_reason(struct connman_network *network) return network->wifi.disconnect_reason; } + +int connman_network_set_assoc_status_code(struct connman_network *network, + int assoc_status_code) +{ + + if (network == NULL) + return 0; + + network->wifi.assoc_status_code = assoc_status_code; + return 0; +} + +int connman_network_get_assoc_status_code(struct connman_network *network) +{ + if (network == NULL) + return 0; + + return network->wifi.assoc_status_code; +} + #endif int connman_network_set_nameservers(struct connman_network *network, diff --git a/src/service.c b/src/service.c index 0c9c8977..468a327b 100755 --- a/src/service.c +++ b/src/service.c @@ -160,6 +160,7 @@ struct connman_service { */ char *keymgmt_type; int disconnect_reason; + int assoc_status_code; #endif #ifdef TIZEN_EXT enum connman_dnsconfig_method dns_config_method_ipv4; @@ -7172,6 +7173,9 @@ static int service_indicate_state(struct connman_service *service) case CONNMAN_SERVICE_STATE_FAILURE: #if defined TIZEN_EXT + + service->assoc_status_code = connman_network_get_assoc_status_code(service->network); + if (service->type == CONNMAN_SERVICE_TYPE_WIFI) service->order = 5; __connman_service_auto_connect(CONNMAN_SERVICE_CONNECT_REASON_AUTO); |