NMDeviceWifiP2P: libnm Reference Manual

## NMDeviceWifiP2P NMDeviceWifiP2P |

## Functions

const char * | nm_device_wifi_p2p_get_hw_address ()
NMWifiP2PPeer * | nm_device_wifi_p2p_get_peer_by_path ()
const GPtrArray * | nm_device_wifi_p2p_get_peers ()
void | nm_device_wifi_p2p_start_find ()
gboolean | nm_device_wifi_p2p_start_find_finish ()
void | nm_device_wifi_p2p_stop_find ()
gboolean | nm_device_wifi_p2p_stop_find_finish ()

## Properties

GPtrArray * | peers | Read

## Signals

void | peer-added | Run First
void | peer-removed | Run First

## Types and Values

#define | NM_DEVICE_WIFI_P2P_HW_ADDRESS
#define | NM_DEVICE_WIFI_P2P_PEERS
#define | NM_DEVICE_WIFI_P2P_WFDIES
| NMDeviceWifiP2P

## Object Hierarchy

        GObject
        ╰── NMObject
            ╰── NMDevice
                ╰── NMDeviceWifiP2P

## Description

## Functions

### nm_device_wifi_p2p_get_hw_address ()

    const char *
    nm_device_wifi_p2p_get_hw_address (NMDeviceWifiP2P *device);

`nm_device_wifi_p2p_get_hw_address` has been deprecated since version 1.24 and should not be used in newly-written code.

Use `nm_device_get_hw_address()` instead.

Gets the actual hardware (MAC) address of the NMDeviceWifiP2P

[skip]

#### Parameters

device | a NMDeviceWifiP2P |

#### Returns

the actual hardware address. This is the internal string used by the device, and must not be modified.

Since: 1.16

### nm_device_wifi_p2p_get_peer_by_path ()

    NMWifiP2PPeer *
    nm_device_wifi_p2p_get_peer_by_path (NMDeviceWifiP2P *device,
                                         const char *path);

Gets a NMWifiP2PPeer by path.

#### Parameters

device | a NMDeviceWifiP2P |
path | the object path of the peer |

#### Returns

the peer or `NULL` if none is found.

[transfer none]

Since: 1.42

### nm_device_wifi_p2p_get_peers ()

    const GPtrArray *
    nm_device_wifi_p2p_get_peers (NMDeviceWifiP2P *device);

Gets all the found peers of the NMDeviceWifiP2P.

#### Parameters

device | a NMDeviceWifiP2P |

#### Returns

a GPtrArray containing all the found NMWifiP2PPeers. The returned array is owned by the client and should not be modified.

[element-type NMWifiP2PPeer]

Since: 1.16

### nm_device_wifi_p2p_start_find ()

    void
    nm_device_wifi_p2p_start_find (NMDeviceWifiP2P *device,
                                   GVariant *options,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Request NM to search for Wi-Fi P2P peers on `device` . Note that the call 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()`.

#### Parameters

device | a NMDeviceWifiP2P |
options | optional options passed to StartFind. | [nullable]
cancellable | a GCancellable, or `NULL` |
callback | a GAsyncReadyCallback, or `NULL` |
user_data | user_data for `callback` |

Since: 1.16

### nm_device_wifi_p2p_start_find_finish ()

    gboolean
    nm_device_wifi_p2p_start_find_finish (NMDeviceWifiP2P *device,
                                          GAsyncResult *result,
                                          GError **error);

Finish an operation started by `nm_device_wifi_p2p_start_find()`.

#### Parameters

device | a NMDeviceWifiP2P |
result | the GAsyncResult |
error | GError return address |

#### Returns

`TRUE` if the call was successful

Since: 1.16

### nm_device_wifi_p2p_stop_find ()

    void
    nm_device_wifi_p2p_stop_find (NMDeviceWifiP2P *device,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

Request NM to stop any ongoing find operation for Wi-Fi P2P peers on `device` .

#### Parameters

device | a NMDeviceWifiP2P |
cancellable | a GCancellable, or `NULL` |
callback | a GAsyncReadyCallback, or `NULL` |
user_data | user_data for `callback` |

Since: 1.16

### nm_device_wifi_p2p_stop_find_finish ()

    gboolean
    nm_device_wifi_p2p_stop_find_finish (NMDeviceWifiP2P *device,
                                         GAsyncResult *result,
                                         GError **error);

Finish an operation started by `nm_device_wifi_p2p_stop_find()`.

#### Parameters

device | a NMDeviceWifiP2P |
result | the GAsyncResult |
error | GError return address |

#### Returns

`TRUE` if the call was successful

Since: 1.16

## Types and Values

### NM_DEVICE_WIFI_P2P_HW_ADDRESS

    #define NM_DEVICE_WIFI_P2P_HW_ADDRESS "hw-address"

### NM_DEVICE_WIFI_P2P_PEERS

    #define NM_DEVICE_WIFI_P2P_PEERS      "peers"

### NM_DEVICE_WIFI_P2P_WFDIES

    #define NM_DEVICE_WIFI_P2P_WFDIES     "wfdies"

### NMDeviceWifiP2P

    typedef struct _NMDeviceWifiP2P NMDeviceWifiP2P;

Since: 1.16

## Property Details

### The `“peers”` property

      “peers”                    GPtrArray *

List of all Wi-Fi P2P peers the device can see.

[type GPtrArray(NMWifiP2PPeer)]

Owner: NMDeviceWifiP2P

Flags: Read

Since: 1.16

## Signal Details

### The `“peer-added”` signal

    void
    user_function (NMDeviceWifiP2P *device,
                   GObject         *peer,
                   gpointer         user_data)

Notifies that a NMWifiP2PPeer is added to the Wi-Fi P2P device.

#### Parameters

device | the Wi-Fi P2P device that received the signal |
peer | the new access point |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 1.16

### The `“peer-removed”` signal

    void
    user_function (NMDeviceWifiP2P *device,
                   GObject         *peer,
                   gpointer         user_data)

Notifies that a NMWifiP2PPeer is removed from the Wi-Fi P2P device.

#### Parameters

device | the Wi-Fi P2P device that received the signal |
peer | the removed access point |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 1.16