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)
GSwifiInterface.h@9:4565d3d3d13b, 2013-10-31 (annotated)
- Committer:
- gsfan
- Date:
- Thu Oct 31 06:59:46 2013 +0000
- Revision:
- 9:4565d3d3d13b
- Parent:
- 8:64184a968e3b
- Child:
- 21:6431364fc667
undef DEBUG
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsfan | 5:78943b3945b5 | 1 | /* GSwifiInterface.h */ |
gsfan | 8:64184a968e3b | 2 | /* EthernetInterface.h */ |
gsfan | 5:78943b3945b5 | 3 | /* Copyright (C) 2012 mbed.org, MIT License |
gsfan | 5:78943b3945b5 | 4 | * |
gsfan | 5:78943b3945b5 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
gsfan | 5:78943b3945b5 | 6 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
gsfan | 5:78943b3945b5 | 7 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
gsfan | 5:78943b3945b5 | 8 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
gsfan | 5:78943b3945b5 | 9 | * furnished to do so, subject to the following conditions: |
gsfan | 5:78943b3945b5 | 10 | * |
gsfan | 5:78943b3945b5 | 11 | * The above copyright notice and this permission notice shall be included in all copies or |
gsfan | 5:78943b3945b5 | 12 | * substantial portions of the Software. |
gsfan | 5:78943b3945b5 | 13 | * |
gsfan | 5:78943b3945b5 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
gsfan | 5:78943b3945b5 | 15 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
gsfan | 5:78943b3945b5 | 16 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
gsfan | 5:78943b3945b5 | 17 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
gsfan | 5:78943b3945b5 | 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
gsfan | 5:78943b3945b5 | 19 | */ |
gsfan | 5:78943b3945b5 | 20 | /* Copyright (C) 2013 gsfan, MIT License |
gsfan | 5:78943b3945b5 | 21 | * port to the GainSpan Wi-FI module GS1011 |
gsfan | 5:78943b3945b5 | 22 | */ |
gsfan | 5:78943b3945b5 | 23 | |
gsfan | 8:64184a968e3b | 24 | #ifndef GSWIFIINTERFACE_H_ |
gsfan | 8:64184a968e3b | 25 | #define GSWIFIINTERFACE_H_ |
gsfan | 5:78943b3945b5 | 26 | |
gsfan | 5:78943b3945b5 | 27 | #include "GSwifi.h" |
gsfan | 5:78943b3945b5 | 28 | |
gsfan | 5:78943b3945b5 | 29 | /** Interface using GSwifi to connect to an IP-based network |
gsfan | 5:78943b3945b5 | 30 | * |
gsfan | 5:78943b3945b5 | 31 | */ |
gsfan | 5:78943b3945b5 | 32 | class GSwifiInterface: public GSwifi { |
gsfan | 5:78943b3945b5 | 33 | public: |
gsfan | 5:78943b3945b5 | 34 | |
gsfan | 5:78943b3945b5 | 35 | /** |
gsfan | 5:78943b3945b5 | 36 | * Constructor |
gsfan | 5:78943b3945b5 | 37 | * |
gsfan | 5:78943b3945b5 | 38 | * \param tx mbed pin to use for tx line of Serial interface |
gsfan | 5:78943b3945b5 | 39 | * \param rx mbed pin to use for rx line of Serial interface |
gsfan | 5:78943b3945b5 | 40 | * \param cts mbed pin to use for cts line of Serial interface |
gsfan | 5:78943b3945b5 | 41 | * \param rts mbed pin to use for rts line of Serial interface |
gsfan | 8:64184a968e3b | 42 | * \param reset reset pin of the wifi module |
gsfan | 8:64184a968e3b | 43 | * \param alarm alarm pin of the wifi module (default: NC) |
gsfan | 8:64184a968e3b | 44 | * \param baud baud rate of Serial interface (default: 9600) |
gsfan | 5:78943b3945b5 | 45 | */ |
gsfan | 8:64184a968e3b | 46 | GSwifiInterface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 9600); |
gsfan | 5:78943b3945b5 | 47 | |
gsfan | 5:78943b3945b5 | 48 | /** Initialize the interface with DHCP. |
gsfan | 5:78943b3945b5 | 49 | * Initialize the interface and configure it to use DHCP (no connection at this point). |
gsfan | 5:78943b3945b5 | 50 | * \return 0 on success, a negative number on failure |
gsfan | 5:78943b3945b5 | 51 | */ |
gsfan | 8:64184a968e3b | 52 | int init(const char* name = NULL); //With DHCP |
gsfan | 5:78943b3945b5 | 53 | |
gsfan | 5:78943b3945b5 | 54 | /** Initialize the interface with a static IP address. |
gsfan | 5:78943b3945b5 | 55 | * Initialize the interface and configure it with the following static configuration (no connection at this point). |
gsfan | 5:78943b3945b5 | 56 | * \param ip the IP address to use |
gsfan | 5:78943b3945b5 | 57 | * \param mask the IP address mask |
gsfan | 5:78943b3945b5 | 58 | * \param gateway the gateway to use |
gsfan | 5:78943b3945b5 | 59 | * \return 0 on success, a negative number on failure |
gsfan | 5:78943b3945b5 | 60 | */ |
gsfan | 8:64184a968e3b | 61 | int init(const char* ip, const char* mask, const char* gateway, const char* name = NULL); |
gsfan | 5:78943b3945b5 | 62 | |
gsfan | 5:78943b3945b5 | 63 | /** Connect |
gsfan | 5:78943b3945b5 | 64 | * Bring the interface up, start DHCP if needed. |
gsfan | 8:64184a968e3b | 65 | * \param sec the Wi-Fi security type |
gsfan | 8:64184a968e3b | 66 | * \param ssid the Wi-Fi SSID |
gsfan | 8:64184a968e3b | 67 | * \param phrase the Wi-Fi passphrase or security key |
gsfan | 8:64184a968e3b | 68 | * \param mode the Wi-Fi mode |
gsfan | 5:78943b3945b5 | 69 | * \return 0 on success, a negative number on failure |
gsfan | 5:78943b3945b5 | 70 | */ |
gsfan | 8:64184a968e3b | 71 | int connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode = WM_INFRASTRUCTURE); |
gsfan | 5:78943b3945b5 | 72 | |
gsfan | 5:78943b3945b5 | 73 | /** Disconnect |
gsfan | 5:78943b3945b5 | 74 | * Bring the interface down |
gsfan | 5:78943b3945b5 | 75 | * \return 0 on success, a negative number on failure |
gsfan | 5:78943b3945b5 | 76 | */ |
gsfan | 5:78943b3945b5 | 77 | int disconnect(); |
gsfan | 5:78943b3945b5 | 78 | |
gsfan | 8:64184a968e3b | 79 | /** Get the MAC address of your Ethernet interface |
gsfan | 8:64184a968e3b | 80 | * \return a pointer to a string containing the MAC address |
gsfan | 8:64184a968e3b | 81 | */ |
gsfan | 8:64184a968e3b | 82 | char* getMACAddress(); |
gsfan | 8:64184a968e3b | 83 | |
gsfan | 8:64184a968e3b | 84 | /** Get the IP address of your Ethernet interface |
gsfan | 8:64184a968e3b | 85 | * \return a pointer to a string containing the IP address |
gsfan | 8:64184a968e3b | 86 | */ |
gsfan | 5:78943b3945b5 | 87 | char* getIPAddress(); |
gsfan | 8:64184a968e3b | 88 | |
gsfan | 8:64184a968e3b | 89 | /** Get the Gateway address of your Ethernet interface |
gsfan | 8:64184a968e3b | 90 | * \return a pointer to a string containing the Gateway address |
gsfan | 8:64184a968e3b | 91 | */ |
gsfan | 8:64184a968e3b | 92 | char* getGateway(); |
gsfan | 8:64184a968e3b | 93 | |
gsfan | 8:64184a968e3b | 94 | /** Get the Network mask of your Ethernet interface |
gsfan | 8:64184a968e3b | 95 | * \return a pointer to a string containing the Network mask |
gsfan | 8:64184a968e3b | 96 | */ |
gsfan | 8:64184a968e3b | 97 | char* getNetworkMask(); |
gsfan | 8:64184a968e3b | 98 | |
gsfan | 5:78943b3945b5 | 99 | }; |
gsfan | 5:78943b3945b5 | 100 | |
gsfan | 5:78943b3945b5 | 101 | #include "TCPSocketConnection.h" |
gsfan | 5:78943b3945b5 | 102 | #include "TCPSocketServer.h" |
gsfan | 8:64184a968e3b | 103 | |
gsfan | 8:64184a968e3b | 104 | #include "Endpoint.h" |
gsfan | 5:78943b3945b5 | 105 | #include "UDPSocket.h" |
gsfan | 5:78943b3945b5 | 106 | |
gsfan | 8:64184a968e3b | 107 | #endif /* GSWIFIINTERFACE_H_ */ |