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
34 ServerReader::ServerReader(ServerSEService *seService,
35 const char *name, Terminal *terminal) : ReaderHelper()
37 if (seService == NULL || name == NULL ||
38 strlen(name) == 0 || terminal == NULL)
40 _ERR("invalid param");
45 this->terminal = terminal;
46 this->seService = seService;
50 ServerReader::~ServerReader()
55 void ServerReader::closeSessions()
59 for (i = 0; i < sessions.size(); i++)
61 if (sessions[i] != NULL)
62 ((ServerSession *)sessions[i])->closeSync();
68 ServerSession *ServerReader::openSessionSync()
70 vector<ByteArray> temp;
72 return openSessionSync(temp, NULL);
75 ServerSession *ServerReader::openSessionSync(const vector<ByteArray> &certHashes, void *caller)
77 ServerSession *session = NULL;
79 session = new (std::nothrow) ServerSession(this, certHashes, caller, terminal);
83 sessions.push_back(session);
89 } /* namespace smartcard_service_api */