summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-07-02 15:03:58 +0200
committerDaniel Campora <daniel@wipy.io>2015-07-02 15:03:58 +0200
commit7fd538c1b6274665e7fa9e409b255eec60b81322 (patch)
tree040de99198d51ab9dea8f368b8f6ebcfcc5b2bf8
parentf522849a4d5a978ac3d322d71a755f75d07e8ce6 (diff)
downloadmicropython-7fd538c1b6274665e7fa9e409b255eec60b81322.tar.gz
micropython-7fd538c1b6274665e7fa9e409b255eec60b81322.zip
cc3200: Raise an exception if trying to scan for networks in AP mode.
-rw-r--r--cc3200/mods/modwlan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index 50bba91437..9f685cf37c 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -946,6 +946,11 @@ STATIC mp_obj_t wlan_scan(mp_obj_t self_in) {
MP_QSTR_security, MP_QSTR_channel, MP_QSTR_rssi
};
+ // check for correct wlan mode
+ if (wlan_obj.mode != ROLE_STA && wlan_obj.mode != ROLE_P2P) {
+ nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_request_not_possible));
+ }
+
Sl_WlanNetworkEntry_t wlanEntry;
mp_obj_t nets = mp_obj_new_list(0, NULL);
uint8_t _index = 0;