GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Dependents: GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more
Fork of GSwifi by
GainSpan Wi-Fi library
The GS1011 is an ultra low power 802.11b wireless module from GainSpan.
see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。
解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Diff: GSwifi.h
- Revision:
- 28:fbba4c58d14c
- Parent:
- 26:b347ee3a1087
- Child:
- 29:1c4419512941
--- a/GSwifi.h Fri Feb 22 01:10:17 2013 +0000 +++ b/GSwifi.h Fri Feb 22 03:07:43 2013 +0000 @@ -72,6 +72,7 @@ GSSEC_WPA_ENT = 16, GSSEC_WPA2_ENT = 32, GSSEC_WPS_BUTTON = 64, + GSSEC_WPS_PIN, }; /** @@ -243,6 +244,10 @@ * unassociate */ int disconnect (); + /** + * re-connect + */ + int reconnect (); /** * use DHCP @@ -360,38 +365,36 @@ * tcp/udp client * @return CID, -1:failure */ - int open (Host &host, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive = NULL); -/* - int open (Host &host, GSPROTOCOL pro, void (*ponGsReceive)(int, int) = NULL); - template<class T> - int open (Host &host, GSPROTOCOL pro, T* pItem, void (T::*ponGsReceive)(int, int)); -*/ + int open (Host &host, GSPROTOCOL pro); + + int open (Host &host, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive) { + int cid = open(host, pro); + if (cid >= 0) _gs_sock[cid].onGsReceive.attach(ponGsReceive); + return cid; + } + template<typename T> + int open (Host &host, GSPROTOCOL pro, T *object, void (T::*member)(int, int)) { + int cid = open(host, pro); + if (cid >= 0) _gs_sock[cid].onGsReceive.attach(object, member); + return cid; + } /** * tcp/udp server * @return CID, -1:failure */ - int listen (int port, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive = NULL); -/* - int listen (int port, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive = NULL); + int listen (int port, GSPROTOCOL pro); + + int listen (int port, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive) { + int cid = listen(port, pro); + if (cid >= 0) _gs_sock[cid].onGsReceive.attach(ponGsReceive); + return cid; + } template<typename T> - int listen (int port, GSPROTOCOL pro, T* pItem, onGsReceiveFunc ponGsReceive) { - void *_object; - char _member[16]; - onGsReceiveFunc *_membercaller; - - _object = static_cast<void*(int, int)>(object); - memcpy(_member, (char*)&ponGsReceive, sizeof(ponGsReceive)); - _membercaller = &FunctionPointer::membercaller<T>; + int listen (int port, GSPROTOCOL pro, T *object, void (T::*member)(int, int)) { + int cid = listen(port, pro); + if (cid >= 0) _gs_sock[cid].onGsReceive.attach(object, member); + return cid; } -*/ -/* - template<typename T> - int listen2 (T* tptr, int port, GSPROTOCOL pro, void (T::*mptr)(int,int)) { - if((mptr != NULL) && (tptr != NULL)) { - return listen(port, pro, reinterpret_cast<onGsReceiveFunc>(mptr)); - } - } -*/ /** * close client/server */ @@ -506,12 +509,12 @@ void newSock (int cid, GSTYPE type, GSPROTOCOL pro); void newSock (int cid, GSTYPE type, GSPROTOCOL pro, onGsReceiveFunc ponGsReceive) { - newSock (cid, type, pro); + newSock(cid, type, pro); _gs_sock[cid].onGsReceive.attach(ponGsReceive); } template<typename T> void newSock (int cid, GSTYPE type, GSPROTOCOL pro, T *object, void (T::*member)(int, int)) { - newSock (cid, type, pro); + newSock(cid, type, pro); _gs_sock[cid].onGsReceive.attach(object, member); } @@ -545,6 +548,7 @@ CircBuffer<char> _buf_cmd; struct GS_Socket _gs_sock[16]; time_t _time; + GSSECURITY _sec; char *_ssid, *_pass; int _reconnect, _reconnect_count;