fix for only one network scanned and for closing wifi logger

This commit is contained in:
Szybet 2022-08-28 17:58:22 +02:00
parent 4bb87485e0
commit f21857fad9
3 changed files with 22 additions and 17 deletions

View file

@ -252,6 +252,8 @@ void wifiDialog::refreshNetworksList() {
QVector<global::wifi::wifiNetworkData> sortedPureNetworkList; QVector<global::wifi::wifiNetworkData> sortedPureNetworkList;
sortedPureNetworkList.append(pureNetworkList.first()); sortedPureNetworkList.append(pureNetworkList.first());
pureNetworkList.removeFirst(); pureNetworkList.removeFirst();
// Possible fix for a segment fault
if(pureNetworkList.isEmpty() == false) {
for(global::wifi::wifiNetworkData wifiNetwork: pureNetworkList) { for(global::wifi::wifiNetworkData wifiNetwork: pureNetworkList) {
bool stopIterating = false; bool stopIterating = false;
int counter = 0; int counter = 0;
@ -269,6 +271,7 @@ void wifiDialog::refreshNetworksList() {
sortedPureNetworkList.append(wifiNetwork); sortedPureNetworkList.append(wifiNetwork);
} }
} }
}
log("There are " + QString::number(sortedPureNetworkList.count()) + " sorted networks", className); log("There are " + QString::number(sortedPureNetworkList.count()) + " sorted networks", className);
for(global::wifi::wifiNetworkData wifiNetwork: sortedPureNetworkList) { for(global::wifi::wifiNetworkData wifiNetwork: sortedPureNetworkList) {
@ -438,7 +441,8 @@ void wifiDialog::watcher() {
bool time = checkProcessName("smarter_time_sync.sh"); bool time = checkProcessName("smarter_time_sync.sh");
if(time == true) { if(time == true) {
forceRefresh = true; forceRefresh = true;
setStatusText("Syncing"); // Please leave it as "Syncting time" because many people will complain about innacurate time. This info will answer them
setStatusText("Syncing time");
QTimer::singleShot(relaunchMs, this, SLOT(watcher())); QTimer::singleShot(relaunchMs, this, SLOT(watcher()));
return void(); return void();
} }

View file

@ -64,7 +64,7 @@ wifilogger::~wifilogger()
void wifilogger::setWifiInfoPage() { void wifilogger::setWifiInfoPage() {
if(checkWifiState() == global::wifi::wifiState::configured) { if(checkWifiState() == global::wifi::wifiState::configured) {
QTimer::singleShot(0, this, SLOT(getWifiInformation())); getWifiInformationTimer.singleShot(0, this, SLOT(getWifiInformation()));
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
ui->nameLabel->setText("Network information"); ui->nameLabel->setText("Network information");
} }
@ -128,7 +128,6 @@ void wifilogger::getWifiInformation() {
QFile wifiInformationPath = QFile("/external_root/run/wifi_information"); QFile wifiInformationPath = QFile("/external_root/run/wifi_information");
if(waitingForFile == false) { if(waitingForFile == false) {
wifiInformationPath.remove(); wifiInformationPath.remove();
log("Sending get_wifi_information ibxd call", className); log("Sending get_wifi_information ibxd call", className);
string_writeconfig("/opt/ibxd", "get_wifi_information\n"); string_writeconfig("/opt/ibxd", "get_wifi_information\n");
waitingForFile = true; waitingForFile = true;
@ -136,7 +135,7 @@ void wifilogger::getWifiInformation() {
if(waitingForFile == true) { if(waitingForFile == true) {
if(wifiInformationPath.exists() == false) { if(wifiInformationPath.exists() == false) {
QTimer::singleShot(1000, this, SLOT(getWifiInformation())); getWifiInformationTimer.singleShot(1000, this, SLOT(getWifiInformation()));
return void(); return void();
} }
} }
@ -179,6 +178,7 @@ void wifilogger::getWifiInformation() {
void wifilogger::on_returnBtn_clicked() void wifilogger::on_returnBtn_clicked()
{ {
log("Exiting wifilogger", className); log("Exiting wifilogger", className);
getWifiInformationTimer.stop();
this->deleteLater(); this->deleteLater();
this->close(); this->close();
} }

View file

@ -31,6 +31,7 @@ private:
QFile fancyLogs = QFile("/external_root/run/wifi_stats"); QFile fancyLogs = QFile("/external_root/run/wifi_stats");
QFile allLogs = QFile("/external_root/var/log/wifi.log"); QFile allLogs = QFile("/external_root/var/log/wifi.log");
bool waitingForFile = false; bool waitingForFile = false;
QTimer getWifiInformationTimer;
private slots: private slots:
void setWifiInfoPage(); void setWifiInfoPage();