From 6bbfdd8dd7b7dd5cfa5e9911b6444d846cf556d8 Mon Sep 17 00:00:00 2001 From: "injun.yang" Date: Tue, 29 May 2018 16:30:32 +0900 Subject: [PATCH] Enhance debug message Change-Id: I1511a363c56ee1ce3f2f184dc82c2b4c2e0aa998 --- bt-service/bt-service-common.c | 18 ++++++++++++++++++ bt-service/bt-service-event-receiver.c | 6 ++++-- bt-service/include/bt-service-common.h | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bt-service/bt-service-common.c b/bt-service/bt-service-common.c index a514535..df929da 100644 --- a/bt-service/bt-service-common.c +++ b/bt-service/bt-service-common.c @@ -1089,6 +1089,24 @@ const char *_bt_convert_disc_reason_to_string(int reason) } } +const char *_bt_convert_profile_state_to_string(bt_profile_state_t state) +{ + switch (state) { + case BT_PROFILE_STATE_UNAVAILABLE: + return "UNAVAILABLE"; + case BT_PROFILE_STATE_DISCONNECTED: + return "DISCONNECTED"; + case BT_PROFILE_STATE_CONNECTING: + return "CONNECTING"; + case BT_PROFILE_STATE_CONNECTED: + return "CONNECTED"; + case BT_PROFILE_STATE_DISCONNECTING: + return "DISCONNECTING"; + } + + return NULL; +} + const char *_bt_convert_service_function_to_string(int function) { int i; diff --git a/bt-service/bt-service-event-receiver.c b/bt-service/bt-service-event-receiver.c index 1829789..d4df236 100644 --- a/bt-service/bt-service-event-receiver.c +++ b/bt-service/bt-service-event-receiver.c @@ -1932,9 +1932,11 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path _bt_convert_device_path_to_address(path, address); _bt_convert_addr_string_to_type(bd_addr.addr, address); + _bt_convert_addr_string_to_secure_string(secure_address, address); - BT_DBG("Profile: %s, state: %d addr: %s", - _bt_convert_uuid_to_string(profile_uuid), state, address); + BT_INFO_C("[%s] state: %s, addr: %s", + _bt_convert_uuid_to_string(profile_uuid), + _bt_convert_profile_state_to_string(state), secure_address); if ((strcmp(profile_uuid, A2DP_SINK_UUID) == 0) && (state == BT_PROFILE_STATE_CONNECTED)) { diff --git a/bt-service/include/bt-service-common.h b/bt-service/include/bt-service-common.h index 726a892..f0783b5 100644 --- a/bt-service/include/bt-service-common.h +++ b/bt-service/include/bt-service-common.h @@ -384,6 +384,8 @@ const char *_bt_convert_error_to_string(int error); const char *_bt_convert_disc_reason_to_string(int reason); +const char *_bt_convert_profile_state_to_string(bt_profile_state_t state); + const char *_bt_convert_service_function_to_string(int function); void _bt_logging_connection(gboolean connect, int addr_type); -- 2.7.4