feat(net): Add method Network.isOnline()#12000
Conversation
👋 Hello me-no-dev, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 16m 55s ⏱️ Results for commit 58cda9a. ♻️ This comment has been updated with latest results. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@me-no-dev I've spotted this PR and I have one remark - I'm not sure if checking if the device is online by checking interfaces' |
|
@szerwi have you tested that? GOT_IP should not come if interface is not connected |
Yes, I have an application that uses WiFi STA & AP, ETH and PPP.
When IP config is dynamic, it returns: |
|
@szerwi I found why that happens and added a check for connected also |
This pull request adds a new method to the
NetworkManagerclass to check if the device is online by verifying if any network interface (except AP) has an assigned IPv4 or global IPv6 address.New functionality:
isOnline()method to theNetworkManagerclass, which returnstrueif any interface (other than AP) has an assigned IPv4 or global IPv6 address. (NetworkManager.cpp,NetworkManager.h) [1] [2]