亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? serial.h

?? serial port vc++ development class
?? H
字號:
//	Serial.h - Definition of the CSerial class
//
//	Copyright (C) 1999-2003 Ramon de Klein (Ramon.de.Klein@ict.nl)
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


#ifndef __SERIAL_H
#define __SERIAL_H


//////////////////////////////////////////////////////////////////////
// The SERIAL_DEFAULT_OVERLAPPED defines if the default open mode uses
// overlapped I/O. When overlapped I/O is available (normal Win32
// platforms) it uses overlapped I/O. Windows CE doesn't allow the use
// of overlapped I/O, so it is disabled there by default.

#ifndef SERIAL_DEFAULT_OVERLAPPED
#ifndef SERIAL_NO_OVERLAPPED
#define SERIAL_DEFAULT_OVERLAPPED	true
#else
#define SERIAL_DEFAULT_OVERLAPPED	false
#endif
#endif


//////////////////////////////////////////////////////////////////////
//
// CSerial - Win32 wrapper for serial communications
//
// Serial communication often causes a lot of problems. This class
// tries to supply an easy to use interface to deal with serial
// devices.
//
// The class is actually pretty ease to use. You only need to open
// the COM-port, where you need to specify the basic serial
// communication parameters. You can also choose to setup handshaking
// and read timeout behaviour.
//
// The following serial classes are available:
//
// CSerial      - Serial communication support.
// CSerialEx    - Serial communication with listener thread for events
// CSerialSync  - Serial communication with synchronized event handler
// CSerialWnd   - Asynchronous serial support, which uses the Win32
//                message queue for event notification.
// CSerialMFC   - Preferred class to use in MFC-based GUI windows.
// 
//
// Pros:
// -----
//	- Easy to use (hides a lot of nasty Win32 stuff)
//	- Fully ANSI and Unicode aware
//
// Cons:
// -----
//  - Little less flexibility then native Win32 API, however you can
//    use this API at the same time for features which are missing
//    from this class.
//  - Incompatible with Windows 95 or Windows NT v3.51 (or earlier),
//    because CancelIo isn't support on these platforms. Define the
//	  SERIAL_NO_CANCELIO macro for support of these platforms as
//	  well. When this macro is defined, then only time-out values of
//	  0 or INFINITE are valid.
//
//
// Copyright (C) 1999-2003 Ramon de Klein
//                         (Ramon.de.Klein@ict.nl)

class CSerial
{
// Class enumerations
public:
	// Communication event
	typedef enum
	{
		EEventUnknown  	   = -1,			// Unknown event
		EEventNone  	   = 0,				// Event trigged without cause
		EEventBreak 	   = EV_BREAK,		// A break was detected on input
		EEventCTS   	   = EV_CTS,		// The CTS signal changed state
		EEventDSR   	   = EV_DSR,		// The DSR signal changed state
		EEventError 	   = EV_ERR,		// A line-status error occurred
		EEventRing  	   = EV_RING,		// A ring indicator was detected
		EEventRLSD  	   = EV_RLSD,		// The RLSD signal changed state
		EEventRecv  	   = EV_RXCHAR,		// Data is received on input
		EEventRcvEv 	   = EV_RXFLAG,		// Event character was received on input
		EEventSend		   = EV_TXEMPTY,	// Last character on output was sent
		EEventPrinterError = EV_PERR,		// Printer error occured
		EEventRx80Full	   = EV_RX80FULL,	// Receive buffer is 80 percent full
		EEventProviderEvt1 = EV_EVENT1,		// Provider specific event 1
		EEventProviderEvt2 = EV_EVENT2,		// Provider specific event 2
	} 
	EEvent;

	// Baudrate
	typedef enum
	{
		EBaudUnknown = -1,			// Unknown
		EBaud110     = CBR_110,		// 110 bits/sec
		EBaud300     = CBR_300,		// 300 bits/sec
		EBaud600     = CBR_600,		// 600 bits/sec
		EBaud1200    = CBR_1200,	// 1200 bits/sec
		EBaud2400    = CBR_2400,	// 2400 bits/sec
		EBaud4800    = CBR_4800,	// 4800 bits/sec
		EBaud9600    = CBR_9600,	// 9600 bits/sec
		EBaud14400   = CBR_14400,	// 14400 bits/sec
		EBaud19200   = CBR_19200,	// 19200 bits/sec (default)
		EBaud38400   = CBR_38400,	// 38400 bits/sec
		EBaud56000   = CBR_56000,	// 56000 bits/sec
		EBaud57600   = CBR_57600,	// 57600 bits/sec
		EBaud115200  = CBR_115200,	// 115200 bits/sec
		EBaud128000  = CBR_128000,	// 128000 bits/sec
		EBaud256000  = CBR_256000,	// 256000 bits/sec
	}
	EBaudrate;

	// Data bits (5-8)
	typedef enum
	{
		EDataUnknown = -1,			// Unknown
		EData5       =  5,			// 5 bits per byte
		EData6       =  6,			// 6 bits per byte
		EData7       =  7,			// 7 bits per byte
		EData8       =  8			// 8 bits per byte (default)
	}
	EDataBits;

	// Parity scheme
	typedef enum
	{
		EParUnknown = -1,			// Unknown
		EParNone    = NOPARITY,		// No parity (default)
		EParOdd     = ODDPARITY,	// Odd parity
		EParEven    = EVENPARITY,	// Even parity
		EParMark    = MARKPARITY,	// Mark parity
		EParSpace   = SPACEPARITY	// Space parity
	}
	EParity;

	// Stop bits
	typedef enum
	{
		EStopUnknown = -1,			// Unknown
		EStop1       = ONESTOPBIT,	// 1 stopbit (default)
		EStop1_5     = ONE5STOPBITS,// 1.5 stopbit
		EStop2       = TWOSTOPBITS	// 2 stopbits
	} 
	EStopBits;

	// Handshaking
	typedef enum
	{
		EHandshakeUnknown		= -1,	// Unknown
		EHandshakeOff			=  0,	// No handshaking
		EHandshakeHardware		=  1,	// Hardware handshaking (RTS/CTS)
		EHandshakeSoftware		=  2	// Software handshaking (XON/XOFF)
	} 
	EHandshake;

	// Timeout settings
	typedef enum
	{
		EReadTimeoutUnknown		= -1,	// Unknown
		EReadTimeoutNonblocking	=  0,	// Always return immediately
		EReadTimeoutBlocking	=  1	// Block until everything is retrieved
	}
	EReadTimeout;

	// Communication errors
	typedef enum
	{
		EErrorUnknown = 0,			// Unknown
		EErrorBreak   = CE_BREAK,	// Break condition detected
		EErrorFrame   = CE_FRAME,	// Framing error
		EErrorIOE     = CE_IOE,		// I/O device error
		EErrorMode    = CE_MODE,	// Unsupported mode
		EErrorOverrun = CE_OVERRUN,	// Character buffer overrun, next byte is lost
		EErrorRxOver  = CE_RXOVER,	// Input buffer overflow, byte lost
		EErrorParity  = CE_RXPARITY,// Input parity error
		EErrorTxFull  = CE_TXFULL	// Output buffer full
	}
	EError;

	// Port availability
	typedef enum
	{
		EPortUnknownError = -1,		// Unknown error occurred
		EPortAvailable    =  0,		// Port is available
		EPortNotAvailable =  1,		// Port is not present
		EPortInUse        =  2		// Port is in use

	} 
	EPort;

// Construction
public:
	CSerial();
	virtual ~CSerial();

// Operations
public:
	// Check if particular COM-port is available (static method).
	static EPort CheckPort (LPCTSTR lpszDevice);

	// Open the serial communications for a particular COM port. You
	// need to use the full devicename (i.e. "COM1") to open the port.
	// It's possible to specify the size of the input/output queues.
	virtual LONG Open (LPCTSTR lpszDevice, DWORD dwInQueue = 0, DWORD dwOutQueue = 0, bool fOverlapped = SERIAL_DEFAULT_OVERLAPPED);

	// Close the serial port.
	virtual LONG Close (void);

	// Setup the communication settings such as baudrate, databits,
	// parity and stopbits. The default settings are applied when the
	// device has been opened. Call this function if these settings do
	// not apply for your application. If you prefer to use integers
	// instead of the enumerated types then just cast the integer to
	// the required type. So the following two initializations are
	// equivalent:
	//
	//   Setup(EBaud9600,EData8,EParNone,EStop1)
	//
	// or
	//
	//   Setup(EBaudrate(9600),EDataBits(8),EParity(NOPARITY),EStopBits(ONESTOPBIT))
	//
	// In the latter case, the types are not validated. So make sure
	// that you specify the appropriate values.
	virtual LONG Setup (EBaudrate eBaudrate = EBaud9600,
						EDataBits eDataBits = EData8,
						EParity   eParity   = EParNone,
						EStopBits eStopBits = EStop1);

	// Set/clear the event character. When this byte is being received
	// on the serial port then the EEventRcvEv event is signalled,
	// when the mask has been set appropriately. If the fAdjustMask flag
	// has been set, then the event mask is automatically adjusted.
	virtual LONG SetEventChar (BYTE bEventChar, bool fAdjustMask = true);

	// Set the event mask, which indicates what events should be
	// monitored. The WaitEvent method can only monitor events that
	// have been enabled. The default setting only monitors the
	// error events and data events. An application may choose to
	// monitor CTS. DSR, RLSD, etc as well.
	virtual LONG SetMask (DWORD dwMask = EEventBreak|EEventError|EEventRecv);

	// The WaitEvent method waits for one of the events that are
	// enabled (see SetMask).
	virtual LONG WaitEvent (LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);

	// Setup the handshaking protocol. There are three forms of
	// handshaking:
	//
	// 1) No handshaking, so data is always send even if the receiver
	//    cannot handle the data anymore. This can lead to data loss,
	//    when the sender is able to transmit data faster then the
	//    receiver can handle.
	// 2) Hardware handshaking, where the RTS/CTS lines are used to
	//    indicate if data can be sent. This mode requires that both
	//    ports and the cable support hardware handshaking. Hardware
	//    handshaking is the most reliable and efficient form of
	//    handshaking available, but is hardware dependant.
	// 3) Software handshaking, where the XON/XOFF characters are used
	//    to throttle the data. A major drawback of this method is that
	//    these characters cannot be used for data anymore.
	virtual LONG SetupHandshaking (EHandshake eHandshake);

	// Read operations can be blocking or non-blocking. You can use
	// this method to setup wether to use blocking or non-blocking
	// reads. Non-blocking reads is the default, which is required
	// for most applications.
	//
	// 1) Blocking reads, which will cause the 'Read' method to block
	//    until the requested number of bytes have been read. This is
	//    useful if you know how many data you will receive.
	// 2) Non-blocking reads, which will read as many bytes into your
	//    buffer and returns almost immediately. This is often the
	//    preferred setting.
	virtual LONG SetupReadTimeouts (EReadTimeout eReadTimeout);

	// Obtain communication settings
	virtual EBaudrate  GetBaudrate    (void);
	virtual EDataBits  GetDataBits    (void);
	virtual EParity    GetParity      (void);
	virtual EStopBits  GetStopBits    (void);
	virtual EHandshake GetHandshaking (void);
	virtual DWORD      GetEventMask   (void);
	virtual BYTE       GetEventChar   (void);

	// Write data to the serial port. Note that we are only able to
	// send ANSI strings, because it probably doesn't make sense to
	// transmit Unicode strings to an application.
	virtual LONG Write (const void* pData, size_t iLen, DWORD* pdwWritten = 0, LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);
	virtual LONG Write (LPCSTR pString, DWORD* pdwWritten = 0, LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);

	// Read data from the serial port. Refer to the description of
	// the 'SetupReadTimeouts' for an explanation about (non) blocking
	// reads and how to use this.
	virtual LONG Read (void* pData, size_t iLen, DWORD* pdwRead = 0, LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);

	// Send a break
	LONG Break (void);

	// Determine what caused the event to trigger
	EEvent GetEventType (void);

	// Obtain the error
	EError GetError (void);

	// Obtain the COMM and event handle
	HANDLE GetCommHandle (void)		{ return m_hFile; }

	// Check if com-port is opened
	bool IsOpen (void) const		{ return (m_hFile != 0); }

	// Obtain last error status
	LONG GetLastError (void) const	{ return m_lLastError; }

	// Obtain CTS/DSR/RING/RLSD settings
	bool GetCTS (void);
	bool GetDSR (void);
	bool GetRing (void);
	bool GetRLSD (void);

	// Purge all buffers
	LONG Purge (void);

protected:
	// Internal helper class which wraps DCB structure
	class CDCB : public DCB
	{
	public:
		CDCB() { DCBlength = sizeof(DCB); }
	};

// Attributes
protected:
	LONG	m_lLastError;		// Last serial error
	HANDLE	m_hFile;			// File handle
	EEvent	m_eEvent;			// Event type
	DWORD	m_dwEventMask;		// Event mask

#ifndef SERIAL_NO_OVERLAPPED
	HANDLE	m_hevtOverlapped;	// Event handle for internal overlapped operations
#endif

protected:
	// Check the requirements
	void CheckRequirements (LPOVERLAPPED lpOverlapped, DWORD dwTimeout) const;

	// CancelIo wrapper (for Win95 compatibility)
	BOOL CancelCommIo (void);
};

#endif	// __SERIAL_H

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类小说欧美激情| 欧美伦理影视网| 色94色欧美sute亚洲线路二| 成人免费看的视频| 国产91精品精华液一区二区三区 | 久久久99免费| 欧美第一区第二区| 精品国产伦理网| 欧美激情中文字幕一区二区| 中文字幕亚洲一区二区av在线 | 欧美一区二区在线播放| 欧美色国产精品| 精品国产乱码久久久久久浪潮 | 欧美视频一区二区三区在线观看| 91福利视频在线| 99国产精品国产精品久久| 日韩一区二区精品| 一区二区在线观看免费| 亚洲天堂精品视频| 国产美女视频91| 欧美一区二区三区视频免费| 伊人一区二区三区| 成人一区二区三区视频在线观看| 在线观看欧美精品| 99久久国产免费看| 成人久久久精品乱码一区二区三区| 日韩国产欧美一区二区三区| 久久se这里有精品| 99免费精品在线观看| 亚洲免费av高清| 亚洲丝袜另类动漫二区| 欧美酷刑日本凌虐凌虐| 国产最新精品免费| 亚洲一区精品在线| 国产夜色精品一区二区av| 欧美性猛片aaaaaaa做受| 极品销魂美女一区二区三区| 亚洲少妇30p| 精品国产99国产精品| 91精品福利在线| 精品一区二区三区蜜桃| 亚洲午夜一区二区三区| 久久天天做天天爱综合色| 色婷婷av久久久久久久| 国模大尺度一区二区三区| 亚洲一卡二卡三卡四卡| 国产精品免费久久久久| 日韩欧美综合在线| 欧美日韩成人一区二区| 9l国产精品久久久久麻豆| 精品在线你懂的| 婷婷国产v国产偷v亚洲高清| 亚洲日本成人在线观看| 久久久久国产成人精品亚洲午夜| 欧美剧在线免费观看网站| 97成人超碰视| 高清久久久久久| 麻豆成人久久精品二区三区红| 亚洲一区视频在线| 亚洲另类在线制服丝袜| 国产偷v国产偷v亚洲高清| 精品乱人伦一区二区三区| 欧美三区在线观看| 91高清在线观看| 色综合久久中文字幕| 成人爽a毛片一区二区免费| 国产乱妇无码大片在线观看| 久88久久88久久久| 蜜臀久久99精品久久久久宅男| 亚洲一二三四在线观看| 亚洲综合图片区| 亚洲国产一区二区在线播放| 亚洲激情自拍视频| 亚洲精品国产精华液| 亚洲精品成人精品456| 亚洲激情成人在线| 亚洲综合男人的天堂| 亚洲国产一区视频| 日韩黄色免费电影| 男女男精品视频| 国产在线精品一区二区| 国产精品123| 不卡电影一区二区三区| av男人天堂一区| 91蜜桃在线观看| 91福利区一区二区三区| 欧美在线播放高清精品| 91精品国产一区二区三区香蕉| 欧美一级专区免费大片| 国产亚洲短视频| 日韩美女视频一区二区| 亚洲电影一区二区| 精品一区二区在线视频| 国产99久久久国产精品潘金网站| 99精品国产99久久久久久白柏| 色噜噜偷拍精品综合在线| 欧美色图免费看| 日韩欧美精品三级| 五月天一区二区三区| 国内偷窥港台综合视频在线播放| 成人看片黄a免费看在线| 91美女视频网站| 欧美一卡二卡三卡四卡| 国产亚洲综合性久久久影院| 亚洲精品你懂的| 欧美aⅴ一区二区三区视频| 国产不卡视频一区二区三区| 一本一道波多野结衣一区二区| 欧美精选午夜久久久乱码6080| 精品少妇一区二区三区在线视频| 国产精品美女久久久久高潮| 亚洲最新在线观看| 激情偷乱视频一区二区三区| proumb性欧美在线观看| 制服丝袜激情欧洲亚洲| 亚洲国产精品激情在线观看| 亚洲成人一二三| 粉嫩aⅴ一区二区三区四区五区| 99久久伊人网影院| 欧美一级高清大全免费观看| 国产精品美女一区二区三区| 日韩精彩视频在线观看| 91在线你懂得| 亚洲精品一区二区三区福利| 一区二区三区四区中文字幕| 久久成人av少妇免费| 日本精品视频一区二区三区| 精品国产乱码久久久久久夜甘婷婷| 亚洲日韩欧美一区二区在线| 国模大尺度一区二区三区| 欧美性猛交xxxx黑人交| 国产日产欧美一区二区视频| 五月天婷婷综合| www.视频一区| 精品日本一线二线三线不卡| 亚洲一级片在线观看| 成人av网址在线| 精品成人在线观看| 欧美a级一区二区| 欧美日韩aaa| 一区二区三区美女| 成人福利视频网站| 久久午夜免费电影| 青青草原综合久久大伊人精品| 91小宝寻花一区二区三区| 精品国产一区二区国模嫣然| 亚洲第四色夜色| 在线观看日韩高清av| 中文字幕制服丝袜一区二区三区| 久久成人久久爱| 日韩欧美国产三级| 视频一区欧美日韩| 欧美日韩亚洲国产综合| 亚洲一区二区三区影院| 色综合久久中文字幕| 中文字幕欧美一| proumb性欧美在线观看| 国产精品九色蝌蚪自拍| 成人免费毛片高清视频| 国产精品视频看| 99在线视频精品| 亚洲美女免费视频| 欧美在线观看视频在线| 亚洲一区二区三区自拍| 欧美视频精品在线观看| 亚洲靠逼com| 欧美色中文字幕| 偷窥少妇高潮呻吟av久久免费| 欧美午夜精品一区二区三区| 亚洲成人自拍一区| 91精品国产高清一区二区三区| 五月天一区二区三区| 91麻豆精品国产自产在线| 久久精品国产亚洲一区二区三区| 日韩一区二区三区观看| 色悠悠久久综合| 亚洲自拍偷拍图区| 91麻豆精品国产| 国产综合色在线视频区| 日本一区免费视频| 97aⅴ精品视频一二三区| 亚洲人成亚洲人成在线观看图片| 色综合天天综合色综合av| 亚洲成av人片在线观看| 日韩视频国产视频| 国产乱国产乱300精品| 国产精品欧美一级免费| 日本电影亚洲天堂一区| 日韩1区2区日韩1区2区| 精品国产一区二区三区不卡| 成人免费的视频| 一区二区三区高清在线| 欧美一区二区视频在线观看2022| 国产在线麻豆精品观看| 国产精品乱码一区二三区小蝌蚪| 欧美综合天天夜夜久久| 日本不卡一区二区| 欧美国产在线观看| 欧美在线观看一二区| 韩国一区二区在线观看|