Re: [PATCHv3] Dbus: Created New event DeviceFoundProperties to provide peer properties of Discovered peers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-06-20 at 10:18 +0530, Nishant Chaprana wrote:
> This event will be sending peer properties to applications for
> Discovered peers.
> Signature of this event will be "oa{sv}".
> This event is required because current event DeviceFound provides
> only peer object path.
> If there are many peers in range then there will be many DeviceFound
> event and
> for each DeviceFOund applicaions would be required to GetAll peer
> properties
> many time will be creating extra load over applicaiton as well as
> over wpa_supplicant.
> So it will be better to send peer properties in a event using which
> applications
> can extract found peer information.

LGTM now, thanks.

Dan

> The issue will not be over CTRL interface because P2P-DEVICE-FOUND
> event sends peer info in it.
> But over Dbus interface DeviceFound provides only peer object.
> 
> Signed-off-by: Nishant Chaprana <n.chaprana@xxxxxxxxxxx>
> ---
>  doc/dbus.doxygen               | 13 +++++++++++++
>  wpa_supplicant/dbus/dbus_new.c | 25 ++++++++++++++++++++-----
>  2 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
> index 28ee371..b95b814 100644
> --- a/doc/dbus.doxygen
> +++ b/doc/dbus.doxygen
> @@ -1630,6 +1630,19 @@ Interface for performing P2P (Wi-Fi Peer-to-
> Peer) P2P Device operations.
>    <li>
>      <h3>DeviceFound ( o : path )</h3>
>    </li>
> +  <li>
> +    <h3>DeviceFoundProperties ( o : path, a{sv} : properties )</h3>
> +    <p>A new peer device has been found.</p>
> +    <h4>Arguments</h4>
> +    <dl>
> +      <dt>o : path</dt>
> +      <dd>A D-Bus path to an object representing the found peer
> device.</dd>
> +    </dl>
> +    <dl>
> +      <dt>a{sv} : properties</dt>
> +      <dd>A dictionary containing properties of found peer
> device.</dd>
> +    </dl>
> +  </li>
>  
>    <li>
>      <h3>DeviceLost ( o : path )</h3>
> diff --git a/wpa_supplicant/dbus/dbus_new.c
> b/wpa_supplicant/dbus/dbus_new.c
> index 0263b2c..a60492d 100644
> --- a/wpa_supplicant/dbus/dbus_new.c
> +++ b/wpa_supplicant/dbus/dbus_new.c
> @@ -3352,6 +3352,13 @@ static const struct wpa_dbus_signal_desc
> wpas_dbus_interface_signals[] = {
>  		  END_ARGS
>  	  }
>  	},
> +	{ "DeviceFoundProperties", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
> +	  {
> +		  { "path", "o", ARG_OUT },
> +		  { "properties", "a{sv}", ARG_OUT },
> +		  END_ARGS
> +	  }
> +	},
>  	{ "DeviceLost", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
>  	  {
>  		  { "path", "o", ARG_OUT },
> @@ -3800,12 +3807,13 @@ static const struct wpa_dbus_signal_desc
> wpas_dbus_p2p_peer_signals[] = {
>   *	In case of peer objects, it would be emitted by either
>   *	the "interface object" or by "peer objects"
>   * @sig_name: signal name - DeviceFound
> + * @properties: determines if add second argument with object
> properties
>   *
> - * Notify listeners about event related with newly found p2p peer
> device
> + * Notify listeners about event related with p2p peer device
>   */
>  static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
>  				  const u8 *dev_addr, const char
> *interface,
> -				  const char *sig_name)
> +				  const char *sig_name, int
> properties)
>  {
>  	struct wpas_dbus_priv *iface;
>  	DBusMessage *msg;
> @@ -3833,7 +3841,10 @@ static void wpas_dbus_signal_peer(struct
> wpa_supplicant *wpa_s,
>  	dbus_message_iter_init_append(msg, &iter);
>  	path = peer_obj_path;
>  	if (!dbus_message_iter_append_basic(&iter,
> DBUS_TYPE_OBJECT_PATH,
> -					    &path))
> +					    &path) ||
> +	    (properties && !wpa_dbus_get_object_properties(
> +		     iface, peer_obj_path,
> WPAS_DBUS_NEW_IFACE_P2P_PEER,
> +		     &iter)))
>  		wpa_printf(MSG_ERROR, "dbus: Failed to construct
> signal");
>  	else
>  		dbus_connection_send(iface->con, msg, NULL);
> @@ -3854,7 +3865,11 @@ void wpas_dbus_signal_peer_device_found(struct
> wpa_supplicant *wpa_s,
>  {
>  	wpas_dbus_signal_peer(wpa_s, dev_addr,
>  			      WPAS_DBUS_NEW_IFACE_P2PDEVICE,
> -			      "DeviceFound");
> +			      "DeviceFound", FALSE);
> +
> +	wpas_dbus_signal_peer(wpa_s, dev_addr,
> +			      WPAS_DBUS_NEW_IFACE_P2PDEVICE,
> +			      "DeviceFoundProperties", TRUE);
>  }
>  
>  /**
> @@ -3869,7 +3884,7 @@ void wpas_dbus_signal_peer_device_lost(struct
> wpa_supplicant *wpa_s,
>  {
>  	wpas_dbus_signal_peer(wpa_s, dev_addr,
>  			      WPAS_DBUS_NEW_IFACE_P2PDEVICE,
> -			      "DeviceLost");
> +			      "DeviceLost", FALSE);
>  }
>  
>  /**

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux