BS_ID81IDCLibImpl.cpp 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. #include "stdafx.h"
  2. //ILog* g_pLog;
  3. extern mEnumScannerDevice EnumScannerDevice;
  4. extern mOpenConnection OpenConnection;
  5. extern mCloseConnection CloseConnection;
  6. extern mCheckHaveIdCard CheckHaveIdCard;
  7. extern mTakeOutIdCard TakeOutIdCard;
  8. extern mStartScanIdCard StartScanIdCard;
  9. extern mSavePicToMemory SavePicToMemory;
  10. extern mSavePicToFile SavePicToFile;
  11. extern mSavePicToFileII SavePicToFileII;
  12. extern mRetainIdCard RetainIdCard;
  13. extern mBackIdCard BackIdCard;
  14. extern mBackAndHoldIdCard BackAndHoldIdCard;
  15. extern mGetID2Info GetID2Info;
  16. extern mGetID2InfoEx GetID2InfoEx;
  17. extern mGetLastErrorCode GetLastErrorCode;
  18. extern mGetLastErrorStr GetLastErrorStr;
  19. extern mGetFWVersion GetFWVersion;
  20. extern mGetSWVersion GetSWVersion;
  21. extern mGetDevStatus GetDevStatus;
  22. extern mResetDevice ResetDevice;
  23. extern mSoftResetDevice SoftResetDevice;
  24. extern mUpdateOnLine UpdateOnLine;
  25. extern mCISCalibrate CISCalibrate;
  26. extern mSensorCalibrate SensorCalibrate;
  27. extern mSetButtonEnable SetButtonEnable;
  28. extern mSetAutoFeedEnable SetAutoFeedEnable;
  29. extern mSetInitFeedMode SetInitFeedMode;
  30. extern mSetHeadFileFormat SetHeadFileFormat;
  31. extern mGetID2InfoFromImage GetID2InfoFromImage;
  32. extern mGetPassportInfoFromImage GetPassportInfoFromImage;
  33. extern mBackIdCardToRerec BackIdCardToRerec;
  34. extern mGetIDInfoForeign GetIDInfoForeign;
  35. extern mGetIDInfoGAT GetIDInfoGAT;
  36. extern mGetIDCardType GetIDCardType;
  37. extern mGetAllTypeIdInfo GetAllTypeIdInfo;
  38. extern mSetLog SetLog;
  39. BS_ID81IDCLibImpl::BS_ID81IDCLibImpl(void)
  40. {
  41. char cTemp[256] = {0};
  42. m_bLoadLibRet = load_so(cTemp);
  43. //LOG4VTM(INFO,("BS_ID81IDCLibImpl creat function()!"));
  44. if (m_bLoadLibRet == false)
  45. {
  46. printf("动态库加载失败!");
  47. return;
  48. }
  49. bool Output = false;
  50. char LogPath[256] = {0};
  51. sprintf(LogPath,"./ID81LOG.log");
  52. int iResult = SetLog(Output,LogPath);
  53. if (iResult != 0)
  54. {
  55. printf("SetLog failed.\n");
  56. }
  57. }
  58. BS_ID81IDCLibImpl::~BS_ID81IDCLibImpl(void)
  59. {
  60. Unload_so();
  61. }
  62. int BS_ID81IDCLibImpl::EnumScannerDev(ScannerInfoRec *ScannerInfo, unsigned *DeviceNumber)
  63. {
  64. if (EnumScannerDevice == NULL)
  65. {
  66. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  67. }
  68. int nRet = EnumScannerDevice(ScannerInfo, DeviceNumber);
  69. return nRet;
  70. }
  71. int BS_ID81IDCLibImpl::OpenDev(unsigned DeviceID)
  72. {
  73. if (OpenConnection == NULL)
  74. {
  75. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  76. }
  77. int nRet = OpenConnection(DeviceID);
  78. return nRet;
  79. }
  80. int BS_ID81IDCLibImpl::CloseDev(unsigned DeviceID)
  81. {
  82. if (CloseConnection == NULL)
  83. {
  84. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  85. }
  86. int nRet = CloseConnection(DeviceID);
  87. return nRet;
  88. }
  89. int BS_ID81IDCLibImpl::CheckIdCard(unsigned DeviceID,int CheckTime)
  90. {
  91. if (CheckHaveIdCard == NULL)
  92. {
  93. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  94. }
  95. int nRet = CheckHaveIdCard(DeviceID,CheckTime);
  96. return nRet;
  97. }
  98. int BS_ID81IDCLibImpl::CheckCardOut(unsigned DeviceID,int CheckTime)
  99. {
  100. if (TakeOutIdCard == NULL)
  101. {
  102. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  103. }
  104. int nRet = TakeOutIdCard(DeviceID,CheckTime);
  105. return nRet;
  106. }
  107. int BS_ID81IDCLibImpl::StartScan(unsigned DeviceID)
  108. {
  109. if (StartScanIdCard == NULL)
  110. {
  111. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  112. }
  113. int nRet = StartScanIdCard(DeviceID);
  114. return nRet;
  115. }
  116. int BS_ID81IDCLibImpl::ReadCard(unsigned DeviceID, char* cFrontImgBuf,char* cRearImgBuf, int* iFrontLen, int* iRearLen)
  117. {
  118. if (SavePicToMemory == NULL)
  119. {
  120. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  121. }
  122. int nRet = SavePicToMemory(DeviceID, cFrontImgBuf,cRearImgBuf, iFrontLen, iRearLen);
  123. return nRet;
  124. }
  125. int BS_ID81IDCLibImpl::SaveToFile(unsigned DeviceID, char *cBmpBuf, int iBufLen,char *FileName, int Format)
  126. {
  127. if (SavePicToFile == NULL)
  128. {
  129. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  130. }
  131. int nRet = SavePicToFile(DeviceID, cBmpBuf, iBufLen,FileName, Format);
  132. return nRet;
  133. }
  134. int BS_ID81IDCLibImpl::RetainCard(unsigned DeviceID)
  135. {
  136. if (RetainIdCard == NULL)
  137. {
  138. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  139. }
  140. int nRet = RetainIdCard(DeviceID);
  141. return nRet;
  142. }
  143. int BS_ID81IDCLibImpl::EjectIdCard(unsigned DeviceID)
  144. {
  145. if (BackIdCard == NULL)
  146. {
  147. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  148. }
  149. int nRet = BackIdCard(DeviceID);
  150. return nRet;
  151. }
  152. int BS_ID81IDCLibImpl::BackAndHoldCard(unsigned DeviceID)
  153. {
  154. if (BackAndHoldIdCard == NULL)
  155. {
  156. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  157. }
  158. int nRet = BackAndHoldIdCard(DeviceID);
  159. return nRet;
  160. }
  161. int BS_ID81IDCLibImpl::LastErrorCode()
  162. {
  163. if (GetLastErrorCode == NULL)
  164. {
  165. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  166. }
  167. int nRet = GetLastErrorCode();
  168. return nRet;
  169. }
  170. int BS_ID81IDCLibImpl::LastErrorStr(char* errStr)
  171. {
  172. if (GetLastErrorStr == NULL)
  173. {
  174. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  175. }
  176. int nRet = GetLastErrorStr(errStr);
  177. return nRet;
  178. }
  179. int BS_ID81IDCLibImpl::FWVersion(unsigned DeviceID,char *cVersionInfo)
  180. {
  181. if (GetFWVersion == NULL)
  182. {
  183. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  184. }
  185. int nRet = GetFWVersion(DeviceID,cVersionInfo);
  186. return nRet;
  187. }
  188. int BS_ID81IDCLibImpl::GetInfo(unsigned DeviceID, IDInfo *mIDInfo, char *ImageName)
  189. {
  190. if (GetID2Info == NULL)
  191. {
  192. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  193. }
  194. int nRet = GetID2Info(DeviceID, mIDInfo, ImageName);
  195. return nRet;
  196. }
  197. int BS_ID81IDCLibImpl::ResetDev(unsigned DeviceID)
  198. {
  199. if (ResetDevice == NULL)
  200. {
  201. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  202. }
  203. int nRet = ResetDevice(DeviceID);
  204. return nRet;
  205. }
  206. int BS_ID81IDCLibImpl::Update(unsigned DeviceID,char *FileName)
  207. {
  208. if (UpdateOnLine == NULL)
  209. {
  210. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  211. }
  212. int nRet = UpdateOnLine(DeviceID,FileName);
  213. return nRet;
  214. }
  215. int BS_ID81IDCLibImpl::CIS(unsigned DeviceID)
  216. {
  217. if (CISCalibrate == NULL)
  218. {
  219. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  220. }
  221. int nRet = CISCalibrate(DeviceID);
  222. return nRet;
  223. }
  224. int BS_ID81IDCLibImpl::Sensor(unsigned DeviceID)
  225. {
  226. if (SensorCalibrate == NULL)
  227. {
  228. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  229. }
  230. int nRet = SensorCalibrate(DeviceID);
  231. return nRet;
  232. }
  233. int BS_ID81IDCLibImpl::SWVersion(char *cVersionInfo)
  234. {
  235. if (GetSWVersion == NULL)
  236. {
  237. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  238. }
  239. int nRet = GetSWVersion(cVersionInfo);
  240. return nRet;
  241. }
  242. int BS_ID81IDCLibImpl::DeviceStatus(unsigned DeviceID,DEVSTATUS *DevStatus)
  243. {
  244. if (GetDevStatus == NULL)
  245. {
  246. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  247. }
  248. int nRet = GetDevStatus(DeviceID,DevStatus);
  249. return nRet;
  250. }
  251. int BS_ID81IDCLibImpl::ResetWithAction(unsigned DeviceID,int iMode)
  252. {
  253. if (SoftResetDevice == NULL)
  254. {
  255. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  256. }
  257. int nRet = SoftResetDevice(DeviceID,iMode);
  258. return nRet;
  259. }
  260. int BS_ID81IDCLibImpl::GetMyIDCardInfo(unsigned DeviceID,int iCardType,void* idinfo,char* ImageName)
  261. {
  262. if (GetAllTypeIdInfo == NULL)
  263. {
  264. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  265. }
  266. int nRet = GetAllTypeIdInfo(DeviceID, iCardType, idinfo, ImageName);
  267. return nRet;
  268. }
  269. int BS_ID81IDCLibImpl::GetMyIDCardType(unsigned DeviceID, int* iCardType)
  270. {
  271. if (GetIDCardType == NULL)
  272. {
  273. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  274. }
  275. int nRet = GetIDCardType(DeviceID, iCardType);
  276. return nRet;
  277. }
  278. int BS_ID81IDCLibImpl::GetMyGATIDInfo(unsigned DeviceID, IDInfoGAT* mIDInfoGAT, char *ImageName)
  279. {
  280. if (GetIDInfoGAT == NULL)
  281. {
  282. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  283. }
  284. int nRet = GetIDInfoGAT(DeviceID, mIDInfoGAT, ImageName);
  285. return nRet;
  286. }
  287. int BS_ID81IDCLibImpl::GetAllTypeCardInfo(unsigned DeviceID,int iCardType,void* idinfo,char* ImageName)
  288. {
  289. if (GetAllTypeIdInfo == NULL)
  290. {
  291. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  292. }
  293. int nRet = GetAllTypeIdInfo(DeviceID, iCardType,idinfo, ImageName);
  294. return nRet;
  295. }
  296. int BS_ID81IDCLibImpl::SetIDLog(bool Output, char* LogPath)
  297. {
  298. if (SetLog == NULL)
  299. {
  300. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  301. }
  302. int nRet = SetLog(Output, LogPath);
  303. return nRet;
  304. }
  305. int BS_ID81IDCLibImpl::SetAutoFeedEnabled(unsigned DeviceID, int nMode)
  306. {
  307. if (SetAutoFeedEnable == NULL)
  308. {
  309. return IDDIGITALCOPIER_HAVE_NOT_INIT;
  310. }
  311. int nRet = SetAutoFeedEnable(DeviceID, nMode);
  312. return nRet;
  313. }