Control a robot over the internet using UDP and a Wifly module (WiFi).

Dependencies:   Motor TextLCD WiflyInterface mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

WiflyInterface Class Reference

WiflyInterface Class Reference

Interface using Wifly to connect to an IP-based network. More...

#include <WiflyInterface.h>

Inherits Wifly.

Public Member Functions

 WiflyInterface (PinName tx, PinName rx, PinName reset, PinName tcp_status, const char *ssid, const char *phrase, Security sec=NONE)
 Constructor.
int init ()
 Initialize the interface with DHCP.
int init (const char *ip, const char *mask, const char *gateway)
 Initialize the interface with a static IP address.
int connect ()
 Connect Bring the interface up, start DHCP if needed.
int disconnect ()
 Disconnect Bring the interface down.
char * getIPAddress ()
 Get IP address.

Detailed Description

Interface using Wifly to connect to an IP-based network.

Definition at line 28 of file WiflyInterface.h.


Constructor & Destructor Documentation

WiflyInterface ( PinName  tx,
PinName  rx,
PinName  reset,
PinName  tcp_status,
const char *  ssid,
const char *  phrase,
Security  sec = NONE 
)

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 3 of file WiflyInterface.cpp.


Member Function Documentation

int connect (  )

Connect Bring the interface up, start DHCP if needed.

Returns:
0 on success, a negative number on failure

Definition at line 30 of file WiflyInterface.cpp.

int disconnect (  )

Disconnect Bring the interface down.

Returns:
0 on success, a negative number on failure

Definition at line 35 of file WiflyInterface.cpp.

char * getIPAddress (  )

Get IP address.

@ returns ip address

Definition at line 40 of file WiflyInterface.cpp.

int init ( const char *  ip,
const char *  mask,
const char *  gateway 
)

Initialize the interface with a static IP address.

Initialize the interface and configure it with the following static configuration (no connection at this point).

Parameters:
ipthe IP address to use
maskthe IP address mask
gatewaythe gateway to use
Returns:
0 on success, a negative number on failure

Definition at line 17 of file WiflyInterface.cpp.

int init ( void   )

Initialize the interface with DHCP.

Initialize the interface and configure it to use DHCP (no connection at this point).

Returns:
0 on success, a negative number on failure

Definition at line 10 of file WiflyInterface.cpp.