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

📄 comport.h

📁 利用串口读写数据实现的识币器驱动程序
💻 H
字号:

#ifndef _COMPORT_H_
#define _COMPORT_H_

#ifdef CASHCODE_EXPORTS
  #define _CASHCODEDLL_API _declspec(dllexport)
#else
  #define _CASHCODEDLL_API _declspec(dllimport)
#endif

class _CASHCODEDLL_API CCOMPort 
{
public:

	void RTS(bool bRTS=true);	// Sets RTS signal to the specified state
	void DTR(bool bDTR=true);	//Sets DTR signal to the specified state
	int iTimeOut;				//Communication Timeout (ms)
	BOOL InitCOM(int,LPSTR);	//Initializes specified port using supplied format string
	BOOL InitCOM(LPSTR,int);	//Initializes currently open port using supplied format string and timeout value
	BOOL OpenCOM(int);		// Opens COM port for further operations
	HANDLE GetHandle();			// Returns file handle associated with the COM port
	virtual BOOL Recieve(LPBYTE,int);	//Reads specified number of bytes into supplied buffer
	virtual BOOL Send(LPBYTE,int);		// Sends specified number of bytes from the specified buffer
	virtual BOOL InitCOM(int,LPSTR,int);// Initializes specified port using supplied format string and timeout value	
	void CloseCOM();					//Closes currently open port
	DWORD IsEnable(int);		//Returns Error code received during opening port 
	CCOMPort();					// default constructor
	virtual ~CCOMPort();		//Object destructor	

private:
	int iCOM;					//COM port number 
	void FindCOM();				//Tryes to open 16 COM ports & fills in EnablePorts array
	HANDLE hCOMPort;			//File handle associated with the COM port
	DWORD EnablePorts[16];		// An array containing port enumeration results (error codes) for firs 16 COM ports
	
};

#endif

⌨️ 快捷键说明

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