Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more
Fork of GSwifi by
GSwifi Class Reference
#include <GSwifi.h>
Public Types | |
| enum | GSSECURITY |
Wi-Fi security. More... | |
| enum | GSPROTOCOL |
TCP/IP protocol. More... | |
| enum | GSTYPE |
Client/Server. More... | |
| typedef void(* | onGsReceiveFunc )(int cid, int len) |
| data receive callback function | |
Public Member Functions | |
| GSwifi (PinName p_tx, PinName p_rx, PinName p_reset, PinName p_alarm=NC, int baud=GS_BAUD) | |
| default constructor (no fllow controll) | |
| GSwifi (PinName p_tx, PinName p_rx, PinName p_cts, PinName p_rts, PinName p_reset, PinName p_alarm=NC, int baud=GS_BAUD) | |
| default constructor (with hardware fllow controll) | |
| void | poll () |
| polling | |
| int | command (const char *cmd, GSRESPONCE res, int timeout=GS_TIMEOUT) |
| send command | |
| void | resetResponse (GSRESPONCE res) |
| reset recv responce | |
| int | waitResponse (int ms) |
| wait recv responce | |
| int | connect (GSSECURITY sec, const char *ssid, const char *pass, int dhcp=1, int reconnect=GS_RECONNECT, char *name=NULL) |
| associate infrastructure | |
| int | adhock (GSSECURITY sec, const char *ssid, const char *pass, IpAddr ipaddr, IpAddr netmask) |
| adhock | |
| int | limitedap (GSSECURITY sec, const char *ssid, const char *pass, IpAddr ipaddr, IpAddr netmask, char *dns=NULL) |
| limited AP | |
| int | disconnect () |
| unassociate | |
| int | reconnect () |
| re-connect | |
| int | setBaud (int baud) |
| main polling | |
| int | setRegion (int reg=GS_WREGDOMAIN) |
| change radio region | |
| int | setAddress (char *name=NULL) |
| use DHCP | |
| int | setAddress (IpAddr ipaddr, IpAddr netmask, IpAddr gateway, IpAddr nameserver) |
| use static ip address | |
| int | getAddress (IpAddr &ipaddr, IpAddr &netmask, IpAddr &gateway, IpAddr &nameserver) |
| get ip address | |
| int | getMacAddress (char *mac) |
| get mac address | |
| int | getHostByName (const char *name, IpAddr &addr) |
| resolv hostname | |
| int | getHostByName (Host &host) |
| resolv hostname | |
| bool | isConnected () |
| wifi connected | |
| GSSTATUS | getStatus () |
| status | |
| int | getRssi () |
| RSSI. | |
| int | setRFPower (int power) |
| RF power. | |
| int | powerSave (int active, int save) |
| power save mode | |
| int | standby (int msec) |
| standby mode | |
| int | wakeup () |
| restore standby | |
| int | deepSleep () |
| deep sleep mode | |
| int | ntpdate (Host host, int sec=0) |
| set NTP server | |
| int | setTime (time_t time) |
| set system time | |
| time_t | getTime () |
| get RTC time | |
| int | gpioOut (int port, int out) |
| GPIO output. | |
| int | provisioning (char *user, char *pass) |
| Web server. | |
| int | certAdd (const char *name, const char *cert, int len) |
| certificate | |
| int | open (Host &host, GSPROTOCOL pro, int port=0) |
| tcp/udp client | |
| int | listen (int port, GSPROTOCOL pro) |
| tcp/udp server | |
| int | close (int cid) |
| close client/server | |
| int | send (int cid, const char *buf, int len) |
| send data tcp(s/c), udp(c) | |
| int | send (int cid, const char *buf, int len, Host &host) |
| send data udp(s) | |
| int | recv (int cid, char *buf, int len) |
| recv data tcp(s/c), udp(c) | |
| int | recv (int cid, char *buf, int len, Host &host) |
| recv data udp(s) | |
| bool | isConnected (int cid) |
| tcp/udp connected | |
| int | httpGet (Host &host, const char *uri, const char *user, const char *pwd, int ssl=0, onGsReceiveFunc ponGsReceive=NULL) |
| http request (GET method) | |
| int | httpPost (Host &host, const char *uri, const char *body, const char *user, const char *pwd, int ssl=0, onGsReceiveFunc ponGsReceive=NULL) |
| http request (POST method) | |
| int | wsOpen (Host &host, const char *uri, const char *user, const char *pwd, onGsReceiveFunc ponGsReceive=NULL) |
| websocket request (Upgrade method) | |
| int | wsSend (int cid, const char *buf, int len, const char *mask=NULL) |
| send data websocket | |
| int | base64encode (char *input, int length, char *output, int len) |
| base64 encode | |
| int | urlencode (char *str, char *buf, int len) |
| url encode | |
| int | urldecode (char *str, char *buf, int len) |
| url decode | |
| int | mail (Host &host, const char *to, const char *from, const char *subject, const char *mesg, const char *user=NULL, const char *pwd=NULL) |
| send mail (smtp) | |
| int | httpd (int port=80) |
| start http server | |
| void | send_httpd_error (int cid, int err) |
| attach uri to dirctory handler | |
| int | attach_httpd (const char *uri, const char *dir) |
| attach uri to dirctory handler | |
| int | attach_httpd (const char *uri, onHttpdCgiFunc ponHttpCgi) |
| attach uri to cgi handler | |
Detailed Description
GSwifi class.
Definition at line 60 of file GSwifi.h.
Member Typedef Documentation
| typedef void(* onGsReceiveFunc)(int cid, int len) |
Member Enumeration Documentation
| enum GSPROTOCOL |
| enum GSSECURITY |
Constructor & Destructor Documentation
| GSwifi | ( | PinName | p_tx, |
| PinName | p_rx, | ||
| PinName | p_reset, | ||
| PinName | p_alarm = NC, |
||
| int | baud = GS_BAUD |
||
| ) |
default constructor (no fllow controll)
- Parameters:
-
p_tx mbed TXD pin (GS RXD) p_rx mbed RXD pin (GS TXD) p_reset GS RESET pin p_alarm GS ALARM pin baud uart baud rate
Definition at line 27 of file GSwifi.cpp.
| GSwifi | ( | PinName | p_tx, |
| PinName | p_rx, | ||
| PinName | p_cts, | ||
| PinName | p_rts, | ||
| PinName | p_reset, | ||
| PinName | p_alarm = NC, |
||
| int | baud = GS_BAUD |
||
| ) |
default constructor (with hardware fllow controll)
- Parameters:
-
p_tx mbed TXD pin (GS RXD) p_rx mbed RXD pin (GS TXD) p_cts mbed CTS pin (GS RTS) p_rts mbed RTS pin (GS CTS) p_reset GS RESET pin p_alarm GS ALARM pin baud uart baud rate
Definition at line 54 of file GSwifi.cpp.
Member Function Documentation
| int adhock | ( | GSSECURITY | sec, |
| const char * | ssid, | ||
| const char * | pass, | ||
| IpAddr | ipaddr, | ||
| IpAddr | netmask | ||
| ) |
adhock
- Parameters:
-
sec GSSEC_OPEN or GSSEC_WEP ssid SSID pass 10 or 26 hexadecimal digits ipaddr my ip address netmask subnet mask
- Return values:
-
0 success -1 failure
Definition at line 842 of file GSwifi.cpp.
| int attach_httpd | ( | const char * | uri, |
| const char * | dir | ||
| ) |
attach uri to dirctory handler
Definition at line 395 of file GSwifi_httpd.cpp.
| int attach_httpd | ( | const char * | uri, |
| onHttpdCgiFunc | ponHttpCgi | ||
| ) |
attach uri to cgi handler
Definition at line 409 of file GSwifi_httpd.cpp.
| int base64encode | ( | char * | input, |
| int | length, | ||
| char * | output, | ||
| int | len | ||
| ) |
base64 encode
Definition at line 281 of file GSwifi_http.cpp.
| int certAdd | ( | const char * | name, |
| const char * | cert, | ||
| int | len | ||
| ) |
certificate
Definition at line 1252 of file GSwifi.cpp.
| int close | ( | int | cid ) |
close client/server
Definition at line 89 of file GSwifi_sock.cpp.
| int command | ( | const char * | cmd, |
| GSRESPONCE | res, | ||
| int | timeout = GS_TIMEOUT |
||
| ) |
send command
Definition at line 672 of file GSwifi.cpp.
| int connect | ( | GSSECURITY | sec, |
| const char * | ssid, | ||
| const char * | pass, | ||
| int | dhcp = 1, |
||
| int | reconnect = GS_RECONNECT, |
||
| char * | name = NULL |
||
| ) |
associate infrastructure
- Parameters:
-
sec GSSEC_OPEN, GSSEC_WEP, GSSEC_WPA_PSK, GSSEC_WPA2_PSK, GSSEC_WPS_BUTTON ssid SSID pass pass phrase dhcp 0:static ip, 1:dhcp reconnect auto re-connect time name my host name
- Return values:
-
0 success -1 failure
Definition at line 730 of file GSwifi.cpp.
| int deepSleep | ( | ) |
deep sleep mode
Definition at line 1195 of file GSwifi.cpp.
| int disconnect | ( | ) |
unassociate
Definition at line 941 of file GSwifi.cpp.
get ip address
Definition at line 1029 of file GSwifi.cpp.
| int getHostByName | ( | const char * | name, |
| IpAddr & | addr | ||
| ) |
resolv hostname
- Parameters:
-
name hostname addr resolved ip address
Definition at line 1047 of file GSwifi.cpp.
| int getHostByName | ( | Host & | host ) |
resolv hostname
- Parameters:
-
host.name hostname host.ipaddr resolved ip address
Definition at line 1059 of file GSwifi.cpp.
| int getMacAddress | ( | char * | mac ) |
get mac address
Definition at line 1037 of file GSwifi.cpp.
| int getRssi | ( | ) |
| GSwifi::GSSTATUS getStatus | ( | ) |
| time_t getTime | ( | ) |
| int gpioOut | ( | int | port, |
| int | out | ||
| ) |
GPIO output.
- Parameters:
-
port 10,11,30,31 out 0:set(high), 1:reset(low)
Definition at line 1243 of file GSwifi.cpp.
| int httpd | ( | int | port = 80 ) |
| int httpGet | ( | Host & | host, |
| const char * | uri, | ||
| const char * | user, | ||
| const char * | pwd, | ||
| int | ssl = 0, |
||
| onGsReceiveFunc | ponGsReceive = NULL |
||
| ) |
http request (GET method)
Definition at line 32 of file GSwifi_http.cpp.
| int httpPost | ( | Host & | host, |
| const char * | uri, | ||
| const char * | body, | ||
| const char * | user, | ||
| const char * | pwd, | ||
| int | ssl = 0, |
||
| onGsReceiveFunc | ponGsReceive = NULL |
||
| ) |
http request (POST method)
Definition at line 78 of file GSwifi_http.cpp.
| bool isConnected | ( | ) |
wifi connected
Definition at line 1071 of file GSwifi.cpp.
| bool isConnected | ( | int | cid ) |
tcp/udp connected
Definition at line 224 of file GSwifi_sock.cpp.
| int limitedap | ( | GSSECURITY | sec, |
| const char * | ssid, | ||
| const char * | pass, | ||
| IpAddr | ipaddr, | ||
| IpAddr | netmask, | ||
| char * | dns = NULL |
||
| ) |
limited AP
- Parameters:
-
sec GSSEC_OPEN or GSSEC_WEP ssid SSID pass 10 or 26 hexadecimal digits ipaddr my ip address (dhcp start address) netmask subnet mask dns my host name
- Return values:
-
0 success -1 failure firmware: s2w-secureweb, s2w-web, s2w-wpsweb
Definition at line 888 of file GSwifi.cpp.
| int listen | ( | int | port, |
| GSPROTOCOL | pro | ||
| ) |
| int mail | ( | Host & | host, |
| const char * | to, | ||
| const char * | from, | ||
| const char * | subject, | ||
| const char * | mesg, | ||
| const char * | user = NULL, |
||
| const char * | pwd = NULL |
||
| ) |
send mail (smtp)
- Parameters:
-
host SMTP server to To address from From address subject Subject mesg Message user username (SMTP Auth) pwd password (SMTP Auth)
- Return values:
-
0 success -1 failure
Definition at line 30 of file GSwifi_smtp.cpp.
| int ntpdate | ( | Host | host, |
| int | sec = 0 |
||
| ) |
set NTP server
- Parameters:
-
host SNTP server sec time sync interval, 0:one time
Definition at line 1203 of file GSwifi.cpp.
| int open | ( | Host & | host, |
| GSPROTOCOL | pro, | ||
| int | port = 0 |
||
| ) |
| void poll | ( | ) |
polling
Definition at line 643 of file GSwifi.cpp.
| int powerSave | ( | int | active, |
| int | save | ||
| ) |
power save mode
- Parameters:
-
active rx radio 0:switched off, 1:always on save power save 0:disable, 1:enable
Definition at line 1125 of file GSwifi.cpp.
| int provisioning | ( | char * | user, |
| char * | pass | ||
| ) |
Web server.
Definition at line 1270 of file GSwifi.cpp.
| int reconnect | ( | ) |
re-connect
Definition at line 955 of file GSwifi.cpp.
| int recv | ( | int | cid, |
| char * | buf, | ||
| int | len | ||
| ) |
| int recv | ( | int | cid, |
| char * | buf, | ||
| int | len, | ||
| Host & | host | ||
| ) |
| void resetResponse | ( | GSRESPONCE | res ) |
reset recv responce
Definition at line 700 of file GSwifi.cpp.
| int send | ( | int | cid, |
| const char * | buf, | ||
| int | len, | ||
| Host & | host | ||
| ) |
send data udp(s)
Definition at line 145 of file GSwifi_sock.cpp.
| int send | ( | int | cid, |
| const char * | buf, | ||
| int | len | ||
| ) |
send data tcp(s/c), udp(c)
Definition at line 101 of file GSwifi_sock.cpp.
| void send_httpd_error | ( | int | cid, |
| int | err | ||
| ) |
attach uri to dirctory handler
Definition at line 360 of file GSwifi_httpd.cpp.
| int setAddress | ( | char * | name = NULL ) |
use DHCP
Definition at line 991 of file GSwifi.cpp.
use static ip address
Definition at line 1004 of file GSwifi.cpp.
| int setBaud | ( | int | baud ) |
main polling
Definition at line 1091 of file GSwifi.cpp.
| int setRegion | ( | int | reg = GS_WREGDOMAIN ) |
change radio region
Definition at line 1106 of file GSwifi.cpp.
| int setRFPower | ( | int | power ) |
| int setTime | ( | time_t | time ) |
| int standby | ( | int | msec ) |
standby mode
- Parameters:
-
msec wakeup after wakeup after msec or alarm1/2 core off, save to RTC ram
Definition at line 1136 of file GSwifi.cpp.
| int urldecode | ( | char * | str, |
| char * | buf, | ||
| int | len | ||
| ) |
url decode
Definition at line 328 of file GSwifi_http.cpp.
| int urlencode | ( | char * | str, |
| char * | buf, | ||
| int | len | ||
| ) |
url encode
Definition at line 307 of file GSwifi_http.cpp.
| int waitResponse | ( | int | ms ) |
wait recv responce
Definition at line 707 of file GSwifi.cpp.
| int wakeup | ( | ) |
restore standby
Definition at line 1159 of file GSwifi.cpp.
| int wsOpen | ( | Host & | host, |
| const char * | uri, | ||
| const char * | user, | ||
| const char * | pwd, | ||
| onGsReceiveFunc | ponGsReceive = NULL |
||
| ) |
websocket request (Upgrade method)
Definition at line 136 of file GSwifi_http.cpp.
| int wsSend | ( | int | cid, |
| const char * | buf, | ||
| int | len, | ||
| const char * | mask = NULL |
||
| ) |
send data websocket
Definition at line 244 of file GSwifi_http.cpp.
Generated on Tue Jul 12 2022 22:02:57 by
1.7.2

GainSpan Wi-Fi GS1011