File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
targets/TARGET_Realtek/TARGET_AMEBA Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,25 @@ nsapi_error_t RTWInterface::set_dhcp(bool dhcp)
130
130
*/
131
131
nsapi_error_t RTWInterface::set_credentials (const char *ssid, const char *pass, nsapi_security_t security)
132
132
{
133
+ if (!ssid) {
134
+ return NSAPI_ERROR_PARAMETER;
135
+ }
136
+
137
+ switch (security) {
138
+ case NSAPI_SECURITY_WPA:
139
+ case NSAPI_SECURITY_WPA2:
140
+ case NSAPI_SECURITY_WPA_WPA2:
141
+ case NSAPI_SECURITY_WEP:
142
+ if ((strlen (pass) < 8 ) || (strlen (pass) > 63 )) { // 802.11 password 8-63 characters
143
+ return NSAPI_ERROR_PARAMETER;
144
+ }
145
+ break ;
146
+ case NSAPI_SECURITY_NONE:
147
+ break ;
148
+ default :
149
+ return NSAPI_ERROR_PARAMETER;
150
+ }
151
+
133
152
strncpy (_ssid, ssid, 255 );
134
153
strncpy (_pass, pass, 255 );
135
154
_security = security;
@@ -281,4 +300,4 @@ const char *RTWInterface::get_gateway()
281
300
NetworkStack *RTWInterface::get_stack ()
282
301
{
283
302
return nsapi_create_stack (&lwip_stack);
284
- }
303
+ }
You can’t perform that action at this time.
0 commit comments