MYNEWT-332: Return error if initiating and host attempts to enable scanning
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/251ba7a1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/251ba7a1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/251ba7a1 Branch: refs/heads/master Commit: 251ba7a1fce27dd62cc6826bb27e50ef25a68278 Parents: 8c6c5a8 Author: William San Filippo <wi...@runtime.io> Authored: Thu Jun 30 13:05:36 2016 -0700 Committer: William San Filippo <wi...@runtime.io> Committed: Thu Jun 30 13:05:36 2016 -0700 ---------------------------------------------------------------------- net/nimble/controller/src/ble_ll_scan.c | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/251ba7a1/net/nimble/controller/src/ble_ll_scan.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_scan.c b/net/nimble/controller/src/ble_ll_scan.c index 8e845c6..e7346ba 100644 --- a/net/nimble/controller/src/ble_ll_scan.c +++ b/net/nimble/controller/src/ble_ll_scan.c @@ -1289,6 +1289,11 @@ ble_ll_scan_set_enable(uint8_t *cmd) /* Start the scanning state machine */ scansm->scan_filt_dups = filter_dups; rc = ble_ll_scan_sm_start(scansm); + } else { + /* Controller does not allow initiating and scanning.*/ + if (scansm->scan_type == BLE_SCAN_TYPE_INITIATE) { + rc = BLE_ERR_CMD_DISALLOWED; + } } } else { if (scansm->scan_enabled) {