diff options
Diffstat (limited to 'src/imports/wifi')
-rw-r--r-- | src/imports/wifi/plugins.qmltypes | 60 | ||||
-rw-r--r-- | src/imports/wifi/qmldir | 1 | ||||
-rw-r--r-- | src/imports/wifi/qwifimanager.cpp | 13 |
3 files changed, 71 insertions, 3 deletions
diff --git a/src/imports/wifi/plugins.qmltypes b/src/imports/wifi/plugins.qmltypes new file mode 100644 index 0000000..6667fcb --- /dev/null +++ b/src/imports/wifi/plugins.qmltypes @@ -0,0 +1,60 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable Qt.labs.wifi 0.1 /system/qml/Qt/labs/wifi/' + +Module { + Component { + name: "QWifiGlobal" + prototype: "QObject" + exports: ["Qt.labs.wifi/Interface 0.1"] + exportMetaObjectRevisions: [0] + Method { name: "wifiSupported"; type: "bool" } + } + Component { + name: "QWifiManager" + prototype: "QObject" + exports: ["Qt.labs.wifi/WifiManager 0.1"] + exportMetaObjectRevisions: [0] + Enum { + name: "NetworkState" + values: { + "Disconnected": 0, + "Authenticating": 1, + "HandshakeFailed": 2, + "ObtainingIPAddress": 3, + "DhcpRequestFailed": 4, + "Connected": 5 + } + } + Property { name: "networkState"; type: "NetworkState"; isReadonly: true } + Property { name: "backendReady"; type: "bool"; isReadonly: true } + Property { name: "scanning"; type: "bool" } + Property { name: "connectedSSID"; type: "string"; isReadonly: true } + Property { name: "networks"; type: "QWifiNetworkListModel"; isReadonly: true; isPointer: true } + Signal { + name: "scanningChanged" + Parameter { name: "scanning"; type: "bool" } + } + Signal { + name: "networkStateChanged" + Parameter { name: "network"; type: "QWifiNetwork"; isPointer: true } + } + Signal { + name: "connectedSSIDChanged" + Parameter { name: "ssid"; type: "string" } + } + Method { name: "start" } + Method { name: "stop" } + Method { + name: "connect" + Parameter { name: "network"; type: "QWifiNetwork"; isPointer: true } + Parameter { name: "passphrase"; type: "string" } + } + Method { name: "disconnect" } + } + Component { name: "QWifiNetworkListModel"; prototype: "QAbstractListModel" } +} diff --git a/src/imports/wifi/qmldir b/src/imports/wifi/qmldir index 4c36784..d4f65d9 100644 --- a/src/imports/wifi/qmldir +++ b/src/imports/wifi/qmldir @@ -1,2 +1,3 @@ module Qt.labs.wifi plugin qwifimodule +typeinfo plugins.qmltypes diff --git a/src/imports/wifi/qwifimanager.cpp b/src/imports/wifi/qwifimanager.cpp index 65073f1..8eec3e0 100644 --- a/src/imports/wifi/qwifimanager.cpp +++ b/src/imports/wifi/qwifimanager.cpp @@ -618,14 +618,21 @@ QByteArray QWifiManager::call(const char *command) const { char data[2048]; size_t len = sizeof(data) - 1; // -1: room to add a 0-terminator - if (q_wifi_command(m_interface.constData(), command, data, &len) < 0) { - qWarning("QWifiManager: call failed: %s", command); + QByteArray cmd; +#ifdef Q_OS_ANDROID +#if !(Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 4) + cmd.append("IFNAME=").append(m_interface).append(" "); +#endif +#endif + cmd.append(command); + if (q_wifi_command(m_interface.constData(), cmd.constData(), data, &len) < 0) { + qWarning("QWifiManager: call failed: %s", cmd.constData()); return QByteArray(); } if (len < sizeof(data)) data[len] = 0; QByteArray result = QByteArray::fromRawData(data, len); - if (QT_WIFI_DEBUG) qDebug("QWifiManager::call: %s ==>\n%s", command, result.constData()); + if (QT_WIFI_DEBUG) qDebug("QWifiManager::call: %s ==>\n%s", cmd.constData(), result.constData()); return result; } |