Decides whether the robot is an access point or a station, and notices when being a station hasn't worked.
Two jobs, both of which only matter at the edges:
At boot, a robot with no configuration becomes an access point. Nothing in
config/target.exs configures wlan0, because the SSID carries the board's
serial number and that isn't known until the thing is running. So an
unconfigured interface is the normal state of a freshly burned robot, and this
is what turns it into a network somebody can join.
A station that never connects falls back. Wrong passphrase, network
renamed, robot taken somewhere else — from here they all look the same, which
is a configured interface that never reports :lan or :internet. After
:connect_timeout it brings the access point back so the robot can be told
again.
The fallback is not persisted, so a reboot tries the configured network once more. That is deliberate: a robot carried out of range of its network should be an access point while it is away and rejoin when it comes home, without anybody having to set it up twice.
What it deliberately doesn't do
It doesn't keep retrying in the background once it has fallen back. The radio can't be both at once, so a retry would take the access point away from whoever is in the middle of using it — which is precisely the person who is trying to fix the problem.
Summary
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(keyword()) :: GenServer.on_start()
Start the monitor.
Options
:connect_timeout- how long a configured network has to reach a connection before the access point comes back, in milliseconds:name- registered name, defaultBB.NSK.Network.Monitor