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)

Revision:
8:64184a968e3b
Parent:
5:78943b3945b5
Child:
11:71d67fea5ace
--- a/Socket/TCPSocketServer.cpp	Wed Jan 30 05:52:14 2013 +0000
+++ b/Socket/TCPSocketServer.cpp	Thu Oct 31 06:41:45 2013 +0000
@@ -31,15 +31,12 @@
 }
 
 int TCPSocketServer::listen(int backlog) {
-    char cmd[CFG_CMD_SIZE];
-
     _server = true;
     if (_cid < 0) {
         // Socket open
         _server = false;
-        sprintf(cmd, "AT+NSTCP=%d", _port);
-        if (_wifi->sendCommand(cmd, GSwifi::RES_CONNECT) == false) return -1;
-        _cid = _wifi->readCID();
+        _cid = _wifi->listen(GSwifi::PROTO_TCP, _port);
+        if (_cid < 0) return -1;
     }
 
     if (backlog != 1)
@@ -49,11 +46,13 @@
 
 
 int TCPSocketServer::accept(TCPSocketConnection& connection) {
-    int acid;
+    int acid = -1;
     while (1) {
-        acid = _wifi->readACID();
+        while (acid < 0) {
+            acid = _wifi->accept(_cid);
+        }
         if (acid >= 0) {
-            connection.confCID(acid);
+            connection.acceptCID(acid);
             return 0;
         }
     }