With QNetworkConfiguration, Wifi network is not re-discovered after using XMLHttpRequest
-
I am trying to avoid network selection prompt in my Qt Quick application. In the code, I verify whether any saved wifi networks are in range before sending a data request from QML. The application should not initiate a data pull when no saved networks are available, thus avoiding the network selection prompt. For this I am using allConfigurations(QNetworkConfiguration::Discovered).
This code works fine if used independently. However, calling this function after using a wifi network once with XMLHttpRequest and then disconnecting changes the status of that network to just "Defined" even though it is still in range. Here is a sample code to reproduce the problem on N900.
Before running the code make sure that a wifi network is defined (saved) and is in range.
connectionutility.h [1]
main.cpp [2]
main.qml [3]Scenario 1: Without using XMLHttpRequest
Step 1: Comment the line queryData(); in main.qml
Step 2: Disconnect from wifi network (if connected)
Step 3: Run the application on device, wait for 20 sec
Expected result: The wifi used previously is displayed in console. (This works)Scenario 2: Using XMLHttpRequest
Step 1: Uncomment the line queryData(); in main.qml
Step 2: Disconnect from wifi network (if connected)
Step 3: Run the application on device, connect to a wifi network (if prompted)
Step 4: After the message "Now disconnect from wifi for testing" is displayed in console, disconnect from Wifi. Wait for 20 sec
Expected result: The wifi used previously is displayed in console. (This doesn't work).Can anyone suggest a fix or a workaround for what I am trying to achieve?
[1] - http://pastebin.com/fjRr4cyv
[2] - http://pastebin.com/NJxuP7rB
[3] - http://pastebin.com/3QQh1ce9