NMDeviceWifi: libnm Reference Manual

## NMDeviceWifi NMDeviceWifi |

## Functions

const char * | nm_device_wifi_get_hw_address ()
const char * | nm_device_wifi_get_permanent_hw_address ()
NM80211Mode | nm_device_wifi_get_mode ()
guint32 | nm_device_wifi_get_bitrate ()
NMDeviceWifiCapabilities | nm_device_wifi_get_capabilities ()
NMAccessPoint * | nm_device_wifi_get_active_access_point ()
NMAccessPoint * | nm_device_wifi_get_access_point_by_path ()
const GPtrArray * | nm_device_wifi_get_access_points ()
gint64 | nm_device_wifi_get_last_scan ()
gboolean | nm_device_wifi_request_scan ()
gboolean | nm_device_wifi_request_scan_options ()
void | nm_device_wifi_request_scan_async ()
void | nm_device_wifi_request_scan_options_async ()
gboolean | nm_device_wifi_request_scan_finish ()

## Types and Values

#define | NM_DEVICE_WIFI_HW_ADDRESS
#define | NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS
#define | NM_DEVICE_WIFI_MODE
#define | NM_DEVICE_WIFI_BITRATE
#define | NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT
#define | NM_DEVICE_WIFI_CAPABILITIES
#define | NM_DEVICE_WIFI_ACCESS_POINTS
#define | NM_DEVICE_WIFI_LAST_SCAN

## Description

## Functions

### nm_device_wifi_get_hw_address ()

    const char *
    nm_device_wifi_get_hw_address (NMDeviceWifi *device);

`nm_device_wifi_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 NMDeviceWifi

[skip]

#### Parameters

device | a NMDeviceWifi |

#### Returns

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

### nm_device_wifi_get_permanent_hw_address ()

    const char *
    nm_device_wifi_get_permanent_hw_address
                                   (NMDeviceWifi *device);

Gets the permanent hardware (MAC) address of the NMDeviceWifi

#### Parameters

device | a NMDeviceWifi |

#### Returns

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

### nm_device_wifi_get_mode ()

    NM80211Mode
    nm_device_wifi_get_mode (NMDeviceWifi *device);

Gets the NMDeviceWifi mode.

#### Parameters

device | a NMDeviceWifi |

#### Returns

the mode

### nm_device_wifi_get_bitrate ()

    guint32
    nm_device_wifi_get_bitrate (NMDeviceWifi *device);

Gets the bit rate of the NMDeviceWifi in kbit/s.

#### Parameters

device | a NMDeviceWifi |

#### Returns

the bit rate (kbit/s)

### nm_device_wifi_get_capabilities ()

    NMDeviceWifiCapabilities
    nm_device_wifi_get_capabilities (NMDeviceWifi *device);

Gets the Wi-Fi capabilities of the NMDeviceWifi.

#### Parameters

device | a NMDeviceWifi |

#### Returns

the capabilities

### nm_device_wifi_get_active_access_point ()

    NMAccessPoint *
    nm_device_wifi_get_active_access_point
                                   (NMDeviceWifi *device);

Gets the active NMAccessPoint.

#### Parameters

device | a NMDeviceWifi |

#### Returns

the access point or `NULL` if none is active.

[transfer none]

### nm_device_wifi_get_access_point_by_path ()

    NMAccessPoint *
    nm_device_wifi_get_access_point_by_path
                                   (NMDeviceWifi *device,
                                    const char *path);

Gets a NMAccessPoint by path.

#### Parameters

device | a NMDeviceWifi |
path | the object path of the access point |

#### Returns

the access point or `NULL` if none is found.

[transfer none]

### nm_device_wifi_get_access_points ()

    const GPtrArray *
    nm_device_wifi_get_access_points (NMDeviceWifi *device);

Gets all the scanned access points of the NMDeviceWifi.

#### Parameters

device | a NMDeviceWifi |

#### Returns

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

[element-type NMAccessPoint]

### nm_device_wifi_get_last_scan ()

    gint64
    nm_device_wifi_get_last_scan (NMDeviceWifi *device);

Returns the timestamp (in CLOCK_BOOTTIME milliseconds) for the last finished network scan. A value of -1 means the device never scanned for access points.

Use `nm_utils_get_timestamp_msec()` to obtain current time value suitable for comparing to this value.

#### Parameters

device | a NMDeviceWifi |

#### Returns

the last scan time in seconds

Since: 1.12

### nm_device_wifi_request_scan ()

    gboolean
    nm_device_wifi_request_scan (NMDeviceWifi *device,
                                 GCancellable *cancellable,
                                 GError **error);

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

Use `nm_device_wifi_request_scan_async()` or GDBusConnection.

Request NM to scan for access points on `device` . Note that the function returns immediately after requesting the scan, and it may take some time after that for the scan to complete.

#### Parameters

device | a NMDeviceWifi |
cancellable | a GCancellable, or `NULL` |
error | location for a GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` on error, in which case `error` will be set.

### nm_device_wifi_request_scan_options ()

    gboolean
    nm_device_wifi_request_scan_options (NMDeviceWifi *device,
                                         GVariant *options,
                                         GCancellable *cancellable,
                                         GError **error);

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

Use `nm_device_wifi_request_scan_options_async()` or GDBusConnection.

Request NM to scan for access points on `device` . Note that the function returns immediately after requesting the scan, and it may take some time after that for the scan to complete. This is the same as `nm_device_wifi_request_scan` except it accepts `options` for the scanning. The argument is the dictionary passed to `RequestScan()` D-Bus call. Valid options inside the dictionary are: 'ssids' => array of SSIDs (saay)

#### Parameters

device | a NMDeviceWifi |
options | dictionary with options for `RequestScan()`, or `NULL` |
cancellable | a GCancellable, or `NULL` |
error | location for a GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` on error, in which case `error` will be set.

Since: 1.2

### nm_device_wifi_request_scan_async ()

    void
    nm_device_wifi_request_scan_async (NMDeviceWifi *device,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Request NM to scan for access points on `device` . Note that `callback` will be called immediately after requesting the scan, and it may take some time after that for the scan to complete.

#### Parameters

device | a NMDeviceWifi |
cancellable | a GCancellable, or `NULL` |
callback | callback to be called when the scan has been requested |
user_data | caller-specific data passed to `callback` |

### nm_device_wifi_request_scan_options_async ()

    void
    nm_device_wifi_request_scan_options_async
                                   (NMDeviceWifi *device,
                                    GVariant *options,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Request NM to scan for access points on `device` . Note that `callback` will be called immediately after requesting the scan, and it may take some time after that for the scan to complete. This is the same as `nm_device_wifi_request_scan_async` except it accepts `options` for the scanning. The argument is the dictionary passed to `RequestScan()` D-Bus call. Valid options inside the dictionary are: 'ssids' => array of SSIDs (saay)

To complete the request call `nm_device_wifi_request_scan_finish()`.

#### Parameters

device | a NMDeviceWifi |
options | dictionary with options for `RequestScan()`, or `NULL` |
cancellable | a GCancellable, or `NULL` |
callback | callback to be called when the scan has been requested |
user_data | caller-specific data passed to `callback` |

Since: 1.2

### nm_device_wifi_request_scan_finish ()

    gboolean
    nm_device_wifi_request_scan_finish (NMDeviceWifi *device,
                                        GAsyncResult *result,
                                        GError **error);

Gets the result of a call to `nm_device_wifi_request_scan_async()` and `nm_device_wifi_request_scan_options_async()`.

#### Parameters

device | a NMDeviceWifi |
result | the result passed to the GAsyncReadyCallback |
error | location for a GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` on error, in which case `error` will be set.

## Types and Values

### NM_DEVICE_WIFI_HW_ADDRESS

    #define NM_DEVICE_WIFI_HW_ADDRESS           "hw-address"

### NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS

    #define NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS "perm-hw-address"

### NM_DEVICE_WIFI_MODE

    #define NM_DEVICE_WIFI_MODE                 "mode"

### NM_DEVICE_WIFI_BITRATE

    #define NM_DEVICE_WIFI_BITRATE              "bitrate"

### NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT

    #define NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT  "active-access-point"

### NM_DEVICE_WIFI_CAPABILITIES

    #define NM_DEVICE_WIFI_CAPABILITIES         "wireless-capabilities"

### NM_DEVICE_WIFI_ACCESS_POINTS

    #define NM_DEVICE_WIFI_ACCESS_POINTS        "access-points"

### NM_DEVICE_WIFI_LAST_SCAN

    #define NM_DEVICE_WIFI_LAST_SCAN            "last-scan"