Get configuration reads MAC address of shield, the name of shield when connected, the net address MASK and the GATEWAY address and finally the IP address and the STATUS global variable. IP address is not important when connected with an access point, because DHCP.
STATUS variable old the connection status : 1 connected, 2 failed,3 temporally lost retrying, 4 reestablished,5 definitively lost.
Several functions for getting and setting are listed later on.
MWiFi.getConfig()
none
none directly but puts several values into variables
these variables can be retrieved using following functions
MAC format "xx.xx.xx.xx.xx" (xx: hexadecimal)( 18 char max)
IP,MASK,GATEWAY format "n.n.n.n" (16 char max)
MWiFi.getMAC(char mac[18]) // puts MAC into a buffer as string
MWiFi.getName(char name[8] )//puts shield net name to a string buffer
Is the (computer) name visible from net (composed with some MAC bytes)
MWiFi.getIP(char ip[16]) //puts ip into a buffer as string. Call after connection to have ip assigned.
MWiFi.setIP(char *ip) // only if you use static ip (switch to static ip mode)
WWiFi.setIPdhcp() //set dhcp mode (default) use only to reset to dhcp mode
MWiFi.getNetMask(char mask[16]) // puts MASK address into a string buffer
MWiFi.setNetMask(char *mask)
MWiFi.getGateway(char gateway[16]) //puts Gateway address into a string buffer
MWiFi.getRemoteIP(char remoteip[16]) // puts ip of client after linking. Call after server has accepted link.
MWiFi.resetMCW() // just for eventuality
MWiFi.setLed(int nled,int state) //switch on/off (1/0) the led nled (nled: from 0 to 4)
Be careful! Led 0 is used as flag for connection and led 1 is used as flag for link
MWiFi.setPowerOff() //switch off radio (shield can be waked-up only by begin() function)
MWiFi.setPowerSave(int millis) //in PSPOLL
MWiFi.setFullPower(int millis) //exits from power save mode
Scanning functions can be used to detect WIFI visible hotspot.
MWiFi.scanNets() //scanning for visible hotspots
none
total number of access point discovered (int).
Details can be retrieved by following function
MWiFi.getNetScanned(int i) //get result of access point i
access point index (in list prepared by scanNets() function)
Pointer to a string in this format:
"Net: name secure type rssi"
Where:
-secure=OPEN/WAP/WAP2/WEP
-type=Acc.P/AdHoc
-rssi= integer (signal power)
MWiFi.getSSIDBestOpen(int totnet) //select the best open (no secure) net in terms of signal
tot number of access point detected by scanNets() function
Pointer to a string name of best access point
MWiFi.existSSID(char *name) //verify if an Access Point is availabe
name of AP
record with AP data (see getNetScanned) or null
Next example demonstrates the use of some basic commands for MWiFi shield