guild icon
Toit
#check network state without net.open?
Thread channel in help
addshore
addshore 09/24/2025 10:06 AM
I currently check for a device IP with
network := net.open network.address
or sometihng similar.
But this has the side affect of actually opening the network, even if it were nt previously opened.
What is the recommended way to check if the device is connected via WiFi, without calling open?

I also tried network.name but this also requires you to get the network first?
Do I need to do something at a lower level? NetworkServiceClient ? etc?
floitsch
floitsch 09/25/2025 07:18 AM
Good question. Maybe @bitphlipphar knows.
addshore
addshore 09/25/2025 08:05 AM
Yeh managed to get something "kind of" working for my usecase, but I feel a nicer abstraction would be great.
TLDR, making developing with wifi APs or Clients easier, while both using jag or not using jag.
I ended up doing a check on firmware.config["wifi"] to see if we have jag and or it is confused, in which case, assume that wifi is already setup, and use that, thus net.open
else, we do wifi.establish with internally set stuff.
But just having a net.is-open might also be neat, which I think might just be a check on if service_ in net is set.
Maybe is-open is a slightly bad name though
3 messages in total