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.
21 /* standard library header */
23 /* SLP library header */
26 #include "ByteArray.h"
27 #include "Synchronous.h"
29 namespace smartcard_service_api
31 typedef void (*terminalNotificationCallback)(void *terminal, int event, int error, void *user_param);
33 typedef void (*terminalTransmitCallback)(unsigned char *buffer, unsigned int length, int error, void *userParam);
34 typedef void (*terminalGetATRCallback)(unsigned char *buffer, unsigned int length, int error, void *userParam);
36 class Terminal : public Synchronous
39 terminalNotificationCallback statusCallback;
44 static const int NOTIFY_SE_AVAILABLE = 1;
45 static const int NOTIFY_SE_NOT_AVAILABLE = -1;
49 statusCallback = NULL;
53 virtual ~Terminal() {}
55 virtual bool initialize() = 0;
56 virtual void finalize() = 0;
57 inline bool isInitialized() { return initialized; }
59 inline char *getName() { return name; }
60 inline void setStatusCallback(terminalNotificationCallback callback) { statusCallback = callback; }
62 virtual bool isSecureElementPresence() = 0;
64 virtual int transmitSync(ByteArray command, ByteArray &result) = 0;
65 virtual int getATRSync(ByteArray &atr) = 0;
67 virtual int transmit(ByteArray command, terminalTransmitCallback callback, void *userData) = 0;
68 virtual int getATR(terminalGetATRCallback callback, void *userData) = 0;
71 } /* namespace smartcard_service_api */
72 #endif /* TERMINAL_H_ */