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;
sortedPureNetworkList.append(pureNetworkList.first());
pureNetworkList.removeFirst();
// Possible fix for a segment fault
if(pureNetworkList.isEmpty() == false) {
for(global::wifi::wifiNetworkData wifiNetwork: pureNetworkList) {
bool stopIterating = false;
int counter = 0;
@ -269,6 +271,7 @@ void wifiDialog::refreshNetworksList() {
sortedPureNetworkList.append(wifiNetwork);
}
}
}
log("There are " + QString::number(sortedPureNetworkList.count()) + " sorted networks", className);
for(global::wifi::wifiNetworkData wifiNetwork: sortedPureNetworkList) {
@ -438,7 +441,8 @@ void wifiDialog::watcher() {
bool time = checkProcessName("smarter_time_sync.sh");
if(time == 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()));
return void();
}

View file

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

View file

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