Creating Your Own Network
Rather than associate with another network, the Wi-Fi interface can start (create) its own network. This is done using the wln.networkstart method. Note that wln.networkstart is a task and there is a certain correct way of handling tasks. To start a network, you only need to supply the name (SSID) of the future network and a channel on which you will want your network to operate.
The wln.networkstart method will be rejected (return 1 — REJECTED) if:
- Another task is currently in progress.
- The Wi-Fi add-on module is not booted using wln.boot (wln.enabled = 0 — NO).
- The Wi-Fi interface is already in the non-idle state (wln.associationstate <> 0 — PL_WLN_NOT_ASSOCIATED). That is, you can't start a network when you are already associated or running a network.
To start a network, you only need to make up your mind regarding its name and operating channel:
'take control and run your own network
wln.networkstart("VOICEOFREBELS",6)
While wln.task<>PL_WLN_TASK_IDLE
Wend
Wi-Fi security (WPA or WEP) must be set prior to starting the network.
There is a significant difference between the GA1000 and the WA2000, WM2000, and WS1102 in the kind of a network they can start:
- The GA1000 creates an ad hoc network.
- The WA2000, WM2000, and WS1102 create an infrastructure network. That is, they appear as an access point to other devices.