contactless_impl.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "contactless_impl.h"
  2. #include<cstring>
  3. #include <cstdio>
  4. ContactlessCardImpl::ContactlessCardImpl()
  5. :m_mode(0)
  6. {
  7. }
  8. ContactlessCardImpl::~ContactlessCardImpl()
  9. {
  10. }
  11. ErrorCodeEnum ContactlessCardImpl::GetDevCategory(DevCategoryInfo &devCategory)
  12. {
  13. ErrorCodeEnum err = Error_Succeed;
  14. std::strcpy(devCategory.szModel, "szModel");
  15. std::strcpy(devCategory.szType, "szCategory");
  16. std::strcpy(devCategory.szVendor, "szVendor");
  17. return err;
  18. }
  19. ErrorCodeEnum ContactlessCardImpl::Reset()
  20. {
  21. ErrorCodeEnum err = Error_Succeed;
  22. m_mode = 0;
  23. return err;
  24. }
  25. ErrorCodeEnum ContactlessCardImpl::DevClose()
  26. {
  27. ErrorCodeEnum err = Error_Succeed;
  28. return err;
  29. }
  30. ErrorCodeEnum ContactlessCardImpl::GetLastErr(DevErrorInfo &devErrInfo)
  31. {
  32. static int times = 0;
  33. char szMessage[128];
  34. char szSubMessage[64];
  35. sprintf(szSubMessage, "%d", ++times);
  36. sprintf(szMessage, "{\"ErrCode\":9555, \"Description\":\"Func:%s,Line:%d,Msg:%s\"}", __FUNCTION__, __LINE__, szSubMessage);
  37. strcpy(devErrInfo.szErrMsg, szMessage);
  38. devErrInfo.dwErrMsgLen = strlen(szMessage);
  39. return Error_Succeed;
  40. }
  41. DEVICEBASE_API ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&baseObj)
  42. {
  43. baseObj = new ContactlessCardImpl();
  44. if(baseObj == NULL) {
  45. return Error_Resource;
  46. } else {
  47. return Error_Succeed;
  48. }
  49. }
  50. DEVICEBASE_API ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj)
  51. {
  52. if(pBaseObj == NULL) {
  53. return Error_Param;
  54. }
  55. if(ContactlessCardImpl* pTmp = dynamic_cast<ContactlessCardImpl*>(pBaseObj))
  56. {
  57. delete pTmp;
  58. pTmp = NULL;
  59. return Error_Succeed;
  60. }
  61. return Error_Param;
  62. }
  63. #ifdef NEWER_COMPILER_WORKAROUNDS
  64. DEVICEBASE_API ErrorCodeEnum GetDevAdapterVersion(DevSoftVersion& retVesion)
  65. {
  66. retVesion.wMajor = retVesion.wMinor = retVesion.wBuild = retVesion.wRevision = 0;
  67. return Error_Succeed;
  68. }
  69. #endif // NEWER_COMPILER_WORKAROUNDS