private fork
Fork of GSwifiInterface by
Diff: GSwifi/GSwifi.cpp
- Revision:
- 15:086d1a33a197
- Parent:
- 13:189e04ac70bd
- Child:
- 16:105b56570533
diff -r 1e89a3f0282d -r 086d1a33a197 GSwifi/GSwifi.cpp --- a/GSwifi/GSwifi.cpp Fri Jan 10 14:23:33 2014 +0000 +++ b/GSwifi/GSwifi.cpp Thu Jan 30 15:10:14 2014 +0000 @@ -80,6 +80,9 @@ case SEC_OPEN: case SEC_WEP: cmdNDHCP(_state.dhcp, _state.name, DEFAULT_WAIT_RESP_TIMEOUT); + if (! _state.dhcp) { + cmdNSET(_state.ip, _state.netmask, _state.ip); + } cmdWAUTH(_state.sec); if (_state.sec != SEC_NONE) { cmdWWEP(1, _state.pass); @@ -95,6 +98,9 @@ case SEC_WPA_PSK: case SEC_WPA2_PSK: cmdNDHCP(_state.dhcp, _state.name, DEFAULT_WAIT_RESP_TIMEOUT); + if (! _state.dhcp) { + cmdNSET(_state.ip, _state.netmask, _state.ip); + } cmdWAUTH(0); cmdWPAPSK(_state.ssid, _state.pass); wait_ms(100); @@ -112,6 +118,9 @@ break; case SEC_WPS_BUTTON: cmdNDHCP(false); + if (! _state.dhcp) { + cmdNSET(_state.ip, _state.netmask, _state.ip); + } cmdWAUTH(0); r = cmdWWPS(true); if (r) break; @@ -123,6 +132,9 @@ break; case SEC_WPS_PIN: cmdNDHCP(false); + if (! _state.dhcp) { + cmdNSET(_state.ip, _state.netmask, _state.ip); + } cmdWAUTH(0); r = cmdWWPS(true, _state.pass); if (r) break; @@ -384,11 +396,12 @@ return 0; } -int GSwifi::setAddress (const char *ip, const char *netmask, const char *gateway, const char *name) { +int GSwifi::setAddress (const char *ip, const char *netmask, const char *gateway, const char *dns, const char *name) { _state.dhcp = false; strncpy(_state.ip, ip, sizeof(_state.ip)); strncpy(_state.netmask, netmask, sizeof(_state.netmask)); strncpy(_state.gateway, gateway, sizeof(_state.gateway)); + strncpy(_state.nameserver, dns, sizeof(_state.nameserver)); strncpy(_state.name, name, sizeof(_state.name)); return 0; }