bt_scan_stop()

bt_scan_stop()

Description

Stops scanning process.

Syntax

bt_scan_stop();

Parameters

This function has no parameters.

Returns

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

Successfully managed to send scan stop command to scan module.

SCRIPT_OPERATION_FAILED

Failed to send scan stop command to scan module.

SCRIPT_NO_ACCESS

This error signifies that Bluetooth communication was not initialized.

Function call example

#include <io> #include <read> #include <float> #include <string> #include <core> #include <write> #include <define> #include <socket> #include <bluetooth> forward public callback (event); new scan_parameters[.type, .options, .interval, .window, .timeout, .interval_coded, .window_coded]; new mac_addr_filter[] = [0xFF, 0x48, 0x80, 0x33, 0xE3, 0xA8]; public callback (event) { switch(event) { case BT_FILTER_MATCH: { // SCAN FILTER MATCH CALLBACK } case BT_FILTER_MISMATCH: { // SCAN FILTER MISMATCH CALLBACK } } return 0; } main() { scan_parameters[.type] = BT_SCAN_TYPE_ACTIVE; scan_parameters[.options] = BT_ADV_OPT_NONE; scan_parameters[.interval] = BT_SCAN_INTERVAL_FAST; scan_parameters[.window] = BT_SCAN_WINDOW_FAST; scan_parameters[.timeout] = 0; scan_parameters[.interval_coded] = 0; scan_parameters[.window_coded] = 0; bt_init(); bt_scan_init(scan_parameters); bt_scan_filter_add(BT_SCAN_FILTER_TYPE_ADDR_PUBLIC, mac_addr_filter, sizeof(mac_addr_filter)); bt_scan_filter_enable((BT_SCAN_FILTER_NAME | BT_SCAN_FILTER_ADDR), false); bt_scan_callback_enable(BT_FILTER_MATCH); bt_scan_start(); bt_scan_stop(); for(;;) { Delay(100); } }