Wifly Driver  V1.0
Macros | Functions | Variables
WiFly.c File Reference
#include "LPC17xx.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "Type.h"
#include "PrintF.h"
#include "WiFly.h"
#include "Config.h"
#include "FreeRTOS.h"
#include "semphr.h"
Include dependency graph for WiFly.c:

Go to the source code of this file.

Macros

#define SET_IP_ADDRESS   "set ip address %s\r\n"
 
#define SET_IP_BACKUP   "set ip backup %s\r\n"
 
#define SET_IP_DHCP   "set ip dhcp %d\r\n"
 
#define SET_IP_FLAGS   "set ip flags %x\r\n"
 
#define SET_IP_GATEWAY   "set ip gateway %s\r\n"
 
#define SET_IP_HOST   "set ip host %s\r\n"
 
#define SET_IP_LOCAL_PORT   "set ip localport %d\r\n"
 
#define SET_IP_NET   "set ip net %s\r\n"
 
#define SET_IP_NETMASK   "set ip netmask %s\r\n"
 
#define SET_IP_PROTO   "set ip proto %d\r\n"
 
#define SET_IP_REMOTE   "set ip remote %d\r\n"
 
#define SET_IP_TCP_MODE   "set ip tcp-mode %x\r\n"
 
#define SET_COM_REM   "set com remote %s\r\n"
 
#define SET_OP_FORMAT   "set option format %d\r\n"
 
#define SET_UART_MD   "set uart mode %x \r\n"
 
#define SET_UART_BAUD   "set uart baud %d \r\n"
 
#define SET_UART_INST   "set uart instant %d \r\n"
 
#define SET_WLAN_TX   "set wlan tx %d \r\n"
 
#define SET_WLAN_AUTH   "set wlan auth %d\r\n"
 
#define SET_WLAN_KEY   "set wlan key %d\r\n"
 
#define SET_WLAN_PHRASE   "set wlan phrase %s\r\n"
 
#define SET_WLAN_SSID   "set wlan ssid %s\r\n"
 
#define SET_WLAN_JOIN   "set wlan join %d\r\n"
 
#define SET_WLAN_CHAN   "set wlan chan %d\r\n"
 
#define SET_DNS_NAME   "set dns name %s\r\n"
 
#define GET_ADHOC   "get adhoc\r\n"
 
#define GET_MAC   "get mac\r\n"
 
#define GET_IP   "get ip a\r\n"
 
#define GET_WLAN   "get wlan\r\n"
 
#define GET_VER   "ver\r\n"
 
#define SHOW_RSSI   "show rssi\r\n"
 
#define SHOW_TIME   "show time\r\n"
 
#define SHOW_CONNECTION   "show connection\r\n"
 
#define AP_MODE   "apmode %s %d"
 
#define CHG_CMD   "$$$"
 
#define CHG_DT   "exit\r\n"
 
#define FACTORYRESET   "factory RESTORE\r\n"
 
#define CLOSE   "close\r\n"
 
#define JOIN   "join %s\r\n"
 
#define LEAVE   "leave\r\n"
 
#define PING   "ping %s\r\n"
 
#define OPEN_CONN   "open %s %d\r\n"
 
#define REBOOT   "reboot\r\n"
 
#define FACTORY_RESET   "factory RESET\r\n"
 
#define SLEEP   "sleep\r\n"
 
#define SAVE   "save\r\n"
 

Functions

uint8_t Wifly_start (uint32_t PortNum, uint32_t baudrate)
 
uint8_t Wifly_logStart (uint32_t PortNum, uint32_t baudrate, uint32_t logSeverity)
 
uint8_t Wifly_ChangeBaudRate (uint32_t baudrate)
 
void Wifly_reset (uint8_t typeReset)
 
uint8_t Wifly_save ()
 
uint8_t Wifly_factoryReset ()
 
uint8_t Wifly_sleep ()
 
uint8_t Wifly_WLANConnect (uint32_t AuthMode, char *ssid, char *passw)
 
uint8_t Wifly_WLANConnectPing (uint32_t AuthMode, char *ssid, char *passw, char *pingIP)
 
uint8_t Wifly_leave ()
 
uint8_t Wifly_WLANConfigConnect (uint32_t AuthMode, char *ssid, char *passw)
 
uint8_t Wifly_ping (char *ip)
 
uint8_t Wifly_open (char *dnsAddress, uint32_t port)
 
uint8_t Wifly_close ()
 
uint8_t Wifly_setIpAddress (char *address)
 
uint8_t Wifly_setIpDHCP (uint8_t mode)
 
uint8_t Wifly_setIpNET (char *address)
 
uint8_t Wifly_setIpFlags (uint32_t mask)
 
uint8_t Wifly_setIpGateway (char *address)
 
uint8_t Wifly_setIpHost (char *address)
 
uint8_t Wifly_setIpLocalPort (uint32_t value)
 
uint8_t Wifly_setIpnetmask (char *address)
 
uint8_t Wifly_setIpProtocol (uint32_t value)
 
uint8_t Wifly_setIpRemote (uint32_t value)
 
uint8_t Wifly_setIpTcpMode (uint32_t value)
 
uint8_t Wifly_setComRemote (char *value)
 
uint8_t Wifly_setOptionFormat (uint32_t value)
 
uint8_t Wifly_setUartMode (uint32_t value)
 
uint8_t Wifly_setUartInstant (uint32_t value)
 
uint8_t Wifly_setUartBaud (uint32_t value)
 
uint8_t Wifly_setWlanTX (uint32_t tx)
 
uint8_t Wifly_setWlanAuth (uint32_t value)
 
uint8_t Wifly_setWlanChannel (uint8_t value)
 
uint8_t Wifly_setWlanJoin (uint32_t value)
 
uint8_t Wifly_setWlanKey (char *value)
 
uint8_t Wifly_setWlanPhrase (char *password)
 
uint8_t Wifly_setWlanSSID (char *value)
 
uint8_t Wifly_setDNSName (char *name)
 
char * Wifly_getIp ()
 
uint8_t Wifly_getChannel ()
 
uint8_t Wifly_getTx ()
 
int32_t Wifly_getRSSI ()
 
uint32_t Wifly_getTime ()
 
char * Wifly_getMac ()
 
char * Wifly_getWlan ()
 
double Wifly_getVer ()
 
uint32_t Wifly_showConnection ()
 
char * Wifly_HTTPReceive (char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
 
uint8_t Wifly_HTTPSend (char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
 
uint8_t Wifly_HTTPConfig (char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
 
char * Wifly_UDPReceive (char *address, uint32_t localPort, uint32_t remotePort, const char *restrict command,...)
 
uint8_t Wifly_UDPSend (char *address, uint32_t localPort, uint32_t remotePort, char *exResp, const char *restrict command,...)
 
uint8_t Wifly_UDPConfig (char *address, uint32_t localPort, uint32_t remotePort)
 
char * Wifly_TCPReceive (char *address, uint32_t remotePort, const char *restrict command,...)
 
uint8_t Wifly_TCPSend (char *address, uint32_t remotePort, char *exResp, const char *restrict command,...)
 
void Wifly_TCPTimeOpen (uint32_t time, char *address, uint32_t remotePort, char *exResp, const char *restrict command,...)
 
void Wifly_TCPTimeOpenDisc ()
 
uint8_t Wifly_TCPConfig (char *address, uint32_t port)
 
uint8_t Wifly_APMode (char *ssid, uint8_t channel)
 
uint8_t Wifly_ConfigAPMode (char *ssid, uint8_t channel, char *ipAddress, char *subnetMask, char *gateway)
 

Variables

xSemaphoreHandle xMutexWifly
 

Macro Definition Documentation

#define AP_MODE   "apmode %s %d"

Definition at line 70 of file WiFly.c.

Referenced by Wifly_APMode().

#define CHG_CMD   "$$$"

Definition at line 71 of file WiFly.c.

#define CHG_DT   "exit\r\n"

Definition at line 72 of file WiFly.c.

#define CLOSE   "close\r\n"

Definition at line 74 of file WiFly.c.

Referenced by Wifly_close().

#define FACTORY_RESET   "factory RESET\r\n"

Definition at line 80 of file WiFly.c.

Referenced by Wifly_factoryReset().

#define FACTORYRESET   "factory RESTORE\r\n"

Definition at line 73 of file WiFly.c.

#define GET_ADHOC   "get adhoc\r\n"

Definition at line 57 of file WiFly.c.

#define GET_IP   "get ip a\r\n"

Definition at line 59 of file WiFly.c.

Referenced by Wifly_getIp().

#define GET_MAC   "get mac\r\n"

Definition at line 58 of file WiFly.c.

Referenced by Wifly_getMac().

#define GET_VER   "ver\r\n"

Definition at line 61 of file WiFly.c.

Referenced by Wifly_getVer().

#define GET_WLAN   "get wlan\r\n"

Definition at line 60 of file WiFly.c.

Referenced by Wifly_getChannel(), Wifly_getTx(), and Wifly_getWlan().

#define JOIN   "join %s\r\n"

Definition at line 75 of file WiFly.c.

Referenced by Wifly_WLANConnect().

#define LEAVE   "leave\r\n"

Definition at line 76 of file WiFly.c.

Referenced by Wifly_leave().

#define OPEN_CONN   "open %s %d\r\n"

Definition at line 78 of file WiFly.c.

Referenced by Wifly_open().

#define PING   "ping %s\r\n"

Definition at line 77 of file WiFly.c.

Referenced by Wifly_ping().

#define REBOOT   "reboot\r\n"

Definition at line 79 of file WiFly.c.

Referenced by Wifly_reset().

#define SAVE   "save\r\n"

Definition at line 84 of file WiFly.c.

Referenced by Wifly_save().

#define SET_COM_REM   "set com remote %s\r\n"

Definition at line 39 of file WiFly.c.

Referenced by Wifly_setComRemote().

#define SET_DNS_NAME   "set dns name %s\r\n"

Definition at line 53 of file WiFly.c.

Referenced by Wifly_setDNSName().

#define SET_IP_ADDRESS   "set ip address %s\r\n"

Definition at line 26 of file WiFly.c.

Referenced by Wifly_setIpAddress().

#define SET_IP_BACKUP   "set ip backup %s\r\n"

Definition at line 27 of file WiFly.c.

#define SET_IP_DHCP   "set ip dhcp %d\r\n"

Definition at line 28 of file WiFly.c.

Referenced by Wifly_setIpDHCP().

#define SET_IP_FLAGS   "set ip flags %x\r\n"

Definition at line 29 of file WiFly.c.

Referenced by Wifly_setIpFlags().

#define SET_IP_GATEWAY   "set ip gateway %s\r\n"

Definition at line 30 of file WiFly.c.

Referenced by Wifly_setIpGateway().

#define SET_IP_HOST   "set ip host %s\r\n"

Definition at line 31 of file WiFly.c.

Referenced by Wifly_setIpHost().

#define SET_IP_LOCAL_PORT   "set ip localport %d\r\n"

Definition at line 32 of file WiFly.c.

Referenced by Wifly_setIpLocalPort().

#define SET_IP_NET   "set ip net %s\r\n"

Definition at line 33 of file WiFly.c.

Referenced by Wifly_setIpNET().

#define SET_IP_NETMASK   "set ip netmask %s\r\n"

Definition at line 34 of file WiFly.c.

Referenced by Wifly_setIpnetmask().

#define SET_IP_PROTO   "set ip proto %d\r\n"

Definition at line 35 of file WiFly.c.

Referenced by Wifly_setIpProtocol().

#define SET_IP_REMOTE   "set ip remote %d\r\n"

Definition at line 36 of file WiFly.c.

Referenced by Wifly_setIpRemote().

#define SET_IP_TCP_MODE   "set ip tcp-mode %x\r\n"

Definition at line 37 of file WiFly.c.

Referenced by Wifly_setIpTcpMode().

#define SET_OP_FORMAT   "set option format %d\r\n"

Definition at line 40 of file WiFly.c.

Referenced by Wifly_setOptionFormat().

#define SET_UART_BAUD   "set uart baud %d \r\n"

Definition at line 42 of file WiFly.c.

Referenced by Wifly_setUartBaud().

#define SET_UART_INST   "set uart instant %d \r\n"

Definition at line 43 of file WiFly.c.

Referenced by Wifly_setUartInstant().

#define SET_UART_MD   "set uart mode %x \r\n"

Definition at line 41 of file WiFly.c.

Referenced by Wifly_reset(), and Wifly_setUartMode().

#define SET_WLAN_AUTH   "set wlan auth %d\r\n"

Definition at line 47 of file WiFly.c.

Referenced by Wifly_setWlanAuth().

#define SET_WLAN_CHAN   "set wlan chan %d\r\n"

Definition at line 52 of file WiFly.c.

Referenced by Wifly_setWlanChannel().

#define SET_WLAN_JOIN   "set wlan join %d\r\n"

Definition at line 51 of file WiFly.c.

Referenced by Wifly_setWlanJoin().

#define SET_WLAN_KEY   "set wlan key %d\r\n"

Definition at line 48 of file WiFly.c.

Referenced by Wifly_setWlanKey().

#define SET_WLAN_PHRASE   "set wlan phrase %s\r\n"

Definition at line 49 of file WiFly.c.

Referenced by Wifly_setWlanPhrase().

#define SET_WLAN_SSID   "set wlan ssid %s\r\n"

Definition at line 50 of file WiFly.c.

Referenced by Wifly_setWlanSSID().

#define SET_WLAN_TX   "set wlan tx %d \r\n"

Definition at line 45 of file WiFly.c.

Referenced by Wifly_setWlanTX().

#define SHOW_CONNECTION   "show connection\r\n"

Definition at line 66 of file WiFly.c.

Referenced by Wifly_showConnection().

#define SHOW_RSSI   "show rssi\r\n"

Definition at line 64 of file WiFly.c.

Referenced by Wifly_getRSSI().

#define SHOW_TIME   "show time\r\n"

Definition at line 65 of file WiFly.c.

Referenced by Wifly_getTime().

#define SLEEP   "sleep\r\n"

Definition at line 81 of file WiFly.c.

Referenced by Wifly_sleep().

Function Documentation

uint8_t Wifly_APMode ( char *  ssid,
uint8_t  channel 
)

Creates a soft AP network on channel.

Parameters
ssidSSID name.
channelConnection channel number.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE. /Caution Only use with firmware 2.45 or higher

Definition at line 1133 of file WiFly.c.

References AOK, AP_MODE, FALSE, SET_DELAY, and TRUE.

uint8_t Wifly_ChangeBaudRate ( uint32_t  baudrate)

Change the UART and wifly baud rate communication

Parameters
baudrateUART port baud rate.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 274 of file WiFly.c.

References FALSE, Log_log(), LV_ERR, LV_INFO, PrintF_delayMs(), PrintF_start(), RESET_SOFTWARE, TRUE, Wifly_reset(), Wifly_save(), and Wifly_setUartBaud().

Here is the call graph for this function:

uint8_t Wifly_close ( )

Close a TCP connection.

Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 493 of file WiFly.c.

References CLOSE, CLOSE_CON, CMD_DELAY, FALSE, Log_log(), LV_INFO, and TRUE.

Referenced by Wifly_TCPReceive(), and Wifly_TCPSend().

Here is the call graph for this function:

uint8_t Wifly_ConfigAPMode ( char *  ssid,
uint8_t  channel,
char *  ipAddress,
char *  subnetMask,
char *  gateway 
)

Sending the command settings necessary to AP mode.

Parameters
ssidSSID name.
channelConnection channel number.
ipAddressLocal IP address
subnetMaskLocal IP subnet mask.
gatewayLocal gateway address.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE. /Caution Only use with firmware 2.45 or higher

Definition at line 1144 of file WiFly.c.

References FALSE, Log_log(), LV_ERR, RESET_SOFTWARE, TRUE, Wifly_getVer(), Wifly_reset(), Wifly_save(), Wifly_setIpAddress(), Wifly_setIpDHCP(), Wifly_setIpGateway(), Wifly_setIpNET(), Wifly_setWlanChannel(), Wifly_setWlanJoin(), Wifly_setWlanSSID(), WLAN_APCON, and xMutexWifly.

Here is the call graph for this function:

uint8_t Wifly_factoryReset ( )

factory Reset

Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 349 of file WiFly.c.

References AOK, CMD_DELAY, FACTORY_RESET, FALSE, and TRUE.

uint8_t Wifly_getChannel ( )

Get wlan command to known wlan channel.

Returns
Channel number.

Definition at line 766 of file WiFly.c.

References FALSE, GET_DELAY, GET_WLAN, Log_log(), LV_INFO, string, and TRUE.

Here is the call graph for this function:

char* Wifly_getIp ( )

Get ip command to known IP address.

Returns
IP address.

Definition at line 752 of file WiFly.c.

References GET_DELAY, GET_IP, Log_log(), LV_INFO, string, and TRUE.

Referenced by Arpalab_sendValue().

Here is the call graph for this function:

char* Wifly_getMac ( )

Get Mac Address.

Returns
MAC Address.

Definition at line 829 of file WiFly.c.

References GET_DELAY, GET_MAC, Log_log(), LV_INFO, string, and TRUE.

Here is the call graph for this function:

int32_t Wifly_getRSSI ( )

Show rssi command to known rssi signal.

Returns
rssi signal (dBm).

Definition at line 799 of file WiFly.c.

References GET_DELAY, Log_log(), LV_INFO, SHOW_RSSI, string, and TRUE.

Here is the call graph for this function:

uint32_t Wifly_getTime ( )

Show time up command response.Return time in seconds since wifly start up.

Returns
time since last start up (s).

Definition at line 814 of file WiFly.c.

References GET_DELAY, Log_log(), LV_INFO, SHOW_TIME, string, and TRUE.

Here is the call graph for this function:

uint8_t Wifly_getTx ( )

Get wlan tx command to known wlan tx power level.

Returns
tx power.

Definition at line 783 of file WiFly.c.

References GET_DELAY, GET_WLAN, Log_log(), LV_INFO, string, and TRUE.

Here is the call graph for this function:

double Wifly_getVer ( )

Get Wifly version

Returns
Wifly firmware version

Definition at line 860 of file WiFly.c.

References GET_DELAY, GET_VER, Log_log(), LV_INFO, string, and TRUE.

Referenced by Wifly_ConfigAPMode().

Here is the call graph for this function:

char* Wifly_getWlan ( )

Get SSID connection name.

Returns
SSID

Definition at line 845 of file WiFly.c.

References GET_DELAY, GET_WLAN, Log_log(), LV_INFO, string, and TRUE.

Here is the call graph for this function:

uint8_t Wifly_HTTPConfig ( char *  dnsAddress,
char *  getCommand,
uint32_t  port,
uint8_t  proto 
)

Sending the command settings necessary to HTTP connection.

Parameters
dnsAddressweb page DNS address.
getCommandget command string format.
portWeb server port connection.
protoIp protocol configuration number.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 932 of file WiFly.c.

References FALSE, MODE_HTTP, TRUE, Wifly_setComRemote(), Wifly_setDNSName(), Wifly_setIpProtocol(), Wifly_setIpRemote(), and Wifly_setOptionFormat().

Referenced by Wifly_HTTPReceive(), and Wifly_HTTPSend().

Here is the call graph for this function:

char* Wifly_HTTPReceive ( char *  dnsAddress,
char *  getCommand,
uint32_t  port,
uint8_t  proto 
)

Send a HTTP command and receive the server response.

Parameters
dnsAddressweb page DNS address.
getCommandget command string format.
portWeb server port connection.
protoIp protocol configuration number.
Returns
string response.

Definition at line 891 of file WiFly.c.

References DATA_M, HTTP_HEAD, TRUE, Wifly_HTTPConfig(), Wifly_open(), and xMutexWifly.

Referenced by Arpalab_receiveValue().

Here is the call graph for this function:

uint8_t Wifly_HTTPSend ( char *  dnsAddress,
char *  getCommand,
uint32_t  port,
uint8_t  proto 
)

Send a HTTP command to send values.

Parameters
dnsAddressweb page DNS address.
getCommandget command string format.
portWeb server port connection.
protoIp protocol configuration number.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 912 of file WiFly.c.

References DATA_M, FALSE, TRUE, Wifly_HTTPConfig(), Wifly_open(), and xMutexWifly.

Referenced by Arpalab_sendValue().

Here is the call graph for this function:

uint8_t Wifly_leave ( )

Leave a join connection

Returns
Returns whether the connection was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 414 of file WiFly.c.

References AOK, FALSE, LEAVE, Log_log(), LV_ERR, LV_INFO, SET_DELAY, and TRUE.

Here is the call graph for this function:

uint8_t Wifly_logStart ( uint32_t  PortNum,
uint32_t  baudrate,
uint32_t  logSeverity 
)

Wifly start Log module to send log information

Parameters
PortNum
baudrateUART port baud rate.
logSeverity
Returns
Returns the result of log initialisation. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 249 of file WiFly.c.

References FALSE, Log_log(), Log_start(), LV_ERR, NULL, and xMutexWifly.

Here is the call graph for this function:

uint8_t Wifly_open ( char *  dnsAddress,
uint32_t  port 
)

Open a TCP connection.

Parameters
dnsAddressdestination DNS or IP address.
portremote port number.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 478 of file WiFly.c.

References FALSE, Log_log(), LV_INFO, OPEN_CON, OPEN_CONN, OPEN_DELAY, and TRUE.

Referenced by Wifly_HTTPReceive(), Wifly_HTTPSend(), Wifly_TCPReceive(), and Wifly_TCPSend().

Here is the call graph for this function:

uint8_t Wifly_ping ( char *  ip)

Ping an IP address

Parameters
ipIP address
Returns
Returns whether the ping was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 465 of file WiFly.c.

References FALSE, Log_log(), LV_INFO, PING, PING_DELAY, PING_OK, and TRUE.

Referenced by Wifly_WLANConnect().

Here is the call graph for this function:

void Wifly_reset ( uint8_t  typeReset)

Reset wifly device to ensure to start from know state

Parameters
typeResetReset type: HARDWARE=0, SOFTWARE=1

Definition at line 299 of file WiFly.c.

References AOK, DATA_M, ECHO_DELAY, FALSE, Log_log(), LV_INFO, MODE_DISCON, PrintF_ChkScan(), PrintF_delayMs(), READY, REBOOT, RST_DELAY, RST_WIFLY_PIN, SET_UART_MD, TRUE, UART_MD, and WLAN_DISCON.

Referenced by Wifly_ChangeBaudRate(), Wifly_ConfigAPMode(), Wifly_start(), Wifly_WLANConfigConnect(), and Wifly_WLANConnect().

Here is the call graph for this function:

uint8_t Wifly_save ( )

Save the configuration settings.

Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 340 of file WiFly.c.

References CMD_DELAY, FALSE, SAVE, SAVE_OK, and TRUE.

Referenced by Wifly_ChangeBaudRate(), Wifly_ConfigAPMode(), and Wifly_WLANConfigConnect().

uint8_t Wifly_setComRemote ( char *  value)

Sets the ASCI string that is sent to the remote TCP client when the TCP port is opened.

Parameters
valueString to send to the remote TCP client.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 618 of file WiFly.c.

References AOK, FALSE, SET_COM_REM, SET_DELAY, and TRUE.

Referenced by Wifly_HTTPConfig(), and Wifly_TCPConfig().

uint8_t Wifly_setDNSName ( char *  value)

sets the name of the host for TCP/IP connections

Parameters
valueDNS Name max 32 charecters.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 742 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_DNS_NAME, and TRUE.

Referenced by Wifly_HTTPConfig().

uint8_t Wifly_setIpAddress ( char *  address)

Sets the WiFly module's IP address.

Parameters
addressIP address
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 508 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_ADDRESS, and TRUE.

Referenced by Wifly_ConfigAPMode().

uint8_t Wifly_setIpDHCP ( uint8_t  value)

Enables/disables DHCP mode.

Parameters
valueDisabled=0, enabled=1
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 518 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_DHCP, and TRUE.

Referenced by Wifly_ConfigAPMode(), and Wifly_WLANConfigConnect().

uint8_t Wifly_setIpFlags ( uint32_t  mask)

Sets the TCP/IP functions

Parameters
maskis a hex number referring to a bit-mapped register. see Figure 2-1 Wifly manual.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 538 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_FLAGS, and TRUE.

uint8_t Wifly_setIpGateway ( char *  address)

Sets the gateway IP address

Parameters
addressIP gateway address.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 548 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_GATEWAY, and TRUE.

Referenced by Wifly_ConfigAPMode().

uint8_t Wifly_setIpHost ( char *  address)

Sets the remote host's IP address

Parameters
addressremote host's IP address
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 558 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_HOST, and TRUE.

Referenced by Wifly_TCPConfig(), and Wifly_UDPConfig().

uint8_t Wifly_setIpLocalPort ( uint32_t  value)

Sets the local port number

Parameters
valueis a decimal number representing the port.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 568 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_LOCAL_PORT, and TRUE.

Referenced by Wifly_UDPConfig().

uint8_t Wifly_setIpNET ( char *  address)

Sets the network mask.

Parameters
addressIP subnet address.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 528 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_NET, and TRUE.

Referenced by Wifly_ConfigAPMode().

uint8_t Wifly_setIpnetmask ( char *  address)

Sets the network mask.

Parameters
address
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 578 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_NETMASK, and TRUE.

uint8_t Wifly_setIpProtocol ( uint32_t  value)

Sets the IP protocol.

Parameters
valueis a bit-mapped register. UDP=0, TCP=2, HTTP... See Figure 2-2 Wifly manual.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 588 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_PROTO, and TRUE.

Referenced by Wifly_HTTPConfig(), Wifly_TCPConfig(), and Wifly_UDPConfig().

uint8_t Wifly_setIpRemote ( uint32_t  value)

Sets the remote host port number.

Parameters
valueport number
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 598 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_REMOTE, and TRUE.

Referenced by Wifly_HTTPConfig(), Wifly_TCPConfig(), and Wifly_UDPConfig().

uint8_t Wifly_setIpTcpMode ( uint32_t  value)

Controls the TCP connect timers, DNSpreferences, and remote configuration options.

Parameters
value
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 608 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_IP_TCP_MODE, and TRUE.

uint8_t Wifly_setOptionFormat ( uint32_t  value)

Sets the HTTP client/web server information.

Parameters
valueis a bitmapped register as shown in Figure 2-4 of wifly manual.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 628 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_OP_FORMAT, and TRUE.

Referenced by Wifly_HTTPConfig(), Wifly_TCPConfig(), and Wifly_UDPConfig().

uint8_t Wifly_setUartBaud ( uint32_t  value)

Change the baud rate

Parameters
valueis 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, or 921600
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 660 of file WiFly.c.

References AOK, DATA_M, FALSE, SET_DELAY, SET_UART_BAUD, and TRUE.

Referenced by Wifly_ChangeBaudRate().

uint8_t Wifly_setUartInstant ( uint32_t  value)

Immediately changes the baud rate

Parameters
valueis 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, or 921600
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 648 of file WiFly.c.

References DATA_M, FALSE, SET_DELAY, SET_UART_INST, and TRUE.

uint8_t Wifly_setUartMode ( uint32_t  value)

Sets Uart mode.

Parameters
valueis a hex number masking a bit-mapped value as shown in Figure 2-7 of wifly manual.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 638 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_UART_MD, and TRUE.

uint8_t Wifly_setWlanAuth ( uint32_t  value)

Sets the authentication mode.

Parameters
valueis a decimal value as shown in Figure 2-13 Wifly manual
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 682 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_AUTH, and TRUE.

Referenced by Wifly_WLANConfigConnect().

uint8_t Wifly_setWlanChannel ( uint8_t  value)

Sets the WLAN channel.

Parameters
valueis a decimal number from 1 to 13 representing a fixed channel
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 692 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_CHAN, and TRUE.

Referenced by Wifly_ConfigAPMode().

uint8_t Wifly_setWlanJoin ( uint32_t  value)

Sets the policy for automatically associating with network access points,where

is one of the options.

Parameters
value0= Manual, 1= Associate with the access point that matches the stored SSID, 2= Associated with any, 4= Create an ad hoc network, 5=Associaed an Soft AP.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 702 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_JOIN, and TRUE.

Referenced by Wifly_ConfigAPMode(), and Wifly_WLANConfigConnect().

uint8_t Wifly_setWlanKey ( char *  password)

sets the WEP-64 or WEP-128 key

Parameters
passwordis 26 ASCII chars in hex without the preceding 0x.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 712 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_KEY, and TRUE.

Referenced by Wifly_WLANConfigConnect().

uint8_t Wifly_setWlanPhrase ( char *  password)

sets the passphrase for WPA and WPA2 security modes

Parameters
passwordis an alphanumeric pass phrase.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 722 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_PHRASE, and TRUE.

Referenced by Wifly_WLANConfigConnect().

uint8_t Wifly_setWlanSSID ( char *  value)

sets the SSID with which the module associates.

Parameters
valueis 1 to 32 characters that represents SSID name.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 732 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_SSID, and TRUE.

Referenced by Wifly_ConfigAPMode(), and Wifly_WLANConfigConnect().

uint8_t Wifly_setWlanTX ( uint32_t  tx)

Set wlan tx command to set wlan tx power level

Parameters
txtx power value (dBm)
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 672 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SET_WLAN_TX, and TRUE.

uint32_t Wifly_showConnection ( )

Get the connection status in the hex format 8(XYZ).

Returns
Return 8(XYZ) is a bit-mapped register providing the information shown in Figure 2-8 of the wifly manual.

Definition at line 876 of file WiFly.c.

References FALSE, GET_DELAY, SHOW_CONNECTION, and string.

uint8_t Wifly_sleep ( )

Puts the module to sleep mode

Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 358 of file WiFly.c.

References AOK, FALSE, SET_DELAY, SLEEP, and TRUE.

uint8_t Wifly_start ( uint32_t  portNum,
uint32_t  baudrate 
)

Wifly start Printf module and connection parameters

Parameters
portNumUART id
baudrateUART baudrate
Returns
Returns the result of wifly initialisation. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 224 of file WiFly.c.

References FALSE, Log_log(), LV_ERR, NULL, PrintF_start(), RESET_HARDWARE, Wifly_reset(), and xMutexWifly.

Here is the call graph for this function:

uint8_t Wifly_TCPConfig ( char *  address,
uint32_t  port 
)

Sending the command settings necessary to UDP connection.

Parameters
addressdestination IP address.
portremote port number.
Returns
Returns whether the configuration was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 1109 of file WiFly.c.

References FALSE, HELLO_CON, MODE_TCP, TRUE, Wifly_setComRemote(), Wifly_setIpHost(), Wifly_setIpProtocol(), Wifly_setIpRemote(), and Wifly_setOptionFormat().

Referenced by Wifly_TCPReceive(), and Wifly_TCPSend().

Here is the call graph for this function:

char* Wifly_TCPReceive ( char *  address,
uint32_t  remotePort,
const char *restrict  command,
  ... 
)

Send a TCP command and receive the server response.

Parameters
addressremote IP address.
remotePortremote port number connection.
commandstring to send.
Returns
String response.

Definition at line 1026 of file WiFly.c.

References DATA_M, TCP_DELAY, TRUE, Wifly_close(), Wifly_open(), Wifly_TCPConfig(), and xMutexWifly.

Referenced by Tcp_receiveValue().

Here is the call graph for this function:

uint8_t Wifly_TCPSend ( char *  address,
uint32_t  remotePort,
char *  exResp,
const char *restrict  command,
  ... 
)

Send a TCP command to send values.

Parameters
addressIP address.
remotePortremote port number.
exRespexpected string response.
commandstring to send.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 1053 of file WiFly.c.

References DATA_M, FALSE, TCP_DELAY, TRUE, Wifly_close(), Wifly_open(), Wifly_TCPConfig(), and xMutexWifly.

Referenced by Tcp_sendValue(), and Wifly_TCPTimeOpen().

Here is the call graph for this function:

void Wifly_TCPTimeOpen ( uint32_t  time,
char *  address,
uint32_t  remotePort,
char *  exResp,
const char *restrict  command,
  ... 
)

Send every time interval a TCP command to send values.

/attention To disable Wifly_TCPTimeOpen you should to call Wifly_TCPTimeOpenDisc in a different task.

Parameters
timetime interval in seconds
addressIP address.
remotePortremote port number.
exRespexpected string response.
commandstring to send.

Definition at line 1081 of file WiFly.c.

References FALSE, PrintF_delayMs(), TRUE, and Wifly_TCPSend().

Here is the call graph for this function:

void Wifly_TCPTimeOpenDisc ( )

Disable TCPTimeOpen

Definition at line 1104 of file WiFly.c.

References FALSE.

uint8_t Wifly_UDPConfig ( char *  address,
uint32_t  localPort,
uint32_t  remotePort 
)

Sending the command settings necessary to UDP connection

Parameters
addressRemote IP address.
localPortLocal port number.
remotePortRemote port number connection.
Returns
Returns whether the configuration was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 1002 of file WiFly.c.

References FALSE, MODE_UDP, TRUE, Wifly_setIpHost(), Wifly_setIpLocalPort(), Wifly_setIpProtocol(), Wifly_setIpRemote(), and Wifly_setOptionFormat().

Referenced by Wifly_UDPReceive(), and Wifly_UDPSend().

Here is the call graph for this function:

char* Wifly_UDPReceive ( char *  address,
uint32_t  localPort,
uint32_t  remotePort,
const char *restrict  command,
  ... 
)

Send a UDP command and receive the server response.

Parameters
addressremote IP address.
localPortlocal port number.
remotePortremote port number connection.
commandCommand string to send.
Returns
String response.

Definition at line 955 of file WiFly.c.

References PrintF_delayMs(), TRUE, UDP_DELAY, Wifly_UDPConfig(), WIFLYBUFSIZE, and xMutexWifly.

Referenced by Udp_receiveValue().

Here is the call graph for this function:

uint8_t Wifly_UDPSend ( char *  address,
uint32_t  localPort,
uint32_t  remotePort,
char *  exResp,
const char *restrict  command,
  ... 
)

Send a UDP command to send values.

Parameters
addressRemote IP address.
localPortLocal port number.
remotePortRemote port number connection.
exRespExpected string response.
commandCommand string to send.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 978 of file WiFly.c.

References FALSE, PrintF_delayMs(), TRUE, UDP_DELAY, Wifly_UDPConfig(), and xMutexWifly.

Referenced by Udp_sendValue().

Here is the call graph for this function:

uint8_t Wifly_WLANConfigConnect ( uint32_t  AuthMode,
char *  ssid,
char *  passw 
)

Sending the command settings necessary to establish WLAN connection.

Parameters
AuthModeis a decimal that represents the authentication mode.
ssidSSID name.
passwpassword of the SSID connection.
Returns
Returns whether the command was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 428 of file WiFly.c.

References FALSE, Log_log(), LV_INFO, MIXED, RESET_SOFTWARE, TRUE, WEP, Wifly_reset(), Wifly_save(), Wifly_setIpDHCP(), Wifly_setWlanAuth(), Wifly_setWlanJoin(), Wifly_setWlanKey(), Wifly_setWlanPhrase(), Wifly_setWlanSSID(), WLAN_CON, WPA1, and WPA2.

Referenced by Wifly_WLANConnect().

Here is the call graph for this function:

uint8_t Wifly_WLANConnect ( uint32_t  AuthMode,
char *  ssid,
char *  passw 
)

Connect to WLAN ssid

Parameters
AuthModeWLAN auth mode
ssidName of WLAN connection
passwWLAN Password
Returns
Returns whether the connection was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 367 of file WiFly.c.

References FALSE, JOIN, JOIN_DELAY, JOIN_OK, Log_log(), LV_ERR, RESET_HARDWARE, TRUE, Wifly_ping(), Wifly_reset(), Wifly_WLANConfigConnect(), and xMutexWifly.

Referenced by Wifly_WLANConnectPing().

Here is the call graph for this function:

uint8_t Wifly_WLANConnectPing ( uint32_t  AuthMode,
char *  ssid,
char *  passw,
char *  pingIP 
)

Connect to WLAN ssid and change IP Ping used to check connection

Parameters
AuthModeWLAN auth mode
ssidName of WLAN connection
passwWLAN Password
pingIPPing address
Returns
Returns whether the connection was successful. SUCCESS = TRUE, ERROR = FALSE.

Definition at line 408 of file WiFly.c.

References Wifly_WLANConnect().

Referenced by Arpalab_receiveValue(), Arpalab_sendValue(), Tcp_receiveValue(), Tcp_sendValue(), Udp_receiveValue(), and Udp_sendValue().

Here is the call graph for this function:

Variable Documentation

xSemaphoreHandle xMutexWifly