Wifi API#

This API interacts with the wpa_supplicant D-Bus API. You can find more context here: https://w1.fi/wpa_supplicant/devel/dbus.html

Name

Specification

Description

state

INT32 property (read)

Get the current wifi state. - 0 Unknown - 1 Off - 2 Disconnected - 3 Offline - 4 Online

bSSs

ARRAY OBJECT_PATH property (read)

The list of known Basic Service Sets.

link

INT32 property (read)

Link quality of the current connection as a percentage (rM1 only).

rssi

INT32 property (read)

Link quality of the current connection in dBm.

network

OBJECT_PATH property (read)

Currently connected network. Will return / if no network is connected.

networks

ARRAY OBJECT_PATH property (read)

List of known Networks.

scanning

BOOLEAN property (read)

If the device is currently scanning for networks.

stateChanged

signal - (out) INT32

Signal sent when the wifi state changes.

linkChanged

signal - (out) INT32

Signal sent when the wifi link quality changes.

networkAdded

signal - (out) OBJECT_PATH

Signal sent when a Network is added.

networkRemoved

signal - (out) OBJECT_PATH

Signal sent when a Network is removed.

networkConnected

signal - (out) OBJECT_PATH

Signal sent when a Network has been connected to.

disconnected

signal

Signal sent when the device is disconnected from the current network.

bssFound

signal - (out) OBJECT_PATH

Signal sent when a BSS is found.

bssRemoved

signal - (out) OBJECT_PATH

Signal sent when a BSS expires from the cache.

scanningChanged

signal - (out) BOOLEAN

Signal sent when scanning state changes.

enable

method - (out) BOOLEAN

Enable wifi. Will return if it was successful or not.

disable

method

Disable wifi.

addNetwork

method - (in) ssid STRING - (in) properties A RRAY{STRING VARIANT} - (out) OBJECT_PATH

Add a Network that can be connected to.

getNetwork

method - (in) properties A RRAY{STRING VARIANT} - (out) OBJECT_PATH

Get a Network that matches all the supplied properties.

getBSS

method - (in) properties A RRAY{STRING VARIANT} - (out) OBJECT_PATH

Get a BSS that matches all the supplied properties.

scan

method - (in) active BOOLEAN

Scan for networks. If the first argument is true, this will be an active scan. The first argument defaults to false.

reconnect

method

Reconnect to a known Network.

reassosiate

method

Reassosiate with the currently connected Network.

disconnect

method

Disconnect from the current Network.

flushBSSCache

method - (in) age UINT32

Flush all BSS items from the cache older than a certain age. If age is 0, all BSS items will be removed.

addBlob

method - (in) name STRING - (in) blob ARRAY BYTE

Add a blob to the wireless interface.

removeBlob

method - (in) name STRING

Remove a blob from the wireless interface.

getBlob

method - (in) name STRING - (out) ARRAY BYTE

Get a blob from the wireless interface.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "wifiapi_interface.h"

using namespace codes::eeems::oxide1;

int main(int argc, char* argv[]){
    QCoreApplication app(argc, argv);

    auto bus = QDBusConnection::systemBus();
    General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
    qDebug() << "Requesting wifi API...";
    QDBusObjectPath path = api.requestAPI("wifi");
    if(path.path() == "/"){
        qDebug() << "Unable to get wifi API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the wifi API!";

    Wifi wifi(OXIDE_SERVICE, path.path(), bus);
    qDebug() << "Monitoring wifi state";
    QObject::connect(&wifi, &Wifi::stateChanged, [](int state){
        qDebug() << state;
    });
    return app.exec();
}
#!/bin/bash
echo "Monitoring wifi state"
rot wifi listen state

BSS#

Name

Specification

Description

bssid

STRING property (read)

Basic Service Set Identifier

ssid

STRING property (read)

Service Set Identifier

privacy

BOOLEAN property (read)

Indicates if the BSS supports privacy

frequency

UINT16 property (read)

Frequency n MHz

network

OBJECT_PATH property (read)

Network for this BSS. / if there is no Network.

key_mgmt

ARRAY STRING property (read)

Key management suite.

removed

signal

Signal sent when the BSS is removed from the cache.

propertiesChanged

signal - (out) `` ARRAY{STRING VALUE}``

Signal sent when properties change on the BSS.

connect

method - (out) OBJECT_PATH

Attempt to connect to a BSS. Returns the OBJECT_PATH for the network. If none exists a new network will be created, assuming a blank password.

Network#

Name

Specification

Description

enabled

BOOLEAN property (read/write)

If this network is enabled or not. If it’s not enable wpa_supplicant will not try to connect to it.

ssid

STRING property (read)

Service Set Identifier

bSSs

ARRAY OBJECT_PATH property (read)

Basic Service Sets for this Network.

password

STRING property (read/write)

Password used to connect to this Network.

protocol

STRING property (read/write)

Protocol used to communicate with this network. - psk - eap - sae

properties

AR RAY{STRING VARIANT} property (read)/write

Properties of the configured network. Dictionary contains entries from “network” block of wpa_supplicant configuration file.

stateChanged

signal - (out) BOOLEAN

Signal sent when the enabled property changes.

propertiesChanged

signal - (out) AR RAY{STRING VARIANT}

Signal sent when the properties of the Network change.

connected

signal

Signal sent when the device connects to the Network.

disconnected

signal

Signal sent when the device disconnects to the Network.

removed

signal

Signal sent when the Network is removed.

connect

method

Attempt to connect to the Network.

remove

method

Remove the Network.