Commit d8bc41bb authored by Benjamin Berg's avatar Benjamin Berg Committed by Thomas Haller
Browse files

libnm: Expose the P2PPeer WfdIEs property

parent 6b74d006
......@@ -1468,6 +1468,7 @@ global:
nm_p2p_peer_get_serial;
nm_p2p_peer_get_strength;
nm_p2p_peer_get_type;
nm_p2p_peer_get_wfd_ies;
nm_setting_p2p_wireless_get_peer;
nm_setting_p2p_wireless_get_type;
nm_setting_p2p_wireless_get_wps_method;
......
......@@ -45,6 +45,8 @@ typedef struct {
char *model_number;
char *serial;
GBytes *wfd_ies;
char *hw_address;
guint8 strength;
......@@ -59,7 +61,7 @@ enum {
PROP_MODEL,
PROP_MODEL_NUMBER,
PROP_SERIAL,
PROP_WFDIES,
PROP_WFD_IES,
PROP_HW_ADDRESS,
PROP_STRENGTH,
PROP_LAST_SEEN,
......@@ -175,6 +177,30 @@ nm_p2p_peer_get_serial (NMP2PPeer *peer)
return NM_P2P_PEER_GET_PRIVATE (peer)->serial;
}
/**
* nm_p2p_peer_get_wfd_ies:
* @peer: a #NMP2PPeer
*
* Gets the WFD information elements of the P2P peer.
*
* Returns: (transfer none): the #GBytes containing the WFD IEs, or %NULL.
*
* Since: 1.16
**/
GBytes *
nm_p2p_peer_get_wfd_ies (NMP2PPeer *peer)
{
NMP2PPeerPrivate *priv;
g_return_val_if_fail (NM_IS_P2P_PEER (peer), NULL);
priv = NM_P2P_PEER_GET_PRIVATE (peer);
if (!priv->wfd_ies || g_bytes_get_size (priv->wfd_ies) == 0)
return NULL;
return priv->wfd_ies;
}
/**
* nm_p2p_peer_get_hw_address:
* @peer: a #NMP2PPeer
......@@ -345,6 +371,9 @@ get_property (GObject *object,
case PROP_SERIAL:
g_value_set_string (value, nm_p2p_peer_get_serial (peer));
break;
case PROP_WFD_IES:
g_value_set_boxed (value, nm_p2p_peer_get_wfd_ies (peer));
break;
case PROP_HW_ADDRESS:
g_value_set_string (value, nm_p2p_peer_get_hw_address (peer));
break;
......@@ -377,6 +406,9 @@ finalize (GObject *object)
g_free (priv->model_number);
g_free (priv->serial);
if (priv->wfd_ies)
g_bytes_unref (priv->wfd_ies);
G_OBJECT_CLASS (nm_p2p_peer_parent_class)->finalize (object);
}
......@@ -391,6 +423,7 @@ init_dbus (NMObject *object)
{ NM_P2P_PEER_MODEL, &priv->model },
{ NM_P2P_PEER_MODEL_NUMBER, &priv->model_number },
{ NM_P2P_PEER_SERIAL, &priv->serial },
{ NM_P2P_PEER_WFD_IES, &priv->wfd_ies },
{ NM_P2P_PEER_HW_ADDRESS, &priv->hw_address },
{ NM_P2P_PEER_STRENGTH, &priv->strength },
{ NM_P2P_PEER_LAST_SEEN, &priv->last_seen },
......@@ -505,6 +538,19 @@ nm_p2p_peer_class_init (NMP2PPeerClass *peer_class)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMP2PPeer:wfd-ies:
*
* The WFD information elements of the P2P peer.
*
* Since: 1.16
**/
g_object_class_install_property
(object_class, PROP_WFD_IES,
g_param_spec_boxed (NM_P2P_PEER_WFD_IES, "", "",
G_TYPE_BYTES,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMP2PPeer:hw-address:
*
......
......@@ -42,7 +42,7 @@ G_BEGIN_DECLS
#define NM_P2P_PEER_MODEL "model"
#define NM_P2P_PEER_MODEL_NUMBER "model-number"
#define NM_P2P_PEER_SERIAL "serial"
#define NM_P2P_PEER_WFDIES "WFDIEs"
#define NM_P2P_PEER_WFD_IES "wfd-ies"
#define NM_P2P_PEER_HW_ADDRESS "hw-address"
#define NM_P2P_PEER_STRENGTH "strength"
#define NM_P2P_PEER_LAST_SEEN "last-seen"
......@@ -80,6 +80,9 @@ const char * nm_p2p_peer_get_model_number (NMP2PPeer *peer);
NM_AVAILABLE_IN_1_16
const char * nm_p2p_peer_get_serial (NMP2PPeer *peer);
NM_AVAILABLE_IN_1_16
GBytes * nm_p2p_peer_get_wfd_ies (NMP2PPeer *peer);
NM_AVAILABLE_IN_1_16
const char * nm_p2p_peer_get_hw_address (NMP2PPeer *peer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment