123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include "contactless_impl.h"
- #include<cstring>
- #include <cstdio>
- ContactlessCardImpl::ContactlessCardImpl()
- :m_mode(0)
- {
- }
- ContactlessCardImpl::~ContactlessCardImpl()
- {
- }
- ErrorCodeEnum ContactlessCardImpl::GetDevCategory(DevCategoryInfo &devCategory)
- {
- ErrorCodeEnum err = Error_Succeed;
- std::strcpy(devCategory.szModel, "szModel");
- std::strcpy(devCategory.szType, "szCategory");
- std::strcpy(devCategory.szVendor, "szVendor");
- return err;
- }
- ErrorCodeEnum ContactlessCardImpl::Reset()
- {
- ErrorCodeEnum err = Error_Succeed;
- m_mode = 0;
- return err;
- }
- ErrorCodeEnum ContactlessCardImpl::DevClose()
- {
- ErrorCodeEnum err = Error_Succeed;
- return err;
- }
- ErrorCodeEnum ContactlessCardImpl::GetLastErr(DevErrorInfo &devErrInfo)
- {
- static int times = 0;
- char szMessage[128];
- char szSubMessage[64];
- sprintf(szSubMessage, "%d", ++times);
- sprintf(szMessage, "{\"ErrCode\":9555, \"Description\":\"Func:%s,Line:%d,Msg:%s\"}", __FUNCTION__, __LINE__, szSubMessage);
- strcpy(devErrInfo.szErrMsg, szMessage);
- devErrInfo.dwErrMsgLen = strlen(szMessage);
- return Error_Succeed;
- }
- DEVICEBASE_API ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&baseObj)
- {
- baseObj = new ContactlessCardImpl();
- if(baseObj == NULL) {
- return Error_Resource;
- } else {
- return Error_Succeed;
- }
- }
- DEVICEBASE_API ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj)
- {
- if(pBaseObj == NULL) {
- return Error_Param;
- }
- if(ContactlessCardImpl* pTmp = dynamic_cast<ContactlessCardImpl*>(pBaseObj))
- {
- delete pTmp;
- pTmp = NULL;
- return Error_Succeed;
- }
- return Error_Param;
- }
- #ifdef NEWER_COMPILER_WORKAROUNDS
- DEVICEBASE_API ErrorCodeEnum GetDevAdapterVersion(DevSoftVersion& retVesion)
- {
- retVesion.wMajor = retVesion.wMinor = retVesion.wBuild = retVesion.wRevision = 0;
- return Error_Succeed;
- }
- #endif // NEWER_COMPILER_WORKAROUNDS
|