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@7:f94c59d0c735, 2013-03-11 (annotated)
- Committer:
- gsfan
- Date:
- Mon Mar 11 08:21:14 2013 +0000
- Revision:
- 7:f94c59d0c735
- Parent:
- 5:78943b3945b5
fix getmacaddress
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsfan | 5:78943b3945b5 | 1 | /* GSwifiInterface.h */ |
gsfan | 5:78943b3945b5 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
gsfan | 5:78943b3945b5 | 3 | * |
gsfan | 5:78943b3945b5 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
gsfan | 5:78943b3945b5 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
gsfan | 5:78943b3945b5 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
gsfan | 5:78943b3945b5 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
gsfan | 5:78943b3945b5 | 8 | * furnished to do so, subject to the following conditions: |
gsfan | 5:78943b3945b5 | 9 | * |
gsfan | 5:78943b3945b5 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
gsfan | 5:78943b3945b5 | 11 | * substantial portions of the Software. |
gsfan | 5:78943b3945b5 | 12 | * |
gsfan | 5:78943b3945b5 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
gsfan | 5:78943b3945b5 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
gsfan | 5:78943b3945b5 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
gsfan | 5:78943b3945b5 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
gsfan | 5:78943b3945b5 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
gsfan | 5:78943b3945b5 | 18 | */ |
gsfan | 5:78943b3945b5 | 19 | /* Copyright (C) 2013 gsfan, MIT License |
gsfan | 5:78943b3945b5 | 20 | * port to the GainSpan Wi-FI module GS1011 |
gsfan | 5:78943b3945b5 | 21 | */ |
gsfan | 5:78943b3945b5 | 22 | |
gsfan | 5:78943b3945b5 | 23 | #ifndef GSwifiINTERFACE_H_ |
gsfan | 5:78943b3945b5 | 24 | #define GSwifiINTERFACE_H_ |
gsfan | 5:78943b3945b5 | 25 | |
gsfan | 5:78943b3945b5 | 26 | #include "GSwifi.h" |
gsfan | 5:78943b3945b5 | 27 | |
gsfan | 5:78943b3945b5 | 28 | /** Interface using GSwifi to connect to an IP-based network |
gsfan | 5:78943b3945b5 | 29 | * |
gsfan | 5:78943b3945b5 | 30 | */ |
gsfan | 5:78943b3945b5 | 31 | class GSwifiInterface: public GSwifi { |
gsfan | 5:78943b3945b5 | 32 | public: |
gsfan | 5:78943b3945b5 | 33 | |
gsfan | 5:78943b3945b5 | 34 | /** |
gsfan | 5:78943b3945b5 | 35 | * Constructor |
gsfan | 5:78943b3945b5 | 36 | * |
gsfan | 5:78943b3945b5 | 37 | * \param tx mbed pin to use for tx line of Serial interface |
gsfan | 5:78943b3945b5 | 38 | * \param rx mbed pin to use for rx line of Serial interface |
gsfan | 5:78943b3945b5 | 39 | * \param cts mbed pin to use for cts line of Serial interface |
gsfan | 5:78943b3945b5 | 40 | * \param rts mbed pin to use for rts line of Serial interface |
gsfan | 5:78943b3945b5 | 41 | * \param reset reset pin of the wifi module () |
gsfan | 5:78943b3945b5 | 42 | * \param ssid ssid of the network |
gsfan | 5:78943b3945b5 | 43 | * \param phrase WEP or WPA key |
gsfan | 5:78943b3945b5 | 44 | * \param sec Security type (NONE, WEP_128 or WPA) |
gsfan | 5:78943b3945b5 | 45 | */ |
gsfan | 5:78943b3945b5 | 46 | GSwifiInterface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, const char * ssid, const char * phrase, Security sec = SEC_NONE); |
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 | 5:78943b3945b5 | 52 | int init(); //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 | 5:78943b3945b5 | 61 | int init(const char* ip, const char* mask, const char* gateway); |
gsfan | 5:78943b3945b5 | 62 | |
gsfan | 5:78943b3945b5 | 63 | /** Connect |
gsfan | 5:78943b3945b5 | 64 | * Bring the interface up, start DHCP if needed. |
gsfan | 5:78943b3945b5 | 65 | * \return 0 on success, a negative number on failure |
gsfan | 5:78943b3945b5 | 66 | */ |
gsfan | 5:78943b3945b5 | 67 | int connect(); |
gsfan | 5:78943b3945b5 | 68 | |
gsfan | 5:78943b3945b5 | 69 | /** Disconnect |
gsfan | 5:78943b3945b5 | 70 | * Bring the interface down |
gsfan | 5:78943b3945b5 | 71 | * \return 0 on success, a negative number on failure |
gsfan | 5:78943b3945b5 | 72 | */ |
gsfan | 5:78943b3945b5 | 73 | int disconnect(); |
gsfan | 5:78943b3945b5 | 74 | |
gsfan | 5:78943b3945b5 | 75 | /** Get IP address |
gsfan | 5:78943b3945b5 | 76 | * |
gsfan | 5:78943b3945b5 | 77 | * @ returns ip address |
gsfan | 5:78943b3945b5 | 78 | */ |
gsfan | 5:78943b3945b5 | 79 | char* getIPAddress(); |
gsfan | 7:f94c59d0c735 | 80 | /** Get MAC address |
gsfan | 7:f94c59d0c735 | 81 | * |
gsfan | 7:f94c59d0c735 | 82 | * @ returns mac address |
gsfan | 7:f94c59d0c735 | 83 | */ |
gsfan | 7:f94c59d0c735 | 84 | char* getMACAddress(); |
gsfan | 7:f94c59d0c735 | 85 | |
gsfan | 5:78943b3945b5 | 86 | private: |
gsfan | 5:78943b3945b5 | 87 | char _ip_string[20]; |
gsfan | 5:78943b3945b5 | 88 | bool _ip_set; |
gsfan | 5:78943b3945b5 | 89 | }; |
gsfan | 5:78943b3945b5 | 90 | |
gsfan | 5:78943b3945b5 | 91 | #include "TCPSocketConnection.h" |
gsfan | 5:78943b3945b5 | 92 | #include "TCPSocketServer.h" |
gsfan | 5:78943b3945b5 | 93 | #include "UDPSocket.h" |
gsfan | 5:78943b3945b5 | 94 | |
gsfan | 5:78943b3945b5 | 95 | #endif /* WIFLYINTERFACE_H_ */ |