Added Gtest for smartcard-service
[platform/core/connectivity/smartcard-service.git] / common / include / Terminal.h
index dccc9bf..af72b10 100644 (file)
 
 namespace smartcard_service_api
 {
-       typedef void (*terminalNotificationCallback)(void *terminal, int event, int error, void *user_param);
+       /* LCOV_EXCL_START */
+       typedef void (*terminalNotificationCallback)(const void *terminal, int event, int error, void *user_param);
 
-       typedef void (*terminalTransmitCallback)(unsigned char *buffer, unsigned int length, int error, void *userParam);
-       typedef void (*terminalGetATRCallback)(unsigned char *buffer, unsigned int length, int error, void *userParam);
+       typedef void (*terminalTransmitCallback)(const unsigned char *buffer, unsigned int length, int error, void *userParam);
+       typedef void (*terminalGetATRCallback)(const unsigned char *buffer, unsigned int length, int error, void *userParam);
 
        class Terminal : public Synchronous
        {
        protected:
                terminalNotificationCallback statusCallback;
                bool initialized;
+               bool closed;
                char *name;
 
        public:
                static const int NOTIFY_SE_AVAILABLE = 1;
                static const int NOTIFY_SE_NOT_AVAILABLE = -1;
 
-               Terminal()
-               {
-                       statusCallback = NULL;
-                       initialized = false;
-                       name = NULL;
-               }
+               Terminal() : statusCallback(NULL), initialized(false),
+                       closed(true), name(NULL) {}
+
                virtual ~Terminal() {}
 
                virtual bool initialize() = 0;
                virtual void finalize() = 0;
-               inline bool isInitialized() { return initialized; }
+               inline bool isInitialized() const { return initialized; }
+
+               virtual bool open() = 0;
+               virtual void close() = 0;
+               inline bool isClosed() const { return closed; }
 
-               inline char *getName() { return name; }
+               inline const char *getName() const { return name; }
                inline void setStatusCallback(terminalNotificationCallback callback) { statusCallback = callback; }
 
-               virtual bool isSecureElementPresence() = 0;
+               virtual bool isSecureElementPresence() const = 0;
 
-               virtual int transmitSync(ByteArray command, ByteArray &result) = 0;
+               virtual int transmitSync(const ByteArray &command, ByteArray &result) = 0;
                virtual int getATRSync(ByteArray &atr) = 0;
 
-               virtual int transmit(ByteArray command, terminalTransmitCallback callback, void *userData) = 0;
+               virtual int transmit(const ByteArray &command, terminalTransmitCallback callback, void *userData) = 0;
                virtual int getATR(terminalGetATRCallback callback, void *userData) = 0;
        };
 
+       /* LCOV_EXCL_STOP */
 } /* namespace smartcard_service_api */
 #endif /* TERMINAL_H_ */