Setting WEP Mode and Key

The wln.setwep method allows you to specify the WEP mode and key. Note that wln.setwep is an immediate task and there is a certain correct way of handling tasks.

Wln.setwep will be rejected (return 1- REJECTED) if the Wi-Fi add-on module is not booted property (wln.enabled= 0- NO).

The mode can be either DISABLED, WEP64, or WEP128. WEP key is entered as a HEX string, not ASCII string. Each character in a string represents one HEX digit: 0..9 or A..F (a..f). The key has a fixed length: 10 HEX digits for WEP-64 or 26 HEX digits for WEP-128. If your key is too short it will be padded with zeroes. If the key is too long it will be truncated.

Here is the code example that sets the Wi-Fi to WEP128 mode:

** Tibbo Basic **


'set WEP128
wln.setwep("11111111111111111111111111",PL_WLN_WEP_MODE_128) 'we love to choose difficult keys

Wi-Fi devices routinely define four WEP keys, but Tibbo hardware only uses a single key (key 1).

Note that the WEP mode and key can't be changed while the Wi-Fi interface is in the associated state (wln.associationstate= 1- PL_WLN_ASSOCIATED) or is running its own network (wln.associationstate= 2- PL_WLN_OWN_NETWORK).

note_tip-wt

You need to call wln.setwep every time before associating with the access point or starting own network. If you are switching from an access point using WEP security to another access point with no security or WPA security, you still need to execute wln.setwep("",PL_WLN_WEP_MODE_DISABLED)!