Is it possible to get SSID list on "Android" and "iOS"?
-
I still can't get my SSID list after updateComplated. I try to connect
updateCompleted signal in function get_wifi_list() and run
ncm.updateConfigurations(). But I still get the same result. Do I miss
something in my code?void zhGlobalSocket::show_wifi_message()
//show private member QNetworkConfigurationManager ncm's whole information
{
auto nc = ncm.allConfigurations();for (auto &x : nc)
{
g_class->send_to_qml(" ~~~ x ~~~>" + x.name() +
x.state() + x.bearerTypeName() + x.isValid() + x.bearerType() +
".");if(x.children().count() > 0)
{
for(int i = 0 ; i< x.children().count(); i++)
g_class->send_to_qml(" === x.children ===>"- x.children()[i].name() + x.children()[i].state() +
x.children()[i].bearerTypeName() + x.children()[i].isValid() +
x.children()[i].bearerType() + ".");
}
}
}
QStringList zhGlobalSocket::get_wifi_list()
{
QStringList list_wifi;
// QNetworkConfigurationManager ncm;//I want to get ncm's information
after ncm updateCompleted. Hence, I let ncm been this class's private member.show_wifi_message();
// for (auto &x : ncm.allConfigurations())
// {
// if (x.bearerType() == QNetworkConfiguration::BearerWLAN)
// {
// list_wifi.append(x.name());
// }
// }
connect(&ncm;, SIGNAL(updateCompleted()), this,
SLOT(update_complated()));// <--- new
ncm.updateConfigurations();// <--- newreturn list_wifi;
}void zhGlobalSocket::update_complated()
{
qDebug() << "=== update_complated ===";
show_wifi_message();
// foreach(QNetworkConfiguration config, ncm.allConfigurations()) {
// g_class->send_to_qml(" === config in
update_complated() ===>" + config.name());
// }
qDebug() << "=== END: update_complated ===";
}Debug message:
D/libEmbApp.so(14029): ../EmbApp/zh_global_class.cpp:390 (void
zhGlobalClass::send_to_qml(QString)): zhGlobalClass::send_to_qml(390): "D/libEmbApp.so(14029): ../EmbApp/zh_global_class.cpp:390 (void zhGlobalClass::send_to_qml(QString)): zhGlobalClass::send_to_qml(390): " ~~~ x ~~~>Bluetooth\u0002Bluetooth\u0001\u0007." W/libEmbApp.so(14029): file:///data/data/org.qtproject.example/qt-reserved- files/qml/QtQuick/Controls/StackView.qml:955 (__performTransition): __performTransition(955): Warning: StackView: cannot transition an item that is anchored! D/libEmbApp.so(14029): ../EmbApp/zh_global_socket.cpp:561 (void zhGlobalSocket::update_complated()): zhGlobalSocket::update_complated(561): === update_complated === D/libEmbApp.so(14029): ../EmbApp/zh_global_class.cpp:390 (void zhGlobalClass::send_to_qml(QString)): zhGlobalClass::send_to_qml(390): " ~~~ x ~~~>WiFi\u000EWLAN\u0001\u0002." W/IInputConnectionWrapper(14029): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper(14029): endBatchEdit on inactive InputConnection D/libEmbApp.so(14029): ../EmbApp/zh_global_class.cpp:390 (void zhGlobalClass::send_to_qml(QString)): zhGlobalClass::send_to_qml(390): " ~~~ x ~~~>Mobile\u0002WCDMA\u0001\u0005." D/libEmbApp.so(14029): ../EmbApp/zh_global_class.cpp:390 (void zhGlobalClass::send_to_qml(QString)): zhGlobalClass::send_to_qml(390): " ~~~ x ~~~>Bluetooth\u0002Bluetooth\u0001\u0007." W/IInputConnectionWrapper(14029): getCursorCapsMode on inactive InputConnection W/IInputConnectionWrapper(14029): getTextBeforeCursor on inactive InputConnection D/libEmbApp.so(14029): ../EmbApp/zh_global_socket.cpp:566 (void zhGlobalSocket::update_complated()): zhGlobalSocket::update_complated(566): === END: update_complated === W/IInputConnectionWrapper(14029): beginBatchEdit on inactive InputConnection - x.children()[i].name() + x.children()[i].state() +