SDK Readers 1.0.1
SDK для связи со считывателями Iron logic
ilr_cpp_helpers.h
См. документацию.
1
7#pragma once
8
9#include <chrono>
10#include <exception>
11#include <string>
12#include <vector>
13
14#include "ilreaders.h"
15
16namespace ilr {
17
22class CILRException : public std::exception {
23public:
30
32 virtual const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
33
34public:
36};
37
46void ILRCheck(ilr_status nCode);
47
51class CCardUID : public ilr_card_uid {
52public:
54 CCardUID();
55
57 CCardUID(const ilr_card_uid& rUID);
58
64 CCardUID(const uint64_t& number, size_t nSize = 8);
65
71 CCardUID(const void* pData, size_t nSize);
72
80 CCardUID(uint8_t nEmSeries, uint16_t nEmNumber, uint16_t nFacility = 0);
81
85 void Clear() {
86 memset(aBytes, 0, sizeof(aBytes));
87 nLength = 0;
88 }
89
93 bool IsEmpty() const {
94 return (0 == nLength);
95 }
96
100 int GetLength() const {
101 return nLength;
102 }
103
110 void Assign(const void* pData, size_t nSize) {
111 nLength = static_cast<uint8_t>((nSize > sizeof(aBytes)) ? sizeof(aBytes) : nSize);
112 if (nLength != 0)
113 memcpy(aBytes, pData, nLength);
114 }
115
122 const CCardUID& operator=(const uint32_t& other) {
123 Assign(&other, sizeof(other));
124 return *this;
125 }
126
132 const CCardUID& operator=(const uint64_t& other) {
133 Assign(&other, sizeof(other));
134 return *this;
135 }
136
142 int Compare(const ilr_card_uid& other) const {
143 int n = (nLength - other.nLength);
144 if (0 == n)
145 n = memcmp(aBytes, other.aBytes, nLength);
146 return n;
147 }
148
156 bool operator==(const ilr_card_uid& other) const {
157 return (nLength == other.nLength) && (memcmp(aBytes, other.aBytes, nLength) == 0);
158 }
159
167 bool operator!=(const ilr_card_uid& other) const {
168 return (nLength != other.nLength) || (memcmp(aBytes, other.aBytes, nLength) != 0);
169 }
170
178 bool operator>(const ilr_card_uid& other) const {
179 return Compare(other) > 0;
180 }
181
189 bool operator>=(const ilr_card_uid& other) const {
190 return Compare(other) >= 0;
191 }
192
200 bool operator<(const ilr_card_uid& other) const {
201 return Compare(other) < 0;
202 }
203
211 bool operator<=(const ilr_card_uid& other) const {
212 return Compare(other) <= 0;
213 }
214
218 std::string ToString() const;
219
223 bool TryParse(const char* pStr);
224};
225
232public:
235
242 CMifareClassicKey(const void* pData, size_t nSize);
243
250
252 inline void Reset() {
253 (ilr_mf_classic_key&)(*this) = kDefault;
254 }
255
257 operator ilr_mf_classic_key() const {
258 return m_nKey;
259 }
260
267 (ilr_mf_classic_key&)(*this) = other;
268 return *this;
269 }
270
274 std::string ToString() const;
275
279 bool TryParse(const char* pStr);
280
281public:
284
285public:
287};
288
295public:
298
304 CMifarePlusKey(const ilr_mf_plus_key& other);
305
312 CMifarePlusKey(const uint64_t& lo, const uint64_t& hi);
313
320
322 inline void Reset() {
323 memset(a, 0xff, sizeof(a));
324 }
325
327 operator ilr_mf_classic_key() const {
328 return ll.lo & 0xffffffffffff;
329 }
330
337 (ilr_mf_plus_key&)(*this) = other;
338 return *this;
339 }
340
347 ll.lo = other & 0xffffffffffff;
348 ll.hi = 0;
349 return *this;
350 }
351
358 bool operator==(const CMifarePlusKey& other) const {
359 return memcmp(a, other.a, sizeof(a)) == 0;
360 }
361
368 bool operator!=(const CMifarePlusKey& other) const {
369 return memcmp(a, other.a, sizeof(a)) != 0;
370 }
371
378 bool operator<(const CMifarePlusKey& other) const {
379 return memcmp(a, other.a, sizeof(a)) < 0;
380 }
381
388 bool operator>(const CMifarePlusKey& other) const {
389 return memcmp(a, other.a, sizeof(a)) > 0;
390 }
391
398 bool operator<=(const CMifarePlusKey& other) const {
399 return memcmp(a, other.a, sizeof(a)) <= 0;
400 }
401
408 bool operator>=(const CMifarePlusKey& other) const {
409 return memcmp(a, other.a, sizeof(a)) >= 0;
410 }
411
412 int Compare(const CMifarePlusKey& other) const;
413
417 std::string ToString(const char* pPartDelimiter = nullptr) const;
418
422 bool TryParse(const char* pStr);
423};
424
431 friend class CILR;
432 friend class CReaderSearch;
433 friend class CReader;
434
435public:
437 CILRHandle();
438
445
447 CILRHandle(const CILRHandle&) = delete;
448
454 CILRHandle(CILRHandle&& other);
455
457 virtual ~CILRHandle();
458
460 CILRHandle& operator=(const CILRHandle&) = delete;
461
468
470 operator ilr_handle() const;
471
473 explicit operator bool() const;
474
480 void Swap(CILRHandle& other) noexcept;
481
483 ilr_handle Get() const;
484
489 void Close();
490
496 void Attach(ilr_handle h);
497
504
505protected:
507};
508
514class CAsyncCommand : public CILRHandle {
515public:
518
525
532
534 virtual ~CAsyncCommand();
535
538
543 inline void Cancel();
544
551 inline ilr_status GetStatus() const;
552
561 inline void GetProgress(size_t& nCurrent, size_t& nTotal) const;
562};
563
565 ILRCheck(ilr_command_cancel(m_h));
566}
567
569 ilr_status res;
570 ILRCheck(ilr_command_get_status(m_h, &res));
571 return res;
572}
573
574inline void CAsyncCommand::GetProgress(size_t& nCurrent, size_t& nTotal) const {
575 ILRCheck(ilr_command_get_progress(m_h, &nCurrent, &nTotal));
576}
577
583class CReaderSearch : public CILRHandle {
584public:
587
594
601
603 virtual ~CReaderSearch();
604
607
625 void* pUserData = nullptr);
626
645 inline void EnableMessageQueue(bool fEnable = true);
646
658 inline bool GetMessage(ilr_search_msg& nMsg, const void*& pMsgData) const;
659
670 inline void SetOptions(const ilr_search_options& rOptions);
671
679 inline void GetOptions(ilr_search_options& rOptions) const;
680
695 inline void SetListenPorts(const uint16_t* pPorts, size_t nCount);
696
708 void GetListenPorts(std::vector<uint16_t>& oPorts) const;
709
722 inline ilr_status GetListenStatus(uint16_t nTcpPort) const;
723
735 inline void Scan(bool fReset = false);
736
747 inline CAsyncCommand Begin_Scan(bool fReset = false);
748
758 inline size_t GetReaderCount() const;
759
768 inline void GetReaderInfo(size_t nIdx, ilr_reader_info& rInfo) const;
769
783 inline void SetAutoScan(bool fEnable = true, bool fWait = true);
784
795 inline CAsyncCommand Begin_SetAutoScan(bool fEnable);
796
804 inline bool GetAutoScan() const;
805
823 inline int OpenPort(ilr_port_type nPortType, const char* pszPortName,
824 ilr_reader_info* pInfo = nullptr);
825
837 inline CAsyncCommand Begin_OpenPort(ilr_port_type nPortType, const char* pszPortName);
838
848 static inline void End_OpenPort(ilr_handle hCommand, int& PortFD, ilr_reader_info& rInfo);
849
863 inline void ClosePort(ilr_port_type nPortType, const char* pszPortName, int hPort);
864
877 inline CAsyncCommand Begin_ClosePort(ilr_port_type nPortType, const char* pszPortName,
878 int hPortFD);
879
884 inline CReaderSearch Clone() const;
885};
886
888 void* pUserData) {
889 ILRCheck(ilr_search_set_message_callback(m_h, pCallback, pUserData));
890}
891
892inline void CReaderSearch::EnableMessageQueue(bool fEnable) {
893 ILRCheck(ilr_search_enable_message_queue(m_h, (ilr_bool)fEnable));
894}
895
896inline bool CReaderSearch::GetMessage(ilr_search_msg& nMsg, const void*& pMsgData) const {
897 ilr_bool f;
898 ILRCheck(ilr_search_get_message(m_h, &nMsg, &pMsgData, &f));
899 return f;
900}
901
902inline void CReaderSearch::SetOptions(const ilr_search_options& rOptions) {
903 ILRCheck(ilr_search_set_options(m_h, &rOptions));
904}
905
906inline void CReaderSearch::GetOptions(ilr_search_options& rOptions) const {
907 ILRCheck(ilr_search_get_options(m_h, &rOptions));
908}
909
910inline void CReaderSearch::SetListenPorts(const uint16_t* pPorts, size_t nCount) {
911 ILRCheck(ilr_search_set_listen_ports(m_h, pPorts, nCount));
912}
913
915 ilr_status res;
916 ILRCheck(ilr_search_get_listen_status(m_h, nTcpPort, &res));
917 return res;
918}
919
920inline void CReaderSearch::Scan(bool fReset) {
921 ILRCheck(ilr_search_scan(m_h, (ilr_bool)fReset));
922}
923
924inline size_t CReaderSearch::GetReaderCount() const {
925 size_t res;
926 ILRCheck(ilr_search_get_reader_count(m_h, &res));
927 return res;
928}
929
930inline void CReaderSearch::GetReaderInfo(size_t nIdx, ilr_reader_info& rInfo) const {
931 ILRCheck(ilr_search_get_reader_info(m_h, nIdx, &rInfo));
932}
933
934inline void CReaderSearch::SetAutoScan(bool fEnable, bool fWait) {
935 ILRCheck(ilr_search_set_auto_scan(m_h, (ilr_bool)fEnable, (ilr_bool)fWait));
936}
937
938inline bool CReaderSearch::GetAutoScan() const {
939 ilr_bool f;
940 ILRCheck(ilr_search_get_auto_scan(m_h, &f));
941 return static_cast<bool>(f);
942}
943
944inline int CReaderSearch::OpenPort(ilr_port_type nPortType, const char* pszPortName,
945 ilr_reader_info* pInfo) {
946 int fd;
947 ILRCheck(ilr_search_open_port(m_h, nPortType, pszPortName, pInfo, &fd));
948 return fd;
949}
950
951inline void CReaderSearch::ClosePort(ilr_port_type nPortType, const char* pszPortName, int hPort) {
952 ILRCheck(ilr_search_close_port(m_h, nPortType, pszPortName, hPort));
953}
954
956 CAsyncCommand res;
957 ILRCheck(ilr_search_begin_scan(m_h, (ilr_bool)fReset, &res.m_h));
958 return res;
959}
960
962 CAsyncCommand res;
963 ILRCheck(ilr_search_begin_set_auto_scan(m_h, (ilr_bool)fEnable, &res.m_h));
964 return res;
965}
966
968 const char* pszPortName) {
969 CAsyncCommand res;
970 ILRCheck(ilr_search_begin_open_port(m_h, nPortType, pszPortName, &res.m_h));
971 return res;
972}
973
974inline void CReaderSearch::End_OpenPort(ilr_handle hCommand, int& PortFD, ilr_reader_info& rInfo) {
975 ILRCheck(ilr_search_end_open_port(hCommand, &PortFD, &rInfo));
976}
977
979 const char* pszPortName, int hPortFD) {
980 CAsyncCommand res;
981 ILRCheck(ilr_search_begin_close_port(m_h, nPortType, pszPortName, hPortFD, &res.m_h));
982 return res;
983}
984
986 ilr_handle hNewHandle;
987 ILRCheck(ilr_clone_handle(m_h, &hNewHandle));
988 return CReaderSearch(hNewHandle);
989}
990
996class CReader : public CILRHandle {
997public:
999 CReader();
1000
1007
1013 CReader(CReader&& other);
1014
1016 virtual ~CReader();
1017
1019 CReader& operator=(CReader&& other);
1020
1037 inline void SetMessageCallback(ilr_reader_message_callback pCallback,
1038 void* pUserData = nullptr);
1039
1058 inline void EnableMessageQueue(bool fEnable = true);
1059
1071 inline bool GetMessage(ilr_reader_msg& nMsg, const void*& pMsgData) const;
1072
1080 inline void SetOptions(const ilr_reader_options& rOptions);
1081
1089 inline void GetOptions(ilr_reader_options& rOptions) const;
1090
1103 inline void Connect(bool fReconnect = false);
1104
1115 inline CAsyncCommand Begin_Connect(bool fReconnect = false);
1116
1125 inline void Disconnect();
1126
1136
1145
1153 inline void GetReaderInfo(ilr_reader_info& rInfo) const;
1154
1166 inline void Scan(bool fReset = false, bool fPowerOff = true);
1167
1179 inline CAsyncCommand Begin_Scan(bool fReset = false, bool fPowerOff = true);
1180
1190 inline bool GetCardInfo(ilr_card_info& rInfo) const;
1191
1204 inline void SetAutoScan(bool fEnable = true, bool fWait = true);
1205
1216 inline CAsyncCommand Begin_SetAutoScan(bool fEnable = true);
1217
1225 inline bool GetAutoScan() const;
1226
1242 inline void ReadMfUltralight(size_t nPageIdx, uint32_t* pBuf, size_t nPageCount,
1243 size_t* pRead = nullptr);
1244
1256 inline CAsyncCommand Begin_ReadMfUltralight(size_t nPageIdx, size_t nPageCount);
1257
1269 static inline void End_ReadMfUltralight(ilr_handle hCommand, const uint32_t*& pList,
1270 size_t& nRead);
1271
1288 inline void WriteMfUltralight(size_t nPageIdx, const uint32_t* pData, size_t nPageCount,
1289 size_t* pWritten = nullptr);
1290
1303 inline CAsyncCommand Begin_WriteMfUltralight(size_t nPageIdx, const uint32_t* pData,
1304 size_t nPageCount);
1305
1314 static inline void End_WriteMfUltralight(ilr_handle hCommand, size_t& nWritten);
1315
1323 inline void LoadMfCKey(const ilr_mf_classic_key& nKey);
1324
1332 inline void LoadMfPKey(const ilr_mf_plus_key& rKey);
1333
1353 inline bool AuthMfCard(size_t nAddress, bool fKeyB);
1354
1367 inline CAsyncCommand Begin_AuthMfCard(size_t nAddress, bool fKeyB);
1368
1377 static inline void End_AuthMfCard(ilr_handle hCommand, bool& fAuthOk);
1378
1395 inline int AuthMfCard2(size_t nAddress, bool fKeyB, uint32_t nKeys = 0xFFFF);
1396
1410 inline CAsyncCommand Begin_AuthMfCard2(size_t nAddress, bool fKeyB, uint32_t nKeys = 0xFFFF);
1411
1420 static inline void End_AuthMfCard2(ilr_handle hCommand, int& nFoundIdx);
1421
1438 inline void ReadMfClassic(size_t nBlockIdx, ilr_mf_block_data* pBuf, size_t nBlockCount,
1439 size_t* pRead = nullptr);
1440
1453 inline CAsyncCommand Begin_ReadMfClassic(size_t nBlockIdx, size_t nBlockCount);
1454
1466 static inline void End_ReadMfClassic(ilr_handle hCommand, const ilr_mf_block_data*& pList,
1467 size_t& nRead);
1468
1484 inline void WriteMfClassic(size_t nBlockIdx, const ilr_mf_block_data* pData, size_t nBlockCount,
1485 size_t* pWritten = nullptr);
1486
1500 inline CAsyncCommand Begin_WriteMfClassic(size_t nBlockIdx, const ilr_mf_block_data* pData,
1501 size_t nBlockCount);
1502
1511 static inline void End_WriteMfClassic(ilr_handle hCommand, size_t& nWritten);
1512
1529 inline void ReadMfPlus(size_t nAddress, ilr_mf_block_data* pBuf, size_t nBlockCount,
1530 bool fOpenText = true, size_t* pRead = nullptr);
1531
1544 inline CAsyncCommand Begin_ReadMfPlus(size_t nAddress, size_t nBlockCount, bool fOpenText);
1545
1557 static inline void End_ReadMfPlus(ilr_handle hCommand, const ilr_mf_block_data*& pList,
1558 size_t& nRead);
1559
1576 inline void WriteMfPlus(size_t nAddress, const ilr_mf_block_data* pData, size_t nBlockCount,
1577 bool fOpenText = true, size_t* pWritten = nullptr);
1578
1592 inline CAsyncCommand Begin_WriteMfPlus(size_t nAddress, const ilr_mf_block_data* pData,
1593 size_t nBlockCount, bool fOpenText);
1594
1603 static inline void End_WriteMfPlus(ilr_handle hCommand, size_t& nWritten);
1604
1619 inline void MfIncrement(size_t nBlockIdx, uint32_t nValue);
1620
1633 inline CAsyncCommand Begin_MfIncrement(size_t nBlockIdx, uint32_t nValue);
1634
1649 inline void MfDecrement(size_t nBlockIdx, uint32_t nValue);
1650
1663 inline CAsyncCommand Begin_MfDecrement(size_t nBlockIdx, uint32_t nValue);
1664
1677 inline void MfTransfer(size_t nBlockIdx);
1678
1689 inline CAsyncCommand Begin_MfTransfer(size_t nBlockIdx);
1690
1703 inline void MfRestore(size_t nBlockIdx);
1704
1715 inline CAsyncCommand Begin_MfRestore(size_t nBlockIdx);
1716
1727 inline void MfPowerOff();
1728
1746 inline bool MfRas(bool fWakeUp, uint8_t& nSAK, uint16_t& nATQ, ilr_card_uid& rUID);
1747
1763 inline bool MfRR(bool fWakeUp, const ilr_card_uid& rUID);
1764
1775 inline void MfHalt();
1776
1787 inline void MfRats();
1788
1801 void MfRats(std::vector<uint8_t>& oAts);
1802
1816 inline void MfWritePerso(uint32_t nAddress, const ilr_mf_plus_key& rKey);
1817
1828 inline void MfCommitPerso();
1829
1846 inline void WriteMfCKey(size_t nIdx, bool fKeyB, const ilr_mf_classic_key* pKeys, size_t nCount,
1847 size_t* pWritten = nullptr);
1848
1863 inline CAsyncCommand Begin_WriteMfCKey(size_t nIdx, bool fKeyB, const ilr_mf_classic_key* pKeys,
1864 size_t nCount);
1865
1875 static inline void End_WriteMfCKey(ilr_handle hCommand, size_t& nWritten);
1876
1893 inline void WriteMfPKey(size_t nIdx, bool fKeyB, const ilr_mf_plus_key* pKeys, size_t nCount,
1894 size_t* pWritten = nullptr);
1895
1910 inline CAsyncCommand Begin_WriteMfPKey(size_t nIdx, bool fKeyB, const ilr_mf_plus_key* pKeys,
1911 size_t nCount);
1912
1921 static inline void End_WriteMfPKey(ilr_handle hCommand, size_t& nWritten);
1922
1930 inline void LoadTemicPassword(const int64_t nPassword);
1931
1944 inline void ScanTemic(int nScanParam = -1);
1945
1956 inline CAsyncCommand Begin_ScanTemic(int nScanParam = -1);
1957
1968 inline void SetScanTemic(bool fEnable = true);
1969
1977 inline bool GetScanTemic() const;
1978
1995 inline void ReadTemic(size_t nBlockIdx, uint32_t* pBuf, size_t nBlockCount, int nScanParam = -1,
1996 size_t* pRead = nullptr);
1997
2010 inline CAsyncCommand Begin_ReadTemic(size_t nBlockIdx, size_t nBlockCount, int nScanParam = -1);
2011
2023 static inline void End_ReadTemic(ilr_handle hCommand, const uint*& pList, size_t& nRead);
2024
2042 inline void WriteTemic(size_t nBlockIdx, const uint32_t* pData, size_t nBlockCount,
2043 bool fLock = false, int nScanParam = -1, size_t* pWritten = nullptr);
2044
2059 inline CAsyncCommand Begin_WriteTemic(size_t nBlockIdx, const uint32_t* pData,
2060 size_t nBlockCount, bool fLock = false,
2061 int nScanParam = -1);
2062
2071 static inline void End_WriteTemic(ilr_handle hCommand, size_t& nWritten);
2072
2084 inline void ResetTemic(bool fWait = true);
2085
2096
2107 static inline void EncodeTemicEmMarine(const ilr_card_uid& rUID, uint32_t* pBuf3,
2108 size_t nBlockCount);
2109
2121 static inline void DecodeTemicEmMarine(const uint32_t* pData3, size_t nBlockCount,
2122 ilr_card_uid& rUID, bool* pConfigOk = nullptr);
2123
2135 static inline void EncodeTemicHid(const ilr_card_uid& rUID, uint32_t* pBuf4, size_t nBlockCount,
2136 int nWiegand);
2137
2149 static inline void DecodeTemicHid(const uint32_t* pData4, size_t nBlockCount,
2150 ilr_card_uid& rUID, int& nWiegand, bool* pConfigOk = nullptr);
2151
2157 static uint32_t GetSupportedCardTypes(ilr_reader_model nReaderModel);
2158
2165 static uint32_t GetSupportedRewrittenCardTypes(ilr_reader_model nReaderModel,
2166 uint32_t nFwVersion);
2167
2172 inline CReader Clone() const;
2173};
2174
2175inline void CReader::SetMessageCallback(ilr_reader_message_callback pCallback, void* pUserData) {
2176 ILRCheck(ilr_reader_set_message_callback(m_h, pCallback, pUserData));
2177}
2178
2179inline void CReader::EnableMessageQueue(bool fEnable) {
2180 ILRCheck(ilr_reader_enable_message_queue(m_h, (ilr_bool)fEnable));
2181}
2182
2183inline bool CReader::GetMessage(ilr_reader_msg& nMsg, const void*& pMsgData) const {
2184 ilr_bool f;
2185 ILRCheck(ilr_reader_get_message(m_h, &nMsg, &pMsgData, &f));
2186 return f;
2187}
2188
2189inline void CReader::SetOptions(const ilr_reader_options& rOptions) {
2190 ILRCheck(ilr_reader_set_options(m_h, &rOptions));
2191}
2192
2193inline void CReader::GetOptions(ilr_reader_options& rOptions) const {
2194 ILRCheck(ilr_reader_get_options(m_h, &rOptions));
2195}
2196
2197inline void CReader::Connect(bool fReconnect) {
2198 ILRCheck(ilr_reader_connect(m_h, (ilr_bool)fReconnect));
2199}
2200
2201inline CAsyncCommand CReader::Begin_Connect(bool fReconnect) {
2202 CAsyncCommand res;
2203 ILRCheck(ilr_reader_begin_connect(m_h, (ilr_bool)fReconnect, &res.m_h));
2204 return res;
2205}
2206
2207inline void CReader::Disconnect() {
2208 ILRCheck(ilr_reader_disconnect(m_h));
2209}
2210
2212 CAsyncCommand res;
2213 ILRCheck(ilr_reader_begin_disconnect(m_h, &res.m_h));
2214 return res;
2215}
2216
2219 ILRCheck(ilr_reader_get_connection_status(m_h, &res));
2220 return res;
2221}
2222
2223inline void CReader::GetReaderInfo(ilr_reader_info& rInfo) const {
2224 ILRCheck(ilr_reader_get_info(m_h, &rInfo));
2225}
2226
2227inline void CReader::Scan(bool fReset, bool fPowerOff) {
2228 ILRCheck(ilr_reader_scan(m_h, (ilr_bool)fReset, (ilr_bool)fPowerOff));
2229}
2230
2231inline CAsyncCommand CReader::Begin_Scan(bool fReset, bool fPowerOff) {
2232 CAsyncCommand res;
2233 ILRCheck(ilr_reader_begin_scan(m_h, (ilr_bool)fReset, (ilr_bool)fPowerOff, &res.m_h));
2234 return res;
2235}
2236
2237inline bool CReader::GetCardInfo(ilr_card_info& rInfo) const {
2238 ILRCheck(ilr_reader_get_card_info(m_h, &rInfo));
2239 return (rInfo.rUID.nLength != 0);
2240}
2241
2242inline void CReader::SetAutoScan(bool fEnable, bool fWait) {
2243 ILRCheck(ilr_reader_set_auto_scan(m_h, (ilr_bool)fEnable, (ilr_bool)fWait));
2244}
2245
2247 CAsyncCommand res;
2248 ILRCheck(ilr_reader_begin_set_auto_scan(m_h, (ilr_bool)fEnable, &res.m_h));
2249 return res;
2250}
2251
2252inline bool CReader::GetAutoScan() const {
2253 ilr_bool res;
2254 ILRCheck(ilr_reader_get_auto_scan(m_h, &res));
2255 return static_cast<bool>(res);
2256}
2257
2258inline void CReader::ReadMfUltralight(size_t nPageIdx, uint32_t* pBuf, size_t nPageCount,
2259 size_t* pRead) {
2260 ILRCheck(ilr_reader_read_mf_ultralight(m_h, nPageIdx, pBuf, nPageCount, pRead));
2261}
2262
2263inline CAsyncCommand CReader::Begin_ReadMfUltralight(size_t nPageIdx, size_t nPageCount) {
2264 CAsyncCommand res;
2265 ILRCheck(ilr_reader_begin_read_mf_ultralight(m_h, nPageIdx, nPageCount, &res.m_h));
2266 return res;
2267}
2268
2269inline void CReader::End_ReadMfUltralight(ilr_handle hCommand, const uint32_t*& pList,
2270 size_t& nRead) {
2271 ILRCheck(ilr_reader_end_read_mf_ultralight(hCommand, &pList, &nRead));
2272}
2273
2274inline void CReader::WriteMfUltralight(size_t nPageIdx, const uint32_t* pData, size_t nPageCount,
2275 size_t* pWritten) {
2276 ILRCheck(ilr_reader_write_mf_ultralight(m_h, nPageIdx, pData, nPageCount, pWritten));
2277}
2278
2279inline CAsyncCommand CReader::Begin_WriteMfUltralight(size_t nPageIdx, const uint32_t* pData,
2280 size_t nPageCount) {
2281 CAsyncCommand res;
2282 ILRCheck(ilr_reader_begin_write_mf_ultralight(m_h, nPageIdx, pData, nPageCount, &res.m_h));
2283 return res;
2284}
2285
2286inline void CReader::End_WriteMfUltralight(ilr_handle hCommand, size_t& nWritten) {
2287 ILRCheck(ilr_reader_end_write_mf_ultralight(hCommand, &nWritten));
2288}
2289
2290inline void CReader::LoadMfCKey(const ilr_mf_classic_key& nKey) {
2291 ILRCheck(ilr_reader_load_mf_ckey(m_h, nKey));
2292}
2293
2294inline void CReader::LoadMfPKey(const ilr_mf_plus_key& rKey) {
2295 ILRCheck(ilr_reader_load_mf_pkey(m_h, rKey));
2296}
2297
2298inline bool CReader::AuthMfCard(size_t nAddress, bool fKeyB) {
2299 ilr_bool res;
2300 ILRCheck(ilr_reader_auth_mf_card(m_h, nAddress, (ilr_bool)fKeyB, &res));
2301 return static_cast<bool>(res);
2302}
2303
2304inline CAsyncCommand CReader::Begin_AuthMfCard(size_t nAddress, bool fKeyB) {
2305 CAsyncCommand res;
2306 ILRCheck(ilr_reader_begin_auth_mf_card(m_h, nAddress, (ilr_bool)fKeyB, &res.m_h));
2307 return res;
2308}
2309
2310inline void CReader::End_AuthMfCard(ilr_handle hCommand, bool& fAuthOk) {
2311 ilr_bool f;
2312 ILRCheck(ilr_reader_end_auth_mf_card(hCommand, &f));
2313 fAuthOk = static_cast<bool>(f);
2314}
2315
2316inline int CReader::AuthMfCard2(size_t nAddress, bool fKeyB, uint32_t nKeys) {
2317 int res;
2318 ILRCheck(ilr_reader_auth_mf_card2(m_h, nAddress, (ilr_bool)fKeyB, nKeys, &res));
2319 return res;
2320}
2321
2322inline CAsyncCommand CReader::Begin_AuthMfCard2(size_t nAddress, bool fKeyB, uint32_t nKeys) {
2323 CAsyncCommand res;
2324 ILRCheck(ilr_reader_begin_auth_mf_card2(m_h, nAddress, (ilr_bool)fKeyB, nKeys, &res.m_h));
2325 return res;
2326}
2327
2328inline void CReader::End_AuthMfCard2(ilr_handle hCommand, int& nFoundIdx) {
2329 ILRCheck(ilr_reader_end_auth_mf_card2(hCommand, &nFoundIdx));
2330}
2331
2332inline void CReader::ReadMfClassic(size_t nBlockIdx, ilr_mf_block_data* pBuf, size_t nBlockCount,
2333 size_t* pRead) {
2334 ILRCheck(ilr_reader_read_mf_classic(m_h, nBlockIdx, pBuf, nBlockCount, pRead));
2335}
2336
2337inline CAsyncCommand CReader::Begin_ReadMfClassic(size_t nBlockIdx, size_t nBlockCount) {
2338 CAsyncCommand res;
2339 ILRCheck(ilr_reader_begin_read_mf_classic(m_h, nBlockIdx, nBlockCount, &res.m_h));
2340 return res;
2341}
2342
2343inline void CReader::End_ReadMfClassic(ilr_handle hCommand, const ilr_mf_block_data*& pList,
2344 size_t& nRead) {
2345 ILRCheck(ilr_reader_end_read_mf_classic(hCommand, &pList, &nRead));
2346}
2347
2348inline void CReader::WriteMfClassic(size_t nBlockIdx, const ilr_mf_block_data* pData,
2349 size_t nBlockCount, size_t* pWritten) {
2350 ILRCheck(ilr_reader_write_mf_classic(m_h, nBlockIdx, pData, nBlockCount, pWritten));
2351}
2352
2354 size_t nBlockCount) {
2355 CAsyncCommand res;
2356 ILRCheck(ilr_reader_begin_write_mf_classic(m_h, nBlockIdx, pData, nBlockCount, &res.m_h));
2357 return res;
2358}
2359
2360inline void CReader::End_WriteMfClassic(ilr_handle hCommand, size_t& nWritten) {
2361 ILRCheck(ilr_reader_end_write_mf_classic(hCommand, &nWritten));
2362}
2363
2364inline void CReader::ReadMfPlus(size_t nAddress, ilr_mf_block_data* pBuf, size_t nBlockCount,
2365 bool fOpenText, size_t* pRead) {
2366 ILRCheck(ilr_reader_read_mf_plus(m_h, nAddress, pBuf, nBlockCount, (ilr_bool)fOpenText, pRead));
2367}
2368
2369inline CAsyncCommand CReader::Begin_ReadMfPlus(size_t nAddress, size_t nBlockCount,
2370 bool fOpenText) {
2371 CAsyncCommand res;
2372 ILRCheck(
2373 ilr_reader_begin_read_mf_plus(m_h, nAddress, nBlockCount, (ilr_bool)fOpenText, &res.m_h));
2374 return res;
2375}
2376
2377inline void CReader::End_ReadMfPlus(ilr_handle hCommand, const ilr_mf_block_data*& pList,
2378 size_t& nRead) {
2379 ILRCheck(ilr_reader_end_read_mf_plus(hCommand, &pList, &nRead));
2380}
2381
2382inline void CReader::WriteMfPlus(size_t nAddress, const ilr_mf_block_data* pData,
2383 size_t nBlockCount, bool fOpenText, size_t* pWritten) {
2384 ILRCheck(
2385 ilr_reader_write_mf_plus(m_h, nAddress, pData, nBlockCount, (ilr_bool)fOpenText, pWritten));
2386}
2387
2389 size_t nBlockCount, bool fOpenText) {
2390 CAsyncCommand res;
2391 ILRCheck(ilr_reader_begin_write_mf_plus(m_h, nAddress, pData, nBlockCount, (ilr_bool)fOpenText,
2392 &res.m_h));
2393 return res;
2394}
2395
2396inline void CReader::End_WriteMfPlus(ilr_handle hCommand, size_t& nWritten) {
2397 ILRCheck(ilr_reader_end_write_mf_plus(hCommand, &nWritten));
2398}
2399
2400inline void CReader::MfIncrement(size_t nBlockIdx, uint32_t nValue) {
2401 ILRCheck(ilr_reader_mf_increment(m_h, nBlockIdx, nValue));
2402}
2403
2404inline CAsyncCommand CReader::Begin_MfIncrement(size_t nBlockIdx, uint32_t nValue) {
2405 CAsyncCommand res;
2406 ILRCheck(ilr_reader_begin_mf_increment(m_h, nBlockIdx, nValue, &res.m_h));
2407 return res;
2408}
2409
2410inline void CReader::MfDecrement(size_t nBlockIdx, uint32_t nValue) {
2411 ILRCheck(ilr_reader_mf_decrement(m_h, nBlockIdx, nValue));
2412}
2413
2414inline CAsyncCommand CReader::Begin_MfDecrement(size_t nBlockIdx, uint32_t nValue) {
2415 CAsyncCommand res;
2416 ILRCheck(ilr_reader_begin_mf_decrement(m_h, nBlockIdx, nValue, &res.m_h));
2417 return res;
2418}
2419
2420inline void CReader::MfTransfer(size_t nBlockIdx) {
2421 ILRCheck(ilr_reader_mf_transfer(m_h, nBlockIdx));
2422}
2423
2425 CAsyncCommand res;
2426 ILRCheck(ilr_reader_begin_mf_transfer(m_h, nBlockIdx, &res.m_h));
2427 return res;
2428}
2429
2430inline void CReader::MfRestore(size_t nBlockIdx) {
2431 ILRCheck(ilr_reader_mf_restore(m_h, nBlockIdx));
2432}
2433
2434inline CAsyncCommand CReader::Begin_MfRestore(size_t nBlockIdx) {
2435 CAsyncCommand res;
2436 ILRCheck(ilr_reader_begin_mf_restore(m_h, nBlockIdx, &res.m_h));
2437 return res;
2438}
2439
2440inline void CReader::MfPowerOff() {
2441 ILRCheck(ilr_reader_mf_power_off(m_h));
2442}
2443
2444inline bool CReader::MfRas(bool fWakeUp, uint8_t& nSAK, uint16_t& nATQ, ilr_card_uid& rUID) {
2445 ilr_bool res;
2446 ILRCheck(ilr_reader_mf_ras(m_h, (ilr_bool)fWakeUp, &nSAK, &nATQ, &rUID, &res));
2447 return static_cast<bool>(res);
2448}
2449
2450inline bool CReader::MfRR(bool fWakeUp, const ilr_card_uid& rUID) {
2451 ilr_bool res;
2452 ILRCheck(ilr_reader_mf_rr(m_h, (ilr_bool)fWakeUp, rUID, &res));
2453 return static_cast<bool>(res);
2454}
2455
2456inline void CReader::MfHalt() {
2457 ILRCheck(ilr_reader_mf_halt(m_h));
2458}
2459
2460inline void CReader::MfRats() {
2461 ILRCheck(ilr_reader_mf_rats(m_h));
2462}
2463
2464inline void CReader::MfWritePerso(uint32_t nAddress, const ilr_mf_plus_key& rKey) {
2465 ILRCheck(ilr_reader_mf_write_perso(m_h, nAddress, rKey));
2466}
2467
2470}
2471
2472inline void CReader::WriteMfCKey(size_t nIdx, bool fKeyB, const ilr_mf_classic_key* pKeys,
2473 size_t nCount, size_t* pWritten) {
2474 ILRCheck(ilr_reader_write_mf_ckey(m_h, nIdx, (ilr_bool)fKeyB, pKeys, nCount, pWritten));
2475}
2476
2477inline CAsyncCommand CReader::Begin_WriteMfCKey(size_t nIdx, bool fKeyB,
2478 const ilr_mf_classic_key* pKeys, size_t nCount) {
2479 CAsyncCommand res;
2480 ILRCheck(ilr_reader_begin_write_mf_ckey(m_h, nIdx, (ilr_bool)fKeyB, pKeys, nCount, &res.m_h));
2481 return res;
2482}
2483
2484inline void CReader::End_WriteMfCKey(ilr_handle hCommand, size_t& nWritten) {
2485 ILRCheck(ilr_reader_end_write_mf_ckey(hCommand, &nWritten));
2486}
2487
2488inline void CReader::WriteMfPKey(size_t nIdx, bool fKeyB, const ilr_mf_plus_key* pKeys,
2489 size_t nCount, size_t* pWritten) {
2490 ILRCheck(ilr_reader_write_mf_pkey(m_h, nIdx, (ilr_bool)fKeyB, pKeys, nCount, pWritten));
2491}
2492
2493inline CAsyncCommand CReader::Begin_WriteMfPKey(size_t nIdx, bool fKeyB,
2494 const ilr_mf_plus_key* pKeys, size_t nCount) {
2495 CAsyncCommand res;
2496 ILRCheck(ilr_reader_begin_write_mf_pkey(m_h, nIdx, (ilr_bool)fKeyB, pKeys, nCount, &res.m_h));
2497 return res;
2498}
2499
2500inline void CReader::End_WriteMfPKey(ilr_handle hCommand, size_t& nWritten) {
2501 ILRCheck(ilr_reader_end_write_mf_pkey(hCommand, &nWritten));
2502}
2503
2504inline void CReader::LoadTemicPassword(const int64_t nPassword) {
2505 ILRCheck(ilr_reader_load_temic_password(m_h, nPassword));
2506}
2507
2508inline void CReader::ScanTemic(int nScanParam) {
2509 ILRCheck(ilr_reader_scan_temic(m_h, nScanParam));
2510}
2511
2513 CAsyncCommand res;
2514 ILRCheck(ilr_reader_begin_scan_temic(m_h, nScanParam, &res.m_h));
2515 return res;
2516}
2517
2518inline void CReader::SetScanTemic(bool fEnable) {
2519 ILRCheck(ilr_reader_set_scan_temic(m_h, (ilr_bool)fEnable));
2520}
2521
2522inline bool CReader::GetScanTemic() const {
2523 ilr_bool res;
2524 ILRCheck(ilr_reader_get_scan_temic(m_h, &res));
2525 return static_cast<bool>(res);
2526}
2527
2528inline void CReader::ReadTemic(size_t nBlockIdx, uint32_t* pBuf, size_t nBlockCount, int nScanParam,
2529 size_t* pRead) {
2530 ILRCheck(ilr_reader_read_temic(m_h, nBlockIdx, pBuf, nBlockCount, nScanParam, pRead));
2531}
2532
2533inline CAsyncCommand CReader::Begin_ReadTemic(size_t nBlockIdx, size_t nBlockCount,
2534 int nScanParam) {
2535 CAsyncCommand res;
2536 ILRCheck(ilr_reader_begin_read_temic(m_h, nBlockIdx, nBlockCount, nScanParam, &res.m_h));
2537 return res;
2538}
2539
2540inline void CReader::End_ReadTemic(ilr_handle hCommand, const uint*& pList, size_t& nRead) {
2541 ILRCheck(ilr_reader_end_read_temic(hCommand, &pList, &nRead));
2542}
2543
2544inline void CReader::WriteTemic(size_t nBlockIdx, const uint32_t* pData, size_t nBlockCount,
2545 bool fLock, int nScanParam, size_t* pWritten) {
2546 ILRCheck(ilr_reader_write_temic(m_h, nBlockIdx, pData, nBlockCount, (ilr_bool)fLock, nScanParam,
2547 pWritten));
2548}
2549
2550inline CAsyncCommand CReader::Begin_WriteTemic(size_t nBlockIdx, const uint32_t* pData,
2551 size_t nBlockCount, bool fLock, int nScanParam) {
2552 CAsyncCommand res;
2553 ILRCheck(ilr_reader_begin_write_temic(m_h, nBlockIdx, pData, nBlockCount, (ilr_bool)fLock,
2554 nScanParam, &res.m_h));
2555 return res;
2556}
2557
2558inline void CReader::End_WriteTemic(ilr_handle hCommand, size_t& nWritten) {
2559 ILRCheck(ilr_reader_end_write_temic(hCommand, &nWritten));
2560}
2561
2562inline void CReader::ResetTemic(bool fWait) {
2563 ILRCheck(ilr_reader_reset_temic(m_h, (ilr_bool)fWait));
2564}
2565
2567 CAsyncCommand res;
2568 ILRCheck(ilr_reader_begin_reset_temic(m_h, &res.m_h));
2569 return res;
2570}
2571
2572inline void CReader::EncodeTemicEmMarine(const ilr_card_uid& rUID, uint32_t* pBuf3,
2573 size_t nBlockCount) {
2574 ILRCheck(ilr_encode_temic_emmarine(rUID, pBuf3, nBlockCount));
2575}
2576
2577inline void CReader::DecodeTemicEmMarine(const uint32_t* pData3, size_t nBlockCount,
2578 ilr_card_uid& rUID, bool* pConfigOk) {
2579 ilr_bool fConfigOk;
2580 ILRCheck(ilr_decode_temic_emmarine(pData3, nBlockCount, &rUID, &fConfigOk));
2581 if (pConfigOk)
2582 *pConfigOk = static_cast<bool>(fConfigOk);
2583}
2584
2585inline void CReader::EncodeTemicHid(const ilr_card_uid& rUID, uint32_t* pBuf4, size_t nBlockCount,
2586 int nWiegand) {
2587 ILRCheck(ilr_encode_temic_hid(rUID, pBuf4, nBlockCount, nWiegand));
2588}
2589
2590inline void CReader::DecodeTemicHid(const uint32_t* pData4, size_t nBlockCount, ilr_card_uid& rUID,
2591 int& nWiegand, bool* pConfigOk) {
2592 ilr_bool fConfigOk;
2593 ILRCheck(ilr_decode_temic_hid(pData4, nBlockCount, &rUID, &nWiegand, &fConfigOk));
2594 if (pConfigOk)
2595 *pConfigOk = static_cast<bool>(fConfigOk);
2596}
2597
2598inline CReader CReader::Clone() const {
2599 ilr_handle hNewHandle;
2600 ILRCheck(ilr_clone_handle(m_h, &hNewHandle));
2601 return CReader(hNewHandle);
2602}
2603
2607class CILR final {
2608public:
2614 CILR(bool fInit = true);
2615
2621 ~CILR();
2622
2624 void Init();
2625
2627 void Finalize();
2628
2632 static inline uint32_t GetVersion();
2633
2639 static inline bool CheckVersion();
2640
2646 static inline void SetLogLevel(ilr_log_level nLevel);
2647
2660 static inline void SetLogCallback(ilr_logging_callback pCallback, void* pUserData = nullptr);
2661
2676 inline void SetFilterPortCallback(ilr_filter_port_callback pCallback,
2677 void* pUserData = nullptr);
2678
2686 inline void SetOptions(const ilr_options& rOptions);
2687
2695 inline void GetOptions(ilr_options& rOptions) const;
2696
2709 inline CReaderSearch GetSearch();
2710
2726 inline CReader GetReader(ilr_port_type nPortType, const char* pszPortName);
2727
2728protected:
2730 bool m_fInit = false;
2731};
2732
2733inline uint32_t CILR::GetVersion() {
2734 return ilr_get_version();
2735}
2736
2737inline bool CILR::CheckVersion() {
2738 return ilr_check_version();
2739}
2740
2742 ILRCheck(ilr_set_log_level(nLevel));
2743}
2744
2745inline void CILR::SetLogCallback(ilr_logging_callback pCallback, void* pUserData) {
2746 ILRCheck(ilr_set_log_callback(pCallback, pUserData));
2747}
2748
2749inline void CILR::SetFilterPortCallback(ilr_filter_port_callback pCallback, void* pUserData) {
2750 ILRCheck(ilr_set_filter_port_callback(pCallback, pUserData));
2751}
2752
2753inline void CILR::SetOptions(const ilr_options& rOptions) {
2754 ILRCheck(ilr_set_options(&rOptions));
2755}
2756
2757inline void CILR::GetOptions(ilr_options& rOptions) const {
2758 ILRCheck(ilr_get_options(&rOptions));
2759}
2760
2762 CReaderSearch res;
2763 ILRCheck(ilr_get_search(&res.m_h));
2764 return res;
2765}
2766
2767inline CReader CILR::GetReader(ilr_port_type nPortType, const char* pszPortName) {
2768 CReader res;
2769 ILRCheck(ilr_get_reader(nPortType, pszPortName, &res.m_h));
2770 return res;
2771}
2772
2779#define GET_BIT(val, bitN) (bool)((val >> (bitN)) & 1)
2787#define SET_BIT(val, bitN, On) \
2788 { (On) ? ((val) |= (1 << (bitN))) : ((val) &= ~(1 << (bitN))); }
2789
2791inline std::chrono::steady_clock::time_point now() {
2792 return std::chrono::steady_clock::now();
2793}
2794
2800template <class result_t = std::chrono::milliseconds, class clock_t = std::chrono::steady_clock,
2801 class duration_t = std::chrono::milliseconds>
2802inline auto since(std::chrono::time_point<clock_t, duration_t> const& start) {
2803 return std::chrono::duration_cast<result_t>(clock_t::now() - start);
2804}
2805
2807extern const char* kPortTypeNames[ILR_PORT_TYPE_SIZE];
2809extern const char* kReaderModelNames[ILR_READER_MODEL_SIZE];
2811extern const char* kCardTypeNames[ILR_CARD_TYPE_SIZE];
2813extern const char* kMpTypeNames[ILR_MF_PLUS_TYPE_SIZE];
2814
2820std::string SdkVersionToStr(uint32_t nVersion);
2821
2827std::string ReaderVersionToStr(uint32_t nVersion);
2828
2834std::string TimeToStr(const int64_t& tTime);
2835
2843bool IsMfClassic(ilr_card_type nType);
2844
2853bool IsMfClassicMode(ilr_card_type nType, ilr_mf_plus_sl nSL);
2854
2862bool IsMfPlus(ilr_card_type nType);
2863
2872bool IsMfPlusSL3Mode(ilr_card_type nType, ilr_mf_plus_sl nSL);
2873
2881inline size_t GetNumberOfMfBlocks(uint32_t nMemSize) {
2882 return nMemSize / 16;
2883}
2884
2892inline size_t GetMfSectorByBlock(size_t nBlockIdx) {
2893 return (nBlockIdx < 128) ? (nBlockIdx / 4) : (32 + ((nBlockIdx - 128) / 16));
2894}
2895
2903inline size_t GetMfBlockBySector(size_t nSectorIdx) {
2904 return (nSectorIdx < 32) ? (nSectorIdx * 4) : (128 + ((nSectorIdx - 32) * 16));
2905}
2906
2914inline size_t GetMfSectorBlockCount(size_t nSectorIdx) {
2915 return (nSectorIdx < 32) ? 4 : 16;
2916}
2917
2926void GetMfBlockInfo(size_t nBlockIdx, size_t& nSectorIdx, size_t& nSBlockIdx, size_t& nSBlockCount);
2927
2936std::string CardUIDToStr(ilr_card_type nType, const CCardUID& rUID);
2937
2943uint32_t GetMfAccessBits(const ilr_mf_block_data& rTrailerData);
2944
2951void SetMfAccessBits(uint32_t nSectorAccess, ilr_mf_block_data& rTrailerData);
2952
2960size_t GetMfAreaByBlockIdx(size_t nBlockIdx);
2961
2969bool TryGetMfAreaAccess(uint32_t nSectorAccess, size_t nArea, uint32_t& nAreaAccess);
2970
2978void SetMfAreaAccess(size_t nArea, uint32_t nAreaAccess, uint32_t& nSectorAccess);
2979
2989inline CMifareClassicKey GetMfClassicKey(const ilr_mf_block_data& rTrailerData, bool fKeyB) {
2990 return CMifareClassicKey(fKeyB ? &rTrailerData.a[10] : rTrailerData.a, 6);
2991}
2992
3000inline void SetMfClassicKey(ilr_mf_block_data& rTrailerData, bool fKeyB,
3001 const ilr_mf_classic_key& nKey) {
3002 memcpy(fKeyB ? &rTrailerData.a[10] : rTrailerData.a, &nKey, 6);
3003}
3004
3013bool TryGetMfValue(const ilr_mf_block_data& rData, int& nValue);
3014
3021void SetMfValue(ilr_mf_block_data& rData, int nValue);
3022
3029bool TryGetMfValueAddress(const ilr_mf_block_data& rData, uint8_t& nAddress);
3030
3037void SetMfValueAddress(ilr_mf_block_data& rData, uint8_t nAddress);
3038
3039}; // namespace ilr
Класс команды SDK.
Definition: ilr_cpp_helpers.h:514
CAsyncCommand & operator=(CAsyncCommand &&other)
Оператор перемещения
Definition: ilr_cpp_helpers.cpp:252
void Cancel()
Отменяет команду. Устанавливает статус ILR_E_ABORT.
Definition: ilr_cpp_helpers.h:564
void GetProgress(size_t &nCurrent, size_t &nTotal) const
Возвращает состояние прогресса выполнения команды.
Definition: ilr_cpp_helpers.h:574
ilr_status GetStatus() const
Возвращает состояние команды.
Definition: ilr_cpp_helpers.h:568
CAsyncCommand()
Конструктор по умолчанию.
Definition: ilr_cpp_helpers.cpp:237
virtual ~CAsyncCommand()
Деструктор
Definition: ilr_cpp_helpers.cpp:249
Класс ID карты.
Definition: ilr_cpp_helpers.h:51
void Clear()
Очищает ID карты.
Definition: ilr_cpp_helpers.h:85
bool TryParse(const char *pStr)
Преобразует строку в номер карты.
Definition: ilr_cpp_helpers.cpp:54
void Assign(const void *pData, size_t nSize)
Устанавливает номера из байтов номера.
Definition: ilr_cpp_helpers.h:110
bool operator==(const ilr_card_uid &other) const
Оператор сравнения на равенство.
Definition: ilr_cpp_helpers.h:156
bool operator>=(const ilr_card_uid &other) const
Оператор сравнения "больше или равно".
Definition: ilr_cpp_helpers.h:189
std::string ToString() const
Преобразует номер карты в строку.
Definition: ilr_cpp_helpers.cpp:43
bool operator<=(const ilr_card_uid &other) const
Оператор сравнения "меньше или равно".
Definition: ilr_cpp_helpers.h:211
const CCardUID & operator=(const uint64_t &other)
Оператор копирования из 8-байтного числа.
Definition: ilr_cpp_helpers.h:132
bool operator!=(const ilr_card_uid &other) const
Оператор сравнения на не равенство.
Definition: ilr_cpp_helpers.h:167
bool IsEmpty() const
Проверяет пустой ли ID карты.
Definition: ilr_cpp_helpers.h:93
const CCardUID & operator=(const uint32_t &other)
Оператор копирования из 4-байтного числа.
Definition: ilr_cpp_helpers.h:122
bool operator>(const ilr_card_uid &other) const
Оператор сравнения "больше".
Definition: ilr_cpp_helpers.h:178
int Compare(const ilr_card_uid &other) const
Сравнивает ID номеров.
Definition: ilr_cpp_helpers.h:142
CCardUID()
Конструктор по умолчанию.
Definition: ilr_cpp_helpers.cpp:19
bool operator<(const ilr_card_uid &other) const
Оператор сравнения "меньше".
Definition: ilr_cpp_helpers.h:200
int GetLength() const
Возвращает размер ID карты в байтах.
Definition: ilr_cpp_helpers.h:100
Класс исключения SDK Readers.
Definition: ilr_cpp_helpers.h:22
CILRException(ilr_status nCode)
Конструктор из кода возврата SDK.
Definition: ilr_cpp_helpers.cpp:11
ilr_status m_nCode
Код возврата SDK.
Definition: ilr_cpp_helpers.h:35
virtual const char * what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW
Возвращает описание ошибки
Definition: ilr_cpp_helpers.cpp:15
Класс дескриптора SDK.
Definition: ilr_cpp_helpers.h:430
void Attach(ilr_handle h)
Присоединяет дескриптор к этому объекту.
Definition: ilr_cpp_helpers.cpp:225
ilr_handle Detach()
Отсоединяет дескриптор от этого объекту.
Definition: ilr_cpp_helpers.cpp:231
CILRHandle & operator=(const CILRHandle &)=delete
Запрещаем копирование этого класса (т.к. он содержит указатель = дескриптор).
void Close()
Закрывает дескриптор SDK.
Definition: ilr_cpp_helpers.cpp:218
virtual ~CILRHandle()
Деструктор
Definition: ilr_cpp_helpers.cpp:189
ilr_handle Get() const
Возвращает дескриптор SDK.
Definition: ilr_cpp_helpers.cpp:214
ilr_handle m_h
Дескриптор SDK.
Definition: ilr_cpp_helpers.h:506
CILRHandle(const CILRHandle &)=delete
Запрещаем копирование этого класса (т.к. он содержит указатель = дескриптор).
CILRHandle()
Конструктор по умолчанию.
Definition: ilr_cpp_helpers.cpp:176
void Swap(CILRHandle &other) noexcept
Обменивается значением с другим дескриптором.
Definition: ilr_cpp_helpers.cpp:210
Класс для инициализации/финализации библиотеки SDK.
Definition: ilr_cpp_helpers.h:2607
CReaderSearch GetSearch()
Создаёт дескриптор поиска считывателей.
Definition: ilr_cpp_helpers.h:2761
void SetFilterPortCallback(ilr_filter_port_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для фильтрации портов при поиске считывателей.
Definition: ilr_cpp_helpers.h:2749
void GetOptions(ilr_options &rOptions) const
Возвращает глобальные настройки библиотеки.
Definition: ilr_cpp_helpers.h:2757
bool m_fInit
Definition: ilr_cpp_helpers.h:2730
static bool CheckVersion()
Проверяет версию SDK.
Definition: ilr_cpp_helpers.h:2737
CReader GetReader(ilr_port_type nPortType, const char *pszPortName)
Создаёт дескриптор считывателя.
Definition: ilr_cpp_helpers.h:2767
static void SetLogLevel(ilr_log_level nLevel)
Устанавливает уровень лога отладки.
Definition: ilr_cpp_helpers.h:2741
static void SetLogCallback(ilr_logging_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для лога отладки.
Definition: ilr_cpp_helpers.h:2745
void SetOptions(const ilr_options &rOptions)
Устанавливает глобальные настройки библиотеки.
Definition: ilr_cpp_helpers.h:2753
void Init()
Definition: ilr_cpp_helpers.cpp:414
void Finalize()
Definition: ilr_cpp_helpers.cpp:421
~CILR()
Деструктор
Definition: ilr_cpp_helpers.cpp:409
static uint32_t GetVersion()
Возвращает номер версии библиотеки.
Definition: ilr_cpp_helpers.h:2733
CILR(bool fInit=true)
Конструктор по умолчанию
Definition: ilr_cpp_helpers.cpp:402
Класс ключа аутентификации Mifare Classic.
Definition: ilr_cpp_helpers.h:231
CMifareClassicKey()
Конструктор по умолчанию.
Definition: ilr_cpp_helpers.cpp:89
ilr_mf_classic_key m_nKey
Ключ аутентификации Mifare Classic.
Definition: ilr_cpp_helpers.h:286
std::string ToString() const
Преобразует номер ключа в строку.
Definition: ilr_cpp_helpers.cpp:105
static const ilr_mf_classic_key kDefault
Definition: ilr_cpp_helpers.h:283
const CMifareClassicKey & operator=(const ilr_mf_classic_key &other)
Оператор копирования ilr_mf_classic_key.
Definition: ilr_cpp_helpers.h:266
bool TryParse(const char *pStr)
Преобразует строку в номер ключа.
Definition: ilr_cpp_helpers.cpp:113
void Reset()
Устанавливает значение ключа по умолчанию.
Definition: ilr_cpp_helpers.h:252
Ключ аутентификации Mifare Plus.
Definition: ilr_cpp_helpers.h:294
std::string ToString(const char *pPartDelimiter=nullptr) const
Преобразует номер ключа в строку.
Definition: ilr_cpp_helpers.cpp:144
bool operator<(const CMifarePlusKey &other) const
Оператор сравнение ключей "меньше".
Definition: ilr_cpp_helpers.h:378
void Reset()
Устанавливает значение ключа по умолчанию
Definition: ilr_cpp_helpers.h:322
const CMifarePlusKey & operator=(const ilr_mf_plus_key &other)
Оператор присвоения ключа Mifare Plus.
Definition: ilr_cpp_helpers.h:336
const CMifarePlusKey & operator=(const ilr_mf_classic_key &other)
Оператор присвоения ключа Mifare Classic.
Definition: ilr_cpp_helpers.h:346
bool operator==(const CMifarePlusKey &other) const
Оператор сравнение ключей на равенство.
Definition: ilr_cpp_helpers.h:358
bool TryParse(const char *pStr)
Преобразует строку в номер ключа.
Definition: ilr_cpp_helpers.cpp:154
CMifarePlusKey()
Конструктор по умолчанию
Definition: ilr_cpp_helpers.cpp:123
bool operator!=(const CMifarePlusKey &other) const
Оператор сравнение ключей на неравенство.
Definition: ilr_cpp_helpers.h:368
bool operator>(const CMifarePlusKey &other) const
Оператор сравнение ключей "больше".
Definition: ilr_cpp_helpers.h:388
bool operator>=(const CMifarePlusKey &other) const
Оператор сравнение ключей "больше или равно".
Definition: ilr_cpp_helpers.h:408
bool operator<=(const CMifarePlusKey &other) const
Оператор сравнение ключей "меньше или равно".
Definition: ilr_cpp_helpers.h:398
Класс поиска считывателей.
Definition: ilr_cpp_helpers.h:583
void GetOptions(ilr_search_options &rOptions) const
Возвращает параметры поиска считывателей.
Definition: ilr_cpp_helpers.h:906
CAsyncCommand Begin_ClosePort(ilr_port_type nPortType, const char *pszPortName, int hPortFD)
Запускает асинхронную команду закрытия порта.
Definition: ilr_cpp_helpers.h:978
virtual ~CReaderSearch()
Деструктор
Definition: ilr_cpp_helpers.cpp:269
void GetListenPorts(std::vector< uint16_t > &oPorts) const
Возвращает список портов для прослушки конвертеров к режиме "Клиент".
Definition: ilr_cpp_helpers.cpp:277
CReaderSearch & operator=(CReaderSearch &&other)
Оператор перемещения
Definition: ilr_cpp_helpers.cpp:272
void SetOptions(const ilr_search_options &rOptions)
Устанавливает параметры поиска считывателей.
Definition: ilr_cpp_helpers.h:902
CAsyncCommand Begin_Scan(bool fReset=false)
Запускает асинхронную команду поиска считывателей.
Definition: ilr_cpp_helpers.h:955
CAsyncCommand Begin_OpenPort(ilr_port_type nPortType, const char *pszPortName)
Запускает асинхронную команду открытия порта.
Definition: ilr_cpp_helpers.h:967
bool GetMessage(ilr_search_msg &nMsg, const void *&pMsgData) const
Извлекает следующее сообщение из очереди.
Definition: ilr_cpp_helpers.h:896
void SetListenPorts(const uint16_t *pPorts, size_t nCount)
Устанавливает список портов для прослушки конвертеров к режиме "Клиент".
Definition: ilr_cpp_helpers.h:910
static void End_OpenPort(ilr_handle hCommand, int &PortFD, ilr_reader_info &rInfo)
Возвращает результат открытия порта.
Definition: ilr_cpp_helpers.h:974
ilr_status GetListenStatus(uint16_t nTcpPort) const
Возвращает состояние Tcp-порта, открытого для прослушки конвертеров в режиме "Клиент".
Definition: ilr_cpp_helpers.h:914
void Scan(bool fReset=false)
Ищет считыватели.
Definition: ilr_cpp_helpers.h:920
void GetReaderInfo(size_t nIdx, ilr_reader_info &rInfo) const
Возвращает информацию о найденном считывателе.
Definition: ilr_cpp_helpers.h:930
CAsyncCommand Begin_SetAutoScan(bool fEnable)
Запускает асинхронную команду вкл/выкл режим авто поиска считывателей.
Definition: ilr_cpp_helpers.h:961
void ClosePort(ilr_port_type nPortType, const char *pszPortName, int hPort)
Закрывает порт
Definition: ilr_cpp_helpers.h:951
bool GetAutoScan() const
Возвращает флаг авто поиска считывателей.
Definition: ilr_cpp_helpers.h:938
void SetAutoScan(bool fEnable=true, bool fWait=true)
Включает/выключает авто поиск считывателей.
Definition: ilr_cpp_helpers.h:934
int OpenPort(ilr_port_type nPortType, const char *pszPortName, ilr_reader_info *pInfo=nullptr)
Открывает порт и возвращает его дескриптор.
Definition: ilr_cpp_helpers.h:944
void SetMessageCallback(ilr_search_message_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для уведомлений поиска считывателей.
Definition: ilr_cpp_helpers.h:887
size_t GetReaderCount() const
Возвращает количество найденных считывателей.
Definition: ilr_cpp_helpers.h:924
CReaderSearch()
Конструктор по умолчанию.
Definition: ilr_cpp_helpers.cpp:257
void EnableMessageQueue(bool fEnable=true)
Включает/выключает очередь сообщений.
Definition: ilr_cpp_helpers.h:892
CReaderSearch Clone() const
Клонирует дескриптор поиска считывателей.
Definition: ilr_cpp_helpers.h:985
Класс считывателя.
Definition: ilr_cpp_helpers.h:996
void ReadMfUltralight(size_t nPageIdx, uint32_t *pBuf, size_t nPageCount, size_t *pRead=nullptr)
Читает данные карты Mifare Ultralight.
Definition: ilr_cpp_helpers.h:2258
CAsyncCommand Begin_WriteMfCKey(size_t nIdx, bool fKeyB, const ilr_mf_classic_key *pKeys, size_t nCount)
Запускает асинхронную команду записи ключей аутентификации Mifare Classic в память считывателя.
Definition: ilr_cpp_helpers.h:2477
void MfWritePerso(uint32_t nAddress, const ilr_mf_plus_key &rKey)
Записывает ключи AES и всех блоков.
Definition: ilr_cpp_helpers.h:2464
void ReadMfClassic(size_t nBlockIdx, ilr_mf_block_data *pBuf, size_t nBlockCount, size_t *pRead=nullptr)
Читает данные карты Mifare Classic или Mifare Plus SL1.
Definition: ilr_cpp_helpers.h:2332
void WriteTemic(size_t nBlockIdx, const uint32_t *pData, size_t nBlockCount, bool fLock=false, int nScanParam=-1, size_t *pWritten=nullptr)
Пишет данные карты Temic.
Definition: ilr_cpp_helpers.h:2544
CAsyncCommand Begin_WriteTemic(size_t nBlockIdx, const uint32_t *pData, size_t nBlockCount, bool fLock=false, int nScanParam=-1)
Запускает асинхронную команду записи данных в карту Temic.
Definition: ilr_cpp_helpers.h:2550
void SetAutoScan(bool fEnable=true, bool fWait=true)
Включает/выключает автоматическое сканирование карт.
Definition: ilr_cpp_helpers.h:2242
bool GetAutoScan() const
Возвращает флаг автоматическое сканирование карт.
Definition: ilr_cpp_helpers.h:2252
CAsyncCommand Begin_SetAutoScan(bool fEnable=true)
Запускает асинхронную команду вкл/выкл автоматического сканирования карт.
Definition: ilr_cpp_helpers.h:2246
ilr_connection_status GetConnectionStatus() const
Возвращает состояние подключения к считывателю
Definition: ilr_cpp_helpers.h:2217
static void End_ReadMfUltralight(ilr_handle hCommand, const uint32_t *&pList, size_t &nRead)
Возвращает результат чтения данных из карты Mifare Ultralight.
Definition: ilr_cpp_helpers.h:2269
CAsyncCommand Begin_ReadTemic(size_t nBlockIdx, size_t nBlockCount, int nScanParam=-1)
Запускает асинхронную команду чтения данных из карты Temic.
Definition: ilr_cpp_helpers.h:2533
void SetScanTemic(bool fEnable=true)
Вкл/выкл сканирование карт Temic (для Z-2 Rd-All и Z-2 EHR).
Definition: ilr_cpp_helpers.h:2518
bool GetScanTemic() const
Возвращает True если сканирование Temic включено.
Definition: ilr_cpp_helpers.h:2522
bool GetMessage(ilr_reader_msg &nMsg, const void *&pMsgData) const
Извлекает следующее сообщение из очереди.
Definition: ilr_cpp_helpers.h:2183
CAsyncCommand Begin_WriteMfPlus(size_t nAddress, const ilr_mf_block_data *pData, size_t nBlockCount, bool fOpenText)
Запускает асинхронную команду записи данных в карту Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2388
static void End_WriteMfPlus(ilr_handle hCommand, size_t &nWritten)
Возвращает результат записи данных в карту Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2396
CAsyncCommand Begin_AuthMfCard(size_t nAddress, bool fKeyB)
Запускает асинхронную команду авторизации сектора карты Mifare Classic / Plus используя ключ,...
Definition: ilr_cpp_helpers.h:2304
void SetMessageCallback(ilr_reader_message_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для уведомлений считывателя.
Definition: ilr_cpp_helpers.h:2175
void Disconnect()
Отключается от считывателя.
Definition: ilr_cpp_helpers.h:2207
void MfRestore(size_t nBlockIdx)
Перемещает содержимое блока в регистр данных Mifare.
Definition: ilr_cpp_helpers.h:2430
void Connect(bool fReconnect=false)
Подключается к считывателю.
Definition: ilr_cpp_helpers.h:2197
static void End_WriteMfUltralight(ilr_handle hCommand, size_t &nWritten)
Возвращает результат записи данных в карту Mifare Ultralight.
Definition: ilr_cpp_helpers.h:2286
int AuthMfCard2(size_t nAddress, bool fKeyB, uint32_t nKeys=0xFFFF)
Авторизует сектор карты Mifare Classic / Plus, используя ключи считывателя.
Definition: ilr_cpp_helpers.h:2316
CAsyncCommand Begin_ReadMfUltralight(size_t nPageIdx, size_t nPageCount)
Запускает асинхронную команду чтения данных из карты Mifare Ultralight.
Definition: ilr_cpp_helpers.h:2263
bool AuthMfCard(size_t nAddress, bool fKeyB)
Авторизует сектор карты Mifare Classic/Plus.
Definition: ilr_cpp_helpers.h:2298
CAsyncCommand Begin_MfRestore(size_t nBlockIdx)
Перемещает содержимое блока в регистр данных Mifare.
Definition: ilr_cpp_helpers.h:2434
void SetOptions(const ilr_reader_options &rOptions)
Устанавливает параметры считывателя.
Definition: ilr_cpp_helpers.h:2189
CAsyncCommand Begin_ReadMfPlus(size_t nAddress, size_t nBlockCount, bool fOpenText)
Запускает асинхронную команду чтения данных из карты Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2369
CAsyncCommand Begin_WriteMfPKey(size_t nIdx, bool fKeyB, const ilr_mf_plus_key *pKeys, size_t nCount)
Запускает асинхронную команду записи ключей аутентификации Mifare Plus в память считывателя.
Definition: ilr_cpp_helpers.h:2493
void MfDecrement(size_t nBlockIdx, uint32_t nValue)
Уменьшает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных.
Definition: ilr_cpp_helpers.h:2410
static void DecodeTemicEmMarine(const uint32_t *pData3, size_t nBlockCount, ilr_card_uid &rUID, bool *pConfigOk=nullptr)
Декодирует номер Em-Marine из данных блоков 0..2 карты Temic.
Definition: ilr_cpp_helpers.h:2577
CAsyncCommand Begin_MfIncrement(size_t nBlockIdx, uint32_t nValue)
Увеличивает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных...
Definition: ilr_cpp_helpers.h:2404
CAsyncCommand Begin_AuthMfCard2(size_t nAddress, bool fKeyB, uint32_t nKeys=0xFFFF)
Запускает асинхронную команду авторизации сектора карты Mifare Classic / Plus. используя ключи в памя...
Definition: ilr_cpp_helpers.h:2322
CAsyncCommand Begin_WriteMfUltralight(size_t nPageIdx, const uint32_t *pData, size_t nPageCount)
Запускает асинхронную команду записи данных в карту Mifare Ultralight.
Definition: ilr_cpp_helpers.h:2279
static void EncodeTemicHid(const ilr_card_uid &rUID, uint32_t *pBuf4, size_t nBlockCount, int nWiegand)
Кодирует данные для эмуляции HID, для записи в блоки 0..3.
Definition: ilr_cpp_helpers.h:2585
void WriteMfUltralight(size_t nPageIdx, const uint32_t *pData, size_t nPageCount, size_t *pWritten=nullptr)
Пишет данные карты Mifare Ultralight.
Definition: ilr_cpp_helpers.h:2274
void WriteMfPKey(size_t nIdx, bool fKeyB, const ilr_mf_plus_key *pKeys, size_t nCount, size_t *pWritten=nullptr)
Записывает ключи аутентификации Mifare Plus в память считывателя
Definition: ilr_cpp_helpers.h:2488
void Scan(bool fReset=false, bool fPowerOff=true)
Ищет карты.
Definition: ilr_cpp_helpers.h:2227
CAsyncCommand Begin_ResetTemic()
Запускает асинхронную команду сброса TRES.
Definition: ilr_cpp_helpers.h:2566
void MfHalt()
Halt.
Definition: ilr_cpp_helpers.h:2456
static void End_WriteMfClassic(ilr_handle hCommand, size_t &nWritten)
Возвращает результат записи данных в карту Mifare Classic или Mifare Plus SL1.
Definition: ilr_cpp_helpers.h:2360
virtual ~CReader()
Деструктор
Definition: ilr_cpp_helpers.cpp:289
void WriteMfClassic(size_t nBlockIdx, const ilr_mf_block_data *pData, size_t nBlockCount, size_t *pWritten=nullptr)
Пишет данные карты Mifare Classic или Mifare Plus SL1.
Definition: ilr_cpp_helpers.h:2348
CAsyncCommand Begin_WriteMfClassic(size_t nBlockIdx, const ilr_mf_block_data *pData, size_t nBlockCount)
Запускает асинхронную команду записи данных в карту Mifare Classic или Mifare Plus SL1.
Definition: ilr_cpp_helpers.h:2353
CAsyncCommand Begin_ReadMfClassic(size_t nBlockIdx, size_t nBlockCount)
Запускает асинхронную команду чтения данных из карты Mifare Classic или Mifare Plus SL1.
Definition: ilr_cpp_helpers.h:2337
static void End_WriteMfCKey(ilr_handle hCommand, size_t &nWritten)
Возвращает результат записи ключей аутентификации Mifare Classic в память считывателя.
Definition: ilr_cpp_helpers.h:2484
void LoadTemicPassword(const int64_t nPassword)
Загружает пароль Temic в память объекта считывателя.
Definition: ilr_cpp_helpers.h:2504
CAsyncCommand Begin_MfDecrement(size_t nBlockIdx, uint32_t nValue)
Уменьшает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных.
Definition: ilr_cpp_helpers.h:2414
static void End_ReadMfClassic(ilr_handle hCommand, const ilr_mf_block_data *&pList, size_t &nRead)
Возвращает результат чтения данных из карты Mifare Classic или Mifare Plus SL1.
Definition: ilr_cpp_helpers.h:2343
void MfRats()
Переходит на ISO 14443-4.
Definition: ilr_cpp_helpers.h:2460
static uint32_t GetSupportedRewrittenCardTypes(ilr_reader_model nReaderModel, uint32_t nFwVersion)
Возвращает типы карт, данные которых умеет читать/писать считыватель
Definition: ilr_cpp_helpers.cpp:362
static void EncodeTemicEmMarine(const ilr_card_uid &rUID, uint32_t *pBuf3, size_t nBlockCount)
Кодирует данные для эмуляции Em-Marine, для записи в блоки 0..2.
Definition: ilr_cpp_helpers.h:2572
CAsyncCommand Begin_Scan(bool fReset=false, bool fPowerOff=true)
Запускает асинхронную команду поиска карты.
Definition: ilr_cpp_helpers.h:2231
void WriteMfCKey(size_t nIdx, bool fKeyB, const ilr_mf_classic_key *pKeys, size_t nCount, size_t *pWritten=nullptr)
Записывает ключи аутентификации Mifare Classic в память считывателя.
Definition: ilr_cpp_helpers.h:2472
CAsyncCommand Begin_MfTransfer(size_t nBlockIdx)
Записывает содержимое во временном регистре данных в блок-значение.
Definition: ilr_cpp_helpers.h:2424
CAsyncCommand Begin_ScanTemic(int nScanParam=-1)
Запускает асинхронную команду поиска карты Temic в поле считывателя.
Definition: ilr_cpp_helpers.h:2512
static void End_WriteMfPKey(ilr_handle hCommand, size_t &nWritten)
Возвращает результат записи ключей аутентификации Mifare Plus в память считывателя.
Definition: ilr_cpp_helpers.h:2500
CReader()
Конструктор по умолчанию.
Definition: ilr_cpp_helpers.cpp:286
void LoadMfCKey(const ilr_mf_classic_key &nKey)
Загружает ключ для авторизации сектора Mifare Classic / Plus SL1.
Definition: ilr_cpp_helpers.h:2290
static void DecodeTemicHid(const uint32_t *pData4, size_t nBlockCount, ilr_card_uid &rUID, int &nWiegand, bool *pConfigOk=nullptr)
Декодирует номер HID из данных блоков 0..3 карты Temic.
Definition: ilr_cpp_helpers.h:2590
void WriteMfPlus(size_t nAddress, const ilr_mf_block_data *pData, size_t nBlockCount, bool fOpenText=true, size_t *pWritten=nullptr)
Пишет данные карты Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2382
void ReadTemic(size_t nBlockIdx, uint32_t *pBuf, size_t nBlockCount, int nScanParam=-1, size_t *pRead=nullptr)
Читает данные карты Temic.
Definition: ilr_cpp_helpers.h:2528
void ReadMfPlus(size_t nAddress, ilr_mf_block_data *pBuf, size_t nBlockCount, bool fOpenText=true, size_t *pRead=nullptr)
Читает данные карты Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2364
CReader & operator=(CReader &&other)
Оператор перемещения
Definition: ilr_cpp_helpers.cpp:292
CAsyncCommand Begin_Connect(bool fReconnect=false)
Запускает асинхронную команду подключения к считывателю.
Definition: ilr_cpp_helpers.h:2201
void GetReaderInfo(ilr_reader_info &rInfo) const
Возвращает информацию о считывателе.
Definition: ilr_cpp_helpers.h:2223
void GetOptions(ilr_reader_options &rOptions) const
Возвращает параметры считывателя.
Definition: ilr_cpp_helpers.h:2193
static void End_ReadMfPlus(ilr_handle hCommand, const ilr_mf_block_data *&pList, size_t &nRead)
Возвращает результат чтения данных из карты Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2377
void LoadMfPKey(const ilr_mf_plus_key &rKey)
Загружает ключ для авторизации сектора Mifare Plus SL3.
Definition: ilr_cpp_helpers.h:2294
void ScanTemic(int nScanParam=-1)
Ищет карту Temic в поле считывателя.
Definition: ilr_cpp_helpers.h:2508
void MfCommitPerso()
Переключает Mifare Plus в SL1 или SL3(если SL1 нет).
Definition: ilr_cpp_helpers.h:2468
CReader Clone() const
Клонирует дескриптор считывателя.
Definition: ilr_cpp_helpers.h:2598
void ResetTemic(bool fWait=true)
Сброс TRES.
Definition: ilr_cpp_helpers.h:2562
bool MfRas(bool fWakeUp, uint8_t &nSAK, uint16_t &nATQ, ilr_card_uid &rUID)
R+A+S(Request+Anticollision+Select)
Definition: ilr_cpp_helpers.h:2444
void MfIncrement(size_t nBlockIdx, uint32_t nValue)
Увеличивает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных...
Definition: ilr_cpp_helpers.h:2400
bool MfRR(bool fWakeUp, const ilr_card_uid &rUID)
R+R(Request+Reselect(по известному номеру)).
Definition: ilr_cpp_helpers.h:2450
static void End_AuthMfCard2(ilr_handle hCommand, int &nFoundIdx)
Возвращает результат авторизации сектора карты.
Definition: ilr_cpp_helpers.h:2328
void MfTransfer(size_t nBlockIdx)
Записывает содержимое во временном регистре данных в блок-значение.
Definition: ilr_cpp_helpers.h:2420
static uint32_t GetSupportedCardTypes(ilr_reader_model nReaderModel)
Возвращает биты типов карт, UID которых умеет читать считыватель.
Definition: ilr_cpp_helpers.cpp:314
static void End_ReadTemic(ilr_handle hCommand, const uint *&pList, size_t &nRead)
Возвращает результат чтения данных из карты Temic.
Definition: ilr_cpp_helpers.h:2540
void EnableMessageQueue(bool fEnable=true)
Включает/выключает очередь сообщений.
Definition: ilr_cpp_helpers.h:2179
void MfPowerOff()
Выключает RF поле считывателя (после выключения нужно подождать 10 мс).
Definition: ilr_cpp_helpers.h:2440
CAsyncCommand Begin_Disconnect()
Запускает асинхронную команду отключения от считывателя.
Definition: ilr_cpp_helpers.h:2211
static void End_WriteTemic(ilr_handle hCommand, size_t &nWritten)
Возвращает результат записи данных в карту Temic.
Definition: ilr_cpp_helpers.h:2558
bool GetCardInfo(ilr_card_info &rInfo) const
Возвращает информацию о карте в поле считывателя.
Definition: ilr_cpp_helpers.h:2237
static void End_AuthMfCard(ilr_handle hCommand, bool &fAuthOk)
Возвращает результат авторизации сектора карты.
Definition: ilr_cpp_helpers.h:2310
ILR_API ilr_status ILR_CALL ilr_set_options(const ilr_options *pOptions)
Устанавливает глобальные настройки библиотеки.
bool ilr_check_version()
Проверяет версию SDK.
Definition: ilreaders.h:753
ILR_API ilr_status ILR_CALL ilr_set_log_level(ilr_log_level nLevel)
Устанавливает уровень лога отладки.
ILR_API uint32_t ILR_CALL ilr_get_version()
Возвращает номер версии библиотеки.
ILR_API ilr_status ILR_CALL ilr_get_options(ilr_options *pOptions)
Возвращает глобальные настройки библиотеки.
void(ILR_CALL * ilr_logging_callback)(ilr_log_level nLevel, const char *pContext, const char *pMessage, void *pUserData)
Тип функции обратного вызова для получения сообщений лога отладки библиотеки.
Definition: ilreaders.h:370
ilr_status
Коды ошибок.
Definition: ilreaders.h:121
ILR_API ilr_status ILR_CALL ilr_set_log_callback(ilr_logging_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для лога отладки.
ILR_API ilr_status ILR_CALL ilr_reader_auth_mf_card(ilr_handle hReader, size_t nAddress, ilr_bool fKeyB, ilr_bool *pAuthOk)
Авторизует сектор карты Mifare Classic/Plus.
ILR_API ilr_status ILR_CALL ilr_reader_set_auto_scan(ilr_handle hReader, ilr_bool fEnable=ILR_TRUE, ilr_bool fWait=ILR_TRUE)
Включает/выключает автоматическое сканирование карт.
ILR_API ilr_status ILR_CALL ilr_reader_read_mf_plus(ilr_handle hReader, size_t nAddress, ilr_mf_block_data *pBuf, size_t nBlockCount, ilr_bool fOpenText=ILR_TRUE, size_t *pRead=nullptr)
Читает данные карты Mifare Plus SL3.
ILR_API ilr_status ILR_CALL ilr_reader_get_auto_scan(ilr_handle hReader, ilr_bool *pEnabled)
Возвращает флаг автоматическое сканирование карт.
ILR_API ilr_status ILR_CALL ilr_reader_begin_write_temic(ilr_handle hReader, size_t nBlockIdx, const uint32_t *pData, size_t nBlockCount, ilr_bool fLock, int nScanParam, ilr_handle *pCommand)
Запускает асинхронную команду записи данных в карту Temic.
ILR_API ilr_status ILR_CALL ilr_reader_get_options(ilr_handle hReader, ilr_reader_options *pOptions)
Возвращает параметры считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_mf_power_off(ilr_handle hReader)
Выключает RF поле считывателя (после выключения нужно подождать 10 мс).
ILR_API ilr_status ILR_CALL ilr_reader_read_mf_classic(ilr_handle hReader, size_t nBlockIdx, ilr_mf_block_data *pBuf, size_t nBlockCount, size_t *pRead=nullptr)
Читает данные карты Mifare Classic или Mifare Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_mf_transfer(ilr_handle hReader, size_t nBlockIdx)
Записывает содержимое во временном регистре данных в блок-значение.
ILR_API ilr_status ILR_CALL ilr_reader_get_info(ilr_handle hReader, ilr_reader_info *pInfo)
Возвращает информацию о считывателе.
ILR_API ilr_status ILR_CALL ilr_reader_set_options(ilr_handle hReader, const ilr_reader_options *pOptions)
Устанавливает параметры считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_write_mf_ultralight(ilr_handle hReader, size_t nPageIdx, const uint32_t *pData, size_t nPageCount, size_t *pWritten=nullptr)
Пишет данные карты Mifare Ultralight.
ILR_API ilr_status ILR_CALL ilr_reader_begin_auth_mf_card2(ilr_handle hReader, size_t nAddress, ilr_bool fKeyB, uint32_t nKeys, ilr_handle *pCommand)
Запускает асинхронную команду авторизации сектора карты Mifare Classic / Plus. используя ключи в памя...
ILR_API ilr_status ILR_CALL ilr_reader_begin_auth_mf_card(ilr_handle hReader, size_t nAddress, ilr_bool fKeyB, ilr_handle *pCommand)
Запускает асинхронную команду авторизации сектора карты Mifare Classic / Plus используя ключ,...
ILR_API ilr_status ILR_CALL ilr_reader_begin_connect(ilr_handle hReader, ilr_bool fReconnect, ilr_handle *pCommand)
Запускает асинхронную команду подключения к считывателю.
ILR_API ilr_status ILR_CALL ilr_reader_end_auth_mf_card2(ilr_handle hCommand, int *pFoundIdx)
Возвращает результат авторизации сектора карты.
ILR_API ilr_status ILR_CALL ilr_reader_get_card_info(ilr_handle hReader, ilr_card_info *pInfo)
Возвращает информацию о карте в поле считывателя.
ILR_API ilr_status ILR_CALL ilr_get_reader(ilr_port_type nPortType, const char *pszPortName, ilr_handle *pReader)
Создаёт дескриптор считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_begin_mf_increment(ilr_handle hReader, size_t nBlockIdx, uint32_t nValue, ilr_handle *pCommand)
Увеличивает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных...
ILR_API ilr_status ILR_CALL ilr_reader_begin_mf_restore(ilr_handle hReader, size_t nBlockIdx, ilr_handle *pCommand)
Перемещает содержимое блока в регистр данных Mifare.
ILR_API ilr_status ILR_CALL ilr_reader_end_read_temic(ilr_handle hCommand, const uint **ppList, size_t *pRead)
Возвращает результат чтения данных из карты Temic.
ILR_API ilr_status ILR_CALL ilr_reader_end_write_mf_ultralight(ilr_handle hCommand, size_t *pWritten)
Возвращает результат записи данных в карту Mifare Ultralight.
ILR_API ilr_status ILR_CALL ilr_reader_begin_scan(ilr_handle hReader, ilr_bool fReset, ilr_bool fPowerOff, ilr_handle *pCommand)
Запускает асинхронную команду поиска карты.
ILR_API ilr_status ILR_CALL ilr_reader_end_auth_mf_card(ilr_handle hCommand, ilr_bool *pAuthOk)
Возвращает результат авторизации сектора карты.
ILR_API ilr_status ILR_CALL ilr_reader_get_connection_status(ilr_handle hReader, ilr_connection_status *pStatus)
Возвращает состояние подключения к считывателю.
ILR_API ilr_status ILR_CALL ilr_reader_begin_mf_decrement(ilr_handle hReader, size_t nBlockIdx, uint32_t nValue, ilr_handle *pCommand)
Уменьшает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных.
ilr_reader_msg
Сообщение считывателя.
Definition: ilreaders.h:502
ILR_API ilr_status ILR_CALL ilr_reader_begin_reset_temic(ilr_handle hReader, ilr_handle *pCommand)
Запускает асинхронную команду сброса TRES.
ILR_API ilr_status ILR_CALL ilr_reader_mf_rr(ilr_handle hReader, ilr_bool fWakeUp, const ilr_card_uid &rUID, ilr_bool *pFound)
R+R(Request+Reselect(по известному номеру)).
ILR_API ilr_status ILR_CALL ilr_reader_mf_write_perso(ilr_handle hReader, uint32_t nAddress, const ilr_mf_plus_key &rKey)
Записывает ключи AES и всех блоков.
ILR_API ilr_status ILR_CALL ilr_reader_mf_commit_perso(ilr_handle hReader)
Переключает Mifare Plus в SL1 или SL3(если SL1 нет).
ILR_API ilr_status ILR_CALL ilr_reader_begin_write_mf_pkey(ilr_handle hReader, size_t nIdx, ilr_bool fKeyB, const ilr_mf_plus_key *pKeys, size_t nCount, ilr_handle *pCommand)
Запускает асинхронную команду записи ключей аутентификации Mifare Plus в память считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_begin_read_mf_plus(ilr_handle hReader, size_t nAddress, size_t nBlockCount, ilr_bool fOpenText, ilr_handle *pCommand)
Запускает асинхронную команду чтения данных из карты Mifare Plus SL3.
ilr_mf_plus_sl
Уровень безопасности Mifare Plus.
Definition: ilreaders.h:570
ILR_API ilr_status ILR_CALL ilr_reader_auth_mf_card2(ilr_handle hReader, size_t nAddress, ilr_bool fKeyB, uint32_t nKeys=0xFFFF, int *pFoundIdx=nullptr)
Авторизует сектор карты Mifare Classic / Plus, используя ключи считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_mf_increment(ilr_handle hReader, size_t nBlockIdx, uint32_t nValue)
Увеличивает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных...
ILR_API ilr_status ILR_CALL ilr_reader_write_mf_pkey(ilr_handle hReader, size_t nIdx, ilr_bool fKeyB, const ilr_mf_plus_key *pKeys, size_t nCount, size_t *pWritten=nullptr)
Записывает ключи аутентификации Mifare Plus в память считывателя
ILR_API ilr_status ILR_CALL ilr_reader_begin_write_mf_ckey(ilr_handle hReader, size_t nIdx, ilr_bool fKeyB, const ilr_mf_classic_key *pKeys, size_t nCount, ilr_handle *pCommand)
Запускает асинхронную команду записи ключей аутентификации Mifare Classic в память считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_scan_temic(ilr_handle hReader, int nScanParam=-1)
Ищет карту Temic в поле считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_begin_write_mf_ultralight(ilr_handle hReader, size_t nPageIdx, const uint32_t *pData, size_t nPageCount, ilr_handle *pCommand)
Запускает асинхронную команду записи данных в карту Mifare Ultralight.
ILR_API ilr_status ILR_CALL ilr_reader_load_mf_ckey(ilr_handle hReader, const ilr_mf_classic_key &nKey)
Загружает ключ для авторизации сектора Mifare Classic / Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_read_temic(ilr_handle hReader, size_t nBlockIdx, uint32_t *pBuf, size_t nBlockCount, int nScanParam=-1, size_t *pRead=nullptr)
Читает данные карты Temic.
ILR_API ilr_status ILR_CALL ilr_reader_write_mf_ckey(ilr_handle hReader, size_t nIdx, ilr_bool fKeyB, const ilr_mf_classic_key *pKeys, size_t nCount, size_t *pWritten=nullptr)
Записывает ключи аутентификации Mifare Classic в память считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_end_read_mf_plus(ilr_handle hCommand, const ilr_mf_block_data **ppList, size_t *pRead)
Возвращает результат чтения данных из карты Mifare Plus SL3.
ILR_API ilr_status ILR_CALL ilr_reader_begin_set_auto_scan(ilr_handle hReader, ilr_bool fEnable, ilr_handle *pCommand)
Запускает асинхронную команду вкл/выкл автоматического сканирования карт.
ILR_API ilr_status ILR_CALL ilr_reader_mf_decrement(ilr_handle hReader, size_t nBlockIdx, uint32_t nValue)
Уменьшает содержимое блока-значения карты Mifare и сохраняет результат во временном регистре данных.
ILR_API ilr_status ILR_CALL ilr_reader_end_write_mf_pkey(ilr_handle hCommand, size_t *pWritten)
Возвращает результат записи ключей аутентификации Mifare Plus в память считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_end_write_mf_plus(ilr_handle hCommand, size_t *pWritten)
Возвращает результат записи данных в карту Mifare Plus SL3.
ILR_API ilr_status ILR_CALL ilr_reader_end_write_mf_classic(ilr_handle hCommand, size_t *pWritten)
Возвращает результат записи данных в карту Mifare Classic или Mifare Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_begin_write_mf_plus(ilr_handle hReader, size_t nAddress, const ilr_mf_block_data *pData, size_t nBlockCount, ilr_bool fOpenText, ilr_handle *pCommand)
Запускает асинхронную команду записи данных в карту Mifare Plus SL3.
ILR_API ilr_status ILR_CALL ilr_reader_end_write_mf_ckey(ilr_handle hCommand, size_t *pWritten)
Возвращает результат записи ключей аутентификации Mifare Classic в память считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_disconnect(ilr_handle hReader)
Отключается от считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_begin_scan_temic(ilr_handle hReader, int nScanParam, ilr_handle *pCommand)
Запускает асинхронную команду поиска карты Temic в поле считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_scan(ilr_handle hReader, ilr_bool fReset=ILR_FALSE, ilr_bool fPowerOff=ILR_TRUE)
Ищет карту в поле считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_end_read_mf_classic(ilr_handle hCommand, const ilr_mf_block_data **ppList, size_t *pRead)
Возвращает результат чтения данных из карты Mifare Classic или Mifare Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_begin_read_mf_ultralight(ilr_handle hReader, size_t nPageIdx, size_t nPageCount, ilr_handle *pCommand)
Запускает асинхронную команду чтения данных из карты Mifare Ultralight.
ILR_API ilr_status ILR_CALL ilr_reader_begin_disconnect(ilr_handle hReader, ilr_handle *pCommand)
Запускает асинхронную команду отключения от считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_set_message_callback(ilr_handle hReader, ilr_reader_message_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для уведомлений считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_reset_temic(ilr_handle hReader, ilr_bool fWait=ILR_TRUE)
Сброс TRES.
ILR_API ilr_status ILR_CALL ilr_reader_mf_halt(ilr_handle hReader)
Halt.
int64_t ilr_mf_classic_key
Ключ аутентификации Mifare Classic.
Definition: ilreaders.h:610
ILR_API ilr_status ILR_CALL ilr_reader_read_mf_ultralight(ilr_handle hReader, size_t nPageIdx, uint32_t *pBuf, size_t nPageCount, size_t *pRead=nullptr)
Читает данные карты Mifare Ultralight.
ILR_API ilr_status ILR_CALL ilr_reader_load_temic_password(ilr_handle hReader, const int64_t &nPassword)
Загружает пароль Temic в память объекта считывателя.
ILR_API ilr_status ILR_CALL ilr_reader_mf_restore(ilr_handle hReader, size_t nBlockIdx)
Перемещает содержимое блока в регистр данных Mifare.
ILR_API ilr_status ILR_CALL ilr_reader_begin_read_mf_classic(ilr_handle hReader, size_t nBlockIdx, size_t nBlockCount, ilr_handle *pCommand)
Запускает асинхронную команду чтения данных из карты Mifare Classic или Mifare Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_end_read_mf_ultralight(ilr_handle hCommand, const uint32_t **ppList, size_t *pRead)
Возвращает результат чтения данных из карты Mifare Ultralight.
ILR_API ilr_status ILR_CALL ilr_reader_end_write_temic(ilr_handle hCommand, size_t *pWritten)
Возвращает результат записи данных в карту Temic.
ILR_API ilr_status ILR_CALL ilr_reader_mf_rats(ilr_handle hReader, uint8_t *pAtsBuf=nullptr, size_t *pSize=nullptr)
Переходит на ISO 14443-4.
ILR_API ilr_status ILR_CALL ilr_reader_get_message(ilr_handle hReader, ilr_reader_msg *pMsg, const void **pMsgData, ilr_bool *pFound)
Извлекает следующее сообщение из очереди.
ILR_API ilr_status ILR_CALL ilr_reader_begin_write_mf_classic(ilr_handle hReader, size_t nBlockIdx, const ilr_mf_block_data *pData, size_t nBlockCount, ilr_handle *pCommand)
Запускает асинхронную команду записи данных в карту Mifare Classic или Mifare Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_begin_read_temic(ilr_handle hReader, size_t nBlockIdx, size_t nBlockCount, int nScanParam, ilr_handle *pCommand)
Запускает асинхронную команду чтения данных из карты Temic.
ILR_API ilr_status ILR_CALL ilr_reader_load_mf_pkey(ilr_handle hReader, const ilr_mf_plus_key &rKey)
Загружает ключ для авторизации сектора Mifare Plus SL3.
ILR_API ilr_status ILR_CALL ilr_reader_enable_message_queue(ilr_handle hReader, ilr_bool fEnable=ILR_TRUE)
Включает/выключает очередь сообщений.
ILR_API ilr_status ILR_CALL ilr_reader_connect(ilr_handle hReader, ilr_bool fReconnect=ILR_FALSE)
Подключается к считывателю.
ILR_API ilr_status ILR_CALL ilr_reader_mf_ras(ilr_handle hReader, ilr_bool fWakeUp, uint8_t *pSAK, uint16_t *pATQ, ilr_card_uid *pUID, ilr_bool *pFound)
R+A+S(Request+Anticollision+Select)
ILR_API ilr_status ILR_CALL ilr_reader_set_scan_temic(ilr_handle hReader, ilr_bool fEnable=ILR_TRUE)
Вкл/выкл сканирование карт Temic (для Z-2 Rd-All и Z-2 EHR).
ILR_API ilr_status ILR_CALL ilr_reader_get_scan_temic(ilr_handle hReader, ilr_bool *pEnable)
Возвращает True если сканирование Temic включено.
void(ILR_CALL * ilr_reader_message_callback)(ilr_reader_msg nMsg, const void *pMsgData, void *pUserData)
Тип функции обратного вызова для получения уведомлений от дескриптора считывателя.
Definition: ilreaders.h:535
ILR_API ilr_status ILR_CALL ilr_reader_write_temic(ilr_handle hReader, size_t nBlockIdx, const uint32_t *pData, size_t nBlockCount, ilr_bool fLock=ILR_FALSE, int nScanParam=-1, size_t *pWritten=nullptr)
Пишет данные карты Temic.
ILR_API ilr_status ILR_CALL ilr_reader_begin_mf_transfer(ilr_handle hReader, size_t nBlockIdx, ilr_handle *pCommand)
Записывает содержимое во временном регистре данных в блок-значение.
ILR_API ilr_status ILR_CALL ilr_reader_write_mf_classic(ilr_handle hReader, size_t nBlockIdx, const ilr_mf_block_data *pData, size_t nBlockCount, size_t *pWritten=nullptr)
Пишет данные карты Mifare Classic или Mifare Plus SL1.
ILR_API ilr_status ILR_CALL ilr_reader_write_mf_plus(ilr_handle hReader, size_t nAddress, const ilr_mf_block_data *pData, size_t nBlockCount, ilr_bool fOpenText=ILR_TRUE, size_t *pWritten=nullptr)
Пишет данные карты Mifare Plus SL3.
ilr_connection_status
Состояние подключения к считывателю.
Definition: ilreaders.h:542
@ ILR_MF_PLUS_TYPE_SIZE
Размер списка.
Definition: ilreaders.h:589
ILR_API ilr_status ILR_CALL ilr_search_set_options(ilr_handle hSearch, const ilr_search_options *pOptions)
Устанавливает параметры поиска считывателей.
ILR_API ilr_status ILR_CALL ilr_search_get_options(ilr_handle hSearch, ilr_search_options *pOptions)
Возвращает параметры поиска считывателей.
void(ILR_CALL * ilr_search_message_callback)(ilr_search_msg nMsg, const void *pMsgData, void *pUserData)
Тип функции обратного вызова для получения уведомлений от дескриптора поиска.
Definition: ilreaders.h:444
ILR_API ilr_status ILR_CALL ilr_search_begin_scan(ilr_handle hSearch, ilr_bool fReset, ilr_handle *pCommand)
Запускает асинхронную команду поиска считывателей.
ILR_API ilr_status ILR_CALL ilr_search_enable_message_queue(ilr_handle hSearch, ilr_bool fEnable=ILR_TRUE)
Включает/выключает очередь сообщений.
ILR_API ilr_status ILR_CALL ilr_search_begin_set_auto_scan(ilr_handle hSearch, ilr_bool fEnable, ilr_handle *pCommand)
Запускает асинхронную команду вкл/выкл режим авто поиска считывателей.
ILR_API ilr_status ILR_CALL ilr_search_get_message(ilr_handle hSearch, ilr_search_msg *pMsg, const void **pMsgData, ilr_bool *pFound)
Извлекает следующее сообщение из очереди.
ILR_API ilr_status ILR_CALL ilr_set_filter_port_callback(ilr_filter_port_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для фильтрации портов при поиске считывателей.
ILR_API ilr_status ILR_CALL ilr_search_scan(ilr_handle hSearch, ilr_bool fReset=ILR_FALSE)
Ищет считыватели.
ILR_API ilr_status ILR_CALL ilr_search_set_message_callback(ilr_handle hSearch, ilr_search_message_callback pCallback, void *pUserData=nullptr)
Устанавливает функцию обратного вызова для уведомлений поиска считывателей.
ILR_API ilr_status ILR_CALL ilr_search_get_auto_scan(ilr_handle hSearch, ilr_bool *pEnabled)
Возвращает флаг авто поиска считывателей.
ilr_bool(ILR_CALL * ilr_filter_port_callback)(ilr_port_type nPortType, const char *pszPortName, void *pUserData)
Тип функции обратного вызова для фильтрации портов при поиске считывателей.
Definition: ilreaders.h:403
ILR_API ilr_status ILR_CALL ilr_get_search(ilr_handle *pSearch)
Создаёт дескриптор поиска считывателей.
ILR_API ilr_status ILR_CALL ilr_search_get_reader_info(ilr_handle hSearch, size_t nIdx, ilr_reader_info *pInfo)
Возвращает информацию о найденном считывателе.
ILR_API ilr_status ILR_CALL ilr_search_get_reader_count(ilr_handle hSearch, size_t *pCount)
Возвращает количество найденных считывателей.
ilr_search_msg
Сообщение поиска считывателей.
Definition: ilreaders.h:410
ILR_API ilr_status ILR_CALL ilr_search_set_listen_ports(ilr_handle hSearch, const uint16_t *pPorts, size_t nCount)
Устанавливает список портов для прослушки конвертеров к режиме "Клиент".
ILR_API ilr_status ILR_CALL ilr_search_set_auto_scan(ilr_handle hSearch, ilr_bool fEnable=ILR_TRUE, ilr_bool fWait=ILR_TRUE)
Включает/выключает авто поиск считывателей.
size_t GetMfSectorByBlock(size_t nBlockIdx)
Возвращает номер сектора по номеру блока карты Mifare Classic/Plus.
Definition: ilr_cpp_helpers.h:2892
size_t GetMfSectorBlockCount(size_t nSectorIdx)
Возвращает количество блоков в секторе.
Definition: ilr_cpp_helpers.h:2914
void SetMfClassicKey(ilr_mf_block_data &rTrailerData, bool fKeyB, const ilr_mf_classic_key &nKey)
Устанавливает ключ аутентификации в блок-прицеп Mifare Classic.
Definition: ilr_cpp_helpers.h:3000
size_t GetNumberOfMfBlocks(uint32_t nMemSize)
Вычисляет количество блоков карты Mifare Classic/Plus по размеру её памяти.
Definition: ilr_cpp_helpers.h:2881
auto since(std::chrono::time_point< clock_t, duration_t > const &start)
Возвращает интервал времени в миллисекундах от времени start до текущего времени.
Definition: ilr_cpp_helpers.h:2802
std::chrono::steady_clock::time_point now()
Definition: ilr_cpp_helpers.h:2791
CMifareClassicKey GetMfClassicKey(const ilr_mf_block_data &rTrailerData, bool fKeyB)
Извлекает ключ аутентификации из блока-прицепа Mifare Classic.
Definition: ilr_cpp_helpers.h:2989
size_t GetMfBlockBySector(size_t nSectorIdx)
Возвращает номер блока по номеру сектора.
Definition: ilr_cpp_helpers.h:2903
Заголовочный файл API SDK Readers.
ILR_API ilr_status ILR_CALL ilr_search_open_port(ilr_handle hSearch, ilr_port_type nPortType, const char *pszPortName, ilr_reader_info *pInfo, int *pPort)
Открывает порт и возвращает его дескриптор.
ILR_API ilr_status ILR_CALL ilr_command_get_status(ilr_handle hCommand, ilr_status *pStatus)
Возвращает состояние команды.
void * ilr_handle
Definition: ilreaders.h:108
ILR_API ilr_status ILR_CALL ilr_search_begin_close_port(ilr_handle hSearch, ilr_port_type nPortType, const char *pszPortName, int hPortFD, ilr_handle *pCommand)
Запускает асинхронную команду закрытия порта.
ILR_API ilr_status ILR_CALL ilr_search_get_listen_status(ilr_handle hSearch, uint16_t nTcpPort, ilr_status *pStatus)
Возвращает состояние Tcp-порта, открытого для прослушки конвертеров в режиме "Клиент".
ILR_API ilr_status ILR_CALL ilr_search_begin_open_port(ilr_handle hSearch, ilr_port_type nPortType, const char *pszPortName, ilr_handle *pCommand)
Запускает асинхронную команду открытия порта.
ILR_API ilr_status ILR_CALL ilr_search_close_port(ilr_handle hSearch, ilr_port_type nPortType, const char *pszPortName, int hPort)
Закрывает порт.
ILR_API ilr_status ILR_CALL ilr_clone_handle(ilr_handle h, ilr_handle *pNewHandle)
Клонирует дескриптор поиска считывателей или дескриптор считывателя.
ILR_API ilr_status ILR_CALL ilr_search_end_open_port(ilr_handle hCommand, int *pPortFD, ilr_reader_info *pInfo)
Возвращает результат открытия порта.
ILR_API ilr_status ILR_CALL ilr_encode_temic_emmarine(const ilr_card_uid &rUID, uint32_t *pBuf3, size_t nBlockCount)
Кодирует данные для эмуляции Em-Marine, для записи в блоки 0..2.
ILR_API ilr_status ILR_CALL ilr_command_get_progress(ilr_handle hCommand, size_t *pCurrent, size_t *pTotal)
Возвращает состояние прогресса выполнения команды.
ILR_API ilr_status ILR_CALL ilr_decode_temic_emmarine(const uint32_t *pData3, size_t nBlockCount, ilr_card_uid *pUID, ilr_bool *pConfigOk=nullptr)
Декодирует номер Em-Marine из данных блоков 0..2 карты Temic.
ilr_bool
Definition: ilreaders.h:111
ILR_API ilr_status ILR_CALL ilr_command_cancel(ilr_handle hCommand)
Отменяет команду. Устанавливает статус ILR_E_ABORT.
ILR_API ilr_status ILR_CALL ilr_encode_temic_hid(const ilr_card_uid &rUID, uint32_t *pBuf4, size_t nBlockCount, int nWiegand)
Кодирует данные для эмуляции HID, для записи в блоки 0..3.
ilr_log_level
Уровень лога.
Definition: ilreaders.h:319
ilr_card_type
Тип карты.
Definition: ilreaders.h:261
@ ILR_CARD_TYPE_SIZE
Размер списка.
Definition: ilreaders.h:286
ilr_port_type
Definition: ilreaders.h:243
@ ILR_PORT_TYPE_SIZE
Definition: ilreaders.h:257
ilr_reader_model
Модель считывателя.
Definition: ilreaders.h:211
@ ILR_READER_MODEL_SIZE
Definition: ilreaders.h:239
ILR_API ilr_status ILR_CALL ilr_decode_temic_hid(const uint32_t *pData4, size_t nBlockCount, ilr_card_uid *pUID, int *pWiegand, ilr_bool *pConfigOk=nullptr)
Декодирует номер HID из данных блоков 0..3 карты Temic.
Информация о карте.
Definition: ilreaders.h:596
ilr_card_uid rUID
Номер карты.
Definition: ilreaders.h:598
Данные блока Mifare Classic/Plus.
Definition: ilreaders.h:631
uint8_t a[16]
Байты блока.
Definition: ilreaders.h:632
Ключ аутентификации Mifare Plus.
Definition: ilreaders.h:616
uint8_t a[16]
Байты ключа.
Definition: ilreaders.h:618
uint64_t hi
Старшая часть ключа.
Definition: ilreaders.h:622
uint64_t lo
Младшая часть ключа.
Definition: ilreaders.h:621
Настройки библиотеки.
Definition: ilreaders.h:378
Информация о считывателе.
Definition: ilreaders.h:295
Настройки считывателя.
Definition: ilreaders.h:663
Настройки поиска считывателей.
Definition: ilreaders.h:474