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.
Fork of GSwifi_old by
GSwifi Class Reference
#include <GSwifi.h>
Public Member Functions | |
GSwifi (PinName p_tx, PinName p_rx, int baud=GS_BAUD) | |
default constructor | |
GSwifi (PinName p_tx, PinName p_rx, PinName p_cts, PinName p_rts, int baud=GS_BAUD) | |
Default constructor (with hardware fllow controll) | |
int | command (const char *cmd, GSRESPONCE res, int timeout=GS_TIMEOUT) |
send command | |
int | cmdResponse (GSRESPONCE res, int ms) |
recv responce | |
int | connect (GSSECURITY sec, const char *ssid, const char *pass, int dhcp=1, int reconnect=0) |
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 | setAddress () |
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 | getHostByName (const char *name, IpAddr &addr) |
resolv hostname | |
int | getHostByName (Host &host) |
resolv hostname | |
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 | |
bool | isConnected () |
wifi connected | |
GSSTATUS | getStatus () |
status | |
int | getRssi () |
RSSI. | |
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. | |
void | poll () |
main polling | |
int | open (Host &host, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive=NULL) |
tcp/udp client | |
int | listen (int port, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive=NULL) |
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 | certAdd (const char *name, const char *cert, int len) |
certificate | |
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 | |
int | provisioning (char *user, char *pass) |
Web server. | |
int | setBaud (int baud) |
change baud rate | |
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 |
Detailed Description
GSwifi class.
Definition at line 135 of file GSwifi.h.
Constructor & Destructor Documentation
GSwifi | ( | PinName | p_tx, |
PinName | p_rx, | ||
int | baud = GS_BAUD |
||
) |
default constructor
Definition at line 19 of file GSwifi.cpp.
GSwifi | ( | PinName | p_tx, |
PinName | p_rx, | ||
PinName | p_cts, | ||
PinName | p_rts, | ||
int | baud = GS_BAUD |
||
) |
Default constructor (with hardware fllow controll)
Definition at line 34 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 574 of file GSwifi.cpp.
int attach_httpd | ( | const char * | uri, |
const char * | dir | ||
) |
attach uri to dirctory handler
Definition at line 372 of file GSwifi_httpd.cpp.
int attach_httpd | ( | const char * | uri, |
onHttpdCgiFunc | ponHttpCgi | ||
) |
attach uri to cgi handler
Definition at line 386 of file GSwifi_httpd.cpp.
int base64encode | ( | char * | input, |
int | length, | ||
char * | output, | ||
int | len | ||
) |
base64 encode
Definition at line 1353 of file GSwifi.cpp.
int certAdd | ( | const char * | name, |
const char * | cert, | ||
int | len | ||
) |
certificate
Definition at line 1313 of file GSwifi.cpp.
int close | ( | int | cid ) |
close client/server
Definition at line 1072 of file GSwifi.cpp.
int cmdResponse | ( | GSRESPONCE | res, |
int | ms | ||
) |
recv responce
Definition at line 345 of file GSwifi.cpp.
int command | ( | const char * | cmd, |
GSRESPONCE | res, | ||
int | timeout = GS_TIMEOUT |
||
) |
send command
Definition at line 311 of file GSwifi.cpp.
int connect | ( | GSSECURITY | sec, |
const char * | ssid, | ||
const char * | pass, | ||
int | dhcp = 1 , |
||
int | reconnect = 0 |
||
) |
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
- Return values:
-
0 success -1 failure
Definition at line 484 of file GSwifi.cpp.
int deepSleep | ( | ) |
deep sleep mode
Definition at line 819 of file GSwifi.cpp.
int disconnect | ( | ) |
unassociate
Definition at line 677 of file GSwifi.cpp.
get ip address
Definition at line 724 of file GSwifi.cpp.
int getHostByName | ( | const char * | name, |
IpAddr & | addr | ||
) |
resolv hostname
- Parameters:
-
name hostname addr resolved ip address
Definition at line 732 of file GSwifi.cpp.
int getHostByName | ( | Host & | host ) |
resolv hostname
- Parameters:
-
host.name hostname host.ipaddr resolved ip address
Definition at line 744 of file GSwifi.cpp.
int getRssi | ( | ) |
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 882 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 1204 of file GSwifi.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 1254 of file GSwifi.cpp.
bool isConnected | ( | int | cid ) |
tcp/udp connected
Definition at line 1200 of file GSwifi.cpp.
bool isConnected | ( | ) |
wifi connected
Definition at line 827 of file GSwifi.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
- Return values:
-
0 success -1 failure firmware: s2w-secureweb, s2w-web, s2w-wpsweb
Definition at line 622 of file GSwifi.cpp.
int listen | ( | int | port, |
GSPROTOCOL | pro, | ||
onGsReceiveFunc | ponGsReceive = NULL |
||
) |
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 7 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 842 of file GSwifi.cpp.
int open | ( | Host & | host, |
GSPROTOCOL | pro, | ||
onGsReceiveFunc | ponGsReceive = NULL |
||
) |
void poll | ( | ) |
main polling
Definition at line 978 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 765 of file GSwifi.cpp.
int provisioning | ( | char * | user, |
char * | pass | ||
) |
Web server.
Definition at line 1330 of file GSwifi.cpp.
int recv | ( | int | cid, |
char * | buf, | ||
int | len, | ||
Host & | host | ||
) |
int recv | ( | int | cid, |
char * | buf, | ||
int | len | ||
) |
int send | ( | int | cid, |
const char * | buf, | ||
int | len, | ||
Host & | host | ||
) |
send data udp(s)
Definition at line 1125 of file GSwifi.cpp.
int send | ( | int | cid, |
const char * | buf, | ||
int | len | ||
) |
send data tcp(s/c), udp(c)
Definition at line 1084 of file GSwifi.cpp.
void send_httpd_error | ( | int | cid, |
int | err | ||
) |
attach uri to dirctory handler
Definition at line 337 of file GSwifi_httpd.cpp.
int setAddress | ( | ) |
use DHCP
Definition at line 691 of file GSwifi.cpp.
use static ip address
Definition at line 698 of file GSwifi.cpp.
int setBaud | ( | int | baud ) |
change baud rate
Definition at line 1339 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 776 of file GSwifi.cpp.
int urldecode | ( | char * | str, |
char * | buf, | ||
int | len | ||
) |
url decode
Definition at line 1407 of file GSwifi.cpp.
int urlencode | ( | char * | str, |
char * | buf, | ||
int | len | ||
) |
url encode
Definition at line 1387 of file GSwifi.cpp.
int wakeup | ( | ) |
restore standby
Definition at line 796 of file GSwifi.cpp.
Generated on Mon Jul 18 2022 14:21:01 by
