|
Wln State Transitions |
Top Previous Next |
The Wi-Fi hardware may be in one of the following states:
| • | Power off (default) state. |
| • | Booted and idle: the hardware is booted, but not associated with any network (and not running an ad-hoc network of its own). |
| • | Booted and associated: the hardware is booted and is associated with a network (or running an ad-hoc network of its own). |
You can always check what state the wln is in:
| • | Power off: wln.enabled= 0- NO. |
| • | Booted and idle: wln.enabled= 1- YES, wln.associationstate= 0- PL_WLN_NOT_ASSOCIATED. |
| • | Booted and associated: wln.enabled= 1- YES, wln.associationstate= 1- PL_WLN_ASSOCIATED. |
The following diagram details possible state transitions.

The only way to advance from power-off into the booted state is through successful boot. The process is described in the Bringing Up Wi-Fi Interface topic. The key method for the process is wln.boot.
There is no special wln method for powering down. Instead, the power supply to the Wi-Fi hardware is cut -- see Powering Down topic. The on_wln_event is generated when the power-down occurs, either as a result of deliberate power cut, or in case the Wi-Fi hardware malfunctions (disconnects).
Transition between the idle and associated states happens as a result of successful association. This is detailed in the Associating With Selected Network topic. The key method is wln.associate. You cannot associate with another network while already being associated, such a request will be rejected.
The wln.disassociate method can be used to force disassociation. The wln object also detects the loss of association automatically, i.e. when the network in question "disappears". In both cases, the on_wln_event event is generated.