501
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
The wln object can only work on a single task at a time. You cannot request
another task execution until the previous one is finished! The following example
shows a wrong way of tasking:
'THIS WON'T WORK!
...
wln.scan("NET1")
wln.associate(wln.scanresultbssid,"NET1",wln.scanresultchannel,wln.scanres
ultbssmode)
'this task will be skipped over!
Here is how you should do this: use the
read-only property and wait
until the previous task is completed.
'A BETTER WAY...
...
While
wln.task<>PL_WLN_TASK_IDLE
'waiting for the previous task to
complete...
Wend
wln.scan("NET1")
...
While
wln.task<>PL_WLN_TASK_IDLE
'waiting for the previous task to
complete...
Wend
wln.associate(wln.scanresultbssid,"NET1",wln.scanresultchannel,wln.scanres
ultbssmode)
...
The above approach still needs some refinement. Just making sure that the
previous task has competed will not guarantee that your next task will be
accepted. This is because some tasks can only be accepted under certain additional
conditions. For example, you can't scan while being associated with a wireless
network (or running an ad-hoc network of your own). Try this, and the
will return 1- REJECTED.
'A MUCH BETTER WAY...
...
While
wln.task<>PL_WLN_TASK_IDLE
'waiting for the previous task to
complete...
Wend
If
wln.scan("NET1")<>ACCEPTED
Then
'Handle this: there must be a reason why the task got rejected.
'We already made sure that the previous task was completed.
'Hence, there is a more 'fundamental' reason for rejection!
End
If
Now, this is still not all. "Task completed" is not equal to "task completed
successfully". In the above example, we were scanning for NET1 network. Now, did
we actually discover it? Find out by testing the value of the
!
For every task that may result in failure there is a way to know if the execution
was successful or not.
528
524
526