A library for talking to Multi-Tech's Cellular SocketModem Devices.

Dependents:   M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more

Files at this revision

API Documentation at this revision

Comitter:
jengbrecht
Date:
Tue Dec 31 22:58:53 2013 +0000
Parent:
119:544578fd290c
Child:
121:5a7fba896c98
Commit message:
Updated Wifi documentation

Changed in this revision

io/MTSSerial.h Show annotated file Show diff for this revision Revisions of this file
wifi/Wifi.h Show annotated file Show diff for this revision Revisions of this file
--- a/io/MTSSerial.h	Tue Dec 31 22:09:21 2013 +0000
+++ b/io/MTSSerial.h	Tue Dec 31 22:58:53 2013 +0000
@@ -25,7 +25,7 @@
     * @param rxBufferSize the size in bytes of the internal SW receive buffer. The
     * default is 64 bytes.
     */
-    MTSSerial(PinName TXD, PinName RXD, int txBufferSize = 64, int rxBufferSize = 64);
+    MTSSerial(PinName TXD, PinName RXD, int txBufferSize = 256, int rxBufferSize = 256);
 
     /** Destructs an MTSSerial object and frees all related resources, including
     * internal buffers.
--- a/wifi/Wifi.h	Tue Dec 31 22:09:21 2013 +0000
+++ b/wifi/Wifi.h	Tue Dec 31 22:58:53 2013 +0000
@@ -24,6 +24,48 @@
 * the SocketModem Shield Arduino compatible board. Please chage Pin Names accordingly to
 * match your hardware configuration. The default baud rate for the WiFi module is 9600 bps.
 *
+* The following example shows how to connect to a WiFi netork and perform a basic ping test:
+* @code
+* #include "mbed.h"
+* #include "MTSSerial.h"
+* #include "Wifi.h"
+* using namespace mts;
+*
+* int main()
+* {
+*   std::string ssid = "Your SSID goes here";
+*   std::string securityKey = "Your secuirty key goes here";
+*   Wifi::SecurityType securityType = Wifi::WPA2;
+*    
+*   //Wait for wifi module to boot up
+*   for (int i = 10; i >= 0; i = i - 2) {
+*       wait(2);
+*       printf("Waiting %d seconds...\n\r", i);
+*   }    
+*
+*   //Setup serial interface to WiFi module
+*   MTSSerial* serial = new MTSSerial(PTD3, PTD2, 256, 256);
+*   serial->baud(9600);
+*    
+*   //Setup Wifi class
+*   Wifi* wifi = Wifi::getInstance();
+*   printf("Init: %s\n\r", wifi->init(serial) ? "SUCCESS" : "FAILURE");
+*    
+*   //Setup and check connection
+*   printf("Set Network: %s\n\r", getCodeNames(wifi->setNetwork(ssid, securityType, securityKey)).c_str());
+*   printf("Set DHCP: %s\n\r", getCodeNames(wifi->setDeviceIP("DHCP")).c_str());
+*   printf("Connect: %s\n\r", wifi->connect() ? "Success" : "Failure");
+*   printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False");
+*   printf("Ping Server: %s\n\r", wifi->ping("8.8.8.8") ? "Success" : "Failed");
+*    
+*   //Disconnect from network
+*   printf("Disconnecting...\n\r");
+*   wifi->disconnect();
+*   printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False");
+* 
+*   printf("End Program\n\r");
+* }
+* @endcode
 */
 class Wifi : public IPStack
 {