Remove storing select response every select command
[platform/core/connectivity/smartcard-service.git] / client / ClientChannel.cpp
index cb69384..b4d84da 100644 (file)
@@ -45,7 +45,7 @@ namespace smartcard_service_api
 
                if (handle == NULL)
                {
-                       SCARD_DEBUG_ERR("ClientIPC::getInstance() failed");
+                       _ERR("ClientIPC::getInstance() failed");
 
                        return;
                }
@@ -86,13 +86,13 @@ namespace smartcard_service_api
                                        rv = waitTimedCondition(0);
                                        if (rv < 0)
                                        {
-                                               SCARD_DEBUG_ERR("closeSync failed [%d]", rv);
+                                               _ERR("timeout [%d]", rv);
                                                this->error = SCARD_ERROR_OPERATION_TIMEOUT;
                                        }
                                }
                                else
                                {
-                                       SCARD_DEBUG_ERR("sendMessage failed");
+                                       _ERR("sendMessage failed");
                                        this->error = SCARD_ERROR_IPC_FAILED;
                                }
                                syncUnlock();
@@ -106,8 +106,7 @@ namespace smartcard_service_api
                        }
                        else
                        {
-                               /* FIXME */
-                               SCARD_DEBUG("unavailable channel");
+                               _INFO("unavailable channel");
                        }
                }
 #endif
@@ -134,12 +133,13 @@ namespace smartcard_service_api
 
                                if (ClientIPC::getInstance().sendMessage(&msg) == false)
                                {
+                                       _ERR("sendMessage failed");
                                        result = SCARD_ERROR_IPC_FAILED;
                                }
                        }
                        else
                        {
-                               SCARD_DEBUG_ERR("unavailable channel");
+                               _ERR("unavailable channel");
                                result = SCARD_ERROR_ILLEGAL_STATE;
                        }
                }
@@ -173,19 +173,17 @@ namespace smartcard_service_api
                                if (rv >= 0)
                                {
                                        result = response;
-
                                        rv = SCARD_ERROR_OK;
                                }
                                else
                                {
-                                       SCARD_DEBUG_ERR("timeout");
-
+                                       _ERR("timeout [%d]", rv);
                                        this->error = SCARD_ERROR_OPERATION_TIMEOUT;
                                }
                        }
                        else
                        {
-                               SCARD_DEBUG_ERR("sendMessage failed");
+                               _ERR("sendMessage failed");
                        }
                        syncUnlock();
 
@@ -197,7 +195,7 @@ namespace smartcard_service_api
                }
                else
                {
-                       SCARD_DEBUG_ERR("unavailable channel");
+                       _ERR("unavailable channel");
                        throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
                }
 
@@ -228,12 +226,13 @@ namespace smartcard_service_api
                        }
                        else
                        {
+                               _ERR("sendMessage failed");
                                result = SCARD_ERROR_IPC_FAILED;
                        }
                }
                else
                {
-                       SCARD_DEBUG_ERR("unavailable channel");
+                       _ERR("unavailable channel");
                        result = SCARD_ERROR_ILLEGAL_STATE;
                }
 
@@ -248,7 +247,7 @@ namespace smartcard_service_api
 
                if (msg == NULL)
                {
-                       SCARD_DEBUG_ERR("message is null");
+                       _ERR("message is null");
                        return result;
                }
 
@@ -259,15 +258,7 @@ namespace smartcard_service_api
                case Message::MSG_REQUEST_TRANSMIT :
                        {
                                /* transmit result */
-                               SCARD_DEBUG("MSG_REQUEST_TRANSMIT");
-
-                               if (msg->error == 0 &&
-                                       ResponseHelper::getStatus(msg->data) == 0)
-                               {
-                                       /* store select response */
-                                       if (msg->data.getAt(1) == APDUCommand::INS_SELECT_FILE)
-                                               channel->setSelectResponse(msg->data);
-                               }
+                               _INFO("MSG_REQUEST_TRANSMIT");
 
                                if (msg->isSynchronousCall() == true) /* synchronized call */
                                {
@@ -293,7 +284,7 @@ namespace smartcard_service_api
 
                case Message::MSG_REQUEST_CLOSE_CHANNEL :
                        {
-                               SCARD_DEBUG("MSG_REQUEST_CLOSE_CHANNEL");
+                               _INFO("MSG_REQUEST_CLOSE_CHANNEL");
 
                                if (msg->isSynchronousCall() == true) /* synchronized call */
                                {
@@ -316,10 +307,12 @@ namespace smartcard_service_api
                        break;
 
                default:
-                       SCARD_DEBUG("unknwon message : %s", msg->toString());
+                       _DBG("Unknown message : %s", msg->toString());
                        break;
                }
 
+               delete msg;
+
                return result;
        }
 } /* namespace smartcard_service_api */
@@ -334,7 +327,7 @@ namespace smartcard_service_api
        } \
        else \
        { \
-               SCARD_DEBUG_ERR("Invalid param"); \
+               _ERR("Invalid param"); \
        }
 
 using namespace smartcard_service_api;