Show error message on connection request callback 56/226556/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 4 Mar 2020 00:21:41 +0000 (09:21 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 5 Mar 2020 04:24:30 +0000 (13:24 +0900)
Change-Id: I1f7a2b11495f7f6740ace2cd935774f529d6d08b
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/src/ft.cpp

index 49734f1..e388ef0 100644 (file)
@@ -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;
     }
 }