From: nazib.ullah Date: Wed, 5 Oct 2016 06:38:32 +0000 (+0600) Subject: [TBT][tizen_3.0_mobile][Gatt Client, Gatt Server Modules updated] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5317a4eb30ccca871a8dcaa14acd3ea58f50d621;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_mobile][Gatt Client, Gatt Server Modules updated] Change-Id: I4b705efbdfe263ea284f6d61c3362b9c96b2fff4 --- diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index 40141fd..31fd3b7 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk index 39d47bb..cae175e 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-i386.tpk differ diff --git a/tbtcoreapp/src/view/tbt-bluetoothle-view.c b/tbtcoreapp/src/view/tbt-bluetoothle-view.c index 3ab97ef..1f7afdd 100644 --- a/tbtcoreapp/src/view/tbt-bluetoothle-view.c +++ b/tbtcoreapp/src/view/tbt-bluetoothle-view.c @@ -37,6 +37,9 @@ #define BT_ADAPTER_DEVICE_DISCOVERY_NONE -1 +#define BATTERY_SERVICE_UUID "0000180f-0000-1000-8000-00805f9b34fb" +#define LINK_LOSS_SERVICE_UUID "00001803-0000-1000-8000-00805f9b34fb" + typedef enum { SERVICE_LISTED, @@ -400,11 +403,16 @@ static void _bt_device_bond_created_cb(int result_recieved, bt_device_info_s *de this = (bluetoothle_view*)user_data; RETM_IF(NULL == this, "view is NULL"); - 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..."); + if(this->view->tbt_info->apptype == TBT_APP_BLE_GATT_CLIENT) + { + 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..."); + } elm_object_disabled_set(this->bluetoothle_btn, EINA_TRUE); elm_object_disabled_set(this->disconnect_btn, EINA_FALSE); + DBG("IS BONDED %d", device_info->is_bonded); + DBG("IS CONNECTED %d", device_info->is_connected); this->is_bonded = device_info->is_bonded; } /** @@ -1111,12 +1119,21 @@ static bool _bt_gatt_foreach_characterstics_cb(int total, int index, bt_gatt_h g int result; RETVM_IF(NULL == gatt_handle,false, "gatt_handle is NULL"); - bt_gatt_write_type_e write_type; - result = bt_gatt_characteristic_get_write_type(gatt_handle, &write_type); - RETVM_IF(result != BT_ERROR_NONE,false, "bt_gatt_characteristic_get_write_type error: %s", get_bluetooth_error(result)); + char* uuid; + result = bt_gatt_get_uuid(gatt_handle, &uuid); + RETVM_IF(result != BT_ERROR_NONE, false, "bt_gatt_get_uuid error: %s", get_bluetooth_error(result)); + DBG("selected service uuid %s", uuid); - result = bt_gatt_characteristic_set_write_type(gatt_handle, BT_GATT_WRITE_TYPE_WRITE); - RETVM_IF(result != BT_ERROR_NONE,false, "bt_gatt_characteristic_set_write_type error: %s", get_bluetooth_error(result)); + if(!strcmp(uuid, LINK_LOSS_SERVICE_UUID)) + { + DBG("Link Loss Service"); + bt_gatt_write_type_e write_type; + result = bt_gatt_characteristic_get_write_type(gatt_handle, &write_type); + RETVM_IF(result != BT_ERROR_NONE,false, "bt_gatt_characteristic_get_write_type error: %s", get_bluetooth_error(result)); + + result = bt_gatt_characteristic_set_write_type(gatt_handle, BT_GATT_WRITE_TYPE_WRITE); + RETVM_IF(result != BT_ERROR_NONE,false, "bt_gatt_characteristic_set_write_type error: %s", get_bluetooth_error(result)); + } bt_gatt_h service; result = bt_gatt_characteristic_get_service(gatt_handle, &service); @@ -1125,7 +1142,6 @@ static bool _bt_gatt_foreach_characterstics_cb(int total, int index, bt_gatt_h g this->n_characteristics = total; this->all_characteristics[index] = gatt_handle; - char* uuid; result = bt_gatt_get_uuid(gatt_handle, &uuid); RETVM_IF(result != BT_ERROR_NONE,false, "bt_gatt_get_uuid error: %s", get_bluetooth_error(result)); DBG("uuid: %s", uuid); @@ -1504,12 +1520,12 @@ static void _sevice_selected_cb(void *data, Evas_Object *obj, void *event_info) RETM_IF(result != BT_ERROR_NONE, "bt_gatt_get_uuid error: %s", get_bluetooth_error(result)); DBG("selected service uuid %s", uuid); - if(!strcmp(uuid, "0000180f-0000-1000-8000-00805f9b34fb")) + if(!strcmp(uuid, BATTERY_SERVICE_UUID)) { DBG("Battery Service"); this->is_battery_svc_selected = true; } - else if(!strcmp(uuid, "00001803-0000-1000-8000-00805f9b34fb")) + else if(!strcmp(uuid, LINK_LOSS_SERVICE_UUID)) { DBG("Link Loss Service"); this->is_link_loss_svc_selected = true; @@ -1739,10 +1755,12 @@ void _app_destroy_cb(void* this) int result; + bt_device_unset_bond_destroyed_cb(); if(view->view->tbt_info->apptype == TBT_APP_BLE_GATT_CLIENT) { bt_adapter_le_stop_scan(); + } else if(view->view->tbt_info->apptype == TBT_APP_BLE_GATT_SERVER) {