bt_scan_filter_enable()
Description
Enables specific set or sets of filters for filtering.
Syntax
bt_scan_filter_enable(filter_mode, match_all);
Parameters
Variable | Input |
| This variable is used to enable specific set of filters. BT_SCAN_FILTER_NAME - Enable all name filters. BT_SCAN_FILTER_ADDR - Enable all address filters. BT_SCAN_FILTER_UUID - Enable all UUID filters. BT_SCAN_FILTER_APPEARANCE - Enable all appearance filters. BT_SCAN_FILTER_SHORT_NAME - Enable all short name filters. BT_SCAN_FILTER_MANUFACTURER_DATA - Enable all manufacturer data filters. BT_SCAN_FILTER_ALL - Enable all filter modes. |
| If set to |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | Successfully managed to send filter enable command to scan module. |
SCRIPT_OPERATION_FAILED | Failed to send filter enable 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>
new scan_parameters[.type, .options, .interval, .window, .timeout, .interval_coded, .window_coded];
new mac_addr_filter[] = [0xFF, 0x48, 0x80, 0x33, 0xE3, 0xA8];
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);
for(;;)
{
Delay(100);
}
}Notes and Warnings
Multiple filter modes can be enabled simultaneously by combining them with the symbol "|".