From: injun.yang Date: Thu, 23 Jan 2020 06:16:41 +0000 (+0900) Subject: Code clean up X-Git-Tag: accepted/tizen/unified/20200210.131844~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F223780%2F1;p=platform%2Fcore%2Fapi%2Fbluetooth.git Code clean up Change-Id: I6e9e7425e7e3cddb8ab0d014dce15aa7a6cb3da0 Signed-off-by: injun.yang Signed-off-by: DoHyun Pyun --- diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 0a75fea..4904ff4 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -623,17 +623,13 @@ do { \ bool is_supported = false; \ if (!_bt_check_supported_feature(feature1, &is_supported)) { \ if (is_supported == true) { \ - LOGI("[%s] SUPPORTED", __FUNCTION__); \ break; \ } \ } else { \ LOGE("[%s] Fail to get the system feature: [%d]", __FUNCTION__, feature1); \ } \ if (!_bt_check_supported_feature(feature2, &is_supported)) { \ - if (is_supported == true) { \ - LOGI("[%s] SUPPORTED", __FUNCTION__); \ - break; \ - } else {\ + if (is_supported == false) { \ LOGE("[%s] NOT_SUPPORTED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_SUPPORTED); \ return BT_ERROR_NOT_SUPPORTED; \ } \ diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c index e3458e0..6c1d7a7 100644 --- a/src/bluetooth-adapter.c +++ b/src/bluetooth-adapter.c @@ -889,7 +889,6 @@ int bt_adapter_foreach_profile_connected_devices(const char *profile_uuid, int bt_adapter_set_state_changed_cb(bt_adapter_state_changed_cb callback, void *user_data) { - BT_DBG(""); BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(callback); @@ -1429,11 +1428,11 @@ int bt_adapter_parse_manufacturer_data(bt_manufacturer_data *data, char *manufac BT_CHECK_INPUT_PARAMETER(manufacturer_data); if (manufacturer_data_len < 30) { - BT_DBG("minimum Size of the smasung specific manufacturer data is greater than 30 "); + BT_ERR("minimum Size of the smasung specific manufacturer data is greater than 30 "); return BT_ERROR_INVALID_PARAMETER; } if (manufacturer_data[0] != 0x00 || manufacturer_data[1] != 0x75) { - BT_DBG("This is not a samsung specific manufaturer data"); + BT_ERR("This is not a samsung specific manufaturer data"); return BT_ERROR_INVALID_PARAMETER; } diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 8671857..1c42639 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -2321,7 +2321,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us BT_INFO("BLUETOOTH_EVENT_GATT_SERVER_CONNECTED"); _bt_convert_address_to_string(&device_addr, (bluetooth_device_address_t *)(param->param_data)); - BT_INFO("GATT Server Connected address[%s]", device_addr); + if (event_index >= 0) cb = bt_event_slot_container[event_index].callback; if (cb) @@ -2354,8 +2354,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us BT_INFO("BLUETOOTH_EVENT_GATT_CLIENT_CONNECTED"); _bt_convert_address_to_string(&device_addr, (bluetooth_device_address_t *)(param->param_data)); - BT_INFO("GATT Connected address[%s] result [%d]", device_addr, - _bt_get_error_code(param->result)); + client_s = (bt_gatt_client_s *)_bt_gatt_get_client(device_addr); if (BT_ERROR_NONE == _bt_get_error_code(param->result)) { @@ -2485,15 +2484,10 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us } #endif case BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED: - BT_INFO("BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED"); #ifdef TIZEN_GATT_CLIENT char_prop = (bt_gatt_char_property_t*)(param->param_data); - if (char_prop == NULL) return; - BT_INFO("Address [%s]", char_prop->address); - BT_INFO("Val len [%d]", char_prop->val_len); - BT_INFO("Event index [%d]", event_index); ((_bt_gatt_client_val_changed_cb)bt_event_slot_container[event_index].callback) (char_prop->prop.uuid, char_prop->address, char_prop->value, char_prop->val_len, @@ -3496,7 +3490,7 @@ static void __bt_le_event_proxy(int event, bluetooth_event_param_t *param, void event_index = __bt_get_cb_index(event); if (event == BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND) - BT_INFO("Need to check 2 slots in the case"); + BT_DBG("Need to check 2 slots in the case"); else if (event_index == -1 || bt_event_slot_container[event_index].callback == NULL) return; @@ -3512,7 +3506,6 @@ static void __bt_le_event_proxy(int event, bluetooth_event_param_t *param, void (_bt_get_error_code(param->result), BT_ADAPTER_LE_DISABLED, bt_event_slot_container[event_index].user_data); break; case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND: /* LCOV_EXCL_START */ - BT_INFO("BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND"); event_index = BT_EVENT_LE_SCAN_RESULT_UPDATED; if (bt_event_slot_container[event_index].callback != NULL) { if (__bt_get_bt_adapter_le_device_scan_info_s(&scan_info, (bluetooth_le_device_info_t *)(param->param_data)) == BT_ERROR_NONE) { diff --git a/src/bluetooth-device.c b/src/bluetooth-device.c index 631ef41..c939b98 100644 --- a/src/bluetooth-device.c +++ b/src/bluetooth-device.c @@ -303,8 +303,6 @@ int bt_device_set_bond_created_cb(bt_device_bond_created_cb callback, void *user BT_CHECK_INPUT_PARAMETER(callback); _bt_set_cb(BT_EVENT_BOND_CREATED, callback, user_data); - BT_DBG("+"); - return BT_ERROR_NONE; } @@ -315,8 +313,6 @@ int bt_device_set_bond_destroyed_cb(bt_device_bond_destroyed_cb callback, void * BT_CHECK_INPUT_PARAMETER(callback); _bt_set_cb(BT_EVENT_BOND_DESTROYED, callback, user_data); - BT_DBG("+"); - return BT_ERROR_NONE; } @@ -420,8 +416,6 @@ int bt_device_unset_bond_created_cb(void) BT_CHECK_INIT_STATUS(); _bt_unset_cb(BT_EVENT_BOND_CREATED); - BT_DBG("+"); - return BT_ERROR_NONE; } @@ -431,8 +425,6 @@ int bt_device_unset_bond_destroyed_cb(void) BT_CHECK_INIT_STATUS(); _bt_unset_cb(BT_EVENT_BOND_DESTROYED); - BT_DBG("+"); - return BT_ERROR_NONE; } @@ -488,7 +480,7 @@ int bt_device_enable_rssi_monitor(const char *remote_address, bluetooth_device_address_t addr_hex = { {0,} }; int error_code = BT_ERROR_NONE; bt_rssi_threshold_t rssi_threshold = { 0, }; - BT_DBG("Enable RSSI"); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); @@ -517,7 +509,7 @@ int bt_device_disable_rssi_monitor(const char *remote_address, bluetooth_device_address_t addr_hex = { {0,} }; int error_code = BT_ERROR_NONE; bt_rssi_threshold_t rssi_threshold = { 0, }; - BT_DBG("Enable RSSI"); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); @@ -538,7 +530,7 @@ int bt_device_get_rssi_strength(const char *remote_address, { bluetooth_device_address_t addr_hex = { {0,} }; int error_code = BT_ERROR_NONE; - BT_DBG("Get RSSI Strength"); + BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(remote_address); @@ -610,9 +602,6 @@ int bt_device_get_service_mask_from_uuid_list(char **uuids, BT_CHECK_INPUT_PARAMETER(service_mask_list); BT_CHECK_INIT_STATUS(); - BT_DBG("Get service mask from uuid list"); - BT_DBG("no_of_service = %d", no_of_service); - for (i = 0; i < no_of_service; i++) { parts = g_strsplit(uuids[i], "-", -1); diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index 142b227..d7c5e70 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -240,16 +240,14 @@ bt_gatt_h _bt_gatt_client_add_service(bt_gatt_client_h client, __bt_string_to_uuid_hex(uuid, service.uuid); service.instance_id = instance_id; - BT_INFO("GATT client add service: get all properties of this service"); ret = bluetooth_gatt_client_get_service_property(client_s->remote_address, &service, &property); ret = _bt_get_error_code(ret); if (ret != BT_ERROR_NONE) { - BT_ERR("bluetooth_gatt_get_service_property is failed"); + BT_ERR("bluetooth_gatt_client_get_service_property is failed"); return NULL; } - BT_INFO("Service properties are retrieved successfully, now create and add service object"); svc = __bt_gatt_service_create(property.uuid, BT_GATT_SERVICE_TYPE_PRIMARY); if (svc == NULL) { @@ -263,15 +261,11 @@ bt_gatt_h _bt_gatt_client_add_service(bt_gatt_client_h client, /* Copy included service handles and charc handles in just created service object */ memcpy(&svc->svc_include_handles, &property.include_handles, sizeof(bt_gatt_handle_info_t)); - BT_INFO("Total number of Included service handles [%d]", svc->svc_include_handles.count); memcpy(&svc->charc_handles, &property.char_handle, sizeof(bt_gatt_handle_info_t)); - BT_INFO("Total number of Characteristic handles [%d]", svc->charc_handles.count); bluetooth_gatt_free_service_property(&property); client_s->services = g_slist_append(client_s->services, svc); - BT_INFO("GATT service added , current count of Client services [%d]", - g_slist_length(client_s->services)); return svc; } @@ -361,10 +355,9 @@ int _bt_gatt_client_update_services(bt_gatt_client_h client) return BT_ERROR_NONE; } - BT_INFO("Services discovered"); client_s->services_discovered = true; for (i = 0; i < prim_svc.count; i++) { - BT_INFO("Service UUID[%d][%s] Instance ID[%d]", + BT_INFO("[%d] [%s] Instance ID[%d]", i, prim_svc.uuids[i], prim_svc.inst_id[i]); if (!_bt_gatt_client_add_service(client, prim_svc.uuids[i], prim_svc.inst_id[i])) { BT_ERR("_bt_gatt_client_add_service is failed [%s]", @@ -492,7 +485,6 @@ int _bt_gatt_client_update_characteristics(bt_gatt_h service) GSList *chr_list = NULL; int i; - BT_INFO("+"); if (svc == NULL) return BT_ERROR_INVALID_PARAMETER; @@ -507,8 +499,6 @@ int _bt_gatt_client_update_characteristics(bt_gatt_h service) __bt_string_to_uuid_hex(svc->uuid, svc_handle.uuid); svc_handle.instance_id = svc->instance_id; - BT_INFO("Total number of charcs [%d]", svc->charc_handles.count); - for (i = 0; i < svc->charc_handles.count; i++) { bt_gatt_characteristic_s *chr = NULL; bt_gatt_char_property_t char_property; @@ -519,7 +509,6 @@ int _bt_gatt_client_update_characteristics(bt_gatt_h service) __bt_string_to_uuid_hex(svc->charc_handles.uuids[i], char_handle.uuid); char_handle.instance_id = svc->charc_handles.inst_id[i]; - BT_INFO("Retrieve Characteristics properties"); ret = bluetooth_gatt_client_get_characteristics_property( client_s->remote_address, &svc_handle, @@ -531,7 +520,6 @@ int _bt_gatt_client_update_characteristics(bt_gatt_h service) continue; } - BT_INFO("Characteristics properties are retreived, not create charc object"); ret = bt_gatt_characteristic_create(char_property.uuid, 0, char_property.permission, (char *)char_property.val, @@ -543,23 +531,10 @@ int _bt_gatt_client_update_characteristics(bt_gatt_h service) if (char_property.permission & BT_GATT_PROPERTY_WRITE_WITHOUT_RESPONSE) { chr->write_type = BT_GATT_WRITE_TYPE_WRITE_NO_RESPONSE; - BT_INFO("Characterics has Write No Response property"); } if (char_property.permission & BT_GATT_PROPERTY_WRITE) { - BT_INFO("Characterics has Write property"); chr->write_type = BT_GATT_WRITE_TYPE_WRITE; } - if (char_property.permission & BT_GATT_PROPERTY_READ) - BT_INFO("Characterics has Read property"); - - if (char_property.permission & BT_GATT_PROPERTY_BROADCAST) - BT_INFO("Characterics has Broadcast property"); - - if (char_property.permission & BT_GATT_PROPERTY_INDICATE) - BT_INFO("Characterics has Indicate property"); - - if (char_property.permission & BT_GATT_PROPERTY_NOTIFY) - BT_INFO("Characterics has Notify property"); /* Copy descriptor handles in just created charc object */ memcpy(&chr->descriptor_handles, &char_property.char_desc_handle, @@ -579,8 +554,6 @@ next: __bt_gatt_client_handle_destroy); svc->characteristics = chr_list; - BT_INFO("Total number of characteristics whose properties are retrieved is [%d]", - g_slist_length(svc->characteristics)); return BT_ERROR_NONE; } @@ -935,8 +908,6 @@ static void __bt_gatt_free_characteristic(bt_gatt_h gatt_handle) bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s*)gatt_handle; - BT_INFO("+"); - /* Remove characteristic from List of GATT handles */ if (gatt_handle_list) gatt_handle_list = g_slist_remove(gatt_handle_list, gatt_handle); @@ -1467,7 +1438,6 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, bluetooth_gatt_server_update_value_t param; #endif - BT_INFO("+"); BT_CHECK_GATT_SUPPORT(); BT_CHECK_INIT_STATUS(); @@ -1477,11 +1447,9 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, BT_VALIDATE_GATT_HANDLE(gatt_handle); if (handle->type == BT_GATT_TYPE_CHARACTERISTIC) { - BT_INFO("Request is for Char write value"); val = &chr->value; val_len = &chr->value_length; } else if (handle->type == BT_GATT_TYPE_DESCRIPTOR) { - BT_INFO("Request is for Descriptor write value"); val = &desc->value; val_len = &desc->value_length; } else { @@ -1525,7 +1493,6 @@ int bt_gatt_set_value(bt_gatt_h gatt_handle, const char *value, *val = g_memdup(value, value_length); *val_len = value_length; - BT_INFO("Value is set"); return BT_ERROR_NONE; /* LCOV_EXCL_STOP */ } @@ -2227,8 +2194,8 @@ int bt_gatt_characteristic_create(const char *uuid, int permissions, chr->type = BT_GATT_TYPE_CHARACTERISTIC; chr->role = BT_GATT_ROLE_SERVER; - BT_INFO("Characteristic UUID : [%s] len [%zd] permissions [%d] properties [%d]", - uuid, strlen(uuid), permissions, properties); + BT_INFO("Create char [%s] permissions [%d] properties [%d]", + uuid, permissions, properties); #ifdef TIZEN_FEATURE_GATT_RELAY chr->uuid = _bt_convert_uuid_to_uuid128(uuid); @@ -3709,7 +3676,6 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, int ret = BT_ERROR_NONE; bt_gatt_common_s *c = (bt_gatt_common_s *)gatt_handle; - BT_INFO("+"); bt_gatt_handle_property_t svc_handle; bt_gatt_handle_property_t chr_handle; bt_gatt_handle_property_t desc_handle; @@ -3737,10 +3703,6 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, service_s = (bt_gatt_service_s*)chr->parent; client_s = (bt_gatt_client_s*)service_s->parent; - BT_INFO("Read Characteristic from remote address [%s] service UUID [%s] char UUID [%s]", - client_s->remote_address, - service_s->uuid, - chr->uuid); /* Create Service and Charc handles */ __bt_string_to_uuid_hex(service_s->uuid, svc_handle.uuid); @@ -3756,7 +3718,6 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, &chr_handle)); if (ret == BT_ERROR_NONE) { - BT_INFO("Characteristic read scheduled successfully, set callback"); chr->read_cb = callback; chr->read_user_data = user_data; } else { @@ -3774,11 +3735,6 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, service_s = (bt_gatt_service_s*)charc_s->parent; client_s = (bt_gatt_client_s*)service_s->parent; - BT_INFO("Read Descriptor from remote address [%s] service UUID [%s] char UUID [%s] desc UUID [%s]", - client_s->remote_address, - service_s->uuid, - charc_s->uuid, - desc->uuid); /* Create Service and Charc & desc handles */ __bt_string_to_uuid_hex(service_s->uuid, svc_handle.uuid); svc_handle.instance_id = service_s->instance_id; @@ -3797,7 +3753,6 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, &desc_handle)); if (ret == BT_ERROR_NONE) { - BT_INFO("Descriptor read scheduled successfully, set callback"); desc->read_cb = callback; desc->read_user_data = user_data; } else { @@ -3808,7 +3763,6 @@ int bt_gatt_client_read_value(bt_gatt_h gatt_handle, BT_ERR("Invalid handle type for read "); } - BT_INFO("Result [%d]", ret); return ret; /* LCOV_EXCL_STOP */ } #else @@ -3879,7 +3833,6 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, bt_gatt_client_s *client_s; bluetooth_gatt_att_data_t write_data; - BT_INFO("+"); BT_CHECK_GATT_CLIENT_SUPPORT(); BT_CHECK_INIT_STATUS(); BT_CHECK_INPUT_PARAMETER(gatt_handle); @@ -3893,15 +3846,9 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, if (c->type == BT_GATT_TYPE_CHARACTERISTIC) { bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)gatt_handle; - int k; memset(&write_data, 0x00, sizeof(bluetooth_gatt_att_data_t)); write_data.length = chr->value_length; - BT_INFO("Char write value length [%d]", write_data.length); - for (k = 0; k < chr->value_length; k++) - BT_INFO("Character val [%d] [0x%x]", k, chr->value[k]); memcpy(&write_data.data[0], chr->value, chr->value_length); - for (k = 0; k < write_data.length; k++) - BT_INFO("Write val [%d] [0x%x]", k, write_data.data[k]); service_s = (bt_gatt_service_s*)chr->parent; client_s = (bt_gatt_client_s*)service_s->parent; @@ -3914,7 +3861,6 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, chr_handle.instance_id = chr->instance_id; if (chr->write_type == BT_GATT_WRITE_TYPE_WRITE) { - BT_INFO("Write characteristic: write type [%d]", chr->write_type); ret = _bt_get_error_code( bluetooth_gatt_client_write_characteristic_value_by_type( client_s->remote_address, @@ -3923,7 +3869,6 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, &write_data, BLUETOOTH_GATT_TYPE_WRITE)); } else if (chr->write_type == BT_GATT_WRITE_TYPE_WRITE_NO_RESPONSE) { - BT_INFO("Write characteristic: write type [%d]", chr->write_type); ret = _bt_get_error_code( bluetooth_gatt_client_write_characteristic_value_by_type( client_s->remote_address, @@ -3935,28 +3880,23 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, BT_ERR("Unknow write type : %d", chr->write_type); ret = BT_ERROR_OPERATION_FAILED; } + if (ret != BT_ERROR_NONE) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); } else { - BT_INFO("GATT char write value scheuled successfully, set callback"); chr->write_cb = callback; chr->write_user_data = user_data; } } else if (c->type == BT_GATT_TYPE_DESCRIPTOR) { bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s *)gatt_handle; - BT_INFO("Write Descriptor"); - int k; charc_s = (bt_gatt_characteristic_s*)desc->parent; service_s = (bt_gatt_service_s*)charc_s->parent; client_s = (bt_gatt_client_s*)service_s->parent; memset(&write_data, 0x00, sizeof(bluetooth_gatt_att_data_t)); write_data.length = desc->value_length; - BT_INFO("Desc write value length [%d]", write_data.length); memcpy(&write_data.data[0], desc->value, desc->value_length); - for (k = 0; k < write_data.length; k++) - BT_INFO("Write val [%d] [0x%x]", k, write_data.data[k]); /* Create Service and Charc & desc handles */ __bt_string_to_uuid_hex(service_s->uuid, svc_handle.uuid); @@ -3979,7 +3919,6 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle, if (ret != BT_ERROR_NONE) { BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret); } else { - BT_INFO("GATT Descriptor write value scheuled successfully, set callback"); desc->write_cb = callback; desc->write_user_data = user_data; } @@ -4250,11 +4189,9 @@ static void __gatt_value_changed_cb(unsigned char *uuid, char *remote_address, bt_gatt_client_s *client_s; bt_gatt_service_s *svc; bt_gatt_characteristic_s *chr; - BT_INFO("+"); char uuid_string[BLUETOOTH_UUID_STRING_MAX]; - __uuid_hex_to_string(uuid, uuid_string) ; - BT_INFO("Address [%s] Char UUID [%s]", remote_address, uuid_string); + __uuid_hex_to_string(uuid, uuid_string) ; client = __find_gatt_client(remote_address); if (client == NULL) {