FujiNet Commodore Programming - FujiNetWIFI/fujinet-firmware GitHub Wiki
Warning
THIS PAGE IS PRELIMINARY - Items will be moved into separate pages, over time.
- Payload: "ADAPTERCONFIG"
- Response: 8 text lines containing SSID, Hostname, IP, Netmask, Gateway, DNS, MAC, BSSID, and Version.
10 PRINT CHR$(147)
20 OPEN 1,15,15,"ADAPTERCONFIG"
30 INPUT#1,S$:PRINT;
40 PRINT " SSID: ";S$
50 INPUT#1,H$:PRINT;
60 PRINT "HOSTNAME: ";H$
70 INPUT#1,I$:PRINT;
80 PRINT " IP: ";I$
90 INPUT#1,N$:PRINT;
100 PRINT " NETMASK: ";N$
110 INPUT#1,G$:PRINT;
120 PRINT " GATEWAY: ";G$
130 INPUT#1,D$:PRINT;
140 PRINT " DNS: ";D$
150 INPUT#1,M$:PRINT;
160 PRINT " MAC: ";M$
170 INPUT#1,B$:PRINT;
180 PRINT " BSSID: ";B$
190 INPUT#1,V$:PRINT;
200 PRINT " VER: ";V$
210 CLOSE1
220 END
For other languages that can handle structured binary data, an alternate payload can be used:
- Payload: "ADAPTERCONFIG:RAW
- Response: The adapter configuration as a binary structure specified below.
struct
{
char ssid[33];
char hostname[64];
unsigned char localIP[4];
unsigned char gateway[4];
unsigned char netmask[4];
unsigned char dnsIP[4];
unsigned char macAddress[6];
unsigned char bssid[6];
char fn_version[15];
} cfg;
#include <cx16.h>
#include <cbm.h>
#include <stdio.h>
/**
* The current network adapter configuration
*/
typedef struct
{
char ssid[33];
char hostname[64];
unsigned char localIP[4];
unsigned char gateway[4];
unsigned char netmask[4];
unsigned char dnsIP[4];
unsigned char macAddress[6];
unsigned char bssid[6];
char fn_version[15];
} AdapterConfig;
AdapterConfig ac;
void main(void)
{
cbm_open(15,15,15,"adapterconfig:raw");
cbm_read(15,&ac,sizeof(AdapterConfig));
cbm_close(15);
printf("%11s %s\n","SSID:",ac.ssid);
printf("%11s %s\n","HOSTNAME:",ac.hostname);
printf("%11s %u.%u.%u.%u\n","IP:",ac.localIP[0],ac.localIP[1],ac.localIP[2],ac.localIP[3]);
printf("%11s %u.%u.%u.%u\n","NETMASK:",ac.netmask[0],ac.netmask[1],ac.netmask[2],ac.netmask[3]);
printf("%11s %u.%u.%u.%u\n","GATEWAY:",ac.gateway[0],ac.gateway[1],ac.gateway[2],ac.gateway[3]);
printf("%11s %u.%u.%u.%u\n","DNS:",ac.dnsIP[0],ac.dnsIP[1],ac.dnsIP[2],ac.dnsIP[3]);
printf("%11s %02X:%02X:%02X:%02X:%02X:%02X\n","MAC:",ac.macAddress[0],ac.macAddress[1],ac.macAddress[2],ac.macAddress[3],ac.macAddress[4],ac.macAddress[5]);
printf("%11s %02X:%02X:%02X:%02X:%02X:%02X\n","BSSID:",ac.bssid[0],ac.bssid[1],ac.bssid[2],ac.bssid[3],ac.bssid[4],ac.bssid[5]);
printf("%11s %s\n\n","FNVER:",ac.fn_version);
}
- Payload: "SETSSID:,"
Important
The SSID is case sensitive, be aware when converting PETSCII to ASCII characters.
OPEN 1,15,15,"SETSSID:MyNetwork,mypassword":CLOSE1
An alternative payload, "SETSSID:RAW:" can be used to send the SSID and password as a fixed block of 97 characters, to allow for handling special characters, as seen in the structure below:
struct
{
char ssid[33];
char password[64];
} cfg;
The contents of this structure are immediately appended after SETSSID:RAW: and must be 97 characters exactly. Both ssid and password are expected to be NULL padded.
Payload: "GETSSID" Response: A single line of text containing the currently configured SSID
10 OPEN 1,15,15,"GETSSID"
20 INPUT#1,S$
21 CLOSE1
30 ? "SSID: ";S$
40 END
Payload: "SCAN" Response: A single number indicating number of discovered networks.
10 OPEN 1,15,15,"SCAN"
20 INPUT#1,N
30 CLOSE1
40 PRINT "# OF NETWORKS FOUND: ";N
50 END
Payload: "SCANRESULT:[:RAW]" Response: "SSID",RSSI
- num is the result # of recent scan, must be less than the total # of entries returned.
- RAW specifies to send back the data using the following data structure:
struct
{
char ssid[32]; // Null terminated and padded
unsigned char rssi;
} result;
60 OPEN 1,15,15,"SCANRESULT:1"
70 INPUT#1,S$,R:REM GET SSID and RSSI
71 CLOSE 1
80 ? "SSID: ";S$;" RSSI: ";R
Payload: "WIFISTATUS" Response: 3 = CONNECTED, 6 = DISCONNECTED
10 OPEN 1,15,15,"WIFISTATUS"
20 INPUT #1,S
30 CLOSE 1
40 PRINT "WIFI STATUS IS ";
50 IF S=3 THEN PRINT "CONNECTED"
60 IF S=6 THEN PRINT "DISCONNECTED"
70 END
Mount the host entered at slot 0-7. Needs to be done before a device slot can use something from a host slot.
Payload: "MOUNTHOST:<0-7>"
OPEN 1,15,15,"MOUNTHOST:1":CLOSE1:REM MOUNT SECOND HOST SLOT
Mount the device configured at device slot 0-4 with given mode (1 = read, 2 = write), these correspond to IEC devices 8 to 11, respectively.
Payload: "MOUNTDRIVE:<0-3>:"
OPEN 1,15,15,"MOUNTDRIVE:0":CLOSE1:REM MOUNT FIRST CONFIGURED DEVICE SLOT
Opens a directory for a mounted host slot 0-7, so it can be listed, and sets its path and optional filter pattern. The directory entries can be read via the READDIR command. The NULL character ($00) can be substituted for the ~ (pi) character, the CONFIG program does this.
Payload: "OPENDIR:<0-7>:[~FILTER]"
OPEN1,15,15,"OPENDIR:0:/~*.D64":CLOSE1:REM OPEN DIR FOR HOST SLOT 1, AND RETURN MATCHING *.D64 FILES