This API unregisters a registered scan filter.
Change-Id: I2bfe2a55970b4e4a31df777e889a25c2387e89c0
Signed-off-by: himanshu <h.himanshu@samsung.com>
/** Clear all scan filter conditions for specific filter index*/
bt_status_t scan_filter_clear(int client_if, int filt_index)
{
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ GVariant *ret;
CHECK_BTGATT_INIT();
- return BT_STATUS_UNSUPPORTED;
+
+ proxy = _bt_hal_get_adapter_proxy();
+ if (proxy == NULL)
+ return BT_STATUS_FAIL;
+
+ ret = g_dbus_proxy_call_sync(proxy, "scan_filter_clear",
+ g_variant_new("(ii)", client_if, filt_index),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+
+ if (error) {
+ ERR("scan_filter_clear Fail: %s", error->message);
+ g_clear_error(&error);
+ return BT_STATUS_FAIL;
+ }
+ if (ret)
+ g_variant_unref(ret);
+ return BT_STATUS_SUCCESS;
}
/** Enable / disable scan filter feature*/
oal_status_t gattc_disconnect(int client_id, bt_address_t *device_address, int conn_id);
+oal_status_t gattc_unregister_scan_filter(int slot_id);
+
oal_status_t gattc_conn_param_update(bt_address_t * address, int min, int max, int latency, int timeout);
oal_status_t gattc_register_for_notification(int client_id, bt_address_t * address,
}
return OAL_STATUS_SUCCESS;
}
+
+oal_status_t gattc_unregister_scan_filter(int slot_id)
+{
+ int ret;
+ int client_if = 0;
+
+ API_TRACE("");
+ CHECK_OAL_GATT_ENABLED();
+
+ BT_INFO("Remove Scan filter Slot ID is: [%d]", slot_id);
+
+ ret = gatt_api->client->scan_filter_clear(client_if, slot_id);
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("error: %s", status2string(ret));
+ return convert_to_oal_status(ret);
+ }
+ return OAL_STATUS_SUCCESS;
+}
}
}
+int _bt_unregister_scan_filter(const char *sender, int slot_id)
+{
+ int ret;
+ bt_adapter_le_scanner_t *scanner = NULL;
+ bluetooth_le_scan_filter_t *scan_filter_data = NULL;
+ GSList *l;
+ gboolean is_slot_id_found = FALSE;
+
+ scanner = __bt_find_scanner_from_list(sender);
+ if (scanner == NULL) {
+ BT_ERR("There is NO available scanner.");
+ return BLUETOOTH_ERROR_NOT_FOUND;
+ }
+
+ for (l = scanner->filter_list; l != NULL; l = g_slist_next(l)) {
+ scan_filter_data = l->data;
+ if (scan_filter_data->slot_id == slot_id) {
+ is_slot_id_found = TRUE;
+ break;
+ }
+ }
+ if (is_slot_id_found == FALSE) {
+ BT_ERR("There is NO registered slot.");
+ return BLUETOOTH_ERROR_NOT_FOUND;
+ }
+ ret = gattc_unregister_scan_filter(slot_id);
+ if (OAL_STATUS_SUCCESS != ret) {
+ BT_ERR("gattc_unregister_scan_filter failed");
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+ scanner->filter_list = g_slist_remove(scanner->filter_list, scan_filter_data);
+ g_free(scan_filter_data);
+ return BLUETOOTH_ERROR_NONE;
+}
+
int _bt_le_init(void)
{
BT_DBG("+");
g_array_append_vals(*out_param1, &is_coded_phy_supported, sizeof(gboolean));
break;
}
+ case BT_UNREGISTER_SCAN_FILTER:{
+ char *sender = NULL;
+ int slot_id;
+
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+ __bt_service_get_parameters(in_param1, &slot_id, sizeof(int));
+ BT_DBG("Remove scan filter [Slot ID : %d]", slot_id);
+
+ result = _bt_unregister_scan_filter(sender, slot_id);
+
+ break;
+ }
case BT_DISCONNECT_DEVICE: {
bluetooth_device_address_t address = { {0} };
int _bt_set_white_list(bluetooth_device_address_t *device_address, int address_type, bool is_add);
int _bt_set_manufacturer_data(bluetooth_manufacturer_data_t *m_data);
+
+int _bt_unregister_scan_filter(const char *sender, int slot_id);
#ifdef __cplusplus
}
#endif /* __cplusplus */