1 /*! 2 * \copyright Copyright (c) 2014-2021 Governikus GmbH & Co. KG, Germany 3 */ 4 5 #pragma once 6 7 #include "CardInfo.h" 8 #include "ReaderConfigurationInfo.h" 9 #include "ReaderManagerPlugInInfo.h" 10 #include "SmartCardDefinitions.h" 11 12 #include <QString> 13 14 namespace governikus 15 { 16 class ReaderInfo 17 { 18 friend class Reader; 19 20 ReaderManagerPlugInType mPlugInType; 21 QString mName; 22 bool mBasicReader; 23 CardInfo mCardInfo; 24 bool mConnected; 25 int mMaxApduLength; 26 27 public: 28 explicit ReaderInfo(const QString& pName = QString(), 29 ReaderManagerPlugInType pPlugInType = ReaderManagerPlugInType::UNKNOWN, 30 const CardInfo& pCardInfo = CardInfo(CardType::NONE)); 31 32 [[nodiscard]] ReaderConfigurationInfo getReaderConfigurationInfo() const; 33 34 getPlugInType()35 [[nodiscard]] ReaderManagerPlugInType getPlugInType() const 36 { 37 return mPlugInType; 38 } 39 40 getCardInfo()41 CardInfo& getCardInfo() 42 { 43 return mCardInfo; 44 } 45 46 getCardInfo()47 [[nodiscard]] const CardInfo& getCardInfo() const 48 { 49 return mCardInfo; 50 } 51 52 getCardTypeString()53 [[nodiscard]] QString getCardTypeString() const 54 { 55 return mCardInfo.getCardTypeString(); 56 } 57 58 hasCard()59 [[nodiscard]] bool hasCard() const 60 { 61 return mCardInfo.isAvailable(); 62 } 63 64 hasEidCard()65 [[nodiscard]] bool hasEidCard() const 66 { 67 return mCardInfo.isEid(); 68 } 69 70 hasPassport()71 [[nodiscard]] bool hasPassport() const 72 { 73 return mCardInfo.isPassport(); 74 } 75 76 getRetryCounter()77 [[nodiscard]] int getRetryCounter() const 78 { 79 return mCardInfo.getRetryCounter(); 80 } 81 82 isRetryCounterDetermined()83 [[nodiscard]] bool isRetryCounterDetermined() const 84 { 85 return mCardInfo.isRetryCounterDetermined(); 86 } 87 88 isPinDeactivated()89 [[nodiscard]] bool isPinDeactivated() const 90 { 91 return mCardInfo.isPinDeactivated(); 92 } 93 94 isPukInoperative()95 [[nodiscard]] bool isPukInoperative() const 96 { 97 return mCardInfo.isPukInoperative(); 98 } 99 100 setCardInfo(const CardInfo & pCardInfo)101 void setCardInfo(const CardInfo& pCardInfo) 102 { 103 mCardInfo = pCardInfo; 104 } 105 106 getName()107 [[nodiscard]] const QString& getName() const 108 { 109 return mName; 110 } 111 112 setBasicReader(bool pIsBasicReader)113 void setBasicReader(bool pIsBasicReader) 114 { 115 mBasicReader = pIsBasicReader; 116 } 117 118 isBasicReader()119 [[nodiscard]] bool isBasicReader() const 120 { 121 return mBasicReader; 122 } 123 124 isConnected()125 [[nodiscard]] bool isConnected() const 126 { 127 return mConnected; 128 } 129 130 setConnected(bool pConnected)131 void setConnected(bool pConnected) 132 { 133 mConnected = pConnected; 134 } 135 136 setMaxApduLength(int pMaxApduLength)137 void setMaxApduLength(int pMaxApduLength) 138 { 139 mMaxApduLength = pMaxApduLength; 140 } 141 142 getMaxApduLength()143 [[nodiscard]] int getMaxApduLength() const 144 { 145 return mMaxApduLength; 146 } 147 148 sufficientApduLength()149 [[nodiscard]] bool sufficientApduLength() const 150 { 151 return mMaxApduLength == -1 || mMaxApduLength >= 500; 152 } 153 154 155 }; 156 157 } // namespace governikus 158