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/

Files at this revision

API Documentation at this revision

Comitter:
gsfan
Date:
Tue Jul 23 02:56:47 2013 +0000
Parent:
38:dfc31d58fa1d
Child:
40:72f70748f6e8
Commit message:
fix setAddress, status

Changed in this revision

GSwifi.cpp Show annotated file Show diff for this revision Revisions of this file
GSwifi.h Show annotated file Show diff for this revision Revisions of this file
--- a/GSwifi.cpp	Mon Jul 22 01:50:14 2013 +0000
+++ b/GSwifi.cpp	Tue Jul 23 02:56:47 2013 +0000
@@ -471,26 +471,35 @@
         } else
         if (strncmp(buf, "DISASSOCIATED", 13) == 0 ||
           strncmp(buf, "Disassociated", 13) == 0 ||
-          strncmp(buf, "Disassociation Event", 20) == 0 ||
-          strncmp(buf, "UnExpected Warm Boot", 20) == 0 ||
+          strncmp(buf, "Disassociation Event", 20) == 0 ) {
+            _connect = false;
+            for (i = 0; i < 16; i ++) {
+                _gs_sock[i].connect = false;
+            }
+        } else
+        if (strncmp(buf, "UnExpected Warm Boot", 20) == 0 ||
           strncmp(buf, "APP Reset-APP SW Reset", 22) == 0 ||
           strncmp(buf, "APP Reset-Wlan Except", 21) == 0 ) {
             DBG("disassociate\r\n");
             _connect = false;
+            _status = GSSTAT_READY;
+            _escape = 0;
+            resetResponse(GSRES_NONE);
+            _gs_mode = GSMODE_COMMAND;
             for (i = 0; i < 16; i ++) {
                 _gs_sock[i].connect = false;
             }
         } else
         if (strncmp(buf, "Out of StandBy-Timer", 20) == 0 ||
           strncmp(buf, "Out of StandBy-Alarm", 20) == 0) {
-//            if (_status == GSSTAT_STANDBY) {
+            if (_status == GSSTAT_STANDBY) {
                 _status = GSSTAT_WAKEUP;
-//            }
+            }
         } else 
         if (strncmp(buf, "Out of Deep Sleep", 17) == 0 ) {
-//            if (_status == GSSTAT_DEEPSLEEP) {
+            if (_status == GSSTAT_DEEPSLEEP) {
                 _status = GSSTAT_READY;
-//            }
+            }
         }
         DBG("status: %d\r\n", _status);
     }
@@ -954,7 +963,7 @@
     } else {
         strcpy(cmd, "AT+NDHCP=1," GS_DHCPNAME);
     }
-    if (command(cmd, GSRES_DHCP), GS_TIMEOUT2) return -1;
+    if (command(cmd, GSRES_DHCP, GS_TIMEOUT2)) return -1;
     if (_ipaddr.isNull()) return -1;
     return 0;
 }
@@ -1094,7 +1103,7 @@
 
     if (_status == GSSTAT_READY) {
         command("AT+WRXACTIVE=0", GSRES_NORMAL);
-        command("AT+STORENWCONN", GSRES_NORMAL);
+        command("AT+STORENWCONN", GSRES_NORMAL, 100);
     } else {
         command("ATE0", GSRES_NORMAL);
         if (_rts) {
--- a/GSwifi.h	Mon Jul 22 01:50:14 2013 +0000
+++ b/GSwifi.h	Tue Jul 23 02:56:47 2013 +0000
@@ -300,6 +300,13 @@
      * @return RSSI (dBm)
      */
     int getRssi ();
+
+    char *getSsid () {
+        return _ssid;
+    }
+    char *getPass () {
+        return _pass;
+    }
 #ifndef GS_LIB_TINY
     /**
      * RF power