CardMix.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #ifndef __CARD_MIX_H
  2. #define __CARD_MIX_H
  3. #pragma once
  4. const int MAX_MAG_TRACK_NUM = 3;
  5. const int MAX_MAG_TRACK_SIZE = 512;
  6. const int MAX_IC_BUFFER_SIZE = 1024;
  7. const int MAX_SLOT_BUFFER_SIZE = 4096;
  8. //move card to position
  9. enum CardPosEnum
  10. {
  11. CI_MOVECARD_FRONT_GATE, //reject to front gate,hold card
  12. CI_MOVECARD_RF_POSITION, //rf position
  13. CI_MOVECARD_IC_POSITION, //ic position
  14. CI_MOVECARD_MAG_POSITION, //magnetic position
  15. CI_MOVECARD_BACK_NOT_HOLD, //capture to retain bin
  16. CI_MOVECARD_FROM_HOPPER, //card set from hopper
  17. CI_MOVECARD_RETRIEVE, //retrieve card,which is in Gate position
  18. };
  19. //card entry type
  20. enum CardInEnum
  21. {
  22. CI_CARD_IN_TYPE_FORBIDDEN, //forbidden card entry
  23. CI_CARD_IN_TYPE_MAG, //accept only Magnetic card entry
  24. CI_CARD_IN_TYPE_ALL //accept any card
  25. };
  26. enum CardStatusEnum
  27. {
  28. CI_MEDIA_NOTPRESENT, //卡机任何位置没有发现卡片
  29. //以下仅供大机、便携发卡机CardIssuer使用
  30. CI_MEDIA_PRESENT, //卡机内部发现卡片
  31. CI_MEDIA_JAMMED, //卡片卡住
  32. //仅供大机、便携卡机CardIssuer和吸入式卡机CardSwiper使用
  33. CI_MEDIA_ENTERING, //卡片在进卡口
  34. //以下仅供多合一、壁挂式、吸入式卡机CardSwiper使用
  35. CI_MEDIA_IC, //在多合一、壁挂式的IC插卡位检测到IC卡 或者 在吸入式卡机卡槽内检测到IC卡
  36. CI_MEDIA_NOT_IC, //在多合一、壁挂式的IC插卡位检测到卡片但未能检测到IC芯片 或者 在吸入式卡机卡槽内检测到纯磁条卡
  37. CI_MEDIA_RF, //检测到非接卡片(ContactlessCard借用)
  38. CI_MEDIA_IDCARD, //检测到身份证(ContactlessCard借用)
  39. };
  40. //retain bin state
  41. enum RtBinStatusEnum
  42. {
  43. CI_RETAINBIN_OK, //number of retained card less than half of retain bin's capacity
  44. CI_RETAIN_NOTSUPP, //no retain bin
  45. CI_RETAINBIN_FULL, //retain bin is full
  46. CI_RETAINBIN_HIGH, //retain bin is almost full,number of retain card more
  47. //than half of retain bin's capacity
  48. };
  49. //issue hopper state
  50. enum IssHopperStatusEnum
  51. {
  52. CI_ISSUEHOPPER_OK, //number of issued card more than half of issue hopper's capacity
  53. CI_ISSUEHOPPER_NOTSUPP, //no issue hopper
  54. CI_ISSUEHOPPER_EMPTY, //issue hopper is empty
  55. CI_ISSUEHOPPER_LOW, //issue hopper is almost empty,number of card less
  56. //than half of issue hopper's capacity
  57. };
  58. enum LightPosEnum
  59. {
  60. CI_LIGHT_MAG = 0x1, //the magnetic stripe light flicker
  61. CI_LIGHT_IC = 0x2, //the IC card light flicker
  62. //CI_LIGHT_MAG_IC, //both the magnetic and IC light flicker
  63. CI_LIGHT_CONTACTLESS = 0x4, //the contactless card light flicker
  64. CI_LIGHT_IDCERTIFICATE = 0x8, //the IDCertificate card light flicker
  65. };
  66. enum TrackSrcEnum
  67. {
  68. CI_TRACK_SOURCE_1, //magnetic track 1
  69. CI_TRACK_SOURCE_2, //magnetic track 2
  70. CI_TRACK_SOURCE_3, //magnetic track 3
  71. };
  72. //magnetic track range for read&write
  73. enum TrackRange
  74. {
  75. CI_TRACK_RANGE_START = 0,
  76. CI_TRACK_RANGE_1 = 1, //track1
  77. CI_TRACK_RANGE_2, //track2
  78. CI_TRACK_RANGE_1_2, //track1&track2
  79. CI_TRACK_RANGE_3, //track3
  80. CI_TRACK_RANGE_1_3, //track1&track3
  81. CI_TRACK_RANGE_2_3, //track2&track3
  82. CI_TRACK_RANGE_1_2_3, //track1&track2&track3
  83. };
  84. //track data state
  85. enum TrackDataStateEnum
  86. {
  87. CI_DATA_OK, //data ok
  88. CI_DATA_INVALID,
  89. };
  90. enum MagWriteModeEnum
  91. {
  92. HIGH_CO,
  93. LOW_CO,
  94. AUTO_CO
  95. //HIGH_CO_NORMAL, //high-co card writing with normal read method at write-verify
  96. //LOW_CO_NORMAL, //low-co card writing with normal read method at write-verify
  97. //AUTO_CO_NORMAL, //auto judge high-co/low-co card with normal read method at write-verify
  98. //HIGH_CO_EXTRA, //high-co card writing with extra read method at write-verify
  99. //LOW_CO_EXTRA, //low-co card writing with extra read method at write-verify
  100. //AUTO_CO_EXTRA //auto judge high-co/low-co card with extra read method at write-verify
  101. };
  102. enum MifareFuctionEnum
  103. {
  104. CI_MIFARE_LOAD_KEY, //load key
  105. CI_MIFARE_AUTH, //authentication
  106. CI_MIFARE_READ, //read
  107. CI_MIFARE_WRITE, //write
  108. CI_MIFARE_INC, //increment transfer
  109. CI_MIFARE_DEC //decrement transfer
  110. };
  111. struct CmdInfo
  112. {
  113. DWORD dwSize;
  114. BYTE data[MAX_IC_BUFFER_SIZE];
  115. };
  116. struct TrackInfo
  117. {
  118. TrackSrcEnum eSource;
  119. TrackDataStateEnum eStatus;
  120. DWORD dwSize;
  121. BYTE data[MAX_MAG_TRACK_SIZE];
  122. };
  123. struct MagTracks
  124. {
  125. TrackRange eRange;
  126. TrackInfo track[MAX_MAG_TRACK_NUM];
  127. };
  128. struct CardNo
  129. {
  130. DWORD dwSize;
  131. DWORD dwTrack2Size;
  132. DWORD dwTrack3Size;
  133. char account[MAX_MAG_TRACK_SIZE];
  134. char track2[MAX_MAG_TRACK_SIZE];
  135. char track3[MAX_MAG_TRACK_SIZE];
  136. };
  137. struct SlotStatus
  138. {
  139. DWORD dwSize;//sum of slots
  140. //数据下标0~x 表示对应卡槽号0~x的是否有卡的状态
  141. //0:卡槽为空,1:卡槽有卡;
  142. BYTE status[MAX_SLOT_BUFFER_SIZE];
  143. };
  144. enum DevOpenType
  145. {
  146. DEV_OPEN_TYPE_USB = 1,
  147. DEV_OPEN_TYPE_COM = 2,
  148. DEV_OPEN_TYPE_BLUETOOTH = 4,
  149. };
  150. #endif//__CARD_MIX_H