[TBT][tbtcoreapp][Non-ACR][Fixed bluetooth app code] 71/167971/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 23 Jan 2018 06:41:00 +0000 (15:41 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 23 Jan 2018 06:41:00 +0000 (15:41 +0900)
Change-Id: I403022d37be089a6ae7186859e6cde7492c28816
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
tbtcoreapp/src/view/tbt-bluetoothle-view.c

index 679ff721447f6ac37c31909694ead0baa836c4a7..08d191e8e9843003d811f412983be5e31c62876e 100644 (file)
@@ -114,6 +114,9 @@ struct _bluetoothle_view
 
 };
 
+bt_scan_filter_h scan_filter;
+
+
 static void _app_destroy_cb(void* this);
 static void init_bluetooth(void* user_data);
 static void _adapter_state_changed_cb(int result, bt_adapter_state_e adapter_state, void *user_data);
@@ -263,6 +266,17 @@ static void discover_bluetooth_le(void* user_data)
        this = (bluetoothle_view*)user_data;
        RETM_IF(NULL == this, "view is NULL");
 
+       result = bt_adapter_le_scan_filter_create(&scan_filter);
+       RETM_IF(result != BT_ERROR_NONE, "bt_adapter_le_scan_filter_create failed --> error: %s", get_bluetooth_error(result));
+
+       result = bt_adapter_le_scan_filter_set_service_uuid(scan_filter, "1803");
+       RETM_IF(result != BT_ERROR_NONE, "bt_adapter_le_scan_filter_set_service_uuid failed --> error: %s", get_bluetooth_error(result));
+
+       result = bt_adapter_le_scan_filter_set_service_uuid(scan_filter, "180f");
+       RETM_IF(result != BT_ERROR_NONE, "bt_adapter_le_scan_filter_set_service_uuid failed --> error: %s", get_bluetooth_error(result));
+
+       result = bt_adapter_le_scan_filter_register(scan_filter);
+
        g_list_free_full(this->devices_list, bluetooth_list_free_func_cb);
        this->devices_list = NULL;
 
@@ -1484,12 +1498,16 @@ static void _device_item_selected_cb(void *data, Evas_Object *obj, void *event_i
        this->selected_device_item = item;
 
        result = bt_adapter_le_stop_scan();
+       sleep(1);
        RETM_IF(result != BT_ERROR_NONE, "bt_adapter_le_stop_scan fail > Error = %d", result);
 
        this->remote_server_address = device_info->remote_address;
 
-       result = bt_device_create_bond(this->remote_server_address);
-       RETM_IF(result != BT_ERROR_NONE, "bt_device_create_bond fail > Error = %s", get_bluetooth_error(result));
+       bt_adapter_le_scan_filter_destroy(scan_filter);
+
+       result = bt_gatt_connect(device_info->remote_address, false);
+       RETM_IF(result != BT_ERROR_NONE, "bt_gatt_connect failed --> error: %s", get_bluetooth_error(result));
+       elm_object_text_set(this->bluetoothle_label, "gatt connecting...");
 
 }