GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Dependents:   GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more

Fork of GSwifi by gs fan

GainSpan Wi-Fi library

The GS1011 is an ultra low power 802.11b wireless module from GainSpan.

see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

/media/uploads/gsfan/gs_im_002.jpg /media/uploads/gsfan/gs1011m_2.jpg

ゲインスパン Wi-Fi モジュール ライブラリ

ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。

解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/

Revision:
2:c6e0e97901b3
Parent:
1:b127c6c5241d
Child:
3:1345daf4ec1a
--- a/GSwifi.cpp	Thu Jul 12 08:19:50 2012 +0000
+++ b/GSwifi.cpp	Thu Jul 12 13:36:04 2012 +0000
@@ -289,7 +289,9 @@
         // dummy CR+LF
         _gs.printf("\r\n");
         wait_ms(100);
-        while (_gs.readable()) _gs_getc(); // dummy read
+        while (_gs.readable()) {
+            _gs_getc(); // dummy read
+        }
         return 0;
     }
 
@@ -654,6 +656,7 @@
     netmask = _netmask;
     gateway = _gateway;
     nameserver = _nameserver;
+    return 0;
 }
 
 int GSwifi::getHostByName (const char* name, IpAddr &addr) {
@@ -689,18 +692,14 @@
     return command(cmd, GSRES_NORMAL);
 }
 
-int GSwifi::powerSave (int beacon, int association) {
+int GSwifi::powerSave (int active, int save) {
     char cmd[GS_CMD_SIZE];
 
     if (_status != GSSTAT_READY) return -1;
 
-    sprintf(cmd, "AT+WAPSM=%d", association);
+    sprintf(cmd, "AT+WRXACTIVE=%d", active);
     command(cmd, GSRES_NORMAL);
-    if (beacon) {
-        sprintf(cmd, "AT+WRXPS=1,%d", beacon);
-    } else {
-        strcpy(cmd, "AT+WRXPS=0");
-    }
+    sprintf(cmd, "AT+WRXPS=1,%d", save);
     return command(cmd, GSRES_NORMAL);
 }
 
@@ -845,7 +844,7 @@
     }
 }
 
-int GSwifi::newSock (int cid, GSTYPE type, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive) {
+void GSwifi::newSock (int cid, GSTYPE type, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive) {
     _gs_sock[cid].type = type;
     _gs_sock[cid].protocol = pro;
     _gs_sock[cid].connect = true;
@@ -1096,10 +1095,13 @@
 // for test
 
 void GSwifi::test () {
+/*
     command(NULL, GSRES_NORMAL);
     wait_ms(100);
     command("AT+NCLOSEALL", GSRES_NORMAL);
     _connect = true;
+*/
+    command("AT+WRXACTIVE=1", GSRES_NORMAL);
 }
 
 int GSwifi::getc() {