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

📄 serport.h

📁 101通讯规约代码,实现和数据库的完整对接,采用多线程多任务开发.
💻 H
字号:
// SerPort.h: interface for the C101Port class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SERPORT_H__5641D5A4_440D_11D4_852F_000021F0F0B8__INCLUDED_)
#define AFX_SERPORT_H__5641D5A4_440D_11D4_852F_000021F0F0B8__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// Flow control flags
#define FC_DTRDSR       0x01
#define FC_RTSCTS       0x02
#define FC_XONXOFF      0x04

// ascii definitions
#define ASCII_BEL       0x07
#define ASCII_BS        0x08
#define ASCII_LF        0x0A
#define ASCII_CR        0x0D
#define ASCII_XON       0x11
#define ASCII_XOFF      0x13

class C101Port  
{
public:
	C101Port();
	virtual ~C101Port();
	BOOL SetSerMask(DWORD dwEvtMask);
	DWORD GetSerMask();
	BOOL Open( int nPort = 1 , int nBaud = CBR_9600 );
	BOOL Close( void );

	BYTE crc8(BYTE *chkchar, int chklong);
	LPSTR CombinationCommand(BYTE *temp,int length);

	int Read( LPSTR, int );
	BOOL Write( LPSTR , DWORD );

	BOOL IsOpened( void ){ return( m_bOpened ); }
	void ClearInBuf();

protected:

	HANDLE m_hIDComDev;
	OVERLAPPED m_osRead, m_osWrite, m_osWaitComm;
	BOOL m_bOpened;

protected:
	int		m_nBufferLoc;
	char	m_BufferData[128];
public:
	void UpdateDatabase(const char* pData, int nData);
};

#endif 

⌨️ 快捷键说明

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