/*
-* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* 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 <stdio.h>
#include "ClientIPC.h"
#include "Reader.h"
#include "Session.h"
-#include "SignatureHelper.h"
#ifndef EXTERN_API
#define EXTERN_API __attribute__((visibility("default")))
namespace smartcard_service_api
{
- Reader::Reader(void *context, const char *name, void *handle):ReaderHelper()
+ Reader::Reader(void *context, const char *name, void *handle) : ReaderHelper()
{
unsigned int length = 0;
present = true;
-#if 0
- getPackageCert();
-#endif
-
SCARD_END();
}
Reader::~Reader()
{
- closeSessions();
- }
-
- void Reader::closeSessions()
- {
size_t i;
+ closeSessions();
+
for (i = 0; i < sessions.size(); i++)
{
- sessions[i]->closeSync();
delete (Session *)sessions[i];
}
sessions.clear();
}
- void Reader::getPackageCert()
+ void Reader::closeSessions()
+ throw(ErrorIO &, ErrorIllegalState &)
{
- packageCert = SignatureHelper::getCertificationHash(getpid());
+ size_t i;
+
+ for (i = 0; i < sessions.size(); i++)
+ {
+ sessions[i]->closeSync();
+ }
}
SessionHelper *Reader::openSessionSync()
+ throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
{
openedSession = NULL;
/* request channel handle from server */
msg.message = Message::MSG_REQUEST_OPEN_SESSION;
msg.param1 = (unsigned int)handle;
- msg.data = packageCert;
msg.error = (unsigned int)context; /* using error to context */
msg.caller = (void *)this;
msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
/* request channel handle from server */
msg.message = Message::MSG_REQUEST_OPEN_SESSION;
msg.param1 = (unsigned int)handle;
-#if 0
- msg.data = packageCert;
-#endif
msg.error = (unsigned int)context; /* using error to context */
msg.caller = (void *)this;
msg.callback = (void *)callback;
EXTERN_API void reader_destroy_instance(reader_h handle)
{
- READER_EXTERN_BEGIN;
- delete reader;
- READER_EXTERN_END;
}