Arduino Yún - Check if wifi is connected in code

Hey guys,

had a look around but couldn't find anything. How would I go about checking to see if the wifi on the Yún is connected to a router or not?

Was expecting something like if(!client.connected) ... But couldn't find anything.

Help would be appreciated,

Thanks

Well, why would there be such a thing?
For one, the AVR side doesn't know diddly squat about WiFi in the first place. Second, for the Linux side, being "connected" might refer to both WiFi and "Wired" connections, with the later possibly considered "always on".
But it should be possible to deduce the status in either case by checking the Lua code for LuCi, which could be then be handed down to the AVR side...

Ralf

You could run ifconfig. Maybe something like that: "ifconfig wlan0 | grep status".
If you parse the returned string you'll get something like "associated". See "runShellCommand()" in the references how to do that.

AppleAssassin:
Hey guys,

had a look around but couldn't find anything. How would I go about checking to see if the wifi on the Yún is connected to a router or not?

Was expecting something like if(!client.connected) ... But couldn't find anything.

Help would be appreciated,

Thanks

@AppleAssassin,
the Yun as two CPU. one is an Atmel (often referred to as the AVR) and one is from Qualcomm. Qualcomm controls the wifi and it has a variant of Linux OS on it. It is a full computer with no monitor.

Overview - https://www.arduino.cc/en/Main/ArduinoBoardYun

Guide - https://www.arduino.cc/en/Guide/ArduinoYun

Blog - http://blog.arduino.cc/category/arduino/yun/

Some software called the bridge connects the two chips.

Make sure to upgrade http://arduino.cc/en/Tutorial/YunSysupgrade

And get an SD chip so you can expand the storage http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace

Best of Luck
Jesse

AppleAssassin:
Hey guys,

had a look around but couldn't find anything. How would I go about checking to see if the wifi on the Yún is connected to a router or not?

Was expecting something like if(!client.connected) ... But couldn't find anything.

Help would be appreciated,

Thanks

I think it should be: checking to see if the wifi on the Yún is connected to a router, if lost then reconnect it.

Watchcat takes care software issue like network drop...