serialctl.hpp
来自「利用Serial ComPort與GPS機器作資料傳輸並可以儲存為google 」· HPP 代码 · 共 41 行
HPP
41 行
/********************************************************************
file base: SerialCtl
file ext: hpp
purpose: Use to control the signal of serial communication.
*********************************************************************/
#ifndef SERIAL_CTL_HPP
#define SERIAL_CTL_HPP
// class SerialCtl
//-----------------------------------------------------------------------------
// Description: This class handle the functionality that interface with the serial communication.
//
class SerialCtl
{
public:
SerialCtl(); // Constructor
~SerialCtl(); // Destructor
public:
void setStatusPort(BOOL on_off); // set Status port whether on or off.
BOOL closePort(); // close port operator.
BOOL openPort(DCB dcb, // open serial communicaiton port.
const char* portName = "COM1"); // Default port is COM1.
BOOL read_scc(char* inputData, // read data from serial communication.
const unsigned int& sizeBuffer, // sizeBuffer is the size of pakcet that
unsigned long& length); // receive from serail port.
BOOL write_scc(LPCVOID data, // write data to serial communication
const unsigned int& sizeBuffer, // sizeBufer is the size of packet that
unsigned long& length); // want to send to serial port.
HANDLE getHandlePort(); // The entry point to get port's handle.
BOOL getStatusPort(); // The entry point to get port's staus.
private:
BOOL statusPort_; // port's status.
HANDLE handlePort_; // the object that is a instace of port.
DCB config_; // configuation of serial communication.
};
#endif //SERIAL_CTL_HPP
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?