State Transitions

The Wi-Fi hardware may be in one of the following states:


The following diagram details possible state transitions:

A diagram illustrating possible state transitions.

The only way to advance from the uninitialized state into the booted state is through a successful boot. The process is described in Bringing Up the Wi-Fi Interface. The key method for this process is wln.boot.

To wind the hardware down, execute wln.disable or put the Wi-Fi module in reset. An on_wln_event(0 — PL_WLN_EVENT_DISABLED) is generated when the Wi-Fi hardware goes offline (because of a hardware reset, because wln.disable was called, or because the hardware has been unplugged or malfunctioned).

Transitioning between the idle and associated states happens as a result of a successful association. This is detailed in Associating With a Network. The key method here is wln.associate.

The wln.disassociate method can be used to force disassociation. The wln. object also detects the loss of association automatically (i.e., when the access point in question "disappears" or kicks out your device). In both cases, the on_wln_event(1 — PL_WLN_EVENT_DISASSOCIATED) event is generated.

The Wi-Fi interface can also create its own network, which is achieved through the wln.networkstart method. Terminating Own Network explains how to end this (in short, use wln.networkstop). Notice that you cannot be associated and run your own network at the same time. These states are mutually exclusive.

The fifth state is only possible on the WA2000: it can be booted into the Monitor/Loader. This is achieved by calling wln.getmoduletype while the hardware is in the uninitialized state. Invoking the same method after executing wln.boot will not switch the WA2000 into running the Monitor/Loader. The only time you need to boot the WA2000 into the Monitor/Loader is when performing a firmware update.