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

Fork of GSwifi_old 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/

Information

Please change the baud rate in advance.

  • ATB=115200
  • AT&W0

It may be better and sometimes faster.
GSwifi gs(p13, p14, baud);

Heavily modified new library: http://mbed.org/users/gsfan/code/GSwifi

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

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

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

Information

モジュールはあらかじめ次のコマンドでボーレートを変更しておく。

  • ATB=115200
  • AT&W0

場合によってはもっと高速の方がいいかもしれない。クラス宣言時にレート設定をする。
GSwifi gs(p13, p14, baud);

大幅に更新された新しいライブラリ: http://mbed.org/users/gsfan/code/GSwifi

Revision:
24:5c350ae2e703
Parent:
23:a783c62c36d0
--- a/GSwifi_httpd.cpp	Mon Jan 21 05:58:28 2013 +0000
+++ b/GSwifi_httpd.cpp	Wed Jan 23 07:41:23 2013 +0000
@@ -174,8 +174,13 @@
 #ifdef GS_USE_WEBSOCKET
     if (flg && _httpd[cid].mode == GSHTTPDMODE_WEBSOCKET) {
         // websocket
+        _httpd[cid].host = _gs_sock[cid].host;
+        j = strlen(_handler[i].uri);
+        _httpd[cid].file = &_httpd[cid].uri[j];
+        _httpd[cid].query = NULL;
+
         send_websocket_accept(cid);
-        break; // break while
+        break; // exit while
 
     } else
 #endif
@@ -256,7 +261,7 @@
     strcpy(file, dir);
     strcat(file, gshttpd->file);
     if (file[strlen(file) - 1] == '/') {
-        strcat(file, "index.htm");
+        strcat(file, "index.html");
     }
     DBG("file: %s\r\n", file);
     
@@ -488,16 +493,11 @@
       case 0x02: // binary
         i = get_handler(_httpd[cid].uri);
         if (i >= 0) {
-            _httpd[cid].host = _gs_sock[cid].host;
-            j = strlen(_handler[i].uri);
-            _httpd[cid].file = &_httpd[cid].uri[j];
-            _httpd[cid].query = NULL;
-
             if (_handler[i].onHttpCgi) {
                 // cgi
                 _handler[i].onHttpCgi(cid, &_httpd[cid]);
                 LOG("%d.%d.%d.%d ", _httpd[cid].host.getIp()[0], _httpd[cid].host.getIp()[1], _httpd[cid].host.getIp()[2], _httpd[cid].host.getIp()[3]);
-                LOG("%s %s %d 200 -\r\n", _httpd[cid].type == GSPROT_HTTPGET ? "GET" : "POST", _httpd[cid].uri, _httpd[cid].length);
+                LOG("%s %s %d 200 -\r\n", "WEBSOCKET", _httpd[cid].uri, _httpd[cid].length);
                 flg = 1;
             }
         }
@@ -561,7 +561,6 @@
     base64encode(buf2, 20, buf, sizeof(buf));
     send(cid, buf, strlen(buf));
     send(cid, "\r\n", 2);
-
 //    send(cid, "Sec-WebSocket-Protocol: chat\r\n", 30);
     send(cid, "\r\n", 2);
     LOG("%d.%d.%d.%d ", _httpd[cid].host.getIp()[0], _httpd[cid].host.getIp()[1], _httpd[cid].host.getIp()[2], _httpd[cid].host.getIp()[3]);