GSwifiInterface library (interface for GainSpan Wi-Fi GS1011 modules) Please see https://mbed.org/users/gsfan/notebook/GSwifiInterface/

Dependents:   GSwifiInterface_HelloWorld GSwifiInterface_HelloServo GSwifiInterface_UDPEchoServer GSwifiInterface_UDPEchoClient ... more

Fork of WiflyInterface by mbed official

GainSpan Wi-Fi library

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

mbed RTOS supported.

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

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

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

mbed RTOS に対応しています。(mbed2.0)

Files at this revision

API Documentation at this revision

Comitter:
gsfan
Date:
Thu Jun 05 06:06:19 2014 +0000
Parent:
19:d035412a7803
Child:
21:6431364fc667
Commit message:
bug fix

Changed in this revision

GSwifi/GSwifi.cpp Show annotated file Show diff for this revision Revisions of this file
GSwifi/GSwifi_conf.h Show annotated file Show diff for this revision Revisions of this file
GSwifi/GSwifi_httpd.cpp Show annotated file Show diff for this revision Revisions of this file
GSwifi/GSwifi_httpd_util.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/GSwifi/GSwifi.cpp	Thu Jun 05 04:21:02 2014 +0000
+++ b/GSwifi/GSwifi.cpp	Thu Jun 05 06:06:19 2014 +0000
@@ -34,10 +34,10 @@
     _state.cid = -1;
 #ifdef CFG_EXTENDED_MEMORY1
     int n = CFG_EXTENDED_SIZE1 / (CFG_MAX_SOCKETS + 1);
-    _state.buf = new CircBuffer<char>(n - 1, CFG_EXTENDED_MEMORY1);
+    _state.buf = new CircBuffer<char>(n - 1, (void*)CFG_EXTENDED_MEMORY1);
 #ifdef CFG_ENABLE_RTOS
     for (int i = 0; i < CFG_MAX_SOCKETS; i ++) {
-        _con[i].buf = new CircBuffer<char>(n - 1, CFG_EXTENDED_MEMORY1 + (n * (i + 1)));
+        _con[i].buf = new CircBuffer<char>(n - 1, (void*)(CFG_EXTENDED_MEMORY1 + (n * (i + 1))));
         if (_con[i].buf == NULL)
             error("CircBuffer failed");
     }
@@ -386,16 +386,9 @@
 
     INFO("threadPoll");
     for (;;) {
-        _wifi->poll();
-#ifdef CFG_ENABLE_HTTPD
-        if (_wifi->isAssociated()) {
-            Thread::wait(1);
-        }
-#else
         Thread::signal_wait(1);
         Thread::wait(1000);
         INFO("disassociated");
-#endif
         while (!_wifi->isAssociated()){
             _wifi->poll();
             Thread::wait(CFG_RECONNECT * 1000);
--- a/GSwifi/GSwifi_conf.h	Thu Jun 05 04:21:02 2014 +0000
+++ b/GSwifi/GSwifi_conf.h	Thu Jun 05 06:06:19 2014 +0000
@@ -34,9 +34,9 @@
 #endif
 /*
 #if defined(TARGET_LPC1768) || defined(TARGET_LPC176X)
-#define CFG_EXTENDED_MEMORY1 0x20080000
+#define CFG_EXTENDED_MEMORY1 0x2007c000
 #define CFG_EXTENDED_SIZE1 0x4000
-#define CFG_EXTENDED_MEMORY2 0x2007e000
+#define CFG_EXTENDED_MEMORY2 0x20082000
 #define CFG_EXTENDED_SIZE2 0x2000
 #endif
 */
--- a/GSwifi/GSwifi_httpd.cpp	Thu Jun 05 04:21:02 2014 +0000
+++ b/GSwifi/GSwifi_httpd.cpp	Thu Jun 05 06:06:19 2014 +0000
@@ -233,7 +233,9 @@
             _httpd[cid].uri[i] = 0;
             INFO("URI %d '%s'", _httpd[cid].req, _httpd[cid].uri);
             _httpd[cid].mode = HTTPDMODE_HEADER;
-            _httpd[cid].buf->flush();
+            if (_httpd[cid].buf != NULL) {
+                _httpd[cid].buf->flush();
+            }
             _httpd[cid].length = 0;
             _httpd[cid].n = 0;
             _httpd[cid].filename = NULL;
--- a/GSwifi/GSwifi_httpd_util.cpp	Thu Jun 05 04:21:02 2014 +0000
+++ b/GSwifi/GSwifi_httpd_util.cpp	Thu Jun 05 06:06:19 2014 +0000
@@ -23,15 +23,15 @@
 int GSwifi::httpdFile (int cid, char *dir) {
     FILE *fp;
     int i, len;
-    char buf[CFG_DATA_SIZE];
-    char file[CFG_CMD_SIZE];
+    char buf[256];
+    char file[80];
 
     INFO("httpdFile %d %s", cid, dir);
 
     strcpy(file, dir);
-    strcat(file, _httpd[cid].filename);
+    strncat(file, _httpd[cid].filename, sizeof(file) - strlen(file) - 1);
     if (file[strlen(file) - 1] == '/') {
-        strcat(file, "index.html");
+        strncat(file, "index.html", sizeof(file) - strlen(file) - 1);
     }
     DBG("file: %s\r\n", file);