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
GSwifiInterface.cpp
00001 /* Copyright (C) 2019 gsfan, MIT License 00002 * port to the GainSpan (Telit) Wi-FI module GS1011/GS2000/GS2100 00003 */ 00004 00005 #include "GSwifiInterface.h" 00006 00007 #ifdef CFG_SPI_DATAINTERFACE 00008 GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, 00009 PinName mosi, PinName miso, PinName sclk, PinName cs, PinName wake, 00010 PinName alarm, int baud, int freq) : 00011 GSwifi(tx, rx, cts, rts, reset, mosi, miso, sclk, cs, wake, alarm, baud, freq) 00012 #else 00013 GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud) : 00014 GSwifi(tx, rx, cts, rts, reset, alarm, baud) 00015 #endif 00016 { 00017 } 00018 00019 int GSwifiInterface::init(const char* name) 00020 { 00021 return setAddress(name); 00022 } 00023 00024 int GSwifiInterface::init(const char* ip, const char* netmask, const char* gateway, const char* dns, const char* name) 00025 { 00026 return setAddress(ip, netmask, gateway, dns, name); 00027 } 00028 00029 int GSwifiInterface::connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode) 00030 { 00031 setSsid(sec, ssid, phrase); 00032 switch (mode) { 00033 case WM_INFRASTRUCTURE: 00034 return join(); 00035 case WM_ADHOCK: 00036 return adhock(); 00037 case WM_LIMITEDAP: 00038 return limitedap(); 00039 } 00040 return -1; 00041 } 00042 00043 int GSwifiInterface::disconnect() 00044 { 00045 return GSwifi::dissociate(); 00046 } 00047 00048 char * GSwifiInterface::getMACAddress() 00049 { 00050 return _state.mac; 00051 } 00052 00053 char * GSwifiInterface::getIPAddress() 00054 { 00055 return _state.ip; 00056 } 00057 00058 char * GSwifiInterface::getGateway() 00059 { 00060 return _state.gateway; 00061 } 00062 00063 char * GSwifiInterface::getNetworkMask() 00064 { 00065 return _state.netmask; 00066 } 00067
Generated on Thu Jul 14 2022 07:53:37 by 1.7.2