WLN (Wi-Fi Association) Library

Top  Previous  Next

The WLN library works with the GA1000 add-on Wi-Fi module (see Programmable Hardware Manual). The library complements the Wi-Fi (wln.) object by providing the following:

Persistent association with an access point of choice;
Implementation of WPA1-PSK and WPA2-PSK security protocols (the wln. object doesn't fully support them per se);
Support for access point switchover (roaming);
Generation of keepalive messages to prevent disassociation.

 

The library is event-based and non-blocking — it quietly runs in the background and takes a minimal amount of CPU time.

 

Library Info

Supported platforms:

Any platform with Wi-Fi (wln.) interface.

Special case: WPA/WPA2 functionality is not supported on the EM500W platform.

Files to include:

Wln.tbs, wln.tbh (from current_library_set\wln\trunk\).

Dependencies:

SOCK library (only if you have #define WLN_WPA 1 or #define WLN_KEEP_ALIVE 1);

You may also need STG library (for storing WPA/WPA2 parameters as described in Trying WPA code example).

API procedures:

Use API procedures to interact with the library.

wln_start() — commences attempts to bring up (boot) the Wi-Fi interface, find and associate with the specified wireless network, and then keep associated at all times.

wln_stop() — shuts down the Wi-Fi interface.

wln_change() — sets a different target wireless network for the WLN library.

wln_rescan() — starts the search for the specified access point in order to obtain its signal strength.

wln_wpa_mkey_get() — calculates the pre-shared master key for WPA1 and WPA2 security modes.

wln_check_association() — informs whether your device is currently associated with an access point.

Event procedures:

Call event procedures from corresponding event handlers, as described here.

wln_proc_timer() — call it from the on_sys_timer() event handler.

wln_proc_data() — call it from the on_sock_data_arrival() event handler.

wln_proc_task_complete() — call it from the on_wln_task_complete() event handler.

wln_proc_event() — call it from the on_wln_event() event handler.

Callback procedures:

Implement the bodies of callback procedures elsewhere in your project.

callback_wln_ok() — informs of the successful association with the target wireless network.

callback_wln_failure() — informs of the failure to find the target wireless network, associate with it, or maintain association.

callback_wln_pre_buffrq() — informs of the insufficient number of free buffer pages available for use by the library.

callback_wln_mkey_progress_update() — periodically called from wln_wpa_mkey_get() to inform about the progress of pre-shared key calculation.

callback_wln_rescan_result() — informs of the completion of the re-scanning initiated by wln_rescan().

Required buffer space:

5 buffer pages minimum;

+1 additional buffer page if keepalive packets are enabled (see WLN_KEEP_ALIVE);

+2 additional buffer pages if WPA/WPA2 support is enabled (see WLN_WPA).