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
GainSpan Wi-Fi library
The GS1011/GS2100 is an ultra low power 802.11b wireless module from GainSpan.
mbed RTOS supported.
- about this library: http://mbed.org/users/gsfan/notebook/GSwifiInterface/
- about Wi-Fi module: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011/GS2100 シリーズ用のライブラリです。
mbed RTOS に対応しています。(mbed2.0)
- このライブラリについて: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
- Wi-FIモジュールについて: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
- UARTコマンド、SPIデータインターフェースに対応しました。(2019/09)
Socket/TCPSocketConnection.h@22:d25a5a0d2497, 2019-09-24 (annotated)
- Committer:
- gsfan
- Date:
- Tue Sep 24 06:24:37 2019 +0000
- Revision:
- 22:d25a5a0d2497
- Parent:
- 8:64184a968e3b
UART Command and SPI Data supported.; bug fix.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsfan | 5:78943b3945b5 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
gsfan | 5:78943b3945b5 | 2 | * |
gsfan | 5:78943b3945b5 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
gsfan | 5:78943b3945b5 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
gsfan | 5:78943b3945b5 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
gsfan | 5:78943b3945b5 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
gsfan | 5:78943b3945b5 | 7 | * furnished to do so, subject to the following conditions: |
gsfan | 5:78943b3945b5 | 8 | * |
gsfan | 5:78943b3945b5 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
gsfan | 5:78943b3945b5 | 10 | * substantial portions of the Software. |
gsfan | 5:78943b3945b5 | 11 | * |
gsfan | 5:78943b3945b5 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
gsfan | 5:78943b3945b5 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
gsfan | 5:78943b3945b5 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
gsfan | 5:78943b3945b5 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
gsfan | 5:78943b3945b5 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
gsfan | 5:78943b3945b5 | 17 | */ |
gsfan | 5:78943b3945b5 | 18 | /* Copyright (C) 2013 gsfan, MIT License |
gsfan | 5:78943b3945b5 | 19 | * port to the GainSpan Wi-FI module GS1011 |
gsfan | 5:78943b3945b5 | 20 | */ |
gsfan | 5:78943b3945b5 | 21 | |
gsfan | 5:78943b3945b5 | 22 | #ifndef TCPSOCKET_H |
gsfan | 5:78943b3945b5 | 23 | #define TCPSOCKET_H |
gsfan | 5:78943b3945b5 | 24 | |
gsfan | 5:78943b3945b5 | 25 | #include "Socket.h" |
gsfan | 5:78943b3945b5 | 26 | #include "Endpoint.h" |
gsfan | 5:78943b3945b5 | 27 | |
gsfan | 5:78943b3945b5 | 28 | /** |
gsfan | 5:78943b3945b5 | 29 | TCP socket connection |
gsfan | 5:78943b3945b5 | 30 | */ |
gsfan | 5:78943b3945b5 | 31 | class TCPSocketConnection: public Socket, public Endpoint { |
gsfan | 5:78943b3945b5 | 32 | |
gsfan | 5:78943b3945b5 | 33 | public: |
gsfan | 5:78943b3945b5 | 34 | /** TCP socket connection |
gsfan | 5:78943b3945b5 | 35 | */ |
gsfan | 5:78943b3945b5 | 36 | TCPSocketConnection(); |
gsfan | 5:78943b3945b5 | 37 | |
gsfan | 5:78943b3945b5 | 38 | /** Connects this TCP socket to the server |
gsfan | 5:78943b3945b5 | 39 | \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS. |
gsfan | 5:78943b3945b5 | 40 | \param port The host's port to connect to. |
gsfan | 5:78943b3945b5 | 41 | \return 0 on success, -1 on failure. |
gsfan | 5:78943b3945b5 | 42 | */ |
gsfan | 5:78943b3945b5 | 43 | int connect(const char* host, const int port); |
gsfan | 5:78943b3945b5 | 44 | |
gsfan | 5:78943b3945b5 | 45 | /** Check if the socket is connected |
gsfan | 5:78943b3945b5 | 46 | \return true if connected, false otherwise. |
gsfan | 5:78943b3945b5 | 47 | */ |
gsfan | 5:78943b3945b5 | 48 | bool is_connected(void); |
gsfan | 5:78943b3945b5 | 49 | |
gsfan | 5:78943b3945b5 | 50 | /** Send data to the remote host. |
gsfan | 5:78943b3945b5 | 51 | \param data The buffer to send to the host. |
gsfan | 5:78943b3945b5 | 52 | \param length The length of the buffer to send. |
gsfan | 5:78943b3945b5 | 53 | \return the number of written bytes on success (>=0) or -1 on failure |
gsfan | 5:78943b3945b5 | 54 | */ |
gsfan | 5:78943b3945b5 | 55 | int send(char* data, int length); |
gsfan | 5:78943b3945b5 | 56 | |
gsfan | 5:78943b3945b5 | 57 | /** Send all the data to the remote host. |
gsfan | 5:78943b3945b5 | 58 | \param data The buffer to send to the host. |
gsfan | 5:78943b3945b5 | 59 | \param length The length of the buffer to send. |
gsfan | 5:78943b3945b5 | 60 | \return the number of written bytes on success (>=0) or -1 on failure |
gsfan | 5:78943b3945b5 | 61 | */ |
gsfan | 5:78943b3945b5 | 62 | int send_all(char* data, int length); |
gsfan | 5:78943b3945b5 | 63 | |
gsfan | 5:78943b3945b5 | 64 | /** Receive data from the remote host. |
gsfan | 5:78943b3945b5 | 65 | \param data The buffer in which to store the data received from the host. |
gsfan | 5:78943b3945b5 | 66 | \param length The maximum length of the buffer. |
gsfan | 5:78943b3945b5 | 67 | \return the number of received bytes on success (>=0) or -1 on failure |
gsfan | 5:78943b3945b5 | 68 | */ |
gsfan | 5:78943b3945b5 | 69 | int receive(char* data, int length); |
gsfan | 5:78943b3945b5 | 70 | |
gsfan | 5:78943b3945b5 | 71 | /** Receive all the data from the remote host. |
gsfan | 5:78943b3945b5 | 72 | \param data The buffer in which to store the data received from the host. |
gsfan | 5:78943b3945b5 | 73 | \param length The maximum length of the buffer. |
gsfan | 5:78943b3945b5 | 74 | \return the number of received bytes on success (>=0) or -1 on failure |
gsfan | 5:78943b3945b5 | 75 | */ |
gsfan | 5:78943b3945b5 | 76 | int receive_all(char* data, int length); |
gsfan | 5:78943b3945b5 | 77 | |
gsfan | 8:64184a968e3b | 78 | void acceptCID (int cid); |
gsfan | 5:78943b3945b5 | 79 | }; |
gsfan | 5:78943b3945b5 | 80 | |
gsfan | 5:78943b3945b5 | 81 | #endif |