123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /////////////////////////////////////////////////////////////////////////////////
- /// Copyright (c) 2012 China Merchants Bank, all rights reserved ///
- /// Adapter Interface for RF IC Card. ///
- /// ///
- /// ///
- /////////////////////////////////////////////////////////////////////////////////
- #ifndef __RFIC_CLASS_H
- #define __RFIC_CLASS_H
- #pragma once
- #include "DeviceBaseClass.h"
- #include "CardMix.h"
- /*const int RF_BLOCK_DATA_SIZE = 16;
- const int KEY_SIZE = 6;
- struct RFBlockData
- {
- DWORD dwSize;
- BYTE data[RF_BLOCK_DATA_SIZE];
- };
- enum KeyModeEnum
- {
- RF_KEYMODE_KEY_A_SET0, //KEY A,keyset0
- RF_KEYMODE_KEY_A_SET1, //KEY A,keyset1
- RF_KEYMODE_KEY_A_SET2, //KEY A,keyset2
- RF_KEYMODE_KEY_B_SET0, //KEY B,keyset0
- RF_KEYMODE_KEY_B_SET1, //KEY B,keyset1
- RF_KEYMODE_KEY_B_SET2, //KEY B,keyset2
- };
- struct KeyInfo
- {
- KeyModeEnum eMode;
- BYTE btSector; //sector number
- BYTE data[KEY_SIZE];
- };*/
- struct RFICReaderStatus
- {
- CardStatusEnum eMediaPos; //detect rf card or not:CI_MEDIA_NOTPRESENT,CI_MEDIA_RF
- };
- class RFICClass : public DeviceBaseClass
- {
- public:
- //device initialization
- virtual ErrorCodeEnum DevOpen(DWORD dwPort,DWORD dwBaudRate) = 0;
-
- //
- // Get card reader status
- //
- virtual ErrorCodeEnum GetDevStatus(RFICReaderStatus &devStatus) = 0;
- //
- // Abort current operation.
- //
- virtual ErrorCodeEnum AbortRead() = 0;
- //
- // Active contactless card(Type A,B,Mifare)
- // The first,second,third activation order decided by fstType,scdType,thdType respectively
- // fstType,scdType,thdType can be one of 'A','B','M','0'(30H,no type)
- // outType indicates the type of activation result
- //
- virtual ErrorCodeEnum ActiveContactlessICCard(char fstType,char scdType,char thdType,char &outType) = 0;
- //
- // Deactivate contactless IC card
- //
- virtual ErrorCodeEnum DeactContactlessICCard() = 0;
- //
- // Warm reset card(IC)
- //
- virtual ErrorCodeEnum WarmReset() = 0;
- //
- // Mifare operation
- // Arguments:
- // - eFunType:function type as load key,authentication and so on
- // - return/data(hex) byte order like BIG EDIAN. ex:0x12345678 --> data[i] = 0x12,data[i+1] = 0x34,data[i+2] = 0x56,data[i+3] = 0x78
- // - sendBuf:[parameter(hex)][data(hex)]
- // - recvBuf:[status(1byte)][return data(hex)]
- // -- [eFunType],[parameter,data],[status(1byte),return data]
- // -- [CI_MIFARE_LOAD_KEY],[key select(1byte),sector num(1byte),uncoded keys(6bytes)],[status(1byte)]
- // -- [CI_MIFARE_AUTH],[key select(1byte),sector num(1byte)],[status(1byte)]
- // -- [CI_MIFARE_READ],[block num(1byte)],[status(1byte),data(16bytes)]
- // -- [CI_MIFARE_WRITE],[block num(1byte),data(16bytes)],[status(1byte)]
- // -- [CI_MIFARE_INC],[source block num(1byte),destination block num(1byte),inc value(4bytes)],[status(1byte)]
- // -- [CI_MIFARE_DEC],[source block num(1byte),destination block num(1byte),dec value(4bytes)],[status(1byte)]
- // -- key select(1byte):AKey(00h),BKey(01h)
- // -- status(1byte):OK(00h),other error code(!00h)
- virtual ErrorCodeEnum MifareCommand(MifareFuctionEnum eFunType,CmdInfo sendBuf,CmdInfo &recvBuf) = 0;
- //
- // RF Type A,B command.
- // APDU:Application Protocol Data Unit
- // Arguments:
- // - CmdSend.lpCmd:Command-APDU
- // - CmdRecv.lpData:Response-APDU
- //
- virtual ErrorCodeEnum RFTypeABCommand(CmdInfo sendBuf,CmdInfo &recvBuf) = 0;
-
- //halt card
- //card have been halted must move from induction zone then can be found again
- virtual ErrorCodeEnum HaltCard() = 0;
- private:
- };
- #endif //__RFIC_CLASS_H
|