summaryrefslogtreecommitdiffstats
path: root/src/wifi/qwifimanager.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@theqtcompany.com>2016-01-19 14:40:23 +0100
committerGatis Paeglis <gatis.paeglis@theqtcompany.com>2016-01-25 09:13:56 +0000
commit1386f2dc628071b0e14c9d21337402101e179380 (patch)
treedba01a76d9fd4c951861abbacba99eccc7512c7e /src/wifi/qwifimanager.cpp
parentc82dd728746f3df9ededdd3beb651dd97449c6d2 (diff)
Use lastError to report relevant errors
This improves the error handling situation in the module. Change-Id: I9a67038efd3d82d7a2b87c2184cce52ad5b855e7 Task-number: QTEE-1037 Reviewed-by: Teemu Holappa <teemu.holappa@theqtcompany.com>
Diffstat (limited to 'src/wifi/qwifimanager.cpp')
-rw-r--r--src/wifi/qwifimanager.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/wifi/qwifimanager.cpp b/src/wifi/qwifimanager.cpp
index 6f733ba..0448ec7 100644
--- a/src/wifi/qwifimanager.cpp
+++ b/src/wifi/qwifimanager.cpp
@@ -110,6 +110,11 @@ void QWifiManagerPrivate::updateWifiState()
{
QProcess ps;
ps.start(QStringLiteral("ps"));
+ if (!ps.waitForStarted()) {
+ updateLastError(ps.program() + QLatin1String(": ") + ps.errorString());
+ return;
+ }
+
ps.waitForFinished();
bool supplicantRunning = ps.readAll().contains("wpa_supplicant");
if (supplicantRunning && m_wifiController->resetSupplicantSocket())
@@ -124,7 +129,7 @@ QString QWifiManagerPrivate::call(const QString &command)
QByteArray reply;
bool success = m_wifiController->supplicant()->sendCommand(command, &reply);
if (!success) {
- qCDebug(B2QT_WIFI) << "call to supplicant failed!";
+ qCDebug(B2QT_WIFI) << "call to supplicant failed";
return QString();
}
@@ -216,7 +221,7 @@ QWifiManager::QWifiManager()
if (!QWifiDevice::wifiSupported())
qCWarning(B2QT_WIFI) << "WifiManager may not work as expected on this device. Use the API provided by QtWifi "
- "library to verify if device has support for Wi-Fi before creating an instance of wifi manager!";
+ "library to verify if device has support for Wi-Fi before creating an instance of wifi manager";
d->m_wifiController = new QWifiController(this, d_ptr);
QObject::connect(d->m_wifiController, &QWifiController::backendStateChanged,
@@ -413,7 +418,7 @@ bool QWifiManager::connect(QWifiConfiguration *config)
{
Q_D(QWifiManager);
if (d->m_backendState != Running) {
- qCWarning(B2QT_WIFI) << "start wifi backend before calling connect() !";
+ qCWarning(B2QT_WIFI) << "start wifi backend before calling connect()";
return false;
}
@@ -438,7 +443,7 @@ bool QWifiManager::connect(QWifiConfiguration *config)
id = d->call(QStringLiteral("ADD_NETWORK"));
id.toInt(&ok);
if (!ok) {
- d->updateLastError(QStringLiteral("failed to add network!"));
+ d->updateLastError(QStringLiteral("failed to add network"));
return false;
}
}