[GATT Server] Delivery the specific error code to central device 15/140615/2 accepted/tizen/4.0/unified/20170816.011228 accepted/tizen/4.0/unified/20170816.014632 accepted/tizen/unified/20170727.190506 submit/tizen/20170725.234514 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170814.115522 submit/tizen_4.0_unified/20170814.115522
authorinjun.yang <injun.yang@samsung.com>
Tue, 25 Jul 2017 14:54:13 +0000 (20:24 +0530)
committerGowtham Anandha Babu <gowtham.ab@samsung.com>
Tue, 25 Jul 2017 14:53:51 +0000 (14:53 +0000)
[Problem] Unalbe to pass application error code to central device
[Cause & Measure] Pass the specific error code to central device
[Checking Method] Reponse with the specific error to central device

Change-Id: I72fdfdef011f7f357e95eb4932e703e0cae08480
Signed-off-by: Gowtham Anandha Babu <gowtham.ab@samsung.com>
bt-api/bt-gatt-service.c

index dee2963..2cd555e 100644 (file)
@@ -2612,31 +2612,29 @@ BT_EXPORT_API int bluetooth_gatt_send_response(int request_id, guint req_type,
 
        if (resp_state != BLUETOOTH_ATT_ERROR_NONE) {
                BT_ERR("resp_state is 0x%X", resp_state);
+               char err_msg[20] = { 0, };
+               g_snprintf(err_msg, sizeof(err_msg), "ATT error: 0x%02x", resp_state);
+               g_dbus_method_invocation_return_dbus_error(req_info->context,
+                                               "org.bluez.Error.Failed", err_msg);
 
                switch (resp_state) {
                case BLUETOOTH_ATT_ERROR_WRITE_REQUEST_REJECTED:
-                       g_dbus_method_invocation_return_dbus_error(req_info->context,
-                       "org.bluez.Error.Failed", "Write Request Rejected");
+                       BT_ERR("Write Request Rejected");
                        break;
                case BLUETOOTH_ATT_ERROR_OBJECT_NOT_SELECTED:
-                       g_dbus_method_invocation_return_dbus_error(req_info->context,
-                       "org.bluez.Error.Failed", "Object Not Selected");
+                       BT_ERR("Object Not Selected");
                        break;
                case BLUETOOTH_ATT_ERROR_CONCURRENCY_LIMIT_EXCEEDED:
-                       g_dbus_method_invocation_return_dbus_error(req_info->context,
-                       "org.bluez.Error.Failed", "Concurrency Limit Exceeded");
+                       BT_ERR("Concurrency Limit Exceeded");
                        break;
                case BLUETOOTH_ATT_ERROR_OBJECT_NAME_EXISTS:
-                       g_dbus_method_invocation_return_dbus_error(req_info->context,
-                       "org.bluez.Error.Failed", "Object Name Already Exists");
+                       BT_ERR("Object Name Already Exists");
                        break;
                case BLUETOOTH_ATT_ERROR_CCCD_IMPROPERLY_CONFIGURED:
-                       g_dbus_method_invocation_return_dbus_error(req_info->context,
-                       "org.bluez.Error.Failed", "CCC Improperly Configured");
+                       BT_ERR("CCC Improperly Configured");
                        break;
                default:
-                       g_dbus_method_invocation_return_dbus_error(req_info->context,
-                       "org.bluez.Error.Failed", "Application Error");
+                       BT_ERR("Application Error");
                        break;
                }