509
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
Setting IP, Gateway, and Netmask (Optional)
The Wi-Fi is a separate network interface and so it has its own IP address, which is
set using the
property. This address is different from the IP address of
the Ethernet interface (see
). We noticed that many people find it
"unusual" that Tibbo hardware device would turn out to have two IP addresses. In
fact, this is completely normal. On the PC, every network interface has an IP of its
own as well.
Technically speaking, IP address configuration can be done at any time. This topic
has been placed into the
section to remind you that
the IP of the wln object has to be set, if not right after the
, then at a later
point. If your application uses a static IP, then setting it in the boot section of your
code is a good idea. If the application obtains the IP address through DHCP, then
the IP can only be set after communicating with the DHCP server, and this will only
be possible after successful
. You may even need to set the IP
address repeatedly if your product switches between different networks (access
points).
There are also
and
that may need to be set
along with the IP address. This is optional and is only required if your device will
have to establish outgoing connections to the network hosts outside of your LAN.
Note that the IP, gateway IP, and netmask of the Wi-Fi interface can't be set when
there is at least one open socket in your system (
<> 0-
PL_SSTS_CLOSED for any socket).
Setting TX Power (Optional)
The output power of the Wi-Fi hardware can be adjusted in 12 steps. The
method is provided for that purpose. The power value roughly
corresponds to dB. The lowest output power is set with wln.settxpower(4) and the
highest power is set with wln.settxpower(15). Lower power reduces the current
consumption of the Wi-Fi module, but not by much. We recommend that you just
use the default power of 15.
Note that setting TX power is a
and there is a certain correct way of
handling tasks.
Scanning for Wi-Fi Networks
Scanning allows you to discover all networks in your device's "neighborhood" and
also learn about their operating parameters, such as the name, RF channel, etc.
The
method is provided for this purpose. Note that scanning is a
and there is a certain correct way of handling tasks.
The wln.scan accepts a single argument of string type. Presence or absence of this
argument defines the "operating mode" of the method.
When called with an empty string, the wln.task will attempt to find all available
wireless networks. After the task completes, a
property will
contain a comma-separated list of network names:
'scan for available network
Dim
s
As
String
...
wln.scan("")
While
wln.task<>PL_WLN_TASK_IDLE
Wend
s=wln.scanresultssid
'the list of networks will be copied into s
520
270
504
508
511
520
521
358
527
500
524
500
526