DEBUG_WIFI
WIFI_PRO_SCANFILE
WIFI_PRO_LISTFILE
OPEN
WEP64
WEP128
WPA
WPA2
PROFILE_0
PROFILE_1
PROFILE_2
PROFILE_3
PROFILE_4
PROFILE_5
PROFILE_6
PROFILE_7
PROFILE_8
PROFILE_9
_buffer
_length
_def_delay
_baudrate
_uart
_errorCode
_rtt
_ip
_gw
_netmask
_dns1
_dns2
_socket_handle
_ftp_handle
_filesize
_essid
_bssid
_channel
_rate
WIFI_PRO
._errorCode
variable stores the corresponding error meaning. This error value is described by constants as the table below:ON()
function allows to switch on the WiFi PRO module and it opens the MCU's UART for communicating with the module. After this step the module will be able to receive commands to manage it. It is necessary to indicate the socket that it is being used: SOCKET0
or SOCKET1
.resetValues()
function allows to restore the module's non-volatile parameter database values to factory defaults. Each one of the module's non-volatile parameters has an associated default value. This function restores all parameters to their factory default values.OFF()
function allows the user to switch off the WiFi PRO module and close the UART. This function must be called in order to keep battery level when the module is not going to be used. It is necessary to indicate the socket that it is being used: SOCKET0
or SOCKET1
.setESSID()
function allows the user to configure the ESSID to join.getESSID()
function allows the user to request the current ESSID setting. The _essid attribute permits to read the settings of the module.WIFI_PRO._essid
→ Stores the current ESSID of the modulesetPassword()
function allows the user to configure the password to the module. It takes several seconds to generate the keys. This function needs two inputs:OPEN
: No securityWEP64
: WEP 64-bitWEP128
: WEP 128-bitWPA
: WPA-PSKWPA2
: WPA2-PSKsoftReset()
function is used to perform a software reset to the module. After calling this function, the new setting takes effect.isConnected()
function permits to know if the WiFi PRO module is already connected to the Access Point. This function returns true or false values in order to provide the status information.getIP()
function permits to request the current IP address of the module.WIFI_PRO._ip
→ Stores the current IP address assigned to the modulesetIP()
function allows the user to set the IP address to the module in the network.setDNS()
function allows the user to set the DNS address to the WiFi PRO module.setGateway()
function allows the user to set the Gateway address to the WiFi PRO module.setNetmask()
function allows the user to set the netmask address to the WiFi PRO module.ping()
function sends a two-byte ICMP PING request packet to the remote host defined as input argument. The input of the function can be a logical name of the target host or a host IP address. Upon successfully receiving an ICMP PING reply from the host, the round trip time in milliseconds is returned (RTT) and stored in the _rtt
attribute.WIFI_PRO._rtt
→ Stores the last round trip time performed by a ping callsetPower()
function allows the user to configure the transmission power of the chipset. The getPower()
function allows the user to request the transmission power of the chipset which is stored in the _power
attribute. After a hardware or software reset, the power level parameter returns to its default value. This parameter is in the range 1 to 14 dBm. The default value is 14 dBm.WIFI_PRO._power
→ Stores the power level settingsetCA()
function sets the certificate of the trusted certificate authority. The WiFi PRO module accepts a server’s identity only if its certificate is signed by one of these certificate authorities.-----BEGIN CERTIFICATE-----
and terminating with: -----END CERTIFICATE-----
. The certificate should include an RSA encryption public key of 1024 or 2048 bits. The signature algorithm may be MD2, MD5 or SHA1. The maximum size of the certificate is 1500 characters.setTCPclient()
function opens a Transmission Control Protocol (TCP) client socket and attempts to connect to the specified port on a server defined as input. Therefore, this function needs three different inputs:_socket_handle
attribute. This handle is in the range 0 to 9. This handle is needed to reference the socket in all following socket commands.WIFI_PRO._socket_handle
→ Stores the TCP socket handlesetTCPserver()
function opens a TCP listening socket on the local IP address and the specified port. The second input parameter specifies the maximum number of remote concurrent connections allowed through the listening socket. Thus, this function needs 2 different inputs:getAllSocketStatus()
function allows the user to update the information of all active sockets connected through a listening socket. The information for each one of the active sockets is stored in a structure called listen_socket_t
. There are ten structures defined in the Waspmote libraries for permitting up to ten connections simultaneously.setUDP()
function opens a UDP (User Datagram Protocol) socket and sets the remote system’s <Host>:<port> address. Therefore, this function needs three different inputs:_socket_handle
attribute. The socket handle is in the range 0 to 9 and is used to reference the socket in all following socket commands.WIFI_PRO._socket_handle
→ Stores the UDP socket handlesend()
function sends a byte stream to the socket specified by the socket handle input. This function needs two different inputs:receive()
function receives a byte stream from the TCP/UDP socket specified by the socket handle. Received data is valid only if it already resides in the module's socket input buffer at the time this command is issued. There are different receiving function prototypes depending on the time the user needs to listen for a new incoming packet. Therefore, this function could need more than one input:closeSocket()
function allows the user to close a TCP/UDP client previously open. The function needs an input parameter for the socket identifier:setCA()
function sets the certificate of the trusted certificate authority. The WiFi PRO module accepts a server’s identity only if its certificate is signed by one of these certificate authorities.sslHandshake()
function negotiates an SSL connection on a given socket handle. This function requires an input to select the socket handle:WIFI_PRO._socket_handle
→ Stores the TCP socket handlegetURL()
function retrieves a file from a URL. This function needs two different inputs:_buffer
attribute. Besides, the _length
attribute defines the length of the answer stored.WIFI_PRO._buffer
→ Pointer to the buffer where the answer from host is storedWIFI_PRO._length
→ Length of the response stored in _bufferpost()
function submits a plain text POST request to a web server defined by the setURL()
function. The “Content-type:” field of the POST request is defined by the setContentType()
function. A default value of “application/x-www-form-urlencoded” will be used.WIFI_PRO._buffer
→ Pointer to the buffer where the answer from host is storedWIFI_PRO._length
→ Length of the response stored in _buffersetCA()
function sets the certificate of the trusted certificate authorities. The WiFi PRO module accepts a server’s identity only if its certificate is signed by one of these authorities.getURL()
and post()
functions to perform HTTPS operations.sendFrameToMeshlium()
function sends the HTTP GET request to the specified host and port. This function needs five inputs: ftpOpenSession()
function opens an FTP link to an FTP server. This function needs different inputs:_ftp_handle
attribute. This handle is used to reference the FTP session in all following FTP commands.WIFI_PRO._ftp_handle
→ Stores the FTP handleftpListing()
function retrieves a full FTP directory listing. The Waspmote SD card is needed for storing all the incoming data on the listing process. There are two function prototypes for this function depending on the inputs:WIFI_PRO_LISTFILE
→ The filename where listing info is storedftpMakeDir()
function allows the user to create a new directory on the FTP server’s file system. This function needs two inputs:ftpOpenSession()
function during the current Internet mode session.ftpChangeCWD()
function allows the user to change the FTP current working directory. This function needs two inputs:ftpOpenSession()
function during the current Internet mode session.ftpFileSize()
function allows the user to get the size of an FTP server’s file. This function needs two inputs:ftpOpenSession()
function during the current Internet mode session.WIFI_PRO._filesize
→ The size in bytes of the file in the FTP serverftpUpload()
function allows the user to upload a file from the Waspmote's SD card to the FTP server. This function performs different steps: it opens a file in server for storage, uploads a stream of data from the SD card file and finally closes the file in server. This function needs different inputs:ftpOpenSession()
function during the current Internet mode session.ftpDownload()
function allows the user to download a file from the FTP server to Waspmote's SD card. This function needs different inputs:ftpOpenSession()
function during the current Internet mode session.ftpCloseSession()
function closes the FTP link. This function needs the following input:ftpOpenSession()
function during the current Internet mode session.scan()
function retrieves a list of all APs available in the surrounding area. The Waspmote SD card is needed for storing all the incoming data on the scanning process.WIFI_PRO_SCANFILE
label in the libraries. So, it is possible to access to this file, display it or extract data from it. Regarding the contents of this file: It contains a list of up to 16 APs available in the surrounding area. Each line contains the following comma-separated fields:<SSID>,ADHOC|AP,<BSSID>,<security-type>,<channel>,<RSSI>
<security-type>
=NONE|WEP64|WEP128|WPA|WPA2<RSSI>
= Value between 0-255 which represents (SNR+NoiseFloor). Higher RSSI values indicate weaker signal strength.WIFI_PRO_SCANFILE
→ The filename where scanning info is storedsetTimeServer()
function allows the user to set the network time server name or IP. The module has two possible network time servers: the primary time server and the alternate time server. So this function has two different inputs:timeActivationFlag()
function sets the network time-of-day activation flag. If this flag is enabled, the module will connect to the time server and retrieve an updated time reading each time it connects to the network. From that point on, the module will maintain time internally. While the module is online, the network time will be refreshed every two hours. The input for this function permits two options in order to enable or disable the flag: true or false.setGMT()
function allows the user to permanently set the module location’s Greenwich mean time offset, in hours. The range of this parameter is -12 to 12. The default is 0.setTimeFromWIFI()
function allows the user to update the Waspmote's RTC settings when the Time Servers is correctly set and the Activation Flag is enabled.setESSID()
function allows the user to set the destination Wireless LAN Service Set Identifier (SSID) string into position 'n' in the ten-profile array. The location of an SSID within the list defines its priority, where the first SSID has the top priority. The SSIDs must be configured consecutively. For example, if the first and third SSIDs are set but the second is not, the module ignores the third SSID. For example, if the module is connected to an AP having an SSID value defined by the fourth SSID, and that SSID is set to a different value using this function, the change will take effect immediately and the module will attempt to associate with an AP having the new SSID. On the other hand, if the module is not currently connected to an AP with SSID defined by the fourth SSID and the value of the fourth SSID is changed, the change will take effect only upon the next connection attempt. This function expects two inputs:PROFILE_0
PROFILE_1
PROFILE_2
PROFILE_3
PROFILE_4
PROFILE_5
PROFILE_6
PROFILE_7
PROFILE_8
PROFILE_9
setPassword()
function allows the user to configure the security keys for each one of the defined profiles. This function needs three inputs:isConnectedMultiple()
function to check if the module has joined any of those APs. The user must keep in mind that this process can take several seconds which implies a great waste of energy.roamingMode()
function enables or disables the Roaming mode.setScanInterval()
function sets the time interval between consecutive scans that the module performs for APs in its vicinity. The range is 1 to 3600 seconds. The default is 5 seconds.setLowThreshold()
function sets a low SNR threshold for the module in Roaming mode. The range is 0 to 254 dB. The default is 10 dB.setHighThreshold()
function sets a high SNR threshold for the module in Roaming mode. The range is 10 to 255 dB. The default is 30 dB.setScanInterval()
function. The module reads the value set in the ESSID parameter and acts accordingly. The module attempts to connect to an AP whose ESSID is listed first in the array of ESSID profiles. If several APs having that same ESSID exist, the module attempts to connect to the one having the strongest signal. If association succeeds, the module stops scanning and activates its DHCP client. It then monitors the SNR level of the AP it is associated with.setLowThreshold()
function), the module starts its periodic scan for APs having SNR above the threshold set by the setHighThreshold()
function.getFirmwareVersion()
function allows the user to query the device firmware version. The attribute _firmwareVersion
permits to access to the string that stores the firmware version of the module.WIFI_PRO._firmwareVersion
→ Stores the firmware version