P2P: Add D-Bus signal GroupFormationFailure

This is similar to the control interface event
P2P-GROUP-FORMATION-FAILURE.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
This commit is contained in:
Nishant Chaprana 2015-08-20 16:28:33 +05:30 committed by Jouni Malinen
parent 926404a6b2
commit 2a95fac944
6 changed files with 73 additions and 0 deletions

View file

@ -1533,6 +1533,16 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
</dd>
</dl>
</li>
<li>
<h3>GroupFormationFailure ( s : reason )</h3>
<p></p>
<h4>Arguments</h4>
<dl>
<dt>s : reason</dt>
<dd>Reason for failure or empty string if not known.</dd>
</dl>
</li>
</ul>
\section dbus_bss fi.w1.wpa_supplicant1.BSS

View file

@ -1857,6 +1857,41 @@ void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
dbus_message_unref(msg);
}
/**
* wpas_dbus_signal_p2p_group_formation_failure - Signals GroupFormationFailure event
* @wpa_s: %wpa_supplicant network interface data
* @reason: indicates the reason code for group formation failure
*
* Sends Event dbus signal and string reason code when available.
*/
void wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
const char *reason)
{
DBusMessage *msg;
struct wpas_dbus_priv *iface;
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
if (iface == NULL)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"GroupFormationFailure");
if (msg == NULL)
return;
if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &reason,
DBUS_TYPE_INVALID))
dbus_connection_send(iface->con, msg, NULL);
else
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
dbus_message_unref(msg);
}
#endif /* CONFIG_P2P */
@ -3172,6 +3207,12 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
END_ARGS
}
},
{ "GroupFormationFailure", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
{
{ "reason", "s", ARG_OUT },
END_ARGS
}
},
{ "GONegotiationSuccess", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
{
{ "properties", "a{sv}", ARG_OUT },

View file

@ -191,6 +191,8 @@ void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
const struct wpa_ssid *ssid,
int client, int network_id);
void wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
const char *reason);
void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
@ -399,6 +401,12 @@ wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
{
}
static inline void
wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
const char *reason)
{
}
static inline void
wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)

View file

@ -657,6 +657,14 @@ void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
}
void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
const char *reason)
{
/* Notify a group formation failed */
wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
}
void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
struct wps_event_fail *fail)
{

View file

@ -114,6 +114,8 @@ void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid, int network_id,
int client);
void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
const char *reason);
void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,

View file

@ -1286,6 +1286,7 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
if (!success) {
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE);
wpas_notify_p2p_group_formation_failure(wpa_s, "");
if (already_deleted)
return;
wpas_p2p_group_delete(wpa_s,
@ -4412,6 +4413,7 @@ static void wpas_p2p_check_join_scan_limit(struct wpa_supplicant *wpa_s)
}
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE);
wpas_notify_p2p_group_formation_failure(wpa_s, "");
}
}
@ -4637,6 +4639,8 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE
"reason=FREQ_CONFLICT");
wpas_notify_p2p_group_formation_failure(
wpa_s, "FREQ_CONFLICT");
return;
}