Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ed6a5b78
Commit
ed6a5b78
authored
Sep 27, 2015
by
Daniel Campora
Browse files
cc3200: Make auth param positional in wlan.connect.
parent
d5de1bf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
cc3200/mods/modwlan.c
View file @
ed6a5b78
...
...
@@ -911,8 +911,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(wlan_scan_obj, wlan_scan);
STATIC
mp_obj_t
wlan_connect
(
mp_uint_t
n_args
,
const
mp_obj_t
*
pos_args
,
mp_map_t
*
kw_args
)
{
STATIC
const
mp_arg_t
allowed_args
[]
=
{
{
MP_QSTR_ssid
,
MP_ARG_REQUIRED
|
MP_ARG_OBJ
,
},
{
MP_QSTR_auth
,
MP_ARG_OBJ
,
{.
u_obj
=
mp_const_none
}
},
{
MP_QSTR_bssid
,
MP_ARG_KW_ONLY
|
MP_ARG_OBJ
,
{.
u_obj
=
mp_const_none
}
},
{
MP_QSTR_auth
,
MP_ARG_KW_ONLY
|
MP_ARG_OBJ
,
{.
u_obj
=
mp_const_none
}
},
{
MP_QSTR_timeout
,
MP_ARG_KW_ONLY
|
MP_ARG_OBJ
,
{.
u_obj
=
mp_const_none
}
},
};
...
...
@@ -930,19 +930,13 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
const
char
*
ssid
=
mp_obj_str_get_data
(
args
[
0
].
u_obj
,
&
ssid_len
);
wlan_validate_ssid_len
(
ssid_len
);
// get the bssid
const
char
*
bssid
=
NULL
;
if
(
args
[
1
].
u_obj
!=
mp_const_none
)
{
bssid
=
mp_obj_str_get_str
(
args
[
1
].
u_obj
);
}
// get the auth config
uint8_t
auth
=
SL_SEC_TYPE_OPEN
;
mp_uint_t
key_len
=
0
;
const
char
*
key
=
NULL
;
if
(
args
[
2
].
u_obj
!=
mp_const_none
)
{
if
(
args
[
1
].
u_obj
!=
mp_const_none
)
{
mp_obj_t
*
sec
;
mp_obj_get_array_fixed_n
(
args
[
2
].
u_obj
,
2
,
&
sec
);
mp_obj_get_array_fixed_n
(
args
[
1
].
u_obj
,
2
,
&
sec
);
auth
=
mp_obj_get_int
(
sec
[
0
]);
key
=
mp_obj_str_get_data
(
sec
[
1
],
&
key_len
);
wlan_validate_security
(
auth
,
key
,
key_len
);
...
...
@@ -956,6 +950,12 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
}
}
// get the bssid
const
char
*
bssid
=
NULL
;
if
(
args
[
2
].
u_obj
!=
mp_const_none
)
{
bssid
=
mp_obj_str_get_str
(
args
[
2
].
u_obj
);
}
// get the timeout
int32_t
timeout
=
-
1
;
if
(
args
[
3
].
u_obj
!=
mp_const_none
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment