Bender Robotics / Mbed 2 deprecated PLAUCI_full

Dependencies:   FatFileSystemCpp mbed PowerControl USBHostLite

Embed: (wiki syntax)

« Back to documentation index

Wifly Class Reference

Wifly Class Reference

The Wifly class. More...

#include <Wifly.h>

Inherited by WiflyInterface.

Public Member Functions

 Wifly (PinName tx, PinName rx, PinName reset, PinName tcp_status, const char *ssid, const char *phrase, Security sec)
 Constructor.
void baudr (int baudrate)
 Set communication baudrate Higher baudrates tends to be unstable.
bool join ()
 Connect the wifi module to the ssid contained in the constructor.
bool disconnect ()
 Disconnect the wifly module from the access point.
bool connect (const char *host, int port)
 Open a tcp connection with the specified host on the specified port.
bool setProtocol (Protocol p)
 Set the protocol (UDP or TCP)
void reset ()
 Reset the wifi module.
bool reboot ()
 Reboot the wifi module.
int readable ()
 Check if characters are available.
int writeable ()
 Check if characters are available.
bool is_connected ()
 Check if a tcp link is active.
char getc ()
 Read a character.
void flush ()
 Flush the buffer.
int putc (char c)
 Write a character.
bool cmdMode ()
 To enter in command mode (we can configure the module)
bool exit ()
 To exit the command mode.
bool close ()
 Close a tcp connection.
int send (const char *str, int len, const char *ACK=NULL, char *res=NULL, int timeout=DEFAULT_WAIT_RESP_TIMEOUT)
 Send a string to the wifi module by serial port.
bool sendCommand (const char *cmd, const char *ack=NULL, char *res=NULL, int timeout=DEFAULT_WAIT_RESP_TIMEOUT)
 Send a command to the wify module.
bool isDHCP ()
 Return true if the module is using dhcp.

Detailed Description

The Wifly class.

Definition at line 50 of file Wifly.h.


Constructor & Destructor Documentation

Wifly ( PinName  tx,
PinName  rx,
PinName  reset,
PinName  tcp_status,
const char *  ssid,
const char *  phrase,
Security  sec 
)

Constructor.

Parameters:
txmbed pin to use for tx line of Serial interface
rxmbed pin to use for rx line of Serial interface
resetreset pin of the wifi module ()
tcp_statusconnection status pin of the wifi module (GPIO 6)
ssidssid of the network
phraseWEP or WPA key
secSecurity type (NONE, WEP_128 or WPA)

Definition at line 45 of file Wifly.cpp.


Member Function Documentation

void baudr ( int  baudrate )

Set communication baudrate Higher baudrates tends to be unstable.

Definition at line 68 of file Wifly.cpp.

bool close (  )

Close a tcp connection.

Returns:
true if successful

Definition at line 387 of file Wifly.cpp.

bool cmdMode (  )

To enter in command mode (we can configure the module)

Returns:
true if successful, false otherwise

Definition at line 331 of file Wifly.cpp.

bool connect ( const char *  host,
int  port 
)

Open a tcp connection with the specified host on the specified port.

Parameters:
hosthost (can be either an ip address or a name. If a name is provided, a dns request will be established)
portport
Returns:
true if successful

Definition at line 230 of file Wifly.cpp.

bool disconnect (  )

Disconnect the wifly module from the access point.

Returns:
true if successful

Reimplemented in WiflyInterface.

Definition at line 346 of file Wifly.cpp.

bool exit (  )

To exit the command mode.

Returns:
true if successful, false otherwise

Definition at line 410 of file Wifly.cpp.

void flush (  )

Flush the buffer.

Definition at line 313 of file Wifly.cpp.

char getc (  )

Read a character.

Returns:
the character read

Definition at line 433 of file Wifly.cpp.

bool is_connected ( void   )

Check if a tcp link is active.

Returns:
true if successful

Definition at line 361 of file Wifly.cpp.

bool isDHCP (  )

Return true if the module is using dhcp.

Returns:
true if the module is using dhcp

Definition at line 208 of file Wifly.h.

bool join (  )

Connect the wifi module to the ssid contained in the constructor.

Returns:
true if connected, false otherwise

Definition at line 84 of file Wifly.cpp.

int putc ( char  c )

Write a character.

Parameters:
thecharacter which will be written

Definition at line 403 of file Wifly.cpp.

int readable ( void   )

Check if characters are available.

Returns:
number of available characters

Definition at line 423 of file Wifly.cpp.

bool reboot (  )

Reboot the wifi module.

Definition at line 375 of file Wifly.cpp.

void reset (  )

Reset the wifi module.

Definition at line 367 of file Wifly.cpp.

int send ( const char *  str,
int  len,
const char *  ACK = NULL,
char *  res = NULL,
int  timeout = DEFAULT_WAIT_RESP_TIMEOUT 
)

Send a string to the wifi module by serial port.

This function desactivates the user interrupt handler when a character is received to analyze the response from the wifi module. Useful to send a command to the module and wait a response.

Parameters:
strstring to be sent
lenstring length
ACKstring which must be acknowledge by the wifi module. If ACK == NULL, no string has to be acknoledged. (default: "NO")
resthis field will contain the response from the wifi module, result of a command sent. This field is available only if ACK = "NO" AND res != NULL (default: NULL)
Returns:
true if ACK has been found in the response from the wifi module. False otherwise or if there is no response in 5s.

Definition at line 457 of file Wifly.cpp.

bool sendCommand ( const char *  cmd,
const char *  ack = NULL,
char *  res = NULL,
int  timeout = DEFAULT_WAIT_RESP_TIMEOUT 
)

Send a command to the wify module.

Check if the module is in command mode. If not enter in command mode

Parameters:
strstring to be sent
ACKstring which must be acknowledge by the wifi module. If ACK == NULL, no string has to be acknoledged. (default: "NO")
resthis field will contain the response from the wifi module, result of a command sent. This field is available only if ACK = "NO" AND res != NULL (default: NULL)
Returns:
true if successful

Definition at line 318 of file Wifly.cpp.

bool setProtocol ( Protocol  p )

Set the protocol (UDP or TCP)

Parameters:
pprotocol
Returns:
true if successful

Definition at line 191 of file Wifly.cpp.

int writeable (  )

Check if characters are available.

Returns:
number of available characters

Definition at line 428 of file Wifly.cpp.