1 #ifndef QTWIFI_H 2 #define QTWIFI_H 3 4 #include <QDebug> 5 #include <QInputDialog> 6 #include <QLabel> 7 #include <QListWidget> 8 #include <QProcess> 9 #include <QThread> 10 #include <QTimer> 11 12 extern "C" { 13 #include "Rk_wifi.h" 14 #include "Rk_softap.h" 15 } 16 17 class qtWifi : public QListWidget 18 { 19 Q_OBJECT 20 21 public: 22 qtWifi(QWidget *parent = nullptr, QLabel *label = nullptr, QPushButton *btn = nullptr, bool on = false); 23 ~qtWifi(); 24 25 static qtWifi* getInstance(QWidget *parent, QLabel *label, QPushButton *btn, bool on = false) 26 { 27 if (!_instance) { 28 _instance = new qtWifi(parent, label, btn, on); 29 } 30 return _instance; 31 } 32 getInstance(void)33 static qtWifi* getInstance(void) 34 { 35 return _instance; 36 } 37 38 bool isOn(); 39 void turnOn(); 40 void turnOff(); 41 private: 42 static int wifi_callback(RK_WIFI_RUNNING_State_e state, 43 RK_WIFI_INFO_Connection_s *info); 44 static qtWifi* _instance; 45 QLabel *text; 46 QPushButton *switchBtn; 47 QTimer *Timer; 48 QString ssid; 49 50 public slots: 51 void on_btnClicked(); 52 void on_itemClicked(QListWidgetItem *item); 53 void on_timer_timeout(); 54 }; 55 56 #endif /* QTWIFI_H */ 57