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.cpp@21:6431364fc667, 2014-06-05 (annotated)
- Committer:
- gsfan
- Date:
- Thu Jun 05 06:12:59 2014 +0000
- Revision:
- 21:6431364fc667
- Parent:
- 12:057089026a20
- Child:
- 22:d25a5a0d2497
fix init (setAddress)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsfan | 5:78943b3945b5 | 1 | /* Copyright (C) 2013 gsfan, MIT License |
gsfan | 5:78943b3945b5 | 2 | * port to the GainSpan Wi-FI module GS1011 |
gsfan | 5:78943b3945b5 | 3 | */ |
gsfan | 5:78943b3945b5 | 4 | |
gsfan | 5:78943b3945b5 | 5 | #include "GSwifiInterface.h" |
gsfan | 5:78943b3945b5 | 6 | |
gsfan | 8:64184a968e3b | 7 | GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud) : |
gsfan | 8:64184a968e3b | 8 | GSwifi(tx, rx, cts, rts, reset, alarm, baud) |
gsfan | 5:78943b3945b5 | 9 | { |
gsfan | 5:78943b3945b5 | 10 | } |
gsfan | 5:78943b3945b5 | 11 | |
gsfan | 8:64184a968e3b | 12 | int GSwifiInterface::init(const char* name) |
gsfan | 5:78943b3945b5 | 13 | { |
gsfan | 11:71d67fea5ace | 14 | return setAddress(name); |
gsfan | 5:78943b3945b5 | 15 | } |
gsfan | 5:78943b3945b5 | 16 | |
gsfan | 21:6431364fc667 | 17 | int GSwifiInterface::init(const char* ip, const char* netmask, const char* gateway, const char* dns, const char* name) |
gsfan | 5:78943b3945b5 | 18 | { |
gsfan | 21:6431364fc667 | 19 | return setAddress(ip, netmask, gateway, dns, name); |
gsfan | 8:64184a968e3b | 20 | } |
gsfan | 8:64184a968e3b | 21 | |
gsfan | 8:64184a968e3b | 22 | int GSwifiInterface::connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode) |
gsfan | 8:64184a968e3b | 23 | { |
gsfan | 11:71d67fea5ace | 24 | setSsid(sec, ssid, phrase); |
gsfan | 8:64184a968e3b | 25 | switch (mode) { |
gsfan | 8:64184a968e3b | 26 | case WM_INFRASTRUCTURE: |
gsfan | 11:71d67fea5ace | 27 | return join(); |
gsfan | 8:64184a968e3b | 28 | case WM_ADHOCK: |
gsfan | 11:71d67fea5ace | 29 | return adhock(); |
gsfan | 8:64184a968e3b | 30 | case WM_LIMITEDAP: |
gsfan | 11:71d67fea5ace | 31 | return limitedap(); |
gsfan | 8:64184a968e3b | 32 | } |
gsfan | 8:64184a968e3b | 33 | return -1; |
gsfan | 5:78943b3945b5 | 34 | } |
gsfan | 5:78943b3945b5 | 35 | |
gsfan | 5:78943b3945b5 | 36 | int GSwifiInterface::disconnect() |
gsfan | 5:78943b3945b5 | 37 | { |
gsfan | 12:057089026a20 | 38 | return GSwifi::dissociate(); |
gsfan | 5:78943b3945b5 | 39 | } |
gsfan | 5:78943b3945b5 | 40 | |
gsfan | 8:64184a968e3b | 41 | char * GSwifiInterface::getMACAddress() |
gsfan | 8:64184a968e3b | 42 | { |
gsfan | 8:64184a968e3b | 43 | return _state.mac; |
gsfan | 8:64184a968e3b | 44 | } |
gsfan | 8:64184a968e3b | 45 | |
gsfan | 5:78943b3945b5 | 46 | char * GSwifiInterface::getIPAddress() |
gsfan | 5:78943b3945b5 | 47 | { |
gsfan | 8:64184a968e3b | 48 | return _state.ip; |
gsfan | 8:64184a968e3b | 49 | } |
gsfan | 5:78943b3945b5 | 50 | |
gsfan | 8:64184a968e3b | 51 | char * GSwifiInterface::getGateway() |
gsfan | 8:64184a968e3b | 52 | { |
gsfan | 8:64184a968e3b | 53 | return _state.gateway; |
gsfan | 8:64184a968e3b | 54 | } |
gsfan | 8:64184a968e3b | 55 | |
gsfan | 8:64184a968e3b | 56 | char * GSwifiInterface::getNetworkMask() |
gsfan | 8:64184a968e3b | 57 | { |
gsfan | 8:64184a968e3b | 58 | return _state.netmask; |
gsfan | 8:64184a968e3b | 59 | } |
gsfan | 21:6431364fc667 | 60 |