iowfehu;gdbjwHJAOPIHO?L
Fork of X_NUCLEO_IDW01M1 by
Diff: SPWFInterface.cpp
- Revision:
- 15:225d5d3c4f84
- Parent:
- 14:af04fe9ca955
- Child:
- 16:156be7b55904
--- a/SPWFInterface.cpp Mon May 16 06:50:04 2016 +0000 +++ b/SPWFInterface.cpp Tue May 24 07:18:35 2016 +0000 @@ -102,6 +102,8 @@ const char *pass_phrase, nsapi_security_t security) { + WiFi_Priv_Mode mode; + //initialize the device before connecting if(!isInitialized) { @@ -110,11 +112,25 @@ else return NSAPI_ERROR_DEVICE_ERROR; } - _spwf.setTimeout(SPWF_CONNECT_TIMEOUT); + _spwf.setTimeout(SPWF_CONNECT_TIMEOUT); - if(security == NSAPI_SECURITY_WPA2) return NSAPI_ERROR_DEVICE_ERROR; - - WiFi_Priv_Mode mode = (WiFi_Priv_Mode)security; + switch(security) + { + case NSAPI_SECURITY_NONE: + mode = (WiFi_Priv_Mode) None; + pass_phrase = NULL; + break; + case NSAPI_SECURITY_WEP: + mode = (WiFi_Priv_Mode) WEP; + break; + case NSAPI_SECURITY_WPA: + case NSAPI_SECURITY_WPA2: + mode = (WiFi_Priv_Mode) WPA_Personal; + break; + default: + mode = (WiFi_Priv_Mode) WPA_Personal; + break; + } return (_spwf.connect((char*)ap, (char*)pass_phrase, mode)); }