#include "bt-event-handler.h"
static gboolean is_le_scanning = FALSE;
-static int is_scan_filter_supported = -1;
BT_EXPORT_API int bluetooth_check_adapter_le(void)
{
return is_discovering;
}
-BT_EXPORT_API gboolean bluetooth_is_scan_filter_supported(void)
+BT_EXPORT_API int bluetooth_is_scan_filter_supported(gboolean *is_supported)
{
int result;
- if (is_scan_filter_supported == -1) {
- BT_INIT_PARAMS();
- BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+ BT_CHECK_PARAMETER(is_supported, return);
- result = _bt_send_request(BT_BLUEZ_SERVICE, BT_IS_SCAN_FILTER_SUPPORTED,
- in_param1, in_param2, in_param3, in_param4, &out_param);
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- if (result == BLUETOOTH_ERROR_NONE)
- is_scan_filter_supported = g_array_index(out_param, int, 0);
- else
- BT_ERR("Fail to send request");
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_IS_SCAN_FILTER_SUPPORTED,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
- BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- }
+ if (result == BLUETOOTH_ERROR_NONE) {
+ *is_supported = g_array_index(out_param, int, 0);
+ BT_INFO("Scan Filter Support[%s]", *is_supported ? "TRUE" : "FALSE");
+ } else
+ BT_ERR("Fail to send request");
- if (is_scan_filter_supported == 1)
- return TRUE;
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- return FALSE;
+ return result;
}
BT_EXPORT_API int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id)