* SPDX-License-Identifier: Apache-2.0
*/
+#include <stdint.h>
+#include <errno.h>
+
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "freertos/task.h"
int bt_mesh_scan_enable(void)
{
+ int err;
+
struct bt_mesh_scan_param scan_param = {
.type = BLE_MESH_SCAN_PASSIVE,
#if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN)
BT_DBG("%s", __func__);
- return bt_le_scan_start(&scan_param, bt_mesh_scan_cb);
+ err = bt_le_scan_start(&scan_param, bt_mesh_scan_cb);
+ if (err && err != -EALREADY) {
+ BT_ERR("starting scan failed (err %d)", err);
+ return err;
+ }
+
+ return 0;
}
int bt_mesh_scan_disable(void)
{
+ int err;
+
BT_DBG("%s", __func__);
- return bt_le_scan_stop();
+ err = bt_le_scan_stop();
+ if (err && err != -EALREADY) {
+ BT_ERR("stopping scan failed (err %d)", err);
+ return err;
+ }
+
+ return 0;
}