Enhance debug message
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-common.c
index 23e9ab3..6636577 100644 (file)
@@ -555,6 +555,7 @@ const char *_bt_convert_service_function_to_string(int function)
                {BT_AVRCP_TARGET_CONNECT, "BT_AVRCP_TARGET_CONNECT"},
                {BT_AVRCP_TARGET_DISCONNECT, "BT_AVRCP_TARGET_DISCONNECT"},
                {BT_AVRCP_HANDLE_CONTROL, "BT_AVRCP_HANDLE_CONTROL"},
+               {BT_AVRCP_HANDLE_CONTROL_TO_DEST, "BT_AVRCP_HANDLE_CONTROL_TO_DEST"},
                {BT_AVRCP_CONTROL_SET_PROPERTY, "BT_AVRCP_CONTROL_SET_PROPERTY"},
                {BT_AVRCP_CONTROL_GET_PROPERTY, "BT_AVRCP_CONTROL_GET_PROPERTY"},
                {BT_AVRCP_GET_TRACK_INFO, "BT_AVRCP_GET_TRACK_INFO"},
@@ -896,7 +897,10 @@ static GDBusProxy *__bt_gdbus_get_profile_proxy(void)
        if (profile_gproxy)
                return profile_gproxy;
 
-       gconn = _bt_get_system_private_conn();
+       /* Shared connection should be used because rfcomm interface was registered
+        * on shared connection not private. Otherwise, dbus rejection is occured
+        * because dbus policy is only applied on shared connection not private. */
+       gconn = _bt_get_system_shared_conn();
        if (gconn == NULL)
                return NULL;
 
@@ -1222,7 +1226,7 @@ int _bt_register_profile_ex(bt_register_profile_info_t *info, gboolean use_defau
                                        NULL, &err);
        if (err) {
                g_dbus_error_strip_remote_error(err);
-               BT_ERR("RegisterProfile failed: %s", err->message);
+               BT_ERR("RegisterProfile2 failed: %s", err->message);
 
                if (g_strrstr(err->message, BT_ACCESS_DENIED_MSG))
                        result = BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -1290,7 +1294,7 @@ int _bt_register_profile_platform(bt_register_profile_info_t *info, gboolean use
 
        if (err) {
                g_dbus_error_strip_remote_error(err);
-               BT_ERR("RegisterProfile failed: %s", err->message);
+               BT_ERR("RegisterProfile1 failed: %s", err->message);
 
                if (g_strrstr(err->message, BT_ACCESS_DENIED_MSG))
                        result = BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -1336,6 +1340,32 @@ void _bt_unregister_profile(char *path)
        return;
 }
 
+void _bt_print_api_caller_name(void)
+{
+       FILE *fp = NULL;
+       char *path = NULL;
+       char buf[256] = {0, };
+       char **str_list = NULL;
+
+       path = g_strdup_printf("/proc/%d/cmdline", getpid());
+       fp = fopen(path, "r");
+       if (fp == NULL) {
+               g_free(path);
+               return;
+       }
+
+       if (fgets(buf, 256, fp) != NULL) {
+               str_list = g_strsplit(buf, " ", -1);
+               if (str_list[0] != '\0')
+                       BT_INFO("Caller : %s", str_list[0]);
+               g_strfreev(str_list);
+       }
+
+       fclose(fp);
+       g_free(path);
+       return;
+}
+
 int _bt_connect_profile(char *address, char *uuid, void *cb,
                                                        gpointer func_data)
 {
@@ -1996,7 +2026,7 @@ void _bt_set_adapter_internal_status(gboolean enabled)
 
 BT_EXPORT_API int bluetooth_get_uuid_name(const char *uuid, char **name)
 {
-#define SHORT_UUID_COUNT       162
+#define SHORT_UUID_COUNT       199
 #define LONG_UUID_COUNT                17
 
        int offset = 0;
@@ -2097,6 +2127,17 @@ BT_EXPORT_API int bluetooth_get_uuid_name(const char *uuid, char **name)
                {"181D", "Weight Scale"},
                {"181E", "Bond Management"},
                {"181F", "Continuous Glucose Monitoring"},
+               {"1820", "Internet Protocol Support Service"},
+               {"1821", "Indoor Positioning"},
+               {"1822", "Pulse Oximeter Service"},
+               {"1823", "HTTP Proxy"},
+               {"1824", "Transport Discovery"},
+               {"1825", "Object Transfer Service"},
+               {"1826", "Fitness Machine"},
+               {"1827", "Mesh Provisioning Service"},
+               {"1828", "Mesh Proxy Service"},
+               {"1829", "Reconnection Configuration"},
+               {"183A", "Insulin Delivery"},
 
                /* GATT Declarations */
                {"2800", "Primary Service Declaration"},
@@ -2178,6 +2219,32 @@ BT_EXPORT_API int bluetooth_get_uuid_name(const char *uuid, char **name)
                {"2A68", "Navigation"},
                {"2A6D", "Pressure"},
                {"2A6E", "Temperature"},
+               {"2A8E", "Height"},
+               {"2A90", "Last Name"},
+               {"2A91", "Maximum Recommended Heart Rate"},
+               {"2A92", "Resting Heart Rate"},
+               {"2A98", "Weight"},
+               {"2A9B", "Body Composition Feature"},
+               {"2A9C", "Body Composition Measurement"},
+               {"2A9D", "Weight Measurement"},
+               {"2AA2", "Language"},
+               {"2AA4", "Bond Management Control Point"},
+               {"2AA5", "Bond Management Features"},
+               {"2AA6", "Central Address Resolution"},
+               {"2AAD", "Indoor Positioning Configuration"},
+               {"2AB5", "Location Name"},
+               {"2AB6", "URI"},
+               {"2ABC", "TDS Control Point"},
+               {"2AC9", "Resolvable Private Address Only"},
+               {"2ACC", "Fitness Machine Feature"},
+               {"2ACE", "Cross Trainer Data"},
+               {"2AD3", "Training Status"},
+               {"2AD7", "Supported Heart Rate Range"},
+               {"2AD9", "Fitness Machine Control Point"},
+               {"2ADA", "Fitness Machine Status"},
+               {"2B1D", "RC Feature"},
+               {"2B1E", "RC Settings"},
+               {"2B1F", "Reconnection Configuration Control Point"},
        };
        static uuid_name_s long_uuid_name[LONG_UUID_COUNT] = {
                // List should be sorted by UUID
@@ -2232,7 +2299,6 @@ BT_EXPORT_API int bluetooth_get_uuid_name(const char *uuid, char **name)
                        start = p + 1;
        }
 
-       BT_INFO("Unknown uuid : %s", uuid);
        *name = g_strdup("Unknown");
        return BLUETOOTH_ERROR_NONE;
 }