From 2c9544bbe8b396bc09e995448ef679138cb58472 Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Sat, 16 Mar 2013 01:18:24 +0900 Subject: [PATCH] merge with master --- UICCTerminal.cpp | 53 +++++++++++++++++++++--------------- include/UICCTerminal.h | 29 ++++++++++---------- packaging/smartcard-plugin-uicc.spec | 4 +-- 3 files changed, 47 insertions(+), 39 deletions(-) diff --git a/UICCTerminal.cpp b/UICCTerminal.cpp index 7c87a27..47adb2e 100644 --- a/UICCTerminal.cpp +++ b/UICCTerminal.cpp @@ -1,19 +1,18 @@ /* -* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* standard library header */ #include @@ -103,6 +102,8 @@ static void _uiccTransmitCallback(TapiHandle *handle, int result, void *data, vo { SCARD_DEBUG("there is no callback"); } + + delete param; } else { @@ -137,6 +138,8 @@ static void _uiccGetATRCallback(TapiHandle *handle, int result, void *data, void { SCARD_DEBUG("there is no callback"); } + + delete param; } else { @@ -225,6 +228,8 @@ namespace smartcard_service_api apdu_data.apdu = command.getBuffer(); apdu_data.apdu_len = command.getLength(); + syncLock(); + result = tel_req_sim_apdu(handle, &apdu_data, &UICCTerminal::uiccTransmitAPDUCallback, this); if (result == 0) { @@ -233,9 +238,8 @@ namespace smartcard_service_api error = 0; this->response.releaseBuffer(); - syncLock(); result = waitTimedCondition(3); - syncUnlock(); + if (result == 0 && error == 0) { @@ -255,6 +259,8 @@ namespace smartcard_service_api { SCARD_DEBUG_ERR("tel_req_sim_apdu failed [%d]", result); } + + syncUnlock(); } else { @@ -275,6 +281,8 @@ namespace smartcard_service_api SCOPE_LOCK(mutex) { + syncLock(); + result = tel_req_sim_atr(handle, &UICCTerminal::uiccGetAtrCallback, this); if (result == 0) { @@ -283,9 +291,7 @@ namespace smartcard_service_api error = 0; this->response.releaseBuffer(); - syncLock(); result = waitTimedCondition(3); - syncUnlock(); if (result == 0 && error == 0) { @@ -305,6 +311,8 @@ namespace smartcard_service_api { SCARD_DEBUG_ERR("tel_req_sim_atr failed [%d]", result); } + + syncUnlock(); } SCARD_END(); @@ -427,6 +435,8 @@ namespace smartcard_service_api SCARD_DEBUG("APDU response"); + instance->syncLock(); + instance->error = access_rt; if (instance->error == 0) @@ -443,7 +453,6 @@ namespace smartcard_service_api SCARD_DEBUG_ERR("error : event->Status == [%d]", access_rt); } - instance->syncLock(); instance->signalCondition(); instance->syncUnlock(); } @@ -456,6 +465,8 @@ namespace smartcard_service_api SCARD_DEBUG("Get ATR response"); + instance->syncLock(); + instance->error = access_rt; if (access_rt == 0) @@ -472,7 +483,6 @@ namespace smartcard_service_api SCARD_DEBUG_ERR("error : event->Status == [%d]", access_rt); } - instance->syncLock(); instance->signalCondition(); instance->syncUnlock(); } @@ -510,4 +520,3 @@ namespace smartcard_service_api } } } /* namespace smartcard_service_api */ - diff --git a/include/UICCTerminal.h b/include/UICCTerminal.h index 625b69c..a7fef1e 100644 --- a/include/UICCTerminal.h +++ b/include/UICCTerminal.h @@ -1,19 +1,18 @@ /* -* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef UICCTERMINAL_H_ #define UICCTERMINAL_H_ diff --git a/packaging/smartcard-plugin-uicc.spec b/packaging/smartcard-plugin-uicc.spec index 682c67d..2e233d3 100755 --- a/packaging/smartcard-plugin-uicc.spec +++ b/packaging/smartcard-plugin-uicc.spec @@ -1,7 +1,7 @@ Name: smartcard-plugin-uicc Summary: Smartcard plugin uicc -Version: 0.0.1 -Release: 9 +Version: 0.0.3 +Release: 0 Group: libs License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz -- 2.7.4