⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comm_buf.cpp

📁 北京航空航天大学指纹识别系统源码
💻 CPP
字号:
// comm_buf.cpp: implementation of the comm_buf class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "comm_buf.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

comm_buf::comm_buf()
{
   iBufferCount = 0;
   SessionResult = COD_S_OK;
}

comm_buf::~comm_buf()
{

}

int comm_buf::GetBufferCount()
{
   return iBufferCount; 
}

BYTE  comm_buf::GetBufferValue(int iIndex)
{
   return abBuffer[iIndex];
}

void comm_buf::SetBufferValue(BYTE bValue,int iIndex)
{
  abBuffer[iIndex] =  bValue;
}

void comm_buf::ClearBuffer()
{
	int j;
	for(j=0;j<128;j++)
	{
		abBuffer[j] = 0;
		abDestBuffer[j] = 0;
	}
    iBufferCount = 0;
    SessionResult = COD_S_OK;
}

void comm_buf::TransmitBuffer()
{
   
    MEM_BUFFER *SourceBuffer = new MEM_BUFFER;
	MEM_BUFFER *DestinationBuffer = new MEM_BUFFER;

	SourceBuffer->srclen = iBufferCount;	
	SourceBuffer->srcbuf = abBuffer;
	DestinationBuffer->srcbuf = abDestBuffer;

	wr_cll_reg(0x07,0x00);
	wr_cll_reg(0x17,0x00);
	wr_cll_reg(0x06,0x00);
	wr_cll_reg(0x16,0x00);
	set_timeout(14);
	//set_tx_len(iBufferCount);

	SessionResult = trscv_cll(SourceBuffer,DestinationBuffer);
    
	if (SessionResult==COD_E_TIMEOUT)
		AfxMessageBox("No response from card!");
	
	iBufferCount  = DestinationBuffer->srclen;

}

void comm_buf::SetBufferCount(int i)
{
  iBufferCount = i;
}

void comm_buf::AddBufferValue(BYTE bValue)
{
    abBuffer[iBufferCount++] =  bValue;
}

int comm_buf::ReceiveBuffer()
{
   int i;
   if (SessionResult == COD_S_OK)
   {
	   for(i=0;i<iBufferCount;i++)
	   {
		   abBuffer[i] = abDestBuffer[i];
	   }

	   return 0;
   }
   else
   {
	   return 1;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -