17 #include <QtCore/QObject> 18 #include <QtCore/QString> 19 #include <QtCore/QScopedPointer> 20 #include <QtCore/QSocketNotifier> 21 #include <QtCore/QHash> 29 class WpaSupplicantCommunicator;
42 TrikWiFiWorker(
const QString &interfaceFilePrefix,
const QString &daemonFile);
47 Q_INVOKABLE
void connect(
const QString &ssid);
88 void error(
const QString &message);
92 void receiveMessages();
96 struct NetworkConfiguration
106 static QHash<QString, QString> parseReply(
const QString &reply);
109 void processMessage(
const QString &message);
112 void processScanResults();
115 int addOpenNetwork(
const QString &ssid);
118 int findNetworkId(
const QString &ssid)
const;
121 void listKnownNetworks();
123 QString mInterfaceFile;
125 QScopedPointer<WpaSupplicantCommunicator> mControlInterface;
126 QScopedPointer<WpaSupplicantCommunicator> mMonitorInterface;
127 QScopedPointer<QSocketNotifier> mMonitorFileSocketNotifier;
130 QHash<QString, NetworkConfiguration> mNetworkConfiguration;
139 bool mIgnoreScanResults =
true;
142 bool mPlannedDisconnect =
false;
Q_INVOKABLE void scanRequest()
Scans for available WiFi networks.
Definition: trikWiFiWorker.cpp:123
Q_INVOKABLE void reinit()
Disposes an old connection to wpa_supplicant and creates a new one.
Definition: trikWiFiWorker.cpp:39
DisconnectReason
Enum with possible reasons of "disconnect" message.
Definition: networkStructs.h:35
void error(const QString &message)
Emitted when something goes wrong.
Contains info about current connection.
Definition: networkStructs.h:53
Q_INVOKABLE void statusRequest()
Gets conection status and connection information such as SSID and IP.
Definition: trikWiFiWorker.cpp:134
Q_INVOKABLE void dispose()
Closes the connection to wpa_supplicant.
Definition: trikWiFiWorker.cpp:70
QList< ScanResult > scanResult()
Returns a list of currently known available WiFi networks. Use scanRequest() method to refresh...
Definition: trikWiFiWorker.cpp:213
Helper template for syncing reader and writer.
Definition: synchronizedVar.h:34
void connected()
Emitted when wpa_supplicant connects to WiFi network. SSID of this network can be retrieved by status...
TrikWiFiWorker(const QString &interfaceFilePrefix, const QString &daemonFile)
Constructor.
Definition: trikWiFiWorker.cpp:26
Q_INVOKABLE void connect(const QString &ssid)
Connect to a network with given ssid.
Definition: trikWiFiWorker.cpp:80
void scanFinished()
Emitted when scanning for available networks initiated by scan() is finished and results are availabl...
Q_INVOKABLE void disconnect()
Disconnect from network if we are currently connected to one.
Definition: trikWiFiWorker.cpp:112
Status statusResult()
Returns last known connection status. To refresh, use statusRequest() method.
Definition: trikWiFiWorker.cpp:159
void disconnected(trikWiFi::DisconnectReason reason)
Emitted when wpa_supplicant disconnects from current network.
Worker object for TrikWiFi, supposed to be runned in its own thread.
Definition: trikWiFiWorker.h:32
Definition: controller.h:25
void statusReady()
Emitted when connection status requested by statusRequest() is ready and results can be obtained by s...
~TrikWiFiWorker() override
Definition: trikWiFiWorker.cpp:34