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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? serial.h

?? 這是一個(gè)串口調(diào)試程序,帶有源代碼的,還是比較好用的.
?? H
字號(hào):
//	Serial.h - Definition of the CSerial class
//
//	Copyright (C) 1999-2001 Ramon de Klein (R.de.Klein@iaf.nl)
//
// This program is free software; you can redistribute it and/ormodify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


#ifndef __SERIAL_H
#define __SERIAL_H


//////////////////////////////////////////////////////////////////////
//
// 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.
// CSerialWnd   - Asynchronous serial support, which uses the Win32
//                message queue for event notification. This is often
//                preferred in GUI applications.
// CSerialMFC   - Preferred class to use in MFC-based GUI threads.
// 
//
// 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.
//
//
// Copyright (C) 1999-2001 Ramon de Klein
//                         (R.de.Klein@iaf.nl)

class CSerial
{
// Class enumerations
public:
	// Communication event
	typedef enum
	{
		EEventNone  = -1,			// 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
	} 
	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 pareticular COM-port is available.
	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 = 2048, DWORD dwOutQueue = 2048);

	// 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);

	// 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);

	// Flush all buffers
	LONG Flush (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
	HANDLE	m_hevtOverlapped;	// Event handle for internal overlapped operations
};

#endif	// __SERIAL_H

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产电影一区在线| 成人国产一区二区三区精品| 日本午夜精品视频在线观看| 日本美女视频一区二区| 视频一区视频二区中文字幕| 日韩一区欧美二区| 国产麻豆精品久久一二三| 国产不卡视频一区二区三区| 一本到不卡免费一区二区| 欧美日韩亚州综合| 精品久久久久久久久久久久久久久久久 | 成人美女视频在线观看18| 91影院在线免费观看| 欧美精品九九99久久| 中文字幕欧美激情一区| 亚洲影院久久精品| 国产98色在线|日韩| 欧美性做爰猛烈叫床潮| 久久久精品国产99久久精品芒果| 综合色天天鬼久久鬼色| 日韩在线卡一卡二| a在线欧美一区| 精品国产乱码久久久久久1区2区| 成人免费在线视频| 精品一二三四在线| 欧美日韩免费观看一区二区三区| 国产亚洲va综合人人澡精品| 亚洲va国产天堂va久久en| 成人h版在线观看| 久久综合狠狠综合久久综合88 | 欧美肥妇bbw| 亚洲图片激情小说| 狠狠色伊人亚洲综合成人| 精品人在线二区三区| 亚洲精品一二三| 成人激情开心网| 久久久精品国产免大香伊 | 亚洲激情中文1区| 成人免费视频一区| 国产日韩av一区| 国产老女人精品毛片久久| 精品久久久三级丝袜| 激情综合网最新| 精品久久久久久久久久久院品网 | 精品国精品自拍自在线| 日韩一区二区视频在线观看| 精品女同一区二区| 国产精品久久久久久久久图文区 | 久久福利资源站| 欧美精品一级二级三级| 亚洲电影视频在线| 欧美性猛片xxxx免费看久爱| 亚洲国产视频a| 91精品国产91久久久久久一区二区 | 国产日产精品1区| 成人精品一区二区三区四区| 69堂亚洲精品首页| 亚洲欧美一区二区视频| 在线观看国产一区二区| 国产精品福利av| 成人动漫中文字幕| 亚洲国产精品久久人人爱蜜臀 | 精品一区二区三区影院在线午夜| 精品国产亚洲在线| 大胆亚洲人体视频| 亚洲国产精品久久人人爱| 精品毛片乱码1区2区3区| 国产精品一品二品| 亚洲资源中文字幕| 精品乱人伦小说| 成人avav在线| 日日夜夜免费精品| 国产精品不卡一区| 7777精品伊人久久久大香线蕉的| 久久99精品视频| 亚洲一区二区免费视频| 久久伊99综合婷婷久久伊| av激情成人网| 国模套图日韩精品一区二区 | 色噜噜夜夜夜综合网| 久久99精品久久久久久国产越南| 国产精品对白交换视频| 欧美一级xxx| 欧美日韩一区二区三区在线| 韩日精品视频一区| 亚洲成人av资源| 欧美激情在线免费观看| 欧美成人午夜电影| 欧美肥胖老妇做爰| 欧洲中文字幕精品| 丁香啪啪综合成人亚洲小说 | 欧美在线不卡视频| 日本欧美在线观看| 亚洲精品久久久久久国产精华液| 欧美一区二区三区日韩视频| 久久66热re国产| 午夜欧美一区二区三区在线播放| 国产亚洲精品精华液| 日韩欧美在线影院| 欧美日韩国产区一| 在线亚洲高清视频| www.视频一区| 成人综合婷婷国产精品久久免费| 免费观看在线综合色| 五月激情丁香一区二区三区| 国产精品久久久一本精品| 久久综合色播五月| 日韩一区二区高清| 91精品黄色片免费大全| 欧美色倩网站大全免费| 色综合一个色综合亚洲| 色综合久久六月婷婷中文字幕| 国产a久久麻豆| bt欧美亚洲午夜电影天堂| jizzjizzjizz欧美| 99久久婷婷国产综合精品电影 | 色哟哟一区二区在线观看| 国产99一区视频免费| 国产一区二区三区免费观看| 国产成人av一区| 精品免费日韩av| 在线观看一区日韩| 色综合久久综合网97色综合| 一本到不卡免费一区二区| 制服视频三区第一页精品| 精品国产91亚洲一区二区三区婷婷| 国产精品久久国产精麻豆99网站| 综合欧美亚洲日本| 亚洲精品国产无天堂网2021| 亚洲天堂a在线| 成人欧美一区二区三区| 水蜜桃久久夜色精品一区的特点| 日韩av在线发布| 99精品国产99久久久久久白柏| 日本高清不卡一区| 久久久久国产精品免费免费搜索| 亚洲视频在线一区| 久色婷婷小香蕉久久| 99精品欧美一区二区蜜桃免费| 91麻豆精品国产自产在线观看一区| www国产精品av| 五月婷婷久久丁香| 成人黄色av电影| 久久久欧美精品sm网站| 亚洲人妖av一区二区| 狠狠色丁香久久婷婷综合丁香| www.久久精品| 国产亚洲综合性久久久影院| 亚洲成a人片在线观看中文| 成人一区二区视频| 精品国产91洋老外米糕| 蜜桃av一区二区| 欧美日韩一区二区三区四区五区| 国产精品对白交换视频| 国产99久久久国产精品潘金网站| 91精品国产综合久久久久| 亚洲一区二区在线免费观看视频| 成人国产精品免费观看视频| 久久久久久夜精品精品免费| 日韩中文字幕亚洲一区二区va在线| 91福利视频久久久久| 亚洲美腿欧美偷拍| 色综合久久99| 亚洲成人av福利| 欧美精品丝袜久久久中文字幕| 中文字幕不卡在线播放| 成人激情图片网| 悠悠色在线精品| 欧美日韩一区二区三区四区| 五月天久久比比资源色| 欧美精品电影在线播放| 理论电影国产精品| 欧美一区二区三区思思人| 久久国产夜色精品鲁鲁99| 日韩欧美国产一区二区三区| 老汉av免费一区二区三区| 91精品国产一区二区三区蜜臀| 午夜久久久久久久久| 精品国产凹凸成av人网站| 国产一区二区看久久| 国产精品国产三级国产普通话三级| 不卡视频一二三| 午夜欧美视频在线观看| 久久亚区不卡日本| 91网页版在线| 亚洲一二三四在线| www欧美成人18+| 日本韩国精品在线| 久久99精品久久久久久动态图| 久久久精品免费免费| 欧美日韩成人在线| 成人动漫一区二区三区| 蜜臀a∨国产成人精品| 国产精品国产精品国产专区不片| 欧美卡1卡2卡| 99久久久久免费精品国产| 奇米888四色在线精品| 亚洲免费三区一区二区| 欧美电视剧免费观看| 欧美视频在线一区|