📄 cdatalink.h
字号:
// cDataLink.h: interface for the cDataLink class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CDATALINK_H__90C31080_073D_11D5_B2C7_000021001526__INCLUDED_)
#define AFX_CDATALINK_H__90C31080_073D_11D5_B2C7_000021001526__INCLUDED_
#include "comm_buf.h" // Added by ClassView
#include "comm_buf_copy.h" // Added by ClassView
#include "InfBuf.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDataLink
{
// PCB FORMAT CODE
#define I_BLOCK 0x02 //I-Block: 000x xx1x
#define R_BLOCK_ACK 0xA2 //R-Block-ACK: 1010 x01x
#define R_BLOCK_NAK 0xB2 //R-Block-NAK: 1011 x01x
#define S_BLOCK_DES 0xC2 //S-Block: 1100 x010
#define S_BLOCK_WTX 0xF2 //S-Block: 1111 x010
// Bitmasks for decoding the several state
#define M_I_BLOCK 0xE2 //I-BLOCK: 1110 0010
#define M_R_BLOCK 0xF6 //R-BLOCK: 1111 0110
#define M_S_BLOCK 0xF7 //S-BLOCK: 1111 0111
#define M_CHAINING 0x10 //Chaining: 0001 0000
#define M_CID 0x08 //CID following: 0000 1000
#define M_NAD 0x04 //NAD following: 0000 0100
#define M_BLOCK_NUMBER 0x01 //BLOCKNUMBER: 0000 0001
#define M_CID_BYTE 0xFF //CID Byte: 1111 1111
#define M_POWER_LEVEL 0x00 //Power Level Indication: 0000 0000
#define M_WTXM 0x3F //Waiting Time eXtension Multipier 0011 1111
// These definitions are only for error handling
#define READY 0
#define PICC_CHAINING 1
#define PCD_CHAINING 2
#define S_WTX_RESPONSE 3
#define PROTOCOL_ERROR 4
#define S_DESELECT_REQ 5
//Run States
#define RECEIVE_STATE 0 // Receive State
#define APPLICATION_STATE 1 // Application State
#define SEND_STATE 2 // Send State
#define RECEIVE_WAIT 3 // Wait State
#define RECEIVE_I 4 // I-Block received
#define RECEIVE_S_WTX_REQ 5 // S-Block WTX response received
#define RECEIVE_R_ACK 7 // R-Block ACKnowledge
#define RECEIVE_S_DES_RES 8 // S-Block DESelect REQuest
#define SEND_R_ACK 11 // Send R(ACK)
#define SEND_S_DES_REQ 12 // Send S(Deselect)response
#define SEND_S_WTX_RES 13 // Send S-Block WTX request
#define SEND_I 14 // Send I-Block
#define SEND_RETRANSMIT 10 // Retransmit the last sent block
#define SEND_R_NAK 15 // Send R(NAK) block
public:
comm_buf_copy CBufferCopy;
comm_buf CComBuf;
int ImplementLinker(BYTE cid,BYTE prot_state,CInfBuf *CInfBuffer);
CDataLink();
virtual ~CDataLink();
private:
// Declaration of PICC or Application specific settings
BYTE power_level_indication; // 00: PICC does not support power level indication
// e.g. 0x0C -> More than suffucient power for full functionality
BYTE nad; // e.g.
BYTE wtxm; // e.g.
// Internal Variables Declaration
BYTE i; // Loop parameter only for I-Block -> Chaining PCD
BYTE j; // Loop parameter only for I-Block -> Chaining PICC
BYTE n; // Loop parameter
BYTE r; // Loop parameter
BYTE offset; // Counter to calculate the maximum space for INF Bytes
BYTE byte_cnt; // Byte Counter only used for Chaining PICC
int byte_nr;
BYTE temp;
BYTE processing;
BYTE fsdi; // will be later corrected
//BYTE prot_state;
BYTE block_number; // Initializised to 1 (Rule A)
//BYTE add_cid;
//BYTE add_nad;
};
#endif // !defined(AFX_CDATALINK_H__90C31080_073D_11D5_B2C7_000021001526__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -