Wln State Transitions

Top  Previous  Next

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 ad-hoc network (wln.enabled= 1- YES and wln.associationstate= 2- PL_WLN_OWN_NETWORK).

 

The following diagram details possible state transitions.

 

wln_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 the process is wln.boot.

There is no special method for powering down. Your application can only hardware-reset the GA1000, after which the boot process can be repeated. The on_wln_event is generated when the GA1000 goes offline, either as a result of a deliberate reset, or in case the Wi-Fi hardware malfunctions or gets disconnected.

Transition between the idle and associated states happens as a result of successful association. This is detailed in Associating With Selected Network. The key method 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 network in question "disappears". In both cases, the on_wln_event event is generated.

The Wi-Fi interface can also create its own ad-hoc network, which is achieved through the wln.networkstart method. Terminating Own Ad-hoc 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.