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.h
00001 /* GSwifiInterface.h */ 00002 /* EthernetInterface.h */ 00003 /* Copyright (C) 2012 mbed.org, MIT License 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00006 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00007 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00008 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00009 * furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included in all copies or 00012 * substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00015 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00016 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00017 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00018 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00019 */ 00020 /* Copyright (C) 2019 gsfan, MIT License 00021 * port to the GainSpan (Telit) Wi-FI module GS1011/GS2000/GS2100 00022 */ 00023 00024 #ifndef GSWIFIINTERFACE_H_ 00025 #define GSWIFIINTERFACE_H_ 00026 00027 #include "GSwifi.h" 00028 00029 /** Interface using GSwifi to connect to an IP-based network 00030 * 00031 */ 00032 class GSwifiInterface: public GSwifi { 00033 public: 00034 00035 /** 00036 * Constructor 00037 * 00038 * \param tx mbed pin to use for tx line of Serial interface 00039 * \param rx mbed pin to use for rx line of Serial interface 00040 * \param cts mbed pin to use for cts line of Serial interface 00041 * \param rts mbed pin to use for rts line of Serial interface 00042 * \param reset reset pin of the wifi module 00043 * \param alarm alarm pin of the wifi module (default: NC) 00044 * \param baud baud rate of Serial interface (default: 9600) 00045 */ 00046 #ifdef CFG_SPI_DATAINTERFACE 00047 GSwifiInterface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, 00048 PinName mosi, PinName miso, PinName sclk, PinName cs, PinName wake, 00049 PinName alarm = NC, int baud = 9600, int freq = 2000000); 00050 #else 00051 GSwifiInterface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 9600); 00052 #endif 00053 00054 /** Initialize the interface with DHCP. 00055 * Initialize the interface and configure it to use DHCP (no connection at this point). 00056 * \return 0 on success, a negative number on failure 00057 */ 00058 int init(const char* name = NULL); //With DHCP 00059 00060 /** Initialize the interface with a static IP address. 00061 * Initialize the interface and configure it with the following static configuration (no connection at this point). 00062 * \param ip the IP address to use 00063 * \param mask the IP address mask 00064 * \param gateway the gateway to use 00065 * \return 0 on success, a negative number on failure 00066 */ 00067 int init(const char* ip, const char* mask, const char* gateway, const char* dns = NULL, const char* name = NULL); 00068 00069 /** Connect 00070 * Bring the interface up, start DHCP if needed. 00071 * \param sec the Wi-Fi security type 00072 * \param ssid the Wi-Fi SSID 00073 * \param phrase the Wi-Fi passphrase or security key 00074 * \param mode the Wi-Fi mode 00075 * \return 0 on success, a negative number on failure 00076 */ 00077 int connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode = WM_INFRASTRUCTURE); 00078 00079 /** Disconnect 00080 * Bring the interface down 00081 * \return 0 on success, a negative number on failure 00082 */ 00083 int disconnect(); 00084 00085 /** Get the MAC address of your Ethernet interface 00086 * \return a pointer to a string containing the MAC address 00087 */ 00088 char* getMACAddress(); 00089 00090 /** Get the IP address of your Ethernet interface 00091 * \return a pointer to a string containing the IP address 00092 */ 00093 char* getIPAddress(); 00094 00095 /** Get the Gateway address of your Ethernet interface 00096 * \return a pointer to a string containing the Gateway address 00097 */ 00098 char* getGateway(); 00099 00100 /** Get the Network mask of your Ethernet interface 00101 * \return a pointer to a string containing the Network mask 00102 */ 00103 char* getNetworkMask(); 00104 00105 }; 00106 00107 #include "TCPSocketConnection.h" 00108 #include "TCPSocketServer.h" 00109 00110 #include "Endpoint.h" 00111 #include "UDPSocket.h" 00112 00113 #endif /* GSWIFIINTERFACE_H_ */ 00114
Generated on Thu Jul 14 2022 07:53:37 by 1.7.2