📄 serial.h
字号:
/*
'COPYRIGHT: Foshan Analytical Instrument Factory, All rights reserved.
'This document, which contains confidential material is private and is
'the 'property and copyright of Foshan Analytical Instrument Factory.
'It is not to 'be used other purposes, copied, distributed or transmitted
'in any form or by 'any means without the prior written consent of the company.
'Infringement of 'copyright is a serious civil and criminal offence which can
'result in heavy 'fines and payment of substantial damages.
'================================================================
'1.模块定义
' 模块名称:Serial.h
' 模块ID:Serial
' 文件名称:Serial.h
' 程序员:李文杰
' 日期:2003/11/01
'2.注释
' 项目:FGA4100通讯控制系统
' 操作系统:Windows 98 or Windows 2000
' 软件环境:Vc++ 6.0
'3.修改履历:
*/
// Serial.h
#ifndef __SERIAL_H__
#define __SERIAL_H__
#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
class CSerial
{
public:
CSerial();
~CSerial();
BOOL Open( int nPort = 2, //通讯口
int nBaud = 4800, //波特率
int nnn=3 ); //奇偶校验方式
BOOL Close( void );
int ReadData( void *, int );
int ReadData( void *buffer);
int SendData( const char *buffer, int size );
int ReadDataWaiting( void );
// BOOL ReadDataWaiting(short int *WaitDataNum);
int ReadDataWaiting(int *WaitDataNum);
BOOL IsOpened( void ){ return( m_bOpened ); }
protected:
BOOL WriteCommByte( unsigned char );
HANDLE m_hIDComDev;
OVERLAPPED m_OverlappedRead, m_OverlappedWrite;
BOOL m_bOpened;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -