Skip to content

SIO Command $FD Scan Networks

Bill Kendrick edited this page May 27, 2022 · 3 revisions

This is a command for Device $70 - The FujiNet Device itself (see SIO-Commands-for-Device-ID-$70).

Scan Networks ($FD)

Description

Causes the ESP to scan for Wi-Fi Networks. There is always a pause, while this command executes.

Note that the ESP will temporarily disconnect from any currently connected network in order to perform the scan, so any open sessions may be lost.

This command returns four bytes, with the first byte being the number of networks detected, and the other three bytes reserved for future use.

Parameters

DCB Value
DDEVIC $70
DUNIT $01
DCOMND $FD
DSTATS 0x40
DBUF Point to a 4 character buffer
DTIMLO $0F
DBYT 4
DAUX1 0
DAUX2 0

Examples

CC65

/**
 * Return number of networks
 */
unsigned char config_do_scan(unsigned char* num_networks)
{
  OS.dcb.ddevic=0x70;
  OS.dcb.dunit=1;
  OS.dcb.dcomnd=0xFD; // do scan
  OS.dcb.dstats=0x40; // Peripheral->Computer
  OS.dcb.dbuf=num_networks;
  OS.dcb.dtimlo=0x0F; // 15 second timeout
  OS.dcb.dbyt=4;      // 4 byte response
  OS.dcb.daux=0;
  siov();

  return OS.dcb.dstats;
}

MADS

	LDA #$FD			; Scan network
	STA DCOMND

	LDA #DREAD			
	STA DSTATS

	LDA #$00			; no filespec needed
	STA DBUFLO
	STA DBUFHI

	LDA #<FUJI_TIMEOUT		; Approximate the number of seconds to wait
	STA DTIMLO
	STA DBYTLO
	STA DBYTHI
	STA DAUX1
	STA DAUX2

	JSR SIOV

See Also

  • Scan Result

Put other related command links here.

Clone this wiki locally