# Receive wifi security reports Steps to register listener and receive wifi connection security reports are: > > > 1. Define listener that will receive report and receive invocation for consent to trusting an AP. > 2. Get ConnectionSecurityFactory instance. > 3. Get IWiFiSecurityManager instance from ConnectionSecurityFactory. > 4. Wait for the security service to become available. > 5. Register listener to receive security reports. > 6. Receive reports in the registered listener. > 7. When the use-case is complete, deregister the listener. Copy to clipboard #include <iostream> #include <chrono> #include <thread> #include <future> #include <telux/sec/ConnectionSecurityFactory.hpp> - class WiFiSecurityReportListenerpublic telux::sec::IWiFiReportListener, - public std::enable\_shared\_from\_this<WiFiSecurityReportListener> { public: > > > /\* Step - 6 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id1)/ > void onReportAvailable(telux::sec::WiFiSecurityReport report) { > > > > > > > > > std::cout << “ssid : “ << report.ssid << std::endl; > > std::cout << “bssid : “ << report.bssid << std::endl; > > std::cout << “is connected : “ << report.isConnectedToAP << std::endl; > > std::cout << “is open : “ << report.isOpenAP << std::endl; > > std::cout << “ml threat score : “ << > > > > > > > > > > > > > > > report.mlAlgorithmAnalysis.threatScore << std::endl; > > > > > > > > > > - std::cout << “ml result“ << > > - static\_cast<int>(report.mlAlgorithmAnalysis.result) << std::endl; > > > > - std::cout << “summoning result“ << > > - static\_cast<int>(report.summoningAnalysis.result) << std::endl; > > > > } > > > > - void onDeauthenticationAttack(telux::sec::DeauthenticationInfo deauthenticationInfo) { > - - std::cout << “disconnect reason“ << > - deauthenticationInfo.deauthenticationReason << std::endl; > > - std::cout << “did AP initiated“ << > - deauthenticationInfo.didAPInitiateDisconnect << std::endl; > > - std::cout << “threat score“ << > - deauthenticationInfo.threatScore << std::endl; > > > > > } > > > > - void isTrustedAP(telux::sec::ApInfo apInfo, bool& isTrusted) { > - std::cout << “ssid : “ << apInfo.ssid << std::endl; > std::cout << “bssid : “ << apInfo.bssid << std::endl; > > > /\* In this example we always trust the AP [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id3)/ > isTrusted = true; > > > > > } > > > > - /\* > - - Initialize application and get a WiFiSecurityManager. > > > > [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id5)/ > > > > > int init() { > > > > > > > > > std::promise<telux::common::ServiceStatus> p{}; > > telux::common::ServiceStatus serviceStatus; > > > > > > /\* Step - 2 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id7)/ > > auto &wifiConSecFact = telux::sec::ConnectionSecurityFactory::getInstance(); > > > > > > /\* Step - 3 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id9)/ > > [wifiConSecMgr\_](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id23) = wifiConSecFact.getWiFiSecurityManager([&](telux::common::ServiceStatus > > srvStatus) { > > > > > > > > > > > > > > > p.set\_value(srvStatus); > > > > > > > > }); > > > > > > > > - if (!wifiConSecMgr\_) { > > - std::cout << “failed to get IWiFiSecurityManager “ << std::endl; > > return -ENOMEM; > > > > > > > > > > } > > > > > > /\* Step - 4 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id11)/ > > serviceStatus = p.get\_future().get(); > > if (serviceStatus != telux::common::ServiceStatus::SERVICE\_AVAILABLE) { > > > > > > > > > > > > > > > std::cout << “security service unavailable” << std::endl; > > > return -EIO; > > > > > > > > } > > > > > > std::cout << “initialization finished” << std::endl; > > return 0; > > > > } > > > > - int registerSecurityReportListener() { > - telux::common::ErrorCode ec; > /\* Step - 5 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id13)/ > ec = [wifiConSecMgr\_](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id25)->registerListener(shared\_from\_this()); > if (ec != telux::common::ErrorCode::SUCCESS) { > > > > > > > > > std::cout << “can’t register listener, err “ << static\_cast<int>(ec) << std::endl; > > return -EIO; > > > > } > > > return 0; > > > > > } > > > > - int deregisterSecurityReportListener() { > - /\* Step - 7 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id15)/ > telux::common::ErrorCode ec; > ec = [wifiConSecMgr\_](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id27)->deregisterListener(shared\_from\_this()); > if (ec != telux::common::ErrorCode::SUCCESS) { > > > > > > > > > std::cout << “can’t deregister listener, err “ << static\_cast<int>(ec) << std::endl; > > return -EIO; > > > > } > > > return 0; > > > > > } - private: - std::shared\_ptr<telux::sec::IWiFiSecurityManager> [wifiConSecMgr\_](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id29); }; int main(int argc, char [\*\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id17)argv) { > > > int ret; > std::shared\_ptr<WiFiSecurityReportListener> app; > > > /\* Step - 1 [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id19)/ > try { > > > > > > > > > app = std::make\_shared<WiFiSecurityReportListener>(); > > > > > - } catch (const std::exception& e) { > - std::cout << “can’t allocate WiFiSecurityReportListener” << std::endl; > return -ENOMEM; > > > > > } > > > ret = app->init(); > if (ret < 0) { > > > > > > > > > return ret; > > > > } > > > ret = app->registerSecurityReportListener(); > if (ret < 0) { > > > > > > > > > return ret; > > > > } > > > /\* Add application specific business logic here [\*](https://docs.qualcomm.com/doc/80-PF458-1/topic/WiFiConnectionReportListener.html#id21)/ > std::this\_thread::sleep\_for(std::chrono::milliseconds(10000)); > > > ret = app->deregisterSecurityReportListener(); > if (ret < 0) { > > > > > > > > > return ret; > > > > } > > > std::cout << “application exiting” << std::endl; > return 0; } Last Published: Jun 24, 2026 [Previous Topic WiFi connection security](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/wifi_connection_security.md) [Next Topic WLAN](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/wlan.md)