LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
myexception.hpp
Go to the documentation of this file.
1#ifndef __MYEXCEPTION_HPP__
2#define __MYEXCEPTION_HPP__
3
4#include <string>
5#include <exception>
6#include <functional>
7
8#if defined(__linux__) || _MSC_VER >= 1900 || defined(ANDROID)
9#define NOEXCEPT noexcept
10#else
11#define NOEXCEPT
12#endif
13
14#include <logicalaccess/lla_core_api.hpp>
15
16namespace logicalaccess
17{
21class LibLogicalAccessException : public std::exception
22{
23 public:
24 explicit LibLogicalAccessException(const char *message)
25 : msg_(message)
26 {
27 }
28
29#ifndef SWIG
30 explicit LibLogicalAccessException(const std::string &message)
31 : msg_(message)
32 {
33 }
34#endif
35
37 {
38 }
39
40 const char *what() const NOEXCEPT override
41 {
42 return msg_.c_str();
43 }
44
45 protected:
46 std::string msg_;
47};
48
56{
57 public:
58 explicit CardException(const std::string &message)
61 {
62 }
63
70 {
71 DEFAULT, // Either the exception was constructed with the legacy constructor and
72 // did not specify the error code, or the exception is too specific to
73 // be listed here. In the later case, rely on the error message for more
74 // information.
86 NOT_FOUND, // File not found or block/byte does not exist.
92 UNKOWN_ERROR // Operation failed, no precise diagnosis
93 };
94
95 CardException(const std::string &message, ErrorType error)
97 , error_type_(error)
98 {
99 }
100
102 {
103 return error_type_;
104 }
105
106 protected:
108};
109
114{
115 public:
116 explicit IKSException(const std::string &message)
118 {
119 }
120};
121
122#define EXCEPTION_MSG_CONNECTED \
123 "Already connected to a card. Please disconnect before."
125#define EXCEPTION_MSG_NOREADER \
126 "No reader found."
127#define EXCEPTION_MSG_LICENSENOACCESS \
128 "The current license doesn't allow this functionality."
131}
132
133#endif
Definition: myexception.hpp:56
ErrorType
Definition: myexception.hpp:70
@ REFERENCE_KEY_UNUSABLE
Definition: myexception.hpp:82
@ NOT_FOUND
Definition: myexception.hpp:86
@ WRONG_CLASS
Definition: myexception.hpp:90
@ EXECUTION_ERROR
Definition: myexception.hpp:75
@ DEFAULT
Definition: myexception.hpp:71
@ WRONG_INSTRUCTION
Definition: myexception.hpp:89
@ SECURITY_STATUS
Definition: myexception.hpp:80
@ COMMAND_NOT_ALLOWED
Definition: myexception.hpp:83
@ FUNCTION_NOT_SUPPORTED
Definition: myexception.hpp:85
@ INVALID_CLA_BYTE
Definition: myexception.hpp:78
@ KEY_NUMBER_INVALID
Definition: myexception.hpp:84
@ UNKOWN_ERROR
Definition: myexception.hpp:92
@ WRONG_P1_P2
Definition: myexception.hpp:87
@ COMMAND_INCOMPATIBLE
Definition: myexception.hpp:79
@ MEMORY_FAILURE
Definition: myexception.hpp:76
@ WRONG_LE
Definition: myexception.hpp:88
@ WRONG_LENGTH
Definition: myexception.hpp:77
@ AID_NOT_FOUND
Definition: myexception.hpp:91
@ AUTHENTICATION_FAILURE
Definition: myexception.hpp:81
CardException(const std::string &message, ErrorType error)
Definition: myexception.hpp:95
enum ErrorType error_code() const
Definition: myexception.hpp:101
enum ErrorType error_type_
Definition: myexception.hpp:107
CardException(const std::string &message)
Definition: myexception.hpp:58
Definition: myexception.hpp:114
IKSException(const std::string &message)
Definition: myexception.hpp:116
A liblogicalaccess exception class.
Definition: myexception.hpp:22
const char * what() const NOEXCEPT override
Definition: myexception.hpp:40
std::string msg_
Definition: myexception.hpp:46
virtual ~LibLogicalAccessException() NOEXCEPT
Definition: myexception.hpp:36
LibLogicalAccessException(const char *message)
Definition: myexception.hpp:24
LibLogicalAccessException(const std::string &message)
Definition: myexception.hpp:30
#define NOEXCEPT
Definition: myexception.hpp:11
Definition: asn1.hpp:9