📄 serial.h
字号:
//Mobile control class by SkyVense
//If you modified this file, please send a copy to skyvense@online.sh.cn
//Thank you!
//Last modifed 2002-02-29 by SkyVense
// Serial.h
#ifndef _SERIAL_H
#define _SERIAL_H
#include "stdafx.h"
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define FC_DTRDSR 0x01
#define FC_RTSCTS 0x02
#define FC_XONXOFF 0x04
#define ASCII_BEL 0x07
#define ASCII_BS 0x08
#define ASCII_LF 0x0A
#define ASCII_CR 0x0D
#define ASCII_XON 0x11
#define ASCII_XOFF 0x13
DWORD WINAPI ReadPortThread(LPVOID lpvoid); //读数据线程
class CSerial
{
public:
CSerial();
virtual ~CSerial();
protected:
HANDLE hReadThread;
BOOL m_bConnected;
CString m_strChar;
public:
BOOL InitCommTimeouts(); //设置超时参数
BOOL InitDCB(UINT uiBaudRate); //配置串口
BOOL ClosePort(HANDLE hCommPort); //关闭串口
BOOL OpenPort(LPTSTR lpszPortName,UINT uiBaudRate); //打开串口
DWORD WritePort(TCHAR *buf,DWORD dwBytesToWrite); //写数据
CString GetPortData();
void ClosePort();//关闭串口 API
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -