Determining Wi-Fi Module Type

Since the wln. object supports two hardware modules — the GA1000 and WA2000 — your app will need to know what module it is dealing with. The GA1000 and WA2000 are closely related, but they still have a number of differences (detailed in Quick Reference: WA2000 vs. GA1000). The wln.getmoduletype method allows you to check the module type.

Internally, the wln. object only needs to determine the module type once. This determination takes around one second and is performed during wln.getmoduletype or wln.boot invocation, whichever happens earlier after the hardware reset of the Wi-Fi module. Consider this example:

Tibbo BASIC
sub on_sys_init
	...'Configure GPIO lines, reset the Wi-Fi add-on module
 
	dim module_type as pl_wln_module_types=wln.getmoduletype 'Type determination will happen here. This will take around 1 sec.
	wln.boot(...) 'Executing this method will not involve another test for the module type
end sub

Finally, if wln.boot is executed first, then the module type is detected then and there:

Tibbo BASIC
sub on_sys_init
	...'Confifure GPIO lines, reset the Wi-Fi add-on module
	
	wln.boot(...) 'Executing this method will also trigger a test for the module type
	dim module_type as pl_wln_module_types=wln.getmoduletype 'Since the module type has already been determined, this will execute very fast
end sub

In practice, your app will always call wln.getmoduletype first. This is because you need to know the module type before booting up the hardware.

As explained in State Transitions, wln.getmoduletype also has a side job — it can be used to boot the WA2000 into the Monitor/Loader, which is necessary for performing firmware updates.