gs fan / Mbed 2 deprecated Wirefree_sample

Dependencies:   mbed

Revision:
0:bf663118b11b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun May 27 03:19:54 2012 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "Wirefree.h"
+
+WIFI_PROFILE w_prof = {
+    "GSWIFI",
+    "PASSWORD",
+    IpAddr(0,0,0,0),
+    IpAddr(0,0,0,0),
+    IpAddr(0,0,0,0)
+};
+Host server = Host(IpAddr(0,0,0,0), 80, "mbed.org");
+
+Wirefree wireless(p13, p14);
+//Wirefree wireless(p13, p14, p12, P0_22); // TX, RX, CTS, RTS
+
+WifiClient client(wireless, server);
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED1);
+
+void parseRxData(char *data, int len)
+{
+}
+
+int main() {
+    char c;
+
+    pc.baud(115200);
+
+    wireless.begin(&w_prof, &parseRxData);
+
+    pc.printf("client connecting...\r\n");
+    if (client.connect()) {
+        myled = 1;
+        pc.printf("connection Success..\r\n");
+    
+        // Make a HTTP request:
+        client.printf("GET / HTTP/1.0\r\n\r\n");
+//        client.flush();
+    } else {
+        pc.printf("connection failed..\r\n");
+        return -1;
+    }
+
+    for (;;) {
+        if (client.available()) {
+            c = client.getc();
+            if (c >= 0x20 && c < 0x7f) {
+                pc.putc(c);
+            } else {
+                pc.printf(" %02x ", c);
+            }
+        }
+        if (!client.connected()) {
+            pc.printf("disconnecting.\r\n");
+            client.stop();
+            myled = 0;
+            break;
+        }
+    }
+}