Wln State Transitions
The Wi-Fi hardware may be in one of the following states:
• Uninitialized state (wln.enabled = 0- NO).
• Booted and idle (wln.enabled= 1- YES and wln.associationstate = 0- PL_WLN_NOT_ASSOCIATED).
• Booted and associated with a network (wln.enabled= 1- YES and wln.associationstate= 1- PL_WLN_ASSOCIATED).
• Booted and running its own network (wln.enabled= 1- YES and wln.associationstate= 2- PL_WLN_OWN_NETWORK).
• In addition, the WA2000 device can be in the fifth state: booted and executing the Monitor/Loader.
The following diagram details 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 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 successful association. This is detailed in Associating With Selected Access Point . 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 device: 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 .