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

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

?? serial.h

?? 不用控制器,對讀卡頭進行讀寫.可設置根據讀卡器類型不同而進行長度的設置
?? 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一区二区三区免费野_久草精品视频
国产一区二区三区视频在线播放 | 亚洲一级在线观看| av不卡免费在线观看| 亚洲国产岛国毛片在线| 成人av在线播放网站| 国产精品乱码一区二区三区软件| 成人午夜免费电影| 亚洲丝袜美腿综合| 欧美日韩国产免费一区二区 | 日韩成人av影视| 欧美r级电影在线观看| 国产最新精品精品你懂的| 中文字幕电影一区| 欧美视频一区在线| 裸体一区二区三区| 国产精品美女久久久久久久网站| 91麻豆国产精品久久| 日韩avvvv在线播放| 精品久久久久一区| 91美女片黄在线观看| 日韩国产在线一| 久久精品视频网| 欧美日韩激情在线| 国产成人亚洲综合a∨猫咪| 亚洲欧美电影院| 日韩精品一区二| www.色精品| 麻豆精品新av中文字幕| 国产精品高潮久久久久无| 欧美日韩国产123区| 福利视频网站一区二区三区| 一级日本不卡的影视| 欧美videossexotv100| 99精品国产99久久久久久白柏| 无码av免费一区二区三区试看 | 日本一区二区综合亚洲| 在线精品视频免费观看| 国产在线国偷精品产拍免费yy| 亚洲男人的天堂一区二区| 欧美成人官网二区| 色天使色偷偷av一区二区| 麻豆91免费观看| 一区二区三区在线观看网站| 精品国产凹凸成av人网站| 欧美午夜在线一二页| 成人午夜电影网站| 麻豆91在线观看| 五月天久久比比资源色| 伊人婷婷欧美激情| 国产欧美日韩在线观看| 制服丝袜亚洲播放| 欧美在线看片a免费观看| 粉嫩aⅴ一区二区三区四区| 麻豆91精品视频| 日韩精品一二三| 亚洲精品你懂的| 综合欧美一区二区三区| 久久天堂av综合合色蜜桃网| 欧美日韩一级片在线观看| 一本大道av伊人久久综合| 国产成人免费视| 国产精品一区二区三区乱码| 日本91福利区| 青青草精品视频| 丝袜美腿亚洲综合| 视频一区视频二区在线观看| 一片黄亚洲嫩模| 亚洲妇女屁股眼交7| 一区二区日韩av| 亚洲欧美日韩一区二区 | 色屁屁一区二区| 91亚洲精品一区二区乱码| 成人性生交大片免费看中文| 国产精品一区二区在线观看网站| 精品亚洲国产成人av制服丝袜| 日韩激情一二三区| 日韩影院在线观看| 美腿丝袜在线亚洲一区| 麻豆精品一区二区| 国模一区二区三区白浆| 国产一区二区电影| 国产裸体歌舞团一区二区| 国产黑丝在线一区二区三区| 国产成人午夜精品5599| 成人美女在线观看| eeuss影院一区二区三区| 99久久久久久| 欧美视频在线一区二区三区 | 久久精品久久久精品美女| 蜜桃av一区二区三区| 国产在线看一区| www.成人网.com| 色哟哟国产精品| 欧美日韩在线播放三区四区| 3d成人动漫网站| 日韩欧美在线网站| 国产肉丝袜一区二区| 综合欧美亚洲日本| 亚洲v中文字幕| 狠狠狠色丁香婷婷综合激情| 国产激情一区二区三区四区 | 91玉足脚交白嫩脚丫在线播放| 欧美在线你懂的| 精品成人佐山爱一区二区| 国产精品久久久久久久久搜平片| 亚洲欧美偷拍卡通变态| 美女高潮久久久| 成人97人人超碰人人99| 欧美日韩国产综合视频在线观看 | 国产精品三级在线观看| 亚洲视频在线一区| 蜜臀a∨国产成人精品| av影院午夜一区| 欧美一卡二卡在线观看| 国产精品不卡一区| 日本不卡在线视频| www.色综合.com| 日韩色视频在线观看| 1区2区3区精品视频| 麻豆精品精品国产自在97香蕉| 99久久精品一区二区| 欧美sm极限捆绑bd| 亚洲国产成人av网| 国产精品一线二线三线精华| 欧美亚洲高清一区二区三区不卡| 精品国产91洋老外米糕| 亚洲一区视频在线观看视频| 国产精品资源在线观看| 欧美日韩久久不卡| 亚洲欧洲日韩综合一区二区| 日韩电影免费一区| 91香蕉视频mp4| 久久视频一区二区| 婷婷国产v国产偷v亚洲高清| 99re这里只有精品首页| 精品不卡在线视频| 日韩福利视频网| 91久久线看在观草草青青| 国产欧美视频在线观看| 极品少妇xxxx偷拍精品少妇| 欧美日韩一区久久| 一区二区三区成人在线视频| 国产jizzjizz一区二区| 亚洲精品一区二区三区蜜桃下载 | 老司机精品视频一区二区三区| 一本大道久久a久久综合| 国产精品美女久久福利网站| 免费观看在线综合| 91精品国产综合久久精品图片| 日韩一区欧美小说| 国产麻豆一精品一av一免费| 3d动漫精品啪啪一区二区竹菊| 亚洲午夜私人影院| 色噜噜狠狠成人中文综合| 亚洲欧洲av在线| 成人高清视频免费观看| 久久久www免费人成精品| 美女网站色91| 欧美一级黄色大片| 视频精品一区二区| 91麻豆精品91久久久久同性| 亚洲成人一区二区在线观看| 日本精品一级二级| 亚洲综合视频网| 欧美视频你懂的| 亚洲成av人片一区二区三区| 欧洲一区二区三区在线| 亚洲一区二区精品久久av| 91精品福利视频| 亚洲123区在线观看| 欧美日韩国产一级片| 青娱乐精品在线视频| 欧美一区二区国产| 国产麻豆精品95视频| 国产精品久久三| 91在线丨porny丨国产| 亚洲欧美日韩综合aⅴ视频| 91国产视频在线观看| 亚洲成人免费视频| 在线播放国产精品二区一二区四区 | 色综合久久九月婷婷色综合| 亚洲三级久久久| 欧美日韩国产小视频在线观看| 日日夜夜精品视频免费| 欧美一区二区三区四区久久| 麻豆精品一区二区综合av| 国产午夜亚洲精品理论片色戒| 国产精品影视在线| 最新中文字幕一区二区三区| 91国产成人在线| 美女视频一区在线观看| 国产亚洲精品精华液| 国产精品一区二区三区网站| 亚洲欧美激情插| 日韩欧美专区在线| 成人午夜视频网站| 午夜精品123| 2020日本不卡一区二区视频| 97精品视频在线观看自产线路二| 亚洲成人免费影院|