From: injun.yang Date: Tue, 25 Jul 2017 14:54:13 +0000 (+0530) Subject: [GATT Server] Delivery the specific error code to central device X-Git-Tag: accepted/tizen/4.0/unified/20170816.011228^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F140615%2F2;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git [GATT Server] Delivery the specific error code to central device [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 --- diff --git a/bt-api/bt-gatt-service.c b/bt-api/bt-gatt-service.c index dee2963..2cd555e 100644 --- a/bt-api/bt-gatt-service.c +++ b/bt-api/bt-gatt-service.c @@ -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; }