mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5577 from VeijoPesonen/realtek_rtl8195am_gt_wifi-set-credential
REALTEK_RTL8195AM Wifi driver - adds check of credentials validitypull/5693/head
commit
aff1d3002f
|
@ -130,6 +130,25 @@ nsapi_error_t RTWInterface::set_dhcp(bool dhcp)
|
||||||
*/
|
*/
|
||||||
nsapi_error_t RTWInterface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security)
|
nsapi_error_t RTWInterface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security)
|
||||||
{
|
{
|
||||||
|
if(!ssid) {
|
||||||
|
return NSAPI_ERROR_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (security) {
|
||||||
|
case NSAPI_SECURITY_WPA:
|
||||||
|
case NSAPI_SECURITY_WPA2:
|
||||||
|
case NSAPI_SECURITY_WPA_WPA2:
|
||||||
|
case NSAPI_SECURITY_WEP:
|
||||||
|
if((strlen(pass) < 8) || (strlen(pass) > 63)) { // 802.11 password 8-63 characters
|
||||||
|
return NSAPI_ERROR_PARAMETER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NSAPI_SECURITY_NONE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NSAPI_ERROR_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(_ssid, ssid, 255);
|
strncpy(_ssid, ssid, 255);
|
||||||
strncpy(_pass, pass, 255);
|
strncpy(_pass, pass, 255);
|
||||||
_security = security;
|
_security = security;
|
||||||
|
@ -281,4 +300,4 @@ const char *RTWInterface::get_gateway()
|
||||||
NetworkStack *RTWInterface::get_stack()
|
NetworkStack *RTWInterface::get_stack()
|
||||||
{
|
{
|
||||||
return nsapi_create_stack(&lwip_stack);
|
return nsapi_create_stack(&lwip_stack);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue