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 mbed official

GainSpan Wi-Fi library

The GS1011/GS2100 is an ultra low power 802.11b wireless module from GainSpan.

mbed RTOS supported.

/media/uploads/gsfan/gs_im_002.jpg /media/uploads/gsfan/gs1011m_2.jpg

ゲインスパン Wi-Fi モジュール ライブラリ

ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011/GS2100 シリーズ用のライブラリです。

mbed RTOS に対応しています。(mbed2.0)

Committer:
gsfan
Date:
Tue Sep 24 06:24:37 2019 +0000
Revision:
22:d25a5a0d2497
Parent:
19:d035412a7803
UART Command and SPI Data supported.; bug fix.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gsfan 22:d25a5a0d2497 1 /* Copyright (C) 2019 gsfan, MIT License
gsfan 5:78943b3945b5 2 *
gsfan 5:78943b3945b5 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
gsfan 5:78943b3945b5 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
gsfan 5:78943b3945b5 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
gsfan 5:78943b3945b5 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
gsfan 5:78943b3945b5 7 * furnished to do so, subject to the following conditions:
gsfan 5:78943b3945b5 8 *
gsfan 5:78943b3945b5 9 * The above copyright notice and this permission notice shall be included in all copies or
gsfan 5:78943b3945b5 10 * substantial portions of the Software.
gsfan 5:78943b3945b5 11 *
gsfan 5:78943b3945b5 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
gsfan 5:78943b3945b5 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
gsfan 5:78943b3945b5 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
gsfan 5:78943b3945b5 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
gsfan 5:78943b3945b5 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
gsfan 5:78943b3945b5 17 *
gsfan 5:78943b3945b5 18 * @section DESCRIPTION
gsfan 5:78943b3945b5 19 *
gsfan 22:d25a5a0d2497 20 * GainSpan (Telit) GS1011, GS2000, GS2100 Wi-Fi module
gsfan 5:78943b3945b5 21 *
gsfan 22:d25a5a0d2497 22 * https://www.telit.com/m2m-iot-products/wifi-bluetooth-modules/
gsfan 5:78943b3945b5 23 * http://www.gainspan.com/modules
gsfan 5:78943b3945b5 24 */
gsfan 8:64184a968e3b 25 /** @file
gsfan 22:d25a5a0d2497 26 * @brief GainSpan (Telit) wi-fi module library for mbed
gsfan 22:d25a5a0d2497 27 * GS1011MIC, GS1011MIP, GS2100MIP, GainSpan WiFi Breakout, etc.
gsfan 8:64184a968e3b 28 */
gsfan 5:78943b3945b5 29
gsfan 5:78943b3945b5 30 #ifndef GSwifi_H
gsfan 5:78943b3945b5 31 #define GSwifi_H
gsfan 5:78943b3945b5 32
gsfan 11:71d67fea5ace 33 #include "GSwifi_conf.h"
gsfan 11:71d67fea5ace 34
gsfan 5:78943b3945b5 35 #include "mbed.h"
gsfan 8:64184a968e3b 36 #include "RawSerial.h"
gsfan 5:78943b3945b5 37 #include "CBuffer.h"
gsfan 8:64184a968e3b 38 #include <ctype.h>
gsfan 8:64184a968e3b 39 #include <stdlib.h>
gsfan 8:64184a968e3b 40 #include <string.h>
gsfan 8:64184a968e3b 41
gsfan 11:71d67fea5ace 42 #ifdef CFG_ENABLE_RTOS
gsfan 11:71d67fea5ace 43 #include "rtos.h"
gsfan 8:64184a968e3b 44 #endif
gsfan 5:78943b3945b5 45
gsfan 5:78943b3945b5 46 //Debug is disabled by default
gsfan 8:64184a968e3b 47 #if defined(DEBUG) and (!defined(TARGET_LPC11U24))
gsfan 8:64184a968e3b 48 #define DBG(x, ...) std::printf("[DBG]" x "\r\n", ##__VA_ARGS__);
gsfan 8:64184a968e3b 49 #define WARN(x, ...) std::printf("[WARN]" x "\r\n", ##__VA_ARGS__);
gsfan 8:64184a968e3b 50 #define ERR(x, ...) std::printf("[ERR]" x "\r\n", ##__VA_ARGS__);
gsfan 8:64184a968e3b 51 #define INFO(x, ...) std::printf("[INFO]" x "\r\n", ##__VA_ARGS__);
gsfan 5:78943b3945b5 52 #else
gsfan 5:78943b3945b5 53 #define DBG(x, ...)
gsfan 5:78943b3945b5 54 #define WARN(x, ...)
gsfan 5:78943b3945b5 55 #define ERR(x, ...)
gsfan 5:78943b3945b5 56 #define INFO(x, ...)
gsfan 5:78943b3945b5 57 #endif
gsfan 5:78943b3945b5 58
gsfan 5:78943b3945b5 59
gsfan 8:64184a968e3b 60 /** GSwifi class
gsfan 8:64184a968e3b 61 */
gsfan 5:78943b3945b5 62 class GSwifi
gsfan 5:78943b3945b5 63 {
gsfan 5:78943b3945b5 64
gsfan 5:78943b3945b5 65 public:
gsfan 5:78943b3945b5 66
gsfan 8:64184a968e3b 67 /** Wi-Fi mode
gsfan 8:64184a968e3b 68 */
gsfan 8:64184a968e3b 69 enum WiFiMode {
gsfan 8:64184a968e3b 70 WM_INFRASTRUCTURE,
gsfan 8:64184a968e3b 71 WM_ADHOCK,
gsfan 8:64184a968e3b 72 WM_LIMITEDAP,
gsfan 8:64184a968e3b 73 };
gsfan 8:64184a968e3b 74
gsfan 8:64184a968e3b 75 /** Wi-Fi security
gsfan 8:64184a968e3b 76 */
gsfan 5:78943b3945b5 77 enum Security {
gsfan 5:78943b3945b5 78 SEC_AUTO = 0,
gsfan 5:78943b3945b5 79 SEC_NONE = 0,
gsfan 5:78943b3945b5 80 SEC_OPEN = 1,
gsfan 5:78943b3945b5 81 SEC_WEP = 2,
gsfan 5:78943b3945b5 82 SEC_WPA_PSK = 4,
gsfan 5:78943b3945b5 83 SEC_WPA2_PSK = 8,
gsfan 5:78943b3945b5 84 SEC_WPA_ENT = 16,
gsfan 5:78943b3945b5 85 SEC_WPA2_ENT = 32,
gsfan 5:78943b3945b5 86 SEC_WPS_BUTTON = 64,
gsfan 8:64184a968e3b 87 SEC_WPS_PIN,
gsfan 5:78943b3945b5 88 };
gsfan 5:78943b3945b5 89
gsfan 8:64184a968e3b 90 /** TCP/IP protocol
gsfan 8:64184a968e3b 91 */
gsfan 5:78943b3945b5 92 enum Protocol {
gsfan 5:78943b3945b5 93 PROTO_UDP = 0,
gsfan 5:78943b3945b5 94 PROTO_TCP = 1,
gsfan 5:78943b3945b5 95 PROTO_HTTPGET,
gsfan 5:78943b3945b5 96 PROTO_HTTPPOST,
gsfan 5:78943b3945b5 97 PROTO_HTTPD,
gsfan 5:78943b3945b5 98 };
gsfan 5:78943b3945b5 99
gsfan 8:64184a968e3b 100 /** Client/Server
gsfan 8:64184a968e3b 101 */
gsfan 8:64184a968e3b 102 enum Type {
gsfan 8:64184a968e3b 103 TYPE_CLIENT = 0,
gsfan 8:64184a968e3b 104 TYPE_SERVER = 1,
gsfan 8:64184a968e3b 105 };
gsfan 8:64184a968e3b 106
gsfan 5:78943b3945b5 107 enum Response {
gsfan 5:78943b3945b5 108 RES_NULL,
gsfan 5:78943b3945b5 109 RES_CONNECT,
gsfan 13:189e04ac70bd 110 RES_WPAPSK,
gsfan 5:78943b3945b5 111 RES_WPS,
gsfan 5:78943b3945b5 112 RES_MACADDRESS,
gsfan 5:78943b3945b5 113 RES_DHCP,
gsfan 5:78943b3945b5 114 RES_DNSLOOKUP,
gsfan 5:78943b3945b5 115 RES_HTTP,
gsfan 5:78943b3945b5 116 RES_RSSI,
gsfan 5:78943b3945b5 117 RES_TIME,
gsfan 8:64184a968e3b 118 RES_STATUS,
gsfan 5:78943b3945b5 119 };
gsfan 5:78943b3945b5 120
gsfan 5:78943b3945b5 121 enum Mode {
gsfan 5:78943b3945b5 122 MODE_COMMAND,
gsfan 8:64184a968e3b 123 MODE_CMDRESP,
gsfan 8:64184a968e3b 124 MODE_ESCAPE,
gsfan 5:78943b3945b5 125 MODE_DATA_RX,
gsfan 8:64184a968e3b 126 MODE_DATA_RX_BULK,
gsfan 5:78943b3945b5 127 MODE_DATA_RXUDP,
gsfan 8:64184a968e3b 128 MODE_DATA_RXUDP_BULK,
gsfan 5:78943b3945b5 129 MODE_DATA_RXHTTP,
gsfan 8:64184a968e3b 130 MODE_DATA_RAW,
gsfan 5:78943b3945b5 131 };
gsfan 5:78943b3945b5 132
gsfan 5:78943b3945b5 133 enum Status {
gsfan 8:64184a968e3b 134 STAT_NONE,
gsfan 5:78943b3945b5 135 STAT_READY,
gsfan 5:78943b3945b5 136 STAT_STANDBY,
gsfan 5:78943b3945b5 137 STAT_WAKEUP,
gsfan 5:78943b3945b5 138 STAT_DEEPSLEEP,
gsfan 5:78943b3945b5 139 };
gsfan 5:78943b3945b5 140
gsfan 8:64184a968e3b 141 // ----- GSwifi.cpp -----
gsfan 8:64184a968e3b 142 /** Constructor
gsfan 8:64184a968e3b 143 * \param tx mbed pin to use for tx line of Serial interface
gsfan 8:64184a968e3b 144 * \param rx mbed pin to use for rx line of Serial interface
gsfan 8:64184a968e3b 145 * \param cts mbed pin to use for cts line of Serial interface
gsfan 8:64184a968e3b 146 * \param rts mbed pin to use for rts line of Serial interface
gsfan 8:64184a968e3b 147 * \param reset reset pin of the wifi module
gsfan 12:057089026a20 148 * \param alarm alarm pin of the wifi module (default NULL)
gsfan 12:057089026a20 149 * \param baud baud rate of Serial interface (default 9600)
gsfan 8:64184a968e3b 150 */
gsfan 22:d25a5a0d2497 151 #ifdef CFG_SPI_DATAINTERFACE
gsfan 22:d25a5a0d2497 152 GSwifi (PinName tx, PinName rx, PinName cts, PinName rts, PinName reset,
gsfan 22:d25a5a0d2497 153 PinName mosi, PinName miso, PinName sclk, PinName cs, PinName wake,
gsfan 22:d25a5a0d2497 154 PinName alarm = NC, int baud = 9600, int freq = 2000000);
gsfan 22:d25a5a0d2497 155 #else
gsfan 12:057089026a20 156 GSwifi (PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 9600);
gsfan 22:d25a5a0d2497 157 #endif
gsfan 5:78943b3945b5 158
gsfan 8:64184a968e3b 159 /** Connect the wifi module to the ssid contained in the constructor.
gsfan 8:64184a968e3b 160 * @param sec Security type (NONE, WEP_128 or WPA)
gsfan 8:64184a968e3b 161 * @param ssid ssid of the network
gsfan 8:64184a968e3b 162 * @param phrase WEP or WPA key
gsfan 8:64184a968e3b 163 * @return 0 if connected, -1 otherwise
gsfan 8:64184a968e3b 164 */
gsfan 11:71d67fea5ace 165 int join ();
gsfan 5:78943b3945b5 166
gsfan 8:64184a968e3b 167 /** Connect the wifi module to the adhock in the constructor.
gsfan 8:64184a968e3b 168 * @param sec Security type (NONE, WEP_128 or WPA)
gsfan 8:64184a968e3b 169 * @param ssid ssid of the network
gsfan 8:64184a968e3b 170 * @param phrase WEP or WPA key
gsfan 8:64184a968e3b 171 * @return 0 if connected, -1 otherwise
gsfan 8:64184a968e3b 172 */
gsfan 11:71d67fea5ace 173 int adhock ();
gsfan 5:78943b3945b5 174
gsfan 8:64184a968e3b 175 /** Connect the wifi module to the limited AP in the constructor.
gsfan 8:64184a968e3b 176 * @param sec Security type (NONE, WEP_128 or WPA)
gsfan 8:64184a968e3b 177 * @param ssid ssid of the network
gsfan 8:64184a968e3b 178 * @param phrase WEP or WPA key
gsfan 8:64184a968e3b 179 * @return 0 if connected, -1 otherwise
gsfan 8:64184a968e3b 180 */
gsfan 11:71d67fea5ace 181 int limitedap ();
gsfan 5:78943b3945b5 182
gsfan 8:64184a968e3b 183 /** Disconnect the wifi module from the access point
gsfan 8:64184a968e3b 184 * @returns 0 if successful
gsfan 8:64184a968e3b 185 */
gsfan 12:057089026a20 186 int dissociate ();
gsfan 12:057089026a20 187 int disconnect () {
gsfan 12:057089026a20 188 return dissociate();
gsfan 12:057089026a20 189 }
gsfan 5:78943b3945b5 190
gsfan 12:057089026a20 191 /** Check if a Wi-Fi link is active
gsfan 8:64184a968e3b 192 * @returns true if successful
gsfan 8:64184a968e3b 193 */
gsfan 12:057089026a20 194 bool isAssociated();
gsfan 5:78943b3945b5 195
gsfan 12:057089026a20 196 /** polling if not use rtos
gsfan 12:057089026a20 197 */
gsfan 11:71d67fea5ace 198 void poll ();
gsfan 8:64184a968e3b 199
gsfan 12:057089026a20 200 /** get Wi-Fi modue status
gsfan 12:057089026a20 201 * @return Status
gsfan 12:057089026a20 202 */
gsfan 12:057089026a20 203 Status getStatus ();
gsfan 12:057089026a20 204
gsfan 12:057089026a20 205 /** set MAC address
gsfan 12:057089026a20 206 */
gsfan 12:057089026a20 207 int setMacAddress (const char *mac);
gsfan 12:057089026a20 208 /** get MAC address
gsfan 12:057089026a20 209 */
gsfan 12:057089026a20 210 int getMacAddress (char *mac);
gsfan 12:057089026a20 211
gsfan 12:057089026a20 212 /** use DHCP
gsfan 12:057089026a20 213 */
gsfan 11:71d67fea5ace 214 int setAddress (const char *name = NULL);
gsfan 12:057089026a20 215 /** use static IP address
gsfan 12:057089026a20 216 * @param ip my ip address (dhcp start address)
gsfan 12:057089026a20 217 * @param netmask subnet mask
gsfan 12:057089026a20 218 * @param gateway default gateway
gsfan 15:086d1a33a197 219 * @param dns name server (default NULL)
gsfan 15:086d1a33a197 220 * @param name my host name (default NULL)
gsfan 12:057089026a20 221 */
gsfan 15:086d1a33a197 222 int setAddress (const char *ip, const char *netmask, const char *gateway, const char *dns = NULL, const char *name = NULL);
gsfan 12:057089026a20 223 /** get IP address
gsfan 12:057089026a20 224 */
gsfan 11:71d67fea5ace 225 int getAddress (char *ip, char *netmask, char *gateway);
gsfan 12:057089026a20 226
gsfan 12:057089026a20 227 /** set Wi-Fi security parameter
gsfan 12:057089026a20 228 * @param sec Security
gsfan 12:057089026a20 229 * @param ssid SSID
gsfan 12:057089026a20 230 * @param pass pass phrase
gsfan 12:057089026a20 231 */
gsfan 11:71d67fea5ace 232 int setSsid (Security sec, const char *ssid, const char *phrase);
gsfan 5:78943b3945b5 233
gsfan 5:78943b3945b5 234 static GSwifi * getInstance() {
gsfan 5:78943b3945b5 235 return _inst;
gsfan 5:78943b3945b5 236 };
gsfan 5:78943b3945b5 237
gsfan 8:64184a968e3b 238 // ----- GSwifi_util.cpp -----
gsfan 8:64184a968e3b 239 int setRegion (int reg);
gsfan 8:64184a968e3b 240
gsfan 12:057089026a20 241 /** get RSSI
gsfan 8:64184a968e3b 242 * @return RSSI (dBm)
gsfan 8:64184a968e3b 243 */
gsfan 8:64184a968e3b 244 int getRssi ();
gsfan 8:64184a968e3b 245
gsfan 8:64184a968e3b 246 /** power save mode
gsfan 8:64184a968e3b 247 * @param active rx radio 0:switched off, 1:always on
gsfan 8:64184a968e3b 248 * @param save power save 0:disable, 1:enable
gsfan 8:64184a968e3b 249 */
gsfan 8:64184a968e3b 250 int powerSave (int active, int save);
gsfan 8:64184a968e3b 251
gsfan 8:64184a968e3b 252 /** RF power
gsfan 8:64184a968e3b 253 * @param power 0(high)-7(low)
gsfan 8:64184a968e3b 254 */
gsfan 8:64184a968e3b 255 int setRfPower (int power);
gsfan 8:64184a968e3b 256
gsfan 8:64184a968e3b 257 /** set system time
gsfan 8:64184a968e3b 258 * @param time date time (UTC)
gsfan 8:64184a968e3b 259 */
gsfan 8:64184a968e3b 260 int setTime (time_t time);
gsfan 8:64184a968e3b 261
gsfan 8:64184a968e3b 262 /** get system time
gsfan 8:64184a968e3b 263 * @return date time (UTC)
gsfan 8:64184a968e3b 264 */
gsfan 8:64184a968e3b 265 time_t getTime ();
gsfan 8:64184a968e3b 266
gsfan 8:64184a968e3b 267 /** set NTP server
gsfan 8:64184a968e3b 268 * @param host SNTP server
gsfan 8:64184a968e3b 269 * @param sec time sync interval, 0:one time
gsfan 8:64184a968e3b 270 */
gsfan 8:64184a968e3b 271 int ntpdate (char *host, int sec = 0);
gsfan 8:64184a968e3b 272
gsfan 8:64184a968e3b 273 /** GPIO output
gsfan 8:64184a968e3b 274 * @param port 10,11,30,31
gsfan 8:64184a968e3b 275 * @param out 0:set(high), 1:reset(low)
gsfan 8:64184a968e3b 276 */
gsfan 8:64184a968e3b 277 int setGpio (int port, int out);
gsfan 8:64184a968e3b 278
gsfan 8:64184a968e3b 279 /** Web server
gsfan 8:64184a968e3b 280 */
gsfan 8:64184a968e3b 281 int provisioning (char *user, char *pass);
gsfan 8:64184a968e3b 282
gsfan 8:64184a968e3b 283 /** standby mode
gsfan 8:64184a968e3b 284 * @param msec wakeup after
gsfan 8:64184a968e3b 285 * wakeup after msec or alarm1/2
gsfan 8:64184a968e3b 286 * core off, save to RTC ram
gsfan 8:64184a968e3b 287 */
gsfan 8:64184a968e3b 288 int standby (int msec);
gsfan 8:64184a968e3b 289
gsfan 8:64184a968e3b 290 /** deep sleep mode
gsfan 8:64184a968e3b 291 */
gsfan 8:64184a968e3b 292 int deepSleep ();
gsfan 8:64184a968e3b 293
gsfan 8:64184a968e3b 294 /** restore standby or deep sleep
gsfan 8:64184a968e3b 295 */
gsfan 8:64184a968e3b 296 int wakeup ();
gsfan 8:64184a968e3b 297
gsfan 8:64184a968e3b 298 // ----- GSwifi_sock.cpp -----
gsfan 8:64184a968e3b 299 /** Resolv hostname
gsfan 8:64184a968e3b 300 * @param name hostname
gsfan 8:64184a968e3b 301 * @param ip resolved ip address
gsfan 8:64184a968e3b 302 */
gsfan 8:64184a968e3b 303 int getHostByName(const char * host, char * ip);
gsfan 8:64184a968e3b 304
gsfan 8:64184a968e3b 305 /** TCP/UDP client
gsfan 8:64184a968e3b 306 * @return CID, -1:failure
gsfan 8:64184a968e3b 307 */
gsfan 12:057089026a20 308 int open (Protocol proto, const char *ip, int port, int src = 0, void(*func)(int) = NULL);
gsfan 8:64184a968e3b 309
gsfan 8:64184a968e3b 310 /** TCP/UDP server
gsfan 8:64184a968e3b 311 * @return CID, -1:failure
gsfan 8:64184a968e3b 312 */
gsfan 12:057089026a20 313 int listen (Protocol proto, int port, void(*func)(int) = NULL);
gsfan 8:64184a968e3b 314
gsfan 8:64184a968e3b 315 /** close client/server
gsfan 8:64184a968e3b 316 */
gsfan 8:64184a968e3b 317 int close (int cid);
gsfan 8:64184a968e3b 318
gsfan 8:64184a968e3b 319 /** send data tcp(s/c), udp(c)
gsfan 8:64184a968e3b 320 */
gsfan 8:64184a968e3b 321 int send (int cid, const char *buf, int len);
gsfan 8:64184a968e3b 322
gsfan 12:057089026a20 323 /** send data udp(s)
gsfan 8:64184a968e3b 324 */
gsfan 8:64184a968e3b 325 int sendto (int cid, const char *buf, int len, const char *ip, int port);
gsfan 8:64184a968e3b 326
gsfan 8:64184a968e3b 327 /** recv data tcp(s/c), udp(c)
gsfan 8:64184a968e3b 328 * @return length
gsfan 8:64184a968e3b 329 */
gsfan 8:64184a968e3b 330 int recv (int cid, char *buf, int len);
gsfan 8:64184a968e3b 331
gsfan 8:64184a968e3b 332 /** recv data udp(s)
gsfan 8:64184a968e3b 333 * @return length
gsfan 8:64184a968e3b 334 */
gsfan 8:64184a968e3b 335 int recvfrom (int cid, char *buf, int len, char *ip, int *port);
gsfan 8:64184a968e3b 336
gsfan 8:64184a968e3b 337 /** readable recv data
gsfan 8:64184a968e3b 338 */
gsfan 8:64184a968e3b 339 int readable (int cid);
gsfan 8:64184a968e3b 340
gsfan 8:64184a968e3b 341 /** tcp/udp connected
gsfan 8:64184a968e3b 342 */
gsfan 8:64184a968e3b 343 bool isConnected (int cid);
gsfan 8:64184a968e3b 344
gsfan 8:64184a968e3b 345 int accept (int cid);
gsfan 8:64184a968e3b 346 int getRemote(int cid, char **ip, int *port);
gsfan 8:64184a968e3b 347
gsfan 8:64184a968e3b 348 // ----- GSwifi_http.cpp -----
gsfan 12:057089026a20 349 /** http request (GET method)
gsfan 12:057089026a20 350 */
gsfan 12:057089026a20 351 int httpGet (const char *host, int port, const char *uri, bool ssl = false, const char *user = NULL, const char *pwd = NULL, void(*func)(int) = NULL);
gsfan 19:d035412a7803 352 int httpGet (const char *host, int port, const char *uri, void(*func)(int)) {
gsfan 12:057089026a20 353 return httpGet(host, port, uri, false, NULL, NULL, func);
gsfan 12:057089026a20 354 }
gsfan 12:057089026a20 355 /** http request (POST method)
gsfan 12:057089026a20 356 */
gsfan 12:057089026a20 357 int httpPost (const char *host, int port, const char *uri, const char *body, bool ssl = false, const char *user = NULL, const char *pwd = NULL, void(*func)(int) = NULL);
gsfan 19:d035412a7803 358 int httpPost (const char *host, int port, const char *uri, const char *body, void(*func)(int)) {
gsfan 12:057089026a20 359 return httpPost(host, port, uri, body, false, NULL, NULL, func);
gsfan 12:057089026a20 360 }
gsfan 12:057089026a20 361
gsfan 8:64184a968e3b 362 int base64encode (const char *input, int length, char *output, int len);
gsfan 8:64184a968e3b 363 int urlencode (const char *str, char *buf, int len);
gsfan 8:64184a968e3b 364 int urldecode (const char *str, char *buf, int len);
gsfan 8:64184a968e3b 365
gsfan 12:057089026a20 366 #ifdef CFG_ENABLE_HTTPD
gsfan 12:057089026a20 367 // ----- GSwifi_httpd.cpp -----
gsfan 12:057089026a20 368 /** start http server
gsfan 12:057089026a20 369 * @param port
gsfan 12:057089026a20 370 */
gsfan 12:057089026a20 371 int httpd (int port = 80);
gsfan 12:057089026a20 372
gsfan 12:057089026a20 373 // ----- GSwifi_httpd_util.cpp -----
gsfan 12:057089026a20 374 /** attach uri to dirctory handler
gsfan 12:057089026a20 375 */
gsfan 12:057089026a20 376 void httpdError (int cid, int err);
gsfan 12:057089026a20 377 /** attach uri to dirctory handler
gsfan 12:057089026a20 378 */
gsfan 12:057089026a20 379 int httpdAttach (const char *uri, const char *dir);
gsfan 12:057089026a20 380 /** attach uri to cgi handler
gsfan 12:057089026a20 381 */
gsfan 15:086d1a33a197 382 int httpdAttach (const char *uri, void (*funcCgi)(int), int type = 0);
gsfan 15:086d1a33a197 383
gsfan 15:086d1a33a197 384 const char *httpdGetFilename (int cid);
gsfan 15:086d1a33a197 385 const char *httpdGetQuerystring (int cid);
gsfan 12:057089026a20 386 #endif
gsfan 12:057089026a20 387
gsfan 12:057089026a20 388 #ifdef CFG_ENABLE_WEBSOCKET
gsfan 12:057089026a20 389 // ----- GSwifi_httpd_ws.cpp -----
gsfan 12:057089026a20 390 /** websocket request (Upgrade method)
gsfan 12:057089026a20 391 * @return CID, -1:failure
gsfan 12:057089026a20 392 */
gsfan 12:057089026a20 393 int wsOpen (const char *host, int port, const char *uri, const char *user = NULL, const char *pwd = NULL);
gsfan 12:057089026a20 394 /** send websocket data
gsfan 12:057089026a20 395 */
gsfan 12:057089026a20 396 int wsSend (int cid, const char *buf, int len, const char *mask = NULL);
gsfan 12:057089026a20 397 #endif
gsfan 12:057089026a20 398
gsfan 12:057089026a20 399 #ifdef CFG_ENABLE_SMTP
gsfan 12:057089026a20 400 // ----- GSwifi_smtp.cpp -----
gsfan 12:057089026a20 401 /** send mail (smtp)
gsfan 12:057089026a20 402 * @param host SMTP server
gsfan 12:057089026a20 403 * @param port SMTP port (25 or 587 or etc.)
gsfan 12:057089026a20 404 * @param to To address
gsfan 12:057089026a20 405 * @param from From address
gsfan 12:057089026a20 406 * @param subject Subject
gsfan 12:057089026a20 407 * @param mesg Message
gsfan 12:057089026a20 408 * @param user username (SMTP Auth)
gsfan 12:057089026a20 409 * @param pwd password (SMTP Auth)
gsfan 12:057089026a20 410 * @retval 0 success
gsfan 12:057089026a20 411 * @retval -1 failure
gsfan 12:057089026a20 412 */
gsfan 12:057089026a20 413 int mail (const char *host, int port, const char *to, const char *from, const char *subject, const char *mesg, const char *user = NULL, const char *pwd = NULL);
gsfan 12:057089026a20 414 #endif
gsfan 12:057089026a20 415
gsfan 8:64184a968e3b 416 // ----- GSwifi_msg.cpp -----
gsfan 8:64184a968e3b 417
gsfan 8:64184a968e3b 418 // ----- GSwifi_at.cpp -----
gsfan 8:64184a968e3b 419 /** Send a command to the wifi module. Check if the module is in command mode. If not enter in command mode
gsfan 8:64184a968e3b 420 * @param cmd string to be sent
gsfan 8:64184a968e3b 421 * @param res need response
gsfan 8:64184a968e3b 422 * @param timeout
gsfan 8:64184a968e3b 423 * @returns 0 if successful
gsfan 8:64184a968e3b 424 */
gsfan 8:64184a968e3b 425 int sendCommand(const char * cmd, Response res = RES_NULL, int timeout = DEFAULT_WAIT_RESP_TIMEOUT);
gsfan 8:64184a968e3b 426
gsfan 8:64184a968e3b 427 /** Send a command to the wifi module. Check if the module is in command mode. If not enter in command mode
gsfan 8:64184a968e3b 428 * @param data string to be sent
gsfan 8:64184a968e3b 429 * @param res need response
gsfan 8:64184a968e3b 430 * @param timeout
gsfan 8:64184a968e3b 431 * @param cmd
gsfan 8:64184a968e3b 432 * @returns 0 if successful
gsfan 8:64184a968e3b 433 */
gsfan 11:71d67fea5ace 434 int sendData(const char * data, int len, int timeout = CFG_TIMEOUT, const char * cmd = NULL);
gsfan 8:64184a968e3b 435
gsfan 5:78943b3945b5 436
gsfan 5:78943b3945b5 437 protected:
gsfan 5:78943b3945b5 438
gsfan 5:78943b3945b5 439 static GSwifi * _inst;
gsfan 11:71d67fea5ace 440 #ifdef CFG_ENABLE_RTOS
gsfan 8:64184a968e3b 441 Thread *_threadPoll;
gsfan 8:64184a968e3b 442 Mutex _mutexUart;
gsfan 8:64184a968e3b 443 #endif
gsfan 5:78943b3945b5 444
gsfan 8:64184a968e3b 445 // Serial _gs;
gsfan 8:64184a968e3b 446 RawSerial _gs;
gsfan 22:d25a5a0d2497 447 #ifdef CFG_SPI_DATAINTERFACE
gsfan 22:d25a5a0d2497 448 SPI _spi;
gsfan 22:d25a5a0d2497 449 InterruptIn _wake;
gsfan 22:d25a5a0d2497 450 Mutex _mutexSpi;
gsfan 22:d25a5a0d2497 451 #endif
gsfan 8:64184a968e3b 452 int _baud;
gsfan 8:64184a968e3b 453 DigitalIn *_cts;
gsfan 8:64184a968e3b 454 DigitalOut *_rts;
gsfan 8:64184a968e3b 455 int _flow;
gsfan 16:105b56570533 456 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC176X) || defined(TARGET_LPC408X)
gsfan 8:64184a968e3b 457 LPC_UART1_TypeDef *_uart;
gsfan 16:105b56570533 458 #elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11UXX)
gsfan 8:64184a968e3b 459 LPC_USART_Type *_uart;
gsfan 12:057089026a20 460 #elif defined(TARGET_LPC11XX)
gsfan 12:057089026a20 461 LPC_UART_TypeDef *_uart;
gsfan 16:105b56570533 462 #elif defined(TARGET_LPC81X)
gsfan 14:1e89a3f0282d 463 LPC_UART_TypeDef *_uart;
gsfan 8:64184a968e3b 464 #endif
gsfan 8:64184a968e3b 465 DigitalInOut _reset;
gsfan 8:64184a968e3b 466 DigitalInOut *_alarm;
gsfan 5:78943b3945b5 467
gsfan 8:64184a968e3b 468 struct STATE {
gsfan 8:64184a968e3b 469 WiFiMode wm;
gsfan 8:64184a968e3b 470 Security sec;
gsfan 8:64184a968e3b 471 char ssid[35];
gsfan 8:64184a968e3b 472 char pass[66];
gsfan 8:64184a968e3b 473 char ip[16];
gsfan 8:64184a968e3b 474 char netmask[16];
gsfan 8:64184a968e3b 475 char gateway[16];
gsfan 8:64184a968e3b 476 char nameserver[16];
gsfan 8:64184a968e3b 477 char mac[18];
gsfan 8:64184a968e3b 478 char resolv[16];
gsfan 8:64184a968e3b 479 char name[32];
gsfan 8:64184a968e3b 480 int rssi;
gsfan 5:78943b3945b5 481 bool dhcp;
gsfan 8:64184a968e3b 482 time_t time;
gsfan 8:64184a968e3b 483
gsfan 22:d25a5a0d2497 484 bool initialized, datainterface;
gsfan 8:64184a968e3b 485 bool associated;
gsfan 8:64184a968e3b 486 volatile Mode mode;
gsfan 8:64184a968e3b 487 volatile Status status;
gsfan 5:78943b3945b5 488 bool escape;
gsfan 8:64184a968e3b 489 volatile bool ok, failure;
gsfan 10:7d8134e7df01 490 volatile Response res;
gsfan 11:71d67fea5ace 491 int cid;
gsfan 5:78943b3945b5 492 int n;
gsfan 8:64184a968e3b 493 CircBuffer<char> *buf;
gsfan 8:64184a968e3b 494 } _state;
gsfan 5:78943b3945b5 495
gsfan 8:64184a968e3b 496 struct CONNECTION {
gsfan 8:64184a968e3b 497 Protocol protocol;
gsfan 8:64184a968e3b 498 Type type;
gsfan 5:78943b3945b5 499 bool connected;
gsfan 5:78943b3945b5 500 char ip[16];
gsfan 5:78943b3945b5 501 int port;
gsfan 5:78943b3945b5 502 CircBuffer<char> *buf;
gsfan 8:64184a968e3b 503 volatile bool received;
gsfan 8:64184a968e3b 504 volatile int parent;
gsfan 8:64184a968e3b 505 volatile bool accept;
gsfan 12:057089026a20 506 void(*func)(int);
gsfan 8:64184a968e3b 507 } _con[16];
gsfan 8:64184a968e3b 508
gsfan 12:057089026a20 509 #ifdef CFG_ENABLE_HTTPD
gsfan 12:057089026a20 510 enum HttpdMode {
gsfan 12:057089026a20 511 HTTPDMODE_REQUEST,
gsfan 12:057089026a20 512 HTTPDMODE_REQUEST_STR,
gsfan 12:057089026a20 513 HTTPDMODE_HEADER,
gsfan 12:057089026a20 514 HTTPDMODE_BODY,
gsfan 12:057089026a20 515 HTTPDMODE_ENTER,
gsfan 12:057089026a20 516 HTTPDMODE_ERROR,
gsfan 15:086d1a33a197 517 HTTPDMODE_WEBSOCKET_BEGIN,
gsfan 12:057089026a20 518 HTTPDMODE_WEBSOCKET,
gsfan 12:057089026a20 519 HTTPDMODE_WEBSOCKET_MASK,
gsfan 12:057089026a20 520 HTTPDMODE_WEBSOCKET_BODY,
gsfan 12:057089026a20 521 HTTPDMODE_WEBSOCKET_ENTER,
gsfan 12:057089026a20 522 };
gsfan 12:057089026a20 523
gsfan 12:057089026a20 524 enum HttpdReq {
gsfan 12:057089026a20 525 REQ_HTTPGET,
gsfan 12:057089026a20 526 REQ_HTTPPOST,
gsfan 12:057089026a20 527 };
gsfan 12:057089026a20 528
gsfan 12:057089026a20 529 struct HTTPD {
gsfan 12:057089026a20 530 HttpdMode mode;
gsfan 12:057089026a20 531 HttpdReq req;
gsfan 12:057089026a20 532 CircBuffer <char>*buf;
gsfan 12:057089026a20 533 char *uri;
gsfan 12:057089026a20 534 char *filename;
gsfan 12:057089026a20 535 char *querystring;
gsfan 12:057089026a20 536 int enter;
gsfan 12:057089026a20 537 int length;
gsfan 12:057089026a20 538 int n;
gsfan 12:057089026a20 539 int keepalive;
gsfan 12:057089026a20 540 #ifdef CFG_ENABLE_WEBSOCKET
gsfan 12:057089026a20 541 int websocket;
gsfan 12:057089026a20 542 char *websocket_key;
gsfan 12:057089026a20 543 int websocket_opcode;
gsfan 12:057089026a20 544 int websocket_flg;
gsfan 12:057089026a20 545 char websocket_mask[4];
gsfan 12:057089026a20 546 int websocket_payload;
gsfan 12:057089026a20 547 #endif
gsfan 12:057089026a20 548 } _httpd[16];
gsfan 12:057089026a20 549
gsfan 12:057089026a20 550 struct HTTPD_HANDLER {
gsfan 12:057089026a20 551 char *uri;
gsfan 12:057089026a20 552 char *dir;
gsfan 12:057089026a20 553 void (*func)(int);
gsfan 15:086d1a33a197 554 int ws;
gsfan 12:057089026a20 555 } _httpd_handler[CFG_HTTPD_HANDLER_NUM];
gsfan 12:057089026a20 556
gsfan 12:057089026a20 557 int _httpd_cid;
gsfan 12:057089026a20 558 int _handler_count;
gsfan 12:057089026a20 559 #endif // CFG_ENABLE_HTTPD
gsfan 12:057089026a20 560
gsfan 8:64184a968e3b 561
gsfan 8:64184a968e3b 562 // ----- GSwifi.cpp -----
gsfan 11:71d67fea5ace 563 #ifdef CFG_ENABLE_RTOS
gsfan 8:64184a968e3b 564 static void threadPoll (void const *args);
gsfan 8:64184a968e3b 565 #endif
gsfan 8:64184a968e3b 566
gsfan 12:057089026a20 567 // ----- GSwifi_sock.cpp -----
gsfan 12:057089026a20 568 void initCon (int cid, bool connected);
gsfan 12:057089026a20 569
gsfan 8:64184a968e3b 570 // ----- GSwifi_util.cpp -----
gsfan 8:64184a968e3b 571 int x2i (char c);
gsfan 8:64184a968e3b 572 char i2x (int i);
gsfan 8:64184a968e3b 573 int from_hex (int ch);
gsfan 8:64184a968e3b 574 int to_hex (int code);
gsfan 8:64184a968e3b 575
gsfan 12:057089026a20 576 // ----- GSwifi_http.cpp -----
gsfan 12:057089026a20 577
gsfan 12:057089026a20 578 #ifdef CFG_ENABLE_HTTPD
gsfan 12:057089026a20 579 // ----- GSwifi_httpd.cpp -----
gsfan 12:057089026a20 580 void httpdRecvData (int cid, char c);
gsfan 12:057089026a20 581 int httpdParseRequest (int cid);
gsfan 12:057089026a20 582 void httpdPoll ();
gsfan 12:057089026a20 583 int httpdParseHeader (int cid);
gsfan 12:057089026a20 584 void reqContentLength (int cid, const char *buf);
gsfan 12:057089026a20 585 void reqConnection (int cid, const char *buf);
gsfan 12:057089026a20 586 void reqUpgrade (int cid, const char *buf);
gsfan 12:057089026a20 587 void reqWebSocketVersion (int cid, const char *buf);
gsfan 12:057089026a20 588 void reqWebSocketKey (int cid, const char *buf);
gsfan 12:057089026a20 589
gsfan 12:057089026a20 590 // ----- GSwifi_httpd_util.cpp -----
gsfan 12:057089026a20 591 int httpdFile (int cid, char *dir);
gsfan 12:057089026a20 592 int httpdGetHandler (const char *uri);
gsfan 12:057089026a20 593 char *mimetype (char *file);
gsfan 12:057089026a20 594 int strnicmp (const char *p1, const char *p2, int n);
gsfan 12:057089026a20 595 #endif
gsfan 12:057089026a20 596
gsfan 12:057089026a20 597 #ifdef CFG_ENABLE_WEBSOCKET
gsfan 12:057089026a20 598 // ----- GSwifi_httpd_ws.cpp -----
gsfan 12:057089026a20 599 int wsWait (int cid, int code);
gsfan 12:057089026a20 600 #ifdef CFG_ENABLE_HTTPD
gsfan 12:057089026a20 601 void wsRecvData (int cid, char c);
gsfan 12:057089026a20 602 int wsParseRequest (int cid);
gsfan 12:057089026a20 603 int wsAccept (int cid);
gsfan 12:057089026a20 604 #endif
gsfan 12:057089026a20 605 #endif
gsfan 12:057089026a20 606
gsfan 12:057089026a20 607 #ifdef CFG_ENABLE_SMTP
gsfan 12:057089026a20 608 // ----- GSwifi_smtp.cpp -----
gsfan 12:057089026a20 609 int smtpWait (int cid, int code);
gsfan 12:057089026a20 610 #endif
gsfan 12:057089026a20 611
gsfan 8:64184a968e3b 612 // ----- GSwifi_msg.cpp -----
gsfan 8:64184a968e3b 613 void recvData (char c);
gsfan 8:64184a968e3b 614 int parseMessage ();
gsfan 8:64184a968e3b 615 void msgOk (const char*);
gsfan 8:64184a968e3b 616 void msgError (const char*);
gsfan 8:64184a968e3b 617 void msgConnect (const char*);
gsfan 8:64184a968e3b 618 void msgDisconnect (const char*);
gsfan 8:64184a968e3b 619 void msgDisassociated (const char*);
gsfan 8:64184a968e3b 620 void msgReset (const char*);
gsfan 8:64184a968e3b 621 void msgOutofStandby (const char*);
gsfan 8:64184a968e3b 622 void msgOutofDeepsleep (const char*);
gsfan 22:d25a5a0d2497 623 void msgDataInterfaceReady (const char*);
gsfan 8:64184a968e3b 624 void resNormal (const char*);
gsfan 8:64184a968e3b 625 void resConnect (const char*);
gsfan 13:189e04ac70bd 626 void resWpapsk (const char *buf);
gsfan 8:64184a968e3b 627 void resWps (const char*);
gsfan 8:64184a968e3b 628 void resMacAddress (const char*);
gsfan 8:64184a968e3b 629 void resIp (const char*);
gsfan 8:64184a968e3b 630 void resLookup (const char*);
gsfan 8:64184a968e3b 631 void resRssi (const char*);
gsfan 8:64184a968e3b 632 void resTime (const char*);
gsfan 8:64184a968e3b 633 void resChannel (const char*);
gsfan 8:64184a968e3b 634 void resStatus (const char*);
gsfan 12:057089026a20 635 void resHttp (const char *buf);
gsfan 5:78943b3945b5 636
gsfan 8:64184a968e3b 637 // ----- GSwifi_at.cpp -----
gsfan 8:64184a968e3b 638 void clearFlags ();
gsfan 8:64184a968e3b 639 int cmdAT ();
gsfan 8:64184a968e3b 640 int cmdE (bool n);
gsfan 8:64184a968e3b 641 int cmdR (bool n);
gsfan 8:64184a968e3b 642 int cmdNMAC (const char *s = NULL);
gsfan 8:64184a968e3b 643 int cmdWREGDOMAIN (int n = CFG_WREGDOMAIN);
gsfan 8:64184a968e3b 644 int cmdWS ();
gsfan 8:64184a968e3b 645 int cmdWM (int n);
gsfan 8:64184a968e3b 646 int cmdWA (const char *s);
gsfan 8:64184a968e3b 647 int cmdWD ();
gsfan 8:64184a968e3b 648 int cmdWWPS (bool n, const char *p = NULL);
gsfan 8:64184a968e3b 649 int cmdNSTAT ();
gsfan 8:64184a968e3b 650 int cmdWSTATUS ();
gsfan 8:64184a968e3b 651 int cmdWRSSI ();
gsfan 8:64184a968e3b 652 int cmdWAUTH (int n);
gsfan 8:64184a968e3b 653 int cmdWWEP (int n, const char *s);
gsfan 8:64184a968e3b 654 int cmdWPAPSK (const char *s, const char *p);
gsfan 8:64184a968e3b 655 int cmdWRXACTIVE (bool n);
gsfan 8:64184a968e3b 656 int cmdWRXPS (bool n);
gsfan 8:64184a968e3b 657 int cmdWP (int n);
gsfan 8:64184a968e3b 658 int cmdNDHCP (bool n, const char *s = NULL, int m = CFG_TIMEOUT);
gsfan 8:64184a968e3b 659 int cmdDHCPSRVR (bool n);
gsfan 8:64184a968e3b 660 int cmdNSET (const char *s, const char *t, const char *u);
gsfan 8:64184a968e3b 661 int cmdDNS (bool n, const char *s);
gsfan 8:64184a968e3b 662 int cmdDNSLOOKUP (const char *s);
gsfan 8:64184a968e3b 663 int cmdDNSSET (const char *s);
gsfan 8:64184a968e3b 664 int cmdSTORENWCONN ();
gsfan 8:64184a968e3b 665 int cmdRESTORENWCONN ();
gsfan 8:64184a968e3b 666 int cmdBDATA (bool n);
gsfan 8:64184a968e3b 667 int cmdNCTCP (const char *s, int n);
gsfan 8:64184a968e3b 668 int cmdNCUDP (const char *s, int n, int m = 0);
gsfan 8:64184a968e3b 669 int cmdNSTCP (int n);
gsfan 8:64184a968e3b 670 int cmdNSUDP (int n);
gsfan 8:64184a968e3b 671 int cmdNCLOSE (int n);
gsfan 8:64184a968e3b 672 int cmdNCLOSEALL ();
gsfan 8:64184a968e3b 673 int cmdHTTPCONF (int n, const char *s);
gsfan 8:64184a968e3b 674 int cmdHTTPCONFDEL (int n);
gsfan 8:64184a968e3b 675 int cmdHTTPOPEN (const char *s, int n = 80, bool m = false);
gsfan 8:64184a968e3b 676 int cmdHTTPSEND (int n, bool m, const char *s, int t = 0);
gsfan 8:64184a968e3b 677 int cmdHTTPCLOSE (int n);
gsfan 8:64184a968e3b 678 int cmdPSDPSLEEP (int n = 0);
gsfan 8:64184a968e3b 679 int cmdPSSTBY (int n, int m = 0);
gsfan 8:64184a968e3b 680 int cmdWEBPROV (const char *s, const char *p);
gsfan 8:64184a968e3b 681 int cmdSETTIME (const char *s, const char *t);
gsfan 8:64184a968e3b 682 int cmdGETTIME ();
gsfan 8:64184a968e3b 683 int cmdNTIMESYNC (bool n, const char *s, int m = 0);
gsfan 8:64184a968e3b 684 int cmdDGPIO (int n, int m);
gsfan 8:64184a968e3b 685
gsfan 8:64184a968e3b 686 // ----- GSwifi_hal.cpp -----
gsfan 8:64184a968e3b 687 void setReset (bool flg);
gsfan 8:64184a968e3b 688 void setAlarm (bool flg);
gsfan 8:64184a968e3b 689 void isrUart ();
gsfan 8:64184a968e3b 690 int getUart ();
gsfan 8:64184a968e3b 691 void putUart (char c);
gsfan 8:64184a968e3b 692 void setRts (bool flg);
gsfan 8:64184a968e3b 693 int lockUart (int ms);
gsfan 8:64184a968e3b 694 void unlockUart ();
gsfan 8:64184a968e3b 695 void initUart (PinName cts, PinName rts, PinName alarm, int baud);
gsfan 22:d25a5a0d2497 696 #ifdef CFG_SPI_DATAINTERFACE
gsfan 22:d25a5a0d2497 697 void isrSpi ();
gsfan 22:d25a5a0d2497 698 void putSpi (char c);
gsfan 22:d25a5a0d2497 699 int lockSpi (int ms);
gsfan 22:d25a5a0d2497 700 void unlockSpi ();
gsfan 22:d25a5a0d2497 701 void initSpi (PinName cs, int freq);
gsfan 22:d25a5a0d2497 702 #endif
gsfan 8:64184a968e3b 703
gsfan 5:78943b3945b5 704 };
gsfan 5:78943b3945b5 705
samux 1:fb4494783863 706 #endif