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:
41:0afda15e9bb4
Parent:
40:72f70748f6e8
Child:
42:9b3c38d66fa8
--- a/GSwifi.cpp	Thu Aug 01 15:09:49 2013 +0000
+++ b/GSwifi.cpp	Wed Aug 21 13:53:56 2013 +0000
@@ -128,13 +128,14 @@
     memset(&_mac, 0, sizeof(_mac));
     _connect = false;
     _status = GSSTAT_READY;
-    _escape = 0;
+    _escape = false;
     resetResponse(GSRES_NONE);
     _gs_mode = GSMODE_COMMAND;
-    _dhcp = 0;
+    _dhcp = false;
     _ssid = NULL;
     _pass = NULL;
     _reconnect = 0;
+    _reconnect_time = 0;
     _buf_cmd.flush();
 
     wait_ms(100);
@@ -246,10 +247,10 @@
                 DBG("unknown [ESC] %02x\r\n", dat);
                 break;
             }
-            _escape = 0;
+            _escape = false;
         } else {
             if (dat == 0x1b) {
-                _escape = 1;
+                _escape = true;
             } else
             if (dat == '\n') {
                 // end of line
@@ -322,10 +323,10 @@
                 DBG("unknown <ESC> %02x\r\n", dat);
                 break;
             }
-            _escape = 0;
+            _escape = false;
         } else {
             if (dat == 0x1b) {
-                _escape = 1;
+                _escape = true;
             } else {
                 // data
                 if (_gs_sock[_cid].data != NULL) {
@@ -410,7 +411,7 @@
             if (len == 0) {
                 DBG("recv binary %d\r\n", _cid);
                 _gs_sock[_cid].received = true;
-                _escape = 0;
+                _escape = false;
                 _gs_mode = GSMODE_COMMAND;
 
                 if (_gs_sock[_cid].protocol == GSPROT_HTTPGET) {
@@ -484,7 +485,7 @@
             DBG("disassociate\r\n");
             _connect = false;
             _status = GSSTAT_READY;
-            _escape = 0;
+            _escape = false;
             resetResponse(GSRES_NONE);
             _gs_mode = GSMODE_COMMAND;
             for (i = 0; i < 16; i ++) {
@@ -657,13 +658,11 @@
     }
 
     if (_reconnect > 0 && ! _connect) {
-        if (_reconnect_count == 0 || (_reconnect_count < _reconnect && _reconnect_time < time(NULL))) {
-            _reconnect_count ++;
-            DBG("reconnect %d/%d\r\n", _reconnect_count, _reconnect);
-            if (reconnect() == 0) {
-                _reconnect_count = 0;
+        if (_reconnect_time < time(NULL)) {
+            DBG("reconnect %d\r\n", _reconnect_time);
+            if (reconnect()) {
+                _reconnect_time = time(NULL) + _reconnect;
             }
-            _reconnect_time = time(NULL) + GS_RECONTIME;
         }
     }
 }
@@ -824,7 +823,7 @@
     if (r == 0) {
         _connect = true;
         _reconnect = reconnect;
-        _reconnect_count = 0;
+        _reconnect_time = 0;
         _sec = sec;
         _dhcp = dhcp;
         if (_reconnect && ssid) {