trikRuntime
trikWiFi.h
Go to the documentation of this file.
1 /* Copyright 2013 Roman Kurbatov, Yurii Litvinov
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/QObject>
18 #include <QtCore/QThread>
19 #include <QtCore/QScopedPointer>
20 
21 #include "networkStructs.h"
22 
23 #include "declSpec.h"
24 
25 namespace trikWiFi {
26 
27 class TrikWiFiWorker;
28 
31 class TRIKWIFI_EXPORT TrikWiFi : public QObject
32 {
33  Q_OBJECT
34 
35 public:
42  TrikWiFi(const QString &interfaceFilePrefix, const QString &daemonFile, QObject *parent = nullptr);
43 
45  ~TrikWiFi() override;
46 
48  void connect(const QString &ssid);
49 
51  void disconnect();
52 
55  void statusRequest();
56 
58  Status statusResult() const;
59 
62  void scanRequest();
63 
65  QList<ScanResult> scanResult() const;
66 
68  void reinit();
69 
71  void dispose();
72 
74  SignalStrength signalStrength();
75 
76 signals:
79  void scanFinished();
80 
82  void connected();
83 
85  void disconnected(trikWiFi::DisconnectReason reason);
86 
89  void statusReady();
90 
92  void error(const QString &message);
93 
94 private:
96  QScopedPointer<TrikWiFiWorker> mWorker;
97 
99  QThread mWorkerThread;
100 };
101 
102 }
#define TRIKWIFI_EXPORT
Definition: declSpec.h:23
DisconnectReason
Enum with possible reasons of "disconnect" message.
Definition: networkStructs.h:35
Contains info about current connection.
Definition: networkStructs.h:53
Class for WiFi management.
Definition: trikWiFi.h:31
Definition: controller.h:25
SignalStrength
Definition: networkStructs.h:44