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:
37:e61ea8267415
Parent:
36:a70b11e1560f
--- a/GSwifi_sock.cpp	Mon Jun 24 07:36:48 2013 +0000
+++ b/GSwifi_sock.cpp	Wed Jun 26 02:39:59 2013 +0000
@@ -102,7 +102,7 @@
     int i;
     char cmd[GS_CMD_SIZE];
 
-    if ((! _gs_sock[cid].connect) || waitCts()) return -1;
+    if ((! _gs_sock[cid].connect) || acquireUart()) return -1;
 
     if ((_gs_sock[cid].protocol == GSPROT_TCP) ||
       (_gs_sock[cid].protocol == GSPROT_UDP && _gs_sock[cid].type == GSTYPE_CLIENT) ||
@@ -118,7 +118,8 @@
             DBG("%c", buf[i]);
 #endif
         }
-#else
+        releaseUart();
+#else // GS_BULK
         sprintf(cmd, "\x1bS%X", cid);
         _gs_puts(cmd);
         for (i = 0; i < len; i ++) {
@@ -131,8 +132,10 @@
         }
         _gs_putc(0x1b);
         _gs_putc('E');
+        releaseUart();
 #endif
     } else {
+        releaseUart();
         return -1;
     }
     
@@ -143,7 +146,7 @@
     char cmd[GS_CMD_SIZE];
     int i;
 
-    if ((! _gs_sock[cid].connect) || waitCts()) return -1;
+    if ((! _gs_sock[cid].connect) || acquireUart()) return -1;
 
     if ((_gs_sock[cid].protocol == GSPROT_UDP && _gs_sock[cid].type == GSTYPE_SERVER)) {
         // UDP Server
@@ -157,7 +160,8 @@
             DBG("%c", buf[i]);
 #endif
         }
-#else
+        releaseUart();
+#else // GS_BULK
         sprintf(cmd, "\x1bU%X%d.%d.%d.%d:%d:", cid, host.getIp()[0], host.getIp()[1], host.getIp()[2], host.getIp()[3], host.getPort());
         _gs_puts(cmd);
         for (i = 0; i < len; i ++) {
@@ -170,8 +174,10 @@
         }
         _gs_putc(0x1b);
         _gs_putc('E');
+        releaseUart();
 #endif
     } else {
+        releaseUart();
         return -1;
     }