Added handling of "AssocStatusCode" signal 52/157852/5
authorManeesh Jain <maneesh.jain@samsung.com>
Thu, 26 Oct 2017 11:57:35 +0000 (17:27 +0530)
committerManeesh Jain <maneesh.jain@samsung.com>
Fri, 3 Nov 2017 10:18:34 +0000 (10:18 +0000)
Description : This can be used by application in case AP is denying association with status code

Change-Id: I195492be4320032b460b708034f044eec03b71dd
Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
gsupplicant/gsupplicant.h
gsupplicant/supplicant.c
plugins/wifi.c
src/network.c
src/service.c

index f115c5e..a33dab0 100755 (executable)
@@ -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;
index f3f2b40..b1232a5 100755 (executable)
@@ -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));
index b7e37a1..116fa60 100755 (executable)
@@ -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,
 };
 
index 546479c..08b1319 100755 (executable)
@@ -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,
index 0c9c897..468a327 100755 (executable)
@@ -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);