2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /* standard library header */
23 /* SLP library header */
27 #include "ServerSEService.h"
28 #include "ServerReader.h"
31 namespace smartcard_service_api
33 ServerReader::ServerReader(ServerSEService *seService,
34 const char *name, Terminal *terminal) : ReaderHelper()
36 if (seService == NULL || name == NULL ||
37 strlen(name) == 0 || terminal == NULL)
39 _ERR("invalid param");
44 this->terminal = terminal;
45 this->seService = seService;
49 ServerReader::~ServerReader()
54 void ServerReader::closeSessions()
55 throw(ErrorIO &, ErrorIllegalState &)
59 for (i = 0; i < sessions.size(); i++)
61 if (sessions[i] != NULL)
62 ((ServerSession *)sessions[i])->closeSync();
68 ServerSession *ServerReader::openSessionSync()
69 throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
71 vector<ByteArray> temp;
73 return openSessionSync(temp, NULL);
76 ServerSession *ServerReader::openSessionSync(const vector<ByteArray> &certHashes, void *caller)
77 throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
79 ServerSession *session = NULL;
81 session = new (std::nothrow) ServerSession(this, certHashes, caller, terminal);
85 sessions.push_back(session);
90 } /* namespace smartcard_service_api */