Commit 6e45cd90 authored by Thomas Haller's avatar Thomas Haller

libnm/device-p2p-wifi: drop API that still needs consideration

Having synchronous API is wrong, or at least questionable.
Granted, libnm isn't currently very good about the exact order
of things to happen. However synchronous API by design delays events
while waiting for the response and hence messes up the ordering.

Maybe synchronous API should not be added to libnm.

Or at least, if we have synchronous API, we certainly need an asynchrnous
variant as well (which is still missing).

As synchronous API is not preferred, it should also be named
nm_some_thing_sync(), accompanied by nm_some_thing() and
nm_some_thing_finish(). The name for the synchronous method should be the
odd one and we shouldn't have an nm_some_thing_async(). Yes, libnm is not
consistend about that.

I am going to drop this API for the moment.
parent 65c4af50
......@@ -1454,8 +1454,6 @@ global:
nm_device_p2p_wifi_get_hw_address;
nm_device_p2p_wifi_get_peers;
nm_device_p2p_wifi_get_type;
nm_device_p2p_wifi_start_find;
nm_device_p2p_wifi_stop_find;
nm_p2p_peer_connection_valid;
nm_p2p_peer_filter_connections;
nm_p2p_peer_get_flags;
......
......@@ -237,76 +237,6 @@ nm_device_p2p_wifi_get_wfdies_as_variant (const NMDeviceP2PWifi *self)
return g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0);
}
/**
* nm_device_p2p_wifi_start_find:
* @device: a #NMDeviceP2PWifi
* @cancellable: a #GCancellable, or %NULL
* @error: location for a #GError, or %NULL
*
* Request NM to search for P2P peers on @device. Note that the function
* returns immediately after requesting the find, and it may take some time
* after that for peers to be found.
*
* The find operation will run for 30s by default. You can stop it earlier
* using nm_device_p2p_wifi_stop_find().
*
* Returns: %TRUE on success, %FALSE on error, in which case @error will be
* set.
*
* Since: 1.16
**/
gboolean
nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device,
GCancellable *cancellable,
GError **error)
{
NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device);
GVariant *options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0);
gboolean ret;
g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE);
ret = nmdbus_device_p2p_wifi_call_start_find_sync (priv->proxy,
options,
cancellable, error);
if (error && *error)
g_dbus_error_strip_remote_error (*error);
return ret;
}
/**
* nm_device_p2p_wifi_stop_find:
* @device: a #NMDeviceP2PWifi
* @cancellable: a #GCancellable, or %NULL
* @error: location for a #GError, or %NULL
*
* Request NM to stop searching for P2P peers on @device.
*
* Returns: %TRUE on success, %FALSE on error, in which case @error will be
* set.
*
* Since: 1.16
**/
gboolean
nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device,
GCancellable *cancellable,
GError **error)
{
NMDeviceP2PWifiPrivate *priv = NM_DEVICE_P2P_WIFI_GET_PRIVATE (device);
gboolean ret;
g_return_val_if_fail (NM_IS_DEVICE_P2P_WIFI (device), FALSE);
ret = nmdbus_device_p2p_wifi_call_stop_find_sync (priv->proxy,
cancellable, error);
if (error && *error)
g_dbus_error_strip_remote_error (*error);
return ret;
}
/*****************************************************************************/
static void
......
......@@ -58,16 +58,6 @@ NMP2PPeer * nm_device_p2p_wifi_get_peer_by_path (NMDeviceP2PWifi *d
NM_AVAILABLE_IN_1_16
const GPtrArray * nm_device_p2p_wifi_get_peers (NMDeviceP2PWifi *device);
NM_AVAILABLE_IN_1_16
gboolean nm_device_p2p_wifi_start_find (NMDeviceP2PWifi *device,
GCancellable *cancellable,
GError **error);
NM_AVAILABLE_IN_1_16
gboolean nm_device_p2p_wifi_stop_find (NMDeviceP2PWifi *device,
GCancellable *cancellable,
GError **error);
G_END_DECLS
#endif /* __NM_DEVICE_P2P_WIFI_H__ */
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