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 |
|
Get the current wifi
state.
- |
bSSs |
|
The list of known Basic Service Sets. |
link |
|
Link quality of the current connection as a percentage (rM1 only). |
rssi |
|
Link quality of the current connection in dBm. |
network |
|
Currently connected
network.
Will return |
networks |
|
List of known Networks. |
scanning |
|
If the device is currently scanning for networks. |
stateChanged |
signal
|
Signal sent when the wifi state changes. |
linkChanged |
signal
|
Signal sent when the wifi link quality changes. |
networkAdded |
signal
|
Signal sent when a Network is added. |
networkRemoved |
signal
|
Signal sent when a Network is removed. |
networkConnected |
signal
|
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)
|
Signal sent when a BSS is found. |
bssRemoved |
signal
|
Signal sent when a BSS expires from the cache. |
scanningChanged |
signal
|
Signal sent when scanning state changes. |
enable |
method
|
Enable wifi. Will return if it was successful or not. |
disable |
method |
Disable wifi. |
addNetwork |
method
|
Add a Network that can be connected to. |
getNetwork |
method
|
Get a Network that matches all the supplied properties. |
getBSS |
method
|
Get a BSS that matches all the supplied properties. |
scan |
method
|
Scan for networks.
If the first argument
is |
reconnect |
method |
Reconnect to a known Network. |
reassosiate |
method |
Reassosiate with the currently connected Network. |
disconnect |
method |
Disconnect from the current Network. |
flushBSSCache |
method
|
Flush all BSS items
from the cache older
than a certain age.
If age is |
addBlob |
method
|
Add a blob to the wireless interface. |
removeBlob |
method
|
Remove a blob from the wireless interface. |
getBlob |
method
|
Get a blob from the wireless interface. |
Example Usage#
#include <liboxide/dbus.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 |
|
Basic Service Set Identifier |
ssid |
|
Service Set Identifier |
privacy |
|
Indicates if the BSS supports privacy |
frequency |
|
Frequency n MHz |
network |
|
Network for this BSS.
|
key_mgmt |
|
Key management suite. |
removed |
signal |
Signal sent when the BSS is removed from the cache. |
propertiesChanged |
signal - (out) - (out) `` ARRAY{STRING VALUE}`` |
Signal sent when properties change on the BSS. |
connect |
method
- (out)
- (out)
|
Attempt to connect to
a BSS.
Returns the
|
Network#
Name |
Specification |
Description |
---|---|---|
enabled |
|
If this network is enabled or not. If it’s not enable wpa_supplicant will not try to connect to it. |
ssid |
|
Service Set Identifier |
bSSs |
|
Basic Service Sets for this Network. |
password |
|
Password used to connect to this Network. |
protocol |
|
Protocol used to
communicate with this
network.
- |
properties |
|
Properties of the configured network. Dictionary contains entries from “network” block of wpa_supplicant configuration file. |
stateChanged |
signal
|
Signal sent when the enabled property changes. |
propertiesChanged |
signal
|
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. |