D-Bus: Add WPS pbc-overlap Event

This sends an Event D-Bus signal with name "pbc-overlap" for
WPS-EVENT-OVERLAP.

Signed-off-by: Avichal Agarwal <avichal.a@samsung.com>
master
Avichal Agarwal 9 years ago committed by Jouni Malinen
parent 4f369652da
commit 1a2f7ca1b8

@ -905,10 +905,11 @@ Interface for performing WPS (Wi-Fi Simple Config) operations.
<h4>Arguments</h4>
<dl>
<dt>s : event</dt>
<dd>Event type. Possible values are: "success, "fail" and "m2d"</dd>
<dd>Event type. Possible values are: "success, "fail", "m2d", and
"pbc-overlap".</dd>
<dt>a{sv} : args</dt>
<dd>
Event arguments. Empty for success event, one entry ( "msg" : i ) for fail event and following entries for m2d event:
Event arguments. Empty for success and pbc-voerlap events, one entry ( "msg" : i ) for fail event and following entries for m2d event:
<table>
<tr><th>config_methods</th><th>Value type</th>
<tr><td>manufacturer</td><td>q</td>

@ -524,6 +524,44 @@ void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_WPS
/**
* wpas_dbus_signal_wps_event_pbc_overlap - Signals PBC overlap WPS event
* @wpa_s: %wpa_supplicant network interface data
*
* Sends Event dbus signal with name "pbc-overlap" and empty dict as arguments
*/
void wpas_dbus_signal_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
{
DBusMessage *msg;
DBusMessageIter iter, dict_iter;
struct wpas_dbus_priv *iface;
char *key = "pbc-overlap";
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
if (iface == NULL || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_WPS, "Event");
if (msg == NULL)
return;
dbus_message_iter_init_append(msg, &iter);
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key) ||
!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
!wpa_dbus_dict_close_write(&iter, &dict_iter))
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
else
dbus_connection_send(iface->con, msg, NULL);
dbus_message_unref(msg);
}
/**
* wpas_dbus_signal_wps_event_success - Signals Success WPS event
* @wpa_s: %wpa_supplicant network interface data

@ -152,6 +152,7 @@ void wpas_dbus_signal_wps_event_m2d(struct wpa_supplicant *wpa_s,
void wpas_dbus_signal_wps_event_fail(struct wpa_supplicant *wpa_s,
struct wps_event_fail *fail);
void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s);
void wpas_dbus_signal_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s);
int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
int wpas_dbus_unregister_network(struct wpa_supplicant *wpa_s, int nid);
@ -297,6 +298,11 @@ static inline void wpas_dbus_signal_wps_event_success(
{
}
static inline void wpas_dbus_signal_wps_event_pbc_overlap(
struct wpa_supplicant *wpa_s)
{
}
static inline int wpas_dbus_register_network(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)
{

@ -1179,6 +1179,7 @@ int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
"PBC session overlap");
wpas_notify_wps_event_pbc_overlap(wpa_s);
#ifdef CONFIG_P2P
if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT ||
wpa_s->p2p_in_provisioning) {

@ -268,6 +268,16 @@ void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
#endif /* CONFIG_WPS */
}
void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
{
if (wpa_s->p2p_mgmt)
return;
#ifdef CONFIG_WPS
wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
#endif /* CONFIG_WPS */
}
void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)

@ -45,6 +45,7 @@ void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
struct wps_event_fail *fail);
void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s);
void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s);
void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,

Loading…
Cancel
Save