From: injun.yang Date: Wed, 16 Aug 2017 05:16:51 +0000 (+0900) Subject: Debug message cleanup X-Git-Tag: submit/tizen/20170817.054358~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git;a=commitdiff_plain;h=2a54b9eaa4183c5a8aeb8a47644e4d055213bd6d Debug message cleanup Change-Id: Iec220a08090d40b40cd58a1e7bea7d242940e8da Signed-off-by: injun.yang --- diff --git a/bt-api/bt-common.c b/bt-api/bt-common.c index 76448b1..f70f5a4 100644 --- a/bt-api/bt-common.c +++ b/bt-api/bt-common.c @@ -126,7 +126,6 @@ bt_user_info_t *_bt_get_user_data(int type) void _bt_common_event_cb(int event, int result, void *param, void *callback, void *user_data) { - BT_DBG("bt_common_event_cb, event: %d", event); bluetooth_event_param_t bt_event = { 0, }; bt_event.event = event; bt_event.result = result; @@ -1982,7 +1981,7 @@ void _bt_set_adapter_internal_status(gboolean enabled) bt_enabled = enabled; } -int _bt_get_uuid_specification_name(const char *uuid, char **name) +BT_EXPORT_API int bluetooth_get_uuid_name(const char *uuid, char **name) { int i; int offset = 0; @@ -1991,6 +1990,67 @@ int _bt_get_uuid_specification_name(const char *uuid, char **name) const char *uuid; const char *specification_name; } bt_uuid_name[] = { + /* BT Classic Services */ + {"1101", "Serial Port Service"}, + {"1102", "LAN Access Using PPP Service"}, + {"1103", "Dialup Networking Service"}, + {"1104", "IrMCSync Service"}, + {"1105", "OBEX Object Push Service"}, + {"1106", "OBEX File Transfer Service"}, + {"1107", "IrMC Sync Command Service"}, + {"1108", "Headset Service"}, + {"1109", "Cordless Telephony Service"}, + {"110A", "Audio Source Service"}, + {"110B", "Audio Sink Service"}, + {"110C", "AV Remote Control Target Service"}, + {"110D", "Advanced Audio Distribution Profile"}, + {"110E", "AV Remote Control Service"}, + {"110F", "Video Conferencing Service"}, + {"1110", "Intercom Service"}, + {"1111", "Fax Service"}, + {"1112", "Headset Audio Gateway Service"}, + {"1113", "WAP Service"}, + {"1114", "WAP Client Service"}, + {"1115", "PANU Service"}, + {"1116", "NAP Service"}, + {"1117", "GN Service"}, + {"1118", "Direct Printing Service"}, + {"1119", "Reference Printing Service"}, + {"111A", "Basic Imaging Profile"}, + {"111B", "Imaging Responder Service"}, + {"111C", "Imaging Automatic Archive Service"}, + {"111D", "Imaging Reference Objects Service"}, + {"111E", "Handsfree Service"}, + {"111F", "Handsfree Audio Gateway Service"}, + {"1120", "Direct Printing Reference Objects Service"}, + {"1121", "Reflected UI Service"}, + {"1122", "Basic Printing Profile"}, + {"1123", "Printing Status Service"}, + {"1124", "Human Interface Device Service"}, + {"1125", "Hardcopy Cable Replacement Profile"}, + {"1126", "HCR Print Service"}, + {"1127", "HCR Scan Service"}, + {"112D", "SIM Access Service"}, + {"112E", "Phonebook Access PCE Service"}, + {"112F", "Phonebook Access PSE Service"}, + {"1130", "Phonebook Access Profile"}, + {"1132", "Message Access Server Service"}, + {"1133", "Message Notification Server Service"}, + {"1134", "Message Access Profile"}, + {"1200", "PnP Information Service"}, + {"1201", "Generic Networking Service"}, + {"1202", "Generic File Transfer Service"}, + {"1203", "Generic Audio Service"}, + {"1204", "Generic Telephony Service"}, + {"1205", "UPnP Service"}, + {"1206", "UPnP Ip Service"}, + {"1303", "Video Source Service"}, + {"1304", "Video Sink Service"}, + {"1305", "Video Distribution Profile"}, + {"1400", "Health Device Profile"}, + {"1401", "HDP Source Service"}, + {"1402", "HDP Sink Service"}, + /* GATT Services */ {"1800", "Generic Access"}, {"1801", "Generic Attribute"}, @@ -2008,6 +2068,18 @@ int _bt_get_uuid_specification_name(const char *uuid, char **name) {"1810", "Blood Pressure"}, {"1811", "Alert Notification Service"}, {"1812", "Human Interface Device"}, + {"1813", "Scan Parameters"}, + {"1814", "Running Speed and Cadence"}, + {"1815", "Automation IO"}, + {"1816", "Cycling Speed and Cadence"}, + {"1818", "Cycling Power"}, + {"1819", "Location and Navigation"}, + {"181A", "Environmental Sensing"}, + {"181B", "Body Composition"}, + {"181C", "User Data"}, + {"181D", "Weight Scale"}, + {"181E", "Bond Management"}, + {"181F", "Continuous Glucose Monitoring"}, /* GATT Declarations */ {"2800", "Primary Service Declaration"}, @@ -2038,8 +2110,18 @@ int _bt_get_uuid_specification_name(const char *uuid, char **name) {"2A08", "Date Time"}, {"2A09", "Day of Week"}, {"2A0A", "Day Date Time"}, + {"2A11", "Time with DST"}, + {"2A12", "Time Accuracy"}, + {"2A13", "Time Source"}, + {"2A14", "Reference Time Information"}, + {"2A16", "Time Update Control Point"}, + {"2A17", "Time Update State"}, + {"2A18", "Glucose Measurement"}, {"2A19", "Battery Level"}, + {"2A1C", "Temperature Measurement"}, + {"2A1D", "Temperature Type"}, {"2A1E", "Intermediate Temperature"}, + {"2A21", "Measurement Interval"}, {"2A23", "System ID"}, {"2A24", "Model Number String"}, {"2A25", "Serial Number String"}, @@ -2049,13 +2131,36 @@ int _bt_get_uuid_specification_name(const char *uuid, char **name) {"2A29", "Manufacturer Name String"}, {"2A2A", "IEEE 11073-20601 Regulatory Certification Data List"}, {"2A2B", "Current Time"}, + {"2A34", "Glucose Measurement Context"}, + {"2A35", "Blood Pressure Measurement"}, {"2A37", "Heart Rate Measurement"}, {"2A38", "Body Sensor Location"}, + {"2A39", "Heart Rate Control Point"}, {"2A3F", "Alert Status"}, {"2A46", "New Alert"}, + {"2A49", "Blood Pressure Feature"}, {"2A4A", "HID Information"}, {"2A4C", "HID Control Point"}, {"2A50", "PnP ID"}, + {"2A51", "Glucose Feature"}, + {"2A52", "Record Access Control Point"}, + {"2A53", "RSC Measurement"}, + {"2A54", "RSC Feature"}, + {"2A55", "SC Control Point"}, + {"2A56", "Digital"}, + {"2A58", "Analog"}, + {"2A5A", "Aggregate"}, + {"2A5B", "CSC Measurement"}, + {"2A5C", "CSC Feature"}, + {"2A5D", "Sensor Location"}, + {"2A63", "Cycling Power Measurement"}, + {"2A64", "Cycling Power Vector"}, + {"2A65", "Cycling Power Feature"}, + {"2A66", "Cycling Power Control Point"}, + {"2A67", "Location and Speed"}, + {"2A68", "Navigation"}, + {"2A6D", "Pressure"}, + {"2A6E", "Temperature"}, /* Custom uuids */ {"7905F431-B5CE-4E99-A40F-4B1E122D00D0", "Apple Notification Center Service"}, @@ -2069,6 +2174,10 @@ int _bt_get_uuid_specification_name(const char *uuid, char **name) {"9A3F68E0-86CE-11E5-A309-0002A5D5C51B", "Samsung Gear Manager Service"}, {"c2f2cc0f-c085-4dd4-be5a-aca3074bbc72", "Control Point"}, {"cece518b-28d7-4171-92d5-76a1e249a3b9", "Notifications Source"}, + {"32D1955A-E5AA-4A96-9A49-08538DA8B8F6", "Samsung Gear Fit Manager Service"}, + {"FE53FF98-B259-4337-B56A-0EC9F82C6BAD", "Control Point"}, + {"C2051EE0-804D-4D50-A12C-15E243852100", "Notifications Source"}, + {"1ab7c24d-185a-45b9-90d4-f7ab1a71949a", "Samsung Health Service"}, {NULL, NULL} }; diff --git a/bt-api/bt-gatt-client.c b/bt-api/bt-gatt-client.c index 9819f1e..51a50ec 100644 --- a/bt-api/bt-gatt-client.c +++ b/bt-api/bt-gatt-client.c @@ -107,26 +107,10 @@ gboolean _bluetooth_gatt_check_service_change_watcher_address( const bluetooth_device_address_t *device_addr) { GSList *l; - char device_address[BT_ADDRESS_STRING_SIZE] = { 0 }; - char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 }; - - _bt_convert_addr_type_to_string(device_address, - (unsigned char *)device_addr->addr); for (l = service_monitor_list; l != NULL; l = l->next) { - char device_address2[BT_ADDRESS_STRING_SIZE] = { 0 }; - char secure_address2[BT_ADDRESS_STRING_SIZE] = { 0 }; bluetooth_device_address_t *addr = l->data; - _bt_convert_addr_type_to_string(device_address2, - (unsigned char *)addr->addr); - _bt_convert_addr_string_to_secure_string(secure_address, - device_address); - _bt_convert_addr_string_to_secure_string(secure_address2, - device_address2); - BT_INFO("service_monitor_list [%s] - Input [%s]", - secure_address2, secure_address); - if (!memcmp(device_addr, addr, sizeof(bluetooth_device_address_t))) return TRUE; @@ -239,8 +223,8 @@ BT_EXPORT_API int bluetooth_gatt_get_service_property(const char *service_handle if (!g_strcmp0(key, "UUID")) { char *name = NULL; service->uuid = g_variant_dup_string(value, &len); - _bt_get_uuid_specification_name(service->uuid, &name); - BT_INFO("======> Service : %s [%s]", service->uuid, name); + bluetooth_get_uuid_name(service->uuid, &name); + BT_INFO("%s %s [%s]", service_handle + 37, service->uuid, name); g_free(name); } else if (!g_strcmp0(key, "Primary")) { service->primary = g_variant_get_boolean(value); @@ -300,8 +284,9 @@ BT_EXPORT_API int bluetooth_gatt_get_primary_services( char device_address[BT_ADDRESS_STRING_SIZE] = { 0 }; char temp_address[BT_ADDRESS_STRING_SIZE] = { 0 }; int ret = BLUETOOTH_ERROR_INTERNAL; + int idx = 0; - BT_INFO("+"); + BT_DBG("+"); BT_CHECK_PARAMETER(address, return); BT_CHECK_PARAMETER(prim_svc, return); BT_CHECK_ENABLED(return); @@ -331,7 +316,7 @@ BT_EXPORT_API int bluetooth_gatt_get_primary_services( if (g_strcmp0(interface_str, GATT_SERV_INTERFACE) != 0) continue; - BT_DBG("Object Path: %s", object_path); + BT_DBG("[%d] Object Path : %s", idx++, object_path); while (g_variant_iter_loop(svc_iter, "{sv}", &key, &value)) { if (g_strcmp0(key, "Primary") == 0) { if (g_variant_get_boolean(value)) @@ -537,8 +522,6 @@ static int __get_permission_flag(char *permission) retv_if(permission == NULL, ret); - BT_INFO("permission = %s", permission); - if (!g_strcmp0(permission, "broadcast")) ret = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_BROADCAST; else if (!g_strcmp0(permission, "read")) @@ -569,6 +552,41 @@ static int __get_permission_flag(char *permission) return ret; } +static void __convert_permission_flag_to_str(unsigned int permission) +{ + char perm[200] = { 0, }; + + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_BROADCAST) + g_strlcat(perm, "broadcast ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ) + g_strlcat(perm, "read ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE) + g_strlcat(perm, "write-without-response ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE) + g_strlcat(perm, "write ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY) + g_strlcat(perm, "notify ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_INDICATE) + g_strlcat(perm, "indicate ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE) + g_strlcat(perm, "authenticated-signed-writes ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_RELIABLE_WRITE) + g_strlcat(perm, "reliable-write ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITABLE_AUXILIARIES) + g_strlcat(perm, "writable-auxiliaries ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_READ) + g_strlcat(perm, "encrypt-read ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_WRITE) + g_strlcat(perm, "encrypt-write ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_READ) + g_strlcat(perm, "encrypt-authenticated-read ", sizeof(perm)); + if (permission & BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_WRITE) + g_strlcat(perm, "encrypt-authenticated-write ", sizeof(perm)); + + BT_INFO("permission [0x%04x] : %s\n", permission, perm); + return; +} + BT_EXPORT_API int bluetooth_gatt_get_characteristics_property( const char *char_handle, bt_gatt_char_property_t *characteristic) { @@ -633,8 +651,8 @@ BT_EXPORT_API int bluetooth_gatt_get_characteristics_property( if (!g_strcmp0(key, "UUID")) { char *name = NULL; characteristic->uuid = g_variant_dup_string(value, &len); - _bt_get_uuid_specification_name(characteristic->uuid, &name); - BT_INFO("Characteristic : %s [%s]", characteristic->uuid, name); + bluetooth_get_uuid_name(characteristic->uuid, &name); + BT_INFO("%s %s [%s]", char_handle + 37, characteristic->uuid, name); g_free(name); } else if (!g_strcmp0(key, "Value")) { gb_array = g_byte_array_new(); @@ -658,6 +676,7 @@ BT_EXPORT_API int bluetooth_gatt_get_characteristics_property( while (g_variant_iter_loop(char_perm_iter, "s", &permission)) characteristic->permission |= __get_permission_flag(permission); + __convert_permission_flag_to_str(characteristic->permission); g_variant_iter_free(char_perm_iter); } else if (!g_strcmp0(key, "Descriptors")) { @@ -843,7 +862,7 @@ BT_EXPORT_API int bluetooth_gatt_get_char_descriptor_property( if (!g_strcmp0(key, "UUID")) { char *name = NULL; descriptor->uuid = g_variant_dup_string(value, &len); - _bt_get_uuid_specification_name(descriptor->uuid, &name); + bluetooth_get_uuid_name(descriptor->uuid, &name); BT_INFO("Descriptor : %s [%s]", descriptor->uuid, name); g_free(name); } else if (!g_strcmp0(key, "Value")) { @@ -882,8 +901,8 @@ static int __bluetooth_get_att_error_code(GError *error) str = g_strrstr(error->message, "ATT error: 0x"); if (str) { len = strlen(str); - att_ecode = g_ascii_xdigit_value(str[len-2]) << 4; - att_ecode += g_ascii_xdigit_value(str[len-1]); + att_ecode = g_ascii_xdigit_value(str[len - 2]) << 4; + att_ecode += g_ascii_xdigit_value(str[len - 1]); } else return BLUETOOTH_ATT_ERROR_INTERNAL; @@ -895,7 +914,6 @@ static int __bluetooth_get_att_error_code(GError *error) BT_ERR("Write not permitted"); break; case BLUETOOTH_ATT_ERROR_AUTHENTICATION: - break; case BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION: case BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE: BT_ERR("Not paired"); @@ -1658,7 +1676,7 @@ BT_EXPORT_API int bluetooth_gatt_write_descriptor_value(const char *desc, return BLUETOOTH_ERROR_NONE; } -BT_EXPORT_API int bluetooth_gatt_watch_characteristics(const char *char_handle) +BT_EXPORT_API int bluetooth_gatt_watch_characteristics(const char *char_handle, const char *svc_name) { GDBusConnection *conn; GError *error = NULL; @@ -1667,7 +1685,7 @@ BT_EXPORT_API int bluetooth_gatt_watch_characteristics(const char *char_handle) BT_CHECK_PARAMETER(char_handle, return); BT_CHECK_ENABLED(return); - BT_INFO_C("### Enable CCCD : %s", char_handle); + BT_INFO_C("### Enable CCCD : %s [%s]", char_handle + 15, svc_name); conn = _bt_gdbus_get_system_gconn(); retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL); diff --git a/bt-api/bt-request-sender.c b/bt-api/bt-request-sender.c index 69f1da2..2a00c51 100644 --- a/bt-api/bt-request-sender.c +++ b/bt-api/bt-request-sender.c @@ -277,7 +277,6 @@ static void __send_request_cb(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { - BT_DBG("Entered __send_request_cb"); bluetooth_event_param_t bt_event; bt_req_info_t *cb_data = user_data; int result = BLUETOOTH_ERROR_NONE; diff --git a/bt-api/include/bt-common.h b/bt-api/include/bt-common.h index 9bc365e..ca829f3 100644 --- a/bt-api/include/bt-common.h +++ b/bt-api/include/bt-common.h @@ -379,8 +379,6 @@ gboolean _bt_check_enabled_internal(void); void _bt_set_adapter_internal_status(gboolean enabled); -int _bt_get_uuid_specification_name(const char *uuid, char **name); - void _bt_convert_device_path_to_addr_type(const char *device_path, unsigned char *addr); diff --git a/bt-service/bt-request-handler.c b/bt-service/bt-request-handler.c index 38ec417..1cde2eb 100644 --- a/bt-service/bt-request-handler.c +++ b/bt-service/bt-request-handler.c @@ -3053,9 +3053,6 @@ gboolean __bt_service_check_privilege(int function_name, char err_msg[256] = {0, }; retv_if(unique_name == NULL, FALSE); - - BT_DBG("unique_name: %s", unique_name); - retv_if(bt_service_conn == NULL, FALSE); ret_val = cynara_creds_get_default_client_method(&client_creds_method); @@ -3079,8 +3076,6 @@ gboolean __bt_service_check_privilege(int function_name, return FALSE; } - BT_DBG("client_creds: %s", client_creds); - ret_val = cynara_creds_gdbus_get_user(bt_service_conn, unique_name, user_creds_method, &user_creds); if (ret_val != CYNARA_API_SUCCESS) { cynara_strerror(ret_val, err_msg, sizeof(err_msg)); @@ -3090,7 +3085,7 @@ gboolean __bt_service_check_privilege(int function_name, return FALSE; } - BT_DBG("user_creds: %s", user_creds); + BT_DBG("%s, %s, %s", unique_name, client_creds, user_creds); switch (function_name) { case BT_SET_LOCAL_NAME: diff --git a/bt-service/bt-service-event-receiver.c b/bt-service/bt-service-event-receiver.c index 835cbe6..a90803b 100644 --- a/bt-service/bt-service-event-receiver.c +++ b/bt-service/bt-service-event-receiver.c @@ -1649,17 +1649,14 @@ void __bt_gatt_char_property_changed_event(GVariant *msg, GVariant *val = NULL; g_variant_iter_init(&value_iter, msg); while ((g_variant_iter_loop(&value_iter, "{sv}", &property, &val))) { - BT_INFO("Property %s", property); + BT_DBG("Property %s", property); ret_if(property == NULL); if (strcasecmp(property, "Notifying") == 0) { gboolean property_flag = FALSE; g_variant_get(val, "b", &property_flag); - if (property_flag == TRUE) - BT_DBG("notifying is enabled"); - else - BT_DBG("notifying is disabled"); + BT_INFO("Notifying is %s", property_flag ? "enabled" : "disabled"); } } } @@ -1869,9 +1866,9 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path 0x02 BDADDR_LE_RANDOM */ _bt_convert_addr_string_to_secure_string(secure_address, address); BT_INFO("Address : %s Type : %d", secure_address, addr_type); - BT_ERR_C("### Disconnected [%s] [%d : %s] [%s]", !addr_type ? "BREDR" : "LE", - disc_reason, _bt_convert_disc_reason_to_string(disc_reason), - !addr_type ? dev_name : secure_address); + BT_ERR_C("### Disconnected [%s] [%s] [%d : %s]", !addr_type ? "BREDR" : "LE", + !addr_type ? dev_name : secure_address, + disc_reason, _bt_convert_disc_reason_to_string(disc_reason)); g_free(dev_name); _bt_headset_set_local_connection(FALSE); @@ -2249,8 +2246,8 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path address = g_malloc0(BT_ADDRESS_STRING_SIZE); _bt_convert_device_path_to_address(path, address); - BT_DBG("Ipsp BT Interface Name: %s", ifname); - BT_DBG("address: %s", address); + BT_DBG("Ipsp BT Interface Name: %s, address: %s", ifname, address); + param = g_variant_new("(iss)", result, address, ifname); ipsp_param = g_variant_new("(ss)", ifname, address); diff --git a/include/bluetooth-api.h b/include/bluetooth-api.h index fe4eba7..99d6634 100644 --- a/include/bluetooth-api.h +++ b/include/bluetooth-api.h @@ -2329,6 +2329,7 @@ int bluetooth_check_adapter_le(void); int bluetooth_enable_adapter_le(void); int bluetooth_disable_adapter_le(void); +int bluetooth_get_uuid_name(const char *uuid, char **name); /** * @fn int bluetooth_reset_adapter(void) @@ -5293,7 +5294,7 @@ int bluetooth_gatt_get_service_property(const char *service_handle, bt_gatt_service_property_t *service); /** - * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle) + * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name) * * @brief Register to GATT based service to receive value change notification/indication. * @@ -5307,11 +5308,12 @@ int bluetooth_gatt_get_service_property(const char *service_handle, * * @exception None * @param[in] service_handle - Handle for remote service. + * @param[in] service_name - Friednly name of service uuid. * * @remark None * @see None */ -int bluetooth_gatt_watch_characteristics(const char *service_handle); +int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name); /** * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)