Wln.associate on GA1000
|Top Previous Next|
GA1000 devices can associate with access points, as well as other wireless devices (stations) running ad-hoc networks.
Wln.associate will be rejected (return 1- REJECTED) if:
•Another task is currently in progress.
Befor your device can successfully associate, it will need to know several key parameters of the target network:
•The SSID (name) of this network;
•The BSSID (MAC address) of this network;
•The channel on which this network operates;
•The BSS mode of this network, i.e. whether this network is an infrastructure network created by an access point or an ad-hoc network created by another station.
Normally, the SSID is known, but BSSID, channel, and BSS mode require some digging. The easiest way to sniff out correct values of these parameters is through scanning. Wln.scan or wln.activescan will fill the wln.scanresultbssid, wln.scanresultchannel, and wln.scanresultbssmode read-only properties with correct data. Example below shows how to put them to good use.
After the association task is completed, you need to check the association result. This can be done through the wln.associationstate property.
If you are running with no security or WEP security, you can start communicating over the Wi-Fi interface as soon as you are done associating. If it is WPA or WPA2 you are dealing with, completing wln.associate is really just the first step. There is a lengthy message exchange to follow. It is best to delegate this to our WLN library!