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
GSwifi.h
00001 /* Copyright (C) 2019 gsfan, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00005 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00006 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00007 * furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 * 00018 * @section DESCRIPTION 00019 * 00020 * GainSpan (Telit) GS1011, GS2000, GS2100 Wi-Fi module 00021 * 00022 * https://www.telit.com/m2m-iot-products/wifi-bluetooth-modules/ 00023 * http://www.gainspan.com/modules 00024 */ 00025 /** @file 00026 * @brief GainSpan (Telit) wi-fi module library for mbed 00027 * GS1011MIC, GS1011MIP, GS2100MIP, GainSpan WiFi Breakout, etc. 00028 */ 00029 00030 #ifndef GSwifi_H 00031 #define GSwifi_H 00032 00033 #include "GSwifi_conf.h" 00034 00035 #include "mbed.h" 00036 #include "RawSerial.h" 00037 #include "CBuffer.h" 00038 #include <ctype.h> 00039 #include <stdlib.h> 00040 #include <string.h> 00041 00042 #ifdef CFG_ENABLE_RTOS 00043 #include "rtos.h" 00044 #endif 00045 00046 //Debug is disabled by default 00047 #if defined(DEBUG) and (!defined(TARGET_LPC11U24)) 00048 #define DBG(x, ...) std::printf("[DBG]" x "\r\n", ##__VA_ARGS__); 00049 #define WARN(x, ...) std::printf("[WARN]" x "\r\n", ##__VA_ARGS__); 00050 #define ERR(x, ...) std::printf("[ERR]" x "\r\n", ##__VA_ARGS__); 00051 #define INFO(x, ...) std::printf("[INFO]" x "\r\n", ##__VA_ARGS__); 00052 #else 00053 #define DBG(x, ...) 00054 #define WARN(x, ...) 00055 #define ERR(x, ...) 00056 #define INFO(x, ...) 00057 #endif 00058 00059 00060 /** GSwifi class 00061 */ 00062 class GSwifi 00063 { 00064 00065 public: 00066 00067 /** Wi-Fi mode 00068 */ 00069 enum WiFiMode { 00070 WM_INFRASTRUCTURE, 00071 WM_ADHOCK, 00072 WM_LIMITEDAP, 00073 }; 00074 00075 /** Wi-Fi security 00076 */ 00077 enum Security { 00078 SEC_AUTO = 0, 00079 SEC_NONE = 0, 00080 SEC_OPEN = 1, 00081 SEC_WEP = 2, 00082 SEC_WPA_PSK = 4, 00083 SEC_WPA2_PSK = 8, 00084 SEC_WPA_ENT = 16, 00085 SEC_WPA2_ENT = 32, 00086 SEC_WPS_BUTTON = 64, 00087 SEC_WPS_PIN, 00088 }; 00089 00090 /** TCP/IP protocol 00091 */ 00092 enum Protocol { 00093 PROTO_UDP = 0, 00094 PROTO_TCP = 1, 00095 PROTO_HTTPGET, 00096 PROTO_HTTPPOST, 00097 PROTO_HTTPD, 00098 }; 00099 00100 /** Client/Server 00101 */ 00102 enum Type { 00103 TYPE_CLIENT = 0, 00104 TYPE_SERVER = 1, 00105 }; 00106 00107 enum Response { 00108 RES_NULL, 00109 RES_CONNECT, 00110 RES_WPAPSK, 00111 RES_WPS, 00112 RES_MACADDRESS, 00113 RES_DHCP, 00114 RES_DNSLOOKUP, 00115 RES_HTTP, 00116 RES_RSSI, 00117 RES_TIME, 00118 RES_STATUS, 00119 }; 00120 00121 enum Mode { 00122 MODE_COMMAND, 00123 MODE_CMDRESP, 00124 MODE_ESCAPE, 00125 MODE_DATA_RX, 00126 MODE_DATA_RX_BULK, 00127 MODE_DATA_RXUDP, 00128 MODE_DATA_RXUDP_BULK, 00129 MODE_DATA_RXHTTP, 00130 MODE_DATA_RAW, 00131 }; 00132 00133 enum Status { 00134 STAT_NONE, 00135 STAT_READY, 00136 STAT_STANDBY, 00137 STAT_WAKEUP, 00138 STAT_DEEPSLEEP, 00139 }; 00140 00141 // ----- GSwifi.cpp ----- 00142 /** Constructor 00143 * \param tx mbed pin to use for tx line of Serial interface 00144 * \param rx mbed pin to use for rx line of Serial interface 00145 * \param cts mbed pin to use for cts line of Serial interface 00146 * \param rts mbed pin to use for rts line of Serial interface 00147 * \param reset reset pin of the wifi module 00148 * \param alarm alarm pin of the wifi module (default NULL) 00149 * \param baud baud rate of Serial interface (default 9600) 00150 */ 00151 #ifdef CFG_SPI_DATAINTERFACE 00152 GSwifi (PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, 00153 PinName mosi, PinName miso, PinName sclk, PinName cs, PinName wake, 00154 PinName alarm = NC, int baud = 9600, int freq = 2000000); 00155 #else 00156 GSwifi (PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 9600); 00157 #endif 00158 00159 /** Connect the wifi module to the ssid contained in the constructor. 00160 * @param sec Security type (NONE, WEP_128 or WPA) 00161 * @param ssid ssid of the network 00162 * @param phrase WEP or WPA key 00163 * @return 0 if connected, -1 otherwise 00164 */ 00165 int join (); 00166 00167 /** Connect the wifi module to the adhock in the constructor. 00168 * @param sec Security type (NONE, WEP_128 or WPA) 00169 * @param ssid ssid of the network 00170 * @param phrase WEP or WPA key 00171 * @return 0 if connected, -1 otherwise 00172 */ 00173 int adhock (); 00174 00175 /** Connect the wifi module to the limited AP in the constructor. 00176 * @param sec Security type (NONE, WEP_128 or WPA) 00177 * @param ssid ssid of the network 00178 * @param phrase WEP or WPA key 00179 * @return 0 if connected, -1 otherwise 00180 */ 00181 int limitedap (); 00182 00183 /** Disconnect the wifi module from the access point 00184 * @returns 0 if successful 00185 */ 00186 int dissociate (); 00187 int disconnect () { 00188 return dissociate(); 00189 } 00190 00191 /** Check if a Wi-Fi link is active 00192 * @returns true if successful 00193 */ 00194 bool isAssociated(); 00195 00196 /** polling if not use rtos 00197 */ 00198 void poll (); 00199 00200 /** get Wi-Fi modue status 00201 * @return Status 00202 */ 00203 Status getStatus (); 00204 00205 /** set MAC address 00206 */ 00207 int setMacAddress (const char *mac); 00208 /** get MAC address 00209 */ 00210 int getMacAddress (char *mac); 00211 00212 /** use DHCP 00213 */ 00214 int setAddress (const char *name = NULL); 00215 /** use static IP address 00216 * @param ip my ip address (dhcp start address) 00217 * @param netmask subnet mask 00218 * @param gateway default gateway 00219 * @param dns name server (default NULL) 00220 * @param name my host name (default NULL) 00221 */ 00222 int setAddress (const char *ip, const char *netmask, const char *gateway, const char *dns = NULL, const char *name = NULL); 00223 /** get IP address 00224 */ 00225 int getAddress (char *ip, char *netmask, char *gateway); 00226 00227 /** set Wi-Fi security parameter 00228 * @param sec Security 00229 * @param ssid SSID 00230 * @param pass pass phrase 00231 */ 00232 int setSsid (Security sec, const char *ssid, const char *phrase); 00233 00234 static GSwifi * getInstance() { 00235 return _inst; 00236 }; 00237 00238 // ----- GSwifi_util.cpp ----- 00239 int setRegion (int reg); 00240 00241 /** get RSSI 00242 * @return RSSI (dBm) 00243 */ 00244 int getRssi (); 00245 00246 /** power save mode 00247 * @param active rx radio 0:switched off, 1:always on 00248 * @param save power save 0:disable, 1:enable 00249 */ 00250 int powerSave (int active, int save); 00251 00252 /** RF power 00253 * @param power 0(high)-7(low) 00254 */ 00255 int setRfPower (int power); 00256 00257 /** set system time 00258 * @param time date time (UTC) 00259 */ 00260 int setTime (time_t time); 00261 00262 /** get system time 00263 * @return date time (UTC) 00264 */ 00265 time_t getTime (); 00266 00267 /** set NTP server 00268 * @param host SNTP server 00269 * @param sec time sync interval, 0:one time 00270 */ 00271 int ntpdate (char *host, int sec = 0); 00272 00273 /** GPIO output 00274 * @param port 10,11,30,31 00275 * @param out 0:set(high), 1:reset(low) 00276 */ 00277 int setGpio (int port, int out); 00278 00279 /** Web server 00280 */ 00281 int provisioning (char *user, char *pass); 00282 00283 /** standby mode 00284 * @param msec wakeup after 00285 * wakeup after msec or alarm1/2 00286 * core off, save to RTC ram 00287 */ 00288 int standby (int msec); 00289 00290 /** deep sleep mode 00291 */ 00292 int deepSleep (); 00293 00294 /** restore standby or deep sleep 00295 */ 00296 int wakeup (); 00297 00298 // ----- GSwifi_sock.cpp ----- 00299 /** Resolv hostname 00300 * @param name hostname 00301 * @param ip resolved ip address 00302 */ 00303 int getHostByName(const char * host, char * ip); 00304 00305 /** TCP/UDP client 00306 * @return CID, -1:failure 00307 */ 00308 int open (Protocol proto, const char *ip, int port, int src = 0, void(*func)(int) = NULL); 00309 00310 /** TCP/UDP server 00311 * @return CID, -1:failure 00312 */ 00313 int listen (Protocol proto, int port, void(*func)(int) = NULL); 00314 00315 /** close client/server 00316 */ 00317 int close (int cid); 00318 00319 /** send data tcp(s/c), udp(c) 00320 */ 00321 int send (int cid, const char *buf, int len); 00322 00323 /** send data udp(s) 00324 */ 00325 int sendto (int cid, const char *buf, int len, const char *ip, int port); 00326 00327 /** recv data tcp(s/c), udp(c) 00328 * @return length 00329 */ 00330 int recv (int cid, char *buf, int len); 00331 00332 /** recv data udp(s) 00333 * @return length 00334 */ 00335 int recvfrom (int cid, char *buf, int len, char *ip, int *port); 00336 00337 /** readable recv data 00338 */ 00339 int readable (int cid); 00340 00341 /** tcp/udp connected 00342 */ 00343 bool isConnected (int cid); 00344 00345 int accept (int cid); 00346 int getRemote(int cid, char **ip, int *port); 00347 00348 // ----- GSwifi_http.cpp ----- 00349 /** http request (GET method) 00350 */ 00351 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); 00352 int httpGet (const char *host, int port, const char *uri, void(*func)(int)) { 00353 return httpGet(host, port, uri, false, NULL, NULL, func); 00354 } 00355 /** http request (POST method) 00356 */ 00357 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); 00358 int httpPost (const char *host, int port, const char *uri, const char *body, void(*func)(int)) { 00359 return httpPost(host, port, uri, body, false, NULL, NULL, func); 00360 } 00361 00362 int base64encode (const char *input, int length, char *output, int len); 00363 int urlencode (const char *str, char *buf, int len); 00364 int urldecode (const char *str, char *buf, int len); 00365 00366 #ifdef CFG_ENABLE_HTTPD 00367 // ----- GSwifi_httpd.cpp ----- 00368 /** start http server 00369 * @param port 00370 */ 00371 int httpd (int port = 80); 00372 00373 // ----- GSwifi_httpd_util.cpp ----- 00374 /** attach uri to dirctory handler 00375 */ 00376 void httpdError (int cid, int err); 00377 /** attach uri to dirctory handler 00378 */ 00379 int httpdAttach (const char *uri, const char *dir); 00380 /** attach uri to cgi handler 00381 */ 00382 int httpdAttach (const char *uri, void (*funcCgi)(int), int type = 0); 00383 00384 const char *httpdGetFilename (int cid); 00385 const char *httpdGetQuerystring (int cid); 00386 #endif 00387 00388 #ifdef CFG_ENABLE_WEBSOCKET 00389 // ----- GSwifi_httpd_ws.cpp ----- 00390 /** websocket request (Upgrade method) 00391 * @return CID, -1:failure 00392 */ 00393 int wsOpen (const char *host, int port, const char *uri, const char *user = NULL, const char *pwd = NULL); 00394 /** send websocket data 00395 */ 00396 int wsSend (int cid, const char *buf, int len, const char *mask = NULL); 00397 #endif 00398 00399 #ifdef CFG_ENABLE_SMTP 00400 // ----- GSwifi_smtp.cpp ----- 00401 /** send mail (smtp) 00402 * @param host SMTP server 00403 * @param port SMTP port (25 or 587 or etc.) 00404 * @param to To address 00405 * @param from From address 00406 * @param subject Subject 00407 * @param mesg Message 00408 * @param user username (SMTP Auth) 00409 * @param pwd password (SMTP Auth) 00410 * @retval 0 success 00411 * @retval -1 failure 00412 */ 00413 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); 00414 #endif 00415 00416 // ----- GSwifi_msg.cpp ----- 00417 00418 // ----- GSwifi_at.cpp ----- 00419 /** Send a command to the wifi module. Check if the module is in command mode. If not enter in command mode 00420 * @param cmd string to be sent 00421 * @param res need response 00422 * @param timeout 00423 * @returns 0 if successful 00424 */ 00425 int sendCommand(const char * cmd, Response res = RES_NULL, int timeout = DEFAULT_WAIT_RESP_TIMEOUT); 00426 00427 /** Send a command to the wifi module. Check if the module is in command mode. If not enter in command mode 00428 * @param data string to be sent 00429 * @param res need response 00430 * @param timeout 00431 * @param cmd 00432 * @returns 0 if successful 00433 */ 00434 int sendData(const char * data, int len, int timeout = CFG_TIMEOUT, const char * cmd = NULL); 00435 00436 00437 protected: 00438 00439 static GSwifi * _inst; 00440 #ifdef CFG_ENABLE_RTOS 00441 Thread *_threadPoll; 00442 Mutex _mutexUart; 00443 #endif 00444 00445 // Serial _gs; 00446 RawSerial _gs; 00447 #ifdef CFG_SPI_DATAINTERFACE 00448 SPI _spi; 00449 InterruptIn _wake; 00450 Mutex _mutexSpi; 00451 #endif 00452 int _baud; 00453 DigitalIn *_cts; 00454 DigitalOut *_rts; 00455 int _flow; 00456 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC176X) || defined(TARGET_LPC408X) 00457 LPC_UART1_TypeDef *_uart; 00458 #elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11UXX) 00459 LPC_USART_Type *_uart; 00460 #elif defined(TARGET_LPC11XX) 00461 LPC_UART_TypeDef *_uart; 00462 #elif defined(TARGET_LPC81X) 00463 LPC_UART_TypeDef *_uart; 00464 #endif 00465 DigitalInOut _reset; 00466 DigitalInOut *_alarm; 00467 00468 struct STATE { 00469 WiFiMode wm; 00470 Security sec; 00471 char ssid[35]; 00472 char pass[66]; 00473 char ip[16]; 00474 char netmask[16]; 00475 char gateway[16]; 00476 char nameserver[16]; 00477 char mac[18]; 00478 char resolv[16]; 00479 char name[32]; 00480 int rssi; 00481 bool dhcp; 00482 time_t time; 00483 00484 bool initialized, datainterface; 00485 bool associated; 00486 volatile Mode mode; 00487 volatile Status status; 00488 bool escape; 00489 volatile bool ok, failure; 00490 volatile Response res; 00491 int cid; 00492 int n; 00493 CircBuffer<char> *buf; 00494 } _state; 00495 00496 struct CONNECTION { 00497 Protocol protocol; 00498 Type type; 00499 bool connected; 00500 char ip[16]; 00501 int port; 00502 CircBuffer<char> *buf; 00503 volatile bool received; 00504 volatile int parent; 00505 volatile bool accept; 00506 void(*func)(int); 00507 } _con[16]; 00508 00509 #ifdef CFG_ENABLE_HTTPD 00510 enum HttpdMode { 00511 HTTPDMODE_REQUEST, 00512 HTTPDMODE_REQUEST_STR, 00513 HTTPDMODE_HEADER, 00514 HTTPDMODE_BODY, 00515 HTTPDMODE_ENTER, 00516 HTTPDMODE_ERROR, 00517 HTTPDMODE_WEBSOCKET_BEGIN, 00518 HTTPDMODE_WEBSOCKET, 00519 HTTPDMODE_WEBSOCKET_MASK, 00520 HTTPDMODE_WEBSOCKET_BODY, 00521 HTTPDMODE_WEBSOCKET_ENTER, 00522 }; 00523 00524 enum HttpdReq { 00525 REQ_HTTPGET, 00526 REQ_HTTPPOST, 00527 }; 00528 00529 struct HTTPD { 00530 HttpdMode mode; 00531 HttpdReq req; 00532 CircBuffer <char>*buf; 00533 char *uri; 00534 char *filename; 00535 char *querystring; 00536 int enter; 00537 int length; 00538 int n; 00539 int keepalive; 00540 #ifdef CFG_ENABLE_WEBSOCKET 00541 int websocket; 00542 char *websocket_key; 00543 int websocket_opcode; 00544 int websocket_flg; 00545 char websocket_mask[4]; 00546 int websocket_payload; 00547 #endif 00548 } _httpd[16]; 00549 00550 struct HTTPD_HANDLER { 00551 char *uri; 00552 char *dir; 00553 void (*func)(int); 00554 int ws; 00555 } _httpd_handler[CFG_HTTPD_HANDLER_NUM]; 00556 00557 int _httpd_cid; 00558 int _handler_count; 00559 #endif // CFG_ENABLE_HTTPD 00560 00561 00562 // ----- GSwifi.cpp ----- 00563 #ifdef CFG_ENABLE_RTOS 00564 static void threadPoll (void const *args); 00565 #endif 00566 00567 // ----- GSwifi_sock.cpp ----- 00568 void initCon (int cid, bool connected); 00569 00570 // ----- GSwifi_util.cpp ----- 00571 int x2i (char c); 00572 char i2x (int i); 00573 int from_hex (int ch); 00574 int to_hex (int code); 00575 00576 // ----- GSwifi_http.cpp ----- 00577 00578 #ifdef CFG_ENABLE_HTTPD 00579 // ----- GSwifi_httpd.cpp ----- 00580 void httpdRecvData (int cid, char c); 00581 int httpdParseRequest (int cid); 00582 void httpdPoll (); 00583 int httpdParseHeader (int cid); 00584 void reqContentLength (int cid, const char *buf); 00585 void reqConnection (int cid, const char *buf); 00586 void reqUpgrade (int cid, const char *buf); 00587 void reqWebSocketVersion (int cid, const char *buf); 00588 void reqWebSocketKey (int cid, const char *buf); 00589 00590 // ----- GSwifi_httpd_util.cpp ----- 00591 int httpdFile (int cid, char *dir); 00592 int httpdGetHandler (const char *uri); 00593 char *mimetype (char *file); 00594 int strnicmp (const char *p1, const char *p2, int n); 00595 #endif 00596 00597 #ifdef CFG_ENABLE_WEBSOCKET 00598 // ----- GSwifi_httpd_ws.cpp ----- 00599 int wsWait (int cid, int code); 00600 #ifdef CFG_ENABLE_HTTPD 00601 void wsRecvData (int cid, char c); 00602 int wsParseRequest (int cid); 00603 int wsAccept (int cid); 00604 #endif 00605 #endif 00606 00607 #ifdef CFG_ENABLE_SMTP 00608 // ----- GSwifi_smtp.cpp ----- 00609 int smtpWait (int cid, int code); 00610 #endif 00611 00612 // ----- GSwifi_msg.cpp ----- 00613 void recvData (char c); 00614 int parseMessage (); 00615 void msgOk (const char*); 00616 void msgError (const char*); 00617 void msgConnect (const char*); 00618 void msgDisconnect (const char*); 00619 void msgDisassociated (const char*); 00620 void msgReset (const char*); 00621 void msgOutofStandby (const char*); 00622 void msgOutofDeepsleep (const char*); 00623 void msgDataInterfaceReady (const char*); 00624 void resNormal (const char*); 00625 void resConnect (const char*); 00626 void resWpapsk (const char *buf); 00627 void resWps (const char*); 00628 void resMacAddress (const char*); 00629 void resIp (const char*); 00630 void resLookup (const char*); 00631 void resRssi (const char*); 00632 void resTime (const char*); 00633 void resChannel (const char*); 00634 void resStatus (const char*); 00635 void resHttp (const char *buf); 00636 00637 // ----- GSwifi_at.cpp ----- 00638 void clearFlags (); 00639 int cmdAT (); 00640 int cmdE (bool n); 00641 int cmdR (bool n); 00642 int cmdNMAC (const char *s = NULL); 00643 int cmdWREGDOMAIN (int n = CFG_WREGDOMAIN); 00644 int cmdWS (); 00645 int cmdWM (int n); 00646 int cmdWA (const char *s); 00647 int cmdWD (); 00648 int cmdWWPS (bool n, const char *p = NULL); 00649 int cmdNSTAT (); 00650 int cmdWSTATUS (); 00651 int cmdWRSSI (); 00652 int cmdWAUTH (int n); 00653 int cmdWWEP (int n, const char *s); 00654 int cmdWPAPSK (const char *s, const char *p); 00655 int cmdWRXACTIVE (bool n); 00656 int cmdWRXPS (bool n); 00657 int cmdWP (int n); 00658 int cmdNDHCP (bool n, const char *s = NULL, int m = CFG_TIMEOUT); 00659 int cmdDHCPSRVR (bool n); 00660 int cmdNSET (const char *s, const char *t, const char *u); 00661 int cmdDNS (bool n, const char *s); 00662 int cmdDNSLOOKUP (const char *s); 00663 int cmdDNSSET (const char *s); 00664 int cmdSTORENWCONN (); 00665 int cmdRESTORENWCONN (); 00666 int cmdBDATA (bool n); 00667 int cmdNCTCP (const char *s, int n); 00668 int cmdNCUDP (const char *s, int n, int m = 0); 00669 int cmdNSTCP (int n); 00670 int cmdNSUDP (int n); 00671 int cmdNCLOSE (int n); 00672 int cmdNCLOSEALL (); 00673 int cmdHTTPCONF (int n, const char *s); 00674 int cmdHTTPCONFDEL (int n); 00675 int cmdHTTPOPEN (const char *s, int n = 80, bool m = false); 00676 int cmdHTTPSEND (int n, bool m, const char *s, int t = 0); 00677 int cmdHTTPCLOSE (int n); 00678 int cmdPSDPSLEEP (int n = 0); 00679 int cmdPSSTBY (int n, int m = 0); 00680 int cmdWEBPROV (const char *s, const char *p); 00681 int cmdSETTIME (const char *s, const char *t); 00682 int cmdGETTIME (); 00683 int cmdNTIMESYNC (bool n, const char *s, int m = 0); 00684 int cmdDGPIO (int n, int m); 00685 00686 // ----- GSwifi_hal.cpp ----- 00687 void setReset (bool flg); 00688 void setAlarm (bool flg); 00689 void isrUart (); 00690 int getUart (); 00691 void putUart (char c); 00692 void setRts (bool flg); 00693 int lockUart (int ms); 00694 void unlockUart (); 00695 void initUart (PinName cts, PinName rts, PinName alarm, int baud); 00696 #ifdef CFG_SPI_DATAINTERFACE 00697 void isrSpi (); 00698 void putSpi (char c); 00699 int lockSpi (int ms); 00700 void unlockSpi (); 00701 void initSpi (PinName cs, int freq); 00702 #endif 00703 00704 }; 00705 00706 #endif
Generated on Thu Jul 14 2022 07:53:37 by 1.7.2