From fdd038cee5479c940d83df6d87c4677472c4c298 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 4 Mar 2020 09:21:41 +0900 Subject: [PATCH] Show error message on connection request callback Change-Id: I1f7a2b11495f7f6740ace2cd935774f529d6d08b Signed-off-by: Jihoon Kim --- receiver/src/ft.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 49734f1..e388ef0 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -460,11 +460,40 @@ static void on_conn_req(sap_peer_agent_h peer_agent, sap_service_connection_result_e result, void *user_data) { - if (result == SAP_CONNECTION_SUCCESS) { + switch (result) + { + case SAP_CONNECTION_SUCCESS: + LOGI("Connection success"); priv_data.socket = socket; sap_peer_agent_accept_service_connection(peer_agent); sap_peer_agent_set_service_connection_terminated_cb(peer_agent, conn_terminated, NULL); sap_socket_set_data_received_cb(socket, on_data_received, peer_agent); + break; + case SAP_CONNECTION_ALREADY_EXIST: + priv_data.socket = socket; + LOGI("Connection Already Exist"); + break; + case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE: + LOGW("Connection failure device unreachable"); + break; + case SAP_CONNECTION_FAILURE_INVALID_PEERAGENT: + LOGW("Connection failure invalid peer agent"); + break; + case SAP_CONNECTION_FAILURE_NETWORK: + LOGW("Connection failure network"); + break; + case SAP_CONNECTION_FAILURE_PEERAGENT_NO_RESPONSE: + LOGW("Connection failure peer agent no response"); + break; + case SAP_CONNECTION_FAILURE_PEERAGENT_REJECTED: + LOGW("Connection failure peer agent rejected"); + break; + case SAP_CONNECTION_FAILURE_UNKNOWN: + LOGW("Connection failure unknown"); + break; + default: + LOGW("Connection failure. error code : %d", result); + break; } } -- 2.7.4