#if defined TIZEN_EXT
int g_supplicant_interface_remove_network(GSupplicantInterface *interface);
-int g_supplicant_interface_get_disconnect_reason(GSupplicantInterface *interface);
#endif
int g_supplicant_interface_set_apscan(GSupplicantInterface *interface,
unsigned int ap_scan);
GSupplicantPeerState state);
void (*peer_request) (GSupplicantPeer *peer);
void (*debug) (const char *str);
+ void (*disconnect_reasoncode)(GSupplicantInterface *interface,
+ int reasoncode);
};
typedef struct _GSupplicantCallbacks GSupplicantCallbacks;
callbacks_pointer->peer_request(peer);
}
+static void callback_disconnect_reason_code(GSupplicantInterface *interface,
+ int reason_code)
+{
+ if (!callbacks_pointer)
+ return;
+
+ if (!callbacks_pointer->disconnect_reasoncode)
+ return;
+
+ if (reason_code != 0)
+ callbacks_pointer->disconnect_reasoncode(interface,
+ reason_code);
+}
+
static void remove_group(gpointer data)
{
GSupplicantGroup *group = data;
} else if (g_strcmp0(key, "Networks") == 0) {
supplicant_dbus_array_foreach(iter, interface_network_added,
interface);
-#if defined TIZEN_EXT
} else if (g_strcmp0(key, "DisconnectReason") == 0) {
- int disconnect_reason = 0;
-
- dbus_message_iter_get_basic(iter, &disconnect_reason);
- interface->disconnect_reason = disconnect_reason;
-
- SUPPLICANT_DBG("disconnect reason (%d)",
- interface->disconnect_reason);
-
-#endif
+ int reason_code;
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) {
+ dbus_message_iter_get_basic(iter, &reason_code);
+ callback_disconnect_reason_code(interface, reason_code);
+ }
} else
SUPPLICANT_DBG("key %s type %c",
key, dbus_message_iter_get_arg_type(iter));
return network_remove(data);
}
-
-int g_supplicant_interface_get_disconnect_reason(GSupplicantInterface *interface)
-{
- int reason_code = 0;
-
- SUPPLICANT_DBG("");
-
- if (interface == NULL)
- return -EINVAL;
-
- if (system_available == FALSE)
- return -EFAULT;
-
- reason_code = interface->disconnect_reason;
-
- return reason_code;
-}
#endif
static const char *g_supplicant_rule0 = "type=signal,"
bool allow_full_scan;
#endif
int disconnect_code;
-
};
#if defined TIZEN_EXT
break;
connman_network_set_connected(network, true);
+ wifi->disconnect_code = 0;
break;
case G_SUPPLICANT_STATE_DISCONNECTED:
network, wifi))
break;
-#if defined TIZEN_EXT
- wifi->disconnect_code = g_supplicant_interface_get_disconnect_reason(wifi->interface);
- DBG("Disconnect Reason code %d", wifi->disconnect_code);
-#endif
/* See table 8-36 Reason codes in IEEE Std 802.11 */
switch (wifi->disconnect_code) {
case 1: /* Unspecified reason */
connman_debug("%s", str);
}
+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 const GSupplicantCallbacks callbacks = {
.system_ready = system_ready,
.system_killed = system_killed,
.system_power_off = system_power_off,
.network_merged = network_merged,
#endif
+ .disconnect_reasoncode = disconnect_reasoncode,
.debug = debug,
};
append_ethernet, service);
connman_dbus_dict_append_basic(dict, "DisconnectReason",
- DBUS_TYPE_INT32, &service->disconnect_reason);
+ DBUS_TYPE_UINT32, &service->disconnect_reason);
break;
#endif