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

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

?? serialportstream.cs

?? VC下面的竄口程序
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Text;
using System.Runtime.InteropServices;

namespace SerialPortDemo
{
	/// <summary>
	/// Summary description for SerialPortStream.
	/// </summary>
	public class SerialPortStream
	{	
		private const int INVALID_HANDLE_VALUE = -1;
		private const int GENERIC_READ = unchecked((int)0x80000000);
		private const int GENERIC_WRITE = 0x40000000;
		private const int OPEN_EXISTING = 3;

		/// <summary>
		/// What is the size of a byte? 7-bit bytes? 8-bit-bytes? Etc...
		/// </summary>
		public enum DATABITS
		{
			DATABITS_8 = 0x8,
			DATABITS_7 = 0x4,
			DATABITS_6 = 0x2,
			DATABITS_5 = 0x1
		};

		public enum STOPBITS
		{
			/// <summary>
			/// One stop bit.
			/// </summary>
			STOPBITS_1 = 0x1,
			/// <summary>
			/// Setting for 1.5 stop bits.
			/// </summary>
			STOPBITS_15 = 0x2,
			/// <summary>
			/// Two stop bits.
			/// </summary>
			STOPBITS_2 = 0x4
		};

		public enum PARITY
		{
			NONE	= 0,
			ODD		= 1,
			EVEN	= 2,
			MARK	= 3,
			SPACE	= 4
		};
		
		public enum BAUDRATE
		{
			BAUD_110 = 110,
			BAUD_300 = 300,
			BAUD_600 = 600,
			BAUD_1200 = 1200,
			BAUD_2400 = 2400,
			BAUD_4800 = 4800,
			BAUD_9600 = 9600,
			BAUD_14400 = 14400,
			BAUD_19200 = 19200,
			BAUD_38400 = 38400,
			BAUD_56000 = 56000,
			BAUD_57600 = 57600,
			BAUD_115200 = 115200,
			BAUD_128000 = 128000,
			BAUD_256000 = 256000
		};

		[Flags()]
		public enum PURGEFLAGS
		{
			TRANSMIT_CLEAR = 0x4,
			RECIEVE_CLEAR = 0x8
		};

		private int handle = INVALID_HANDLE_VALUE;
		private int port;									// comm port number
		private PARITY parity;								// port parity
		private DATABITS dataBits;							// data bits
		private STOPBITS stopBits;							// stop bits
		private BAUDRATE baudRate;							// port speed
		private int TransmitBufferSize = 512;				// default output buffer size
		private int RecieveBufferSize  = 512;				// default input buffer size
		private int CommunicationTimeout = 100;				// communication timeout (milliseconds)
		
		#region Serial_Port_Specific_Structs
		/// <summary>
		/// This structure defines the control setting for a serial communications device.
		/// </summary>
		private struct DCB
		{
			public int DCBlength;         // Specifies the DCB structure length, in bytes.
			public int BaudRate;          // Specifies the baud rate at which the communication device operates.
			public int Binary;           // Specifies if binary mode is enabled.
			public int ParityEnabled;           // Specifies if parity checking is enabled.
			public int OutxCtsFlow;      // Specifies if the CTS (clear-to-send) signal is monitored for output flow control.
			public int OutxDsrFlow;      // Specifies if the DSR (data-set-ready) signal is monitored for output flow control.
			public int DtrControl;       // Specifies the DTR (data-terminal-ready) flow control.
			public int DsrSensitivity;   // Specifies if the communications driver is sensitive to the state of the DSR signal.
			public int TXContinueOnXoff; // Specifies if transmission stops when the input buffer is full and the driver has transmitted the XoffChar character.
			public int OutX;             // Specifies if XON/XOFF flow control is used during transmission.
			public int InX;              // Specifies if XON/XOFF flow control is used during reception.
			public int ErrorCharEnabled;        // Specifies if bytes received with parity errors are replaced with the character specified by the ErrorChar member.
			public int Null;             // Specifies if null bytes are discarded.
			public int RtsControl;       // Specifies the RTS (request-to-send) flow control.
			public int AbortOnError;     // Specifies if read and write operations are terminated if an error occurs.
			public int Dummy2;           // Reserved; do not use.
			public Int16 Reserved;       // Not used; set to zero.
			public Int16 XonLim;          // Specifies the minimum number of bytes accepted in the input buffer before the XON character is sent.
			public Int16 XoffLim;         // Specifies the maximum number of bytes accepted in the input buffer before the XOFF character is sent.
			public byte ByteSize;         // Specifies the number of bits in the bytes transmitted and received.
			public byte ParityScheme;           // Specifies the parity scheme to be used.
			public byte StopBits;         // Specifies the number of stop bits to be used.
			public char XonChar;          // Specifies the value of the XON character for both transmission and reception.
			public char XoffChar;         // Specifies the value of the XOFF character for both transmission and reception.
			public char ErrorChar;        // Specifies the value of the character used to replace bytes received with a parity error.
			public char EofChar;          // Specifies the value of the character used to signal the end of data.
			public char EvtChar;          // Specifies the value of the character used to signal an event.
			public Int16 Reserved1;      // Reserved; do not use.
		}


		/// <summary>
		/// Structure to set the Serial Port Timeouts.
		/// </summary>
		private struct COMM_TIMEOUTS
		{												  // typedef struct _COMMTIMEOUTS { 
			public int ReadIntervalTimeout;             // Specifies the maximum acceptable time, in milliseconds, to elapse between the arrival of two characters on the communication line.
			public int ReadTotalTimeoutMultiplier;      // Specifies the multiplier, in milliseconds, used to calculate the total time-out period for read operations.
			public int ReadTotalTimeoutconstant;        // Specifies the constant, in milliseconds, used to calculate the total time-out period for read operations.
			public int WriteTotalTimeoutMultiplier;     // Specifies the multiplier, in milliseconds, used to calculate the total time-out period for write operations.
			public int WriteTotalTimeoutconstant;       // Specifies the constant, in milliseconds, used to calculate the total time-out period for write operations.
		}

		private class OVERLAPPED            // typedef struct _OVERLAPPED { 
		{
			public int Internal;			// Reserved for operating system use.
			public int InternalHigh;		// Reserved for operating system use.
			public int Offset;		        // Specifies a file position at which to start the transfer.
			public int OffsetHigh;			// Specifies the high word of the byte offset at which to start the transfer. 
			public int hEvent;		        // Handle to an event set to the signaled state when the operation has been completed.
		}

		#endregion

		
		#region coredll.dll helper functions

		/// <summary>
		/// This function fills in a device-control block (a DCB structure) with
		/// the current control settings for a specified communication device.
		/// </summary>
		/// <param name="handle">File Handle to the serial port device</param>
		/// <param name="deviceControlBlock">A Device Control Block to fill with the current settings.</param>
		/// <returns>Whether the call was successful or not.</returns>
		[DllImport ("coredll.dll")] 
		private static extern int GetCommState(int handle ,out DCB deviceControlBlock);			

		/// <summary>
		/// This function configures a communications device according to the
		/// specifications in a device-control block (a DCB structure). The
		/// function reinitializes all hardware and control settings, but it
		/// does not empty output or input queues
		/// </summary>
		/// <param name="handle">File Handle to the serial port device.</param>
		/// <param name="deviceControlBlock">A Device Control Block to with the new settings.</param>
		/// <returns>Whether the call was successful or not.</returns>
		[DllImport ("coredll.dll")] 
		private static extern int SetCommState(int handle, ref DCB deviceControlBlock);
	
		/// <summary>
		/// /// This function sets the time-out parameters for all read and write
		/// operations on a specified communications device.
		/// </summary>
		/// <param name="handle">File Handle to the serial port device.</param>
		/// <param name="CommTimeouts">COMM_TIMEOUTS structure with the new timeouts for the port.</param>
		/// <returns>Whether the call was successful or not</returns>
		[DllImport ("coredll.dll")] 
		private static extern int SetCommTimeouts(int handle, ref COMM_TIMEOUTS CommTimeouts);

		/// <summary>
		/// This function can discard all characters from the output or input
		/// buffer of a specified communications resource. It can also terminate
		/// pending read or write operations on the resource. 
		/// </summary>
		/// <param name="handle">Handle to the resource to purge.</param>
		/// <param name="purgeFlags">Purge Flags (i.e. Transmit, Recieve, Both)</param>
		/// <returns>Result integer.</returns>
		[DllImport ("coredll.dll")] 
		private static extern int PurgeComm(int handle, PURGEFLAGS purgeFlags);

		/// <summary>
		/// This function initializes the communications parameters for a
		/// specified communications device. 
		/// </summary>
		/// <param name="handle">The handle to the serial port.</param>
		/// <param name="dwInQueue">The Input Queue length</param>
		/// <param name="dwOutQueue">The Output Queue Length</param>
		/// <returns>HRESULT on wether SetupComm failed or succeeded.</returns>
		[DllImport ("coredll.dll")] 
		private static extern int SetupComm(int handle, int dwInQueue, int dwOutQueue);
		
		/// <summary>
		/// This function closes an open object handle
		/// </summary>
		/// <param name="handle">The handle to close</param>
		/// <returns>Whether the call succeeded or not.</returns>
		[DllImport ("coredll.dll")] 
		private static extern int CloseHandle(int handle);

		/// <summary>
		/// Creates a file.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲成av人在线观看导航| 亚洲第四色夜色| 亚洲精品一区二区精华| 欧美一区二区视频网站| 欧美日韩免费一区二区三区视频| 精品视频色一区| 欧美xxxx老人做受| 中文字幕一区二区不卡| 欧美三级蜜桃2在线观看| av电影天堂一区二区在线观看| 99精品视频在线播放观看| 欧美肥妇毛茸茸| 国产精品免费视频网站| 午夜精品免费在线| 成人在线视频首页| 福利一区二区在线观看| 日韩一区二区三区四区| 亚洲毛片av在线| 成人黄色在线看| 久久影院午夜论| 青椒成人免费视频| 欧美色综合影院| 亚洲欧美中日韩| 国产成人在线影院 | 日本一区二区高清| 另类专区欧美蜜桃臀第一页| 欧美日韩一二区| 在线观看91精品国产麻豆| 在线观看视频一区二区欧美日韩 | 99视频在线精品| 久久精品国产秦先生| 视频在线观看一区二区三区| 麻豆成人av在线| 91视频一区二区| 中文字幕精品一区二区精品绿巨人| 精品一区二区免费| 欧美一区二区三区视频免费播放| 亚洲欧洲精品一区二区精品久久久| 日韩国产欧美在线播放| 欧美主播一区二区三区| 国产拍揄自揄精品视频麻豆| 国产福利一区二区三区视频| 日韩三级免费观看| 美日韩一区二区三区| 欧美日韩在线观看一区二区| 亚洲图片欧美视频| 欧美视频中文一区二区三区在线观看| 中文字幕乱码日本亚洲一区二区| 99综合影院在线| 首页亚洲欧美制服丝腿| 4438x成人网最大色成网站| 国产成人午夜精品5599| 中文字幕一区在线观看| 欧美日韩在线亚洲一区蜜芽| 五月综合激情婷婷六月色窝| 国产亚洲成aⅴ人片在线观看| 91丨九色丨蝌蚪富婆spa| 日本欧美一区二区三区乱码 | 国产精品久线观看视频| 欧美一区二区三区视频| 国产久卡久卡久卡久卡视频精品| 久久综合久久综合久久综合| 色综合久久88色综合天天 | 中文字幕乱码久久午夜不卡 | 蜜臀久久99精品久久久久久9| 久久久国产午夜精品| 欧美日本韩国一区| 91亚洲精品乱码久久久久久蜜桃| 麻豆成人综合网| 亚洲国产欧美在线| 久久亚洲精华国产精华液 | 白白色 亚洲乱淫| 紧缚捆绑精品一区二区| 亚洲黄色片在线观看| 久久精品人人爽人人爽| 精品日韩在线观看| 欧美疯狂性受xxxxx喷水图片| 国产精品一区免费视频| 久久精品国产一区二区三| 亚洲一区二区三区不卡国产欧美| 亚洲精品日日夜夜| 成人免费视频免费观看| 制服丝袜亚洲色图| 午夜欧美2019年伦理| 粉嫩aⅴ一区二区三区四区五区| 欧美亚洲综合网| 日韩av一区二区在线影视| 欧美电影在哪看比较好| 日本成人在线电影网| 成人午夜激情片| 欧美亚洲动漫精品| 久久综合久久综合久久综合| 精品国产免费一区二区三区四区| 国产午夜久久久久| 亚洲国产精品一区二区久久| 精品一区二区三区免费毛片爱| 国产大陆a不卡| 宅男噜噜噜66一区二区66| 国产免费成人在线视频| 亚洲激情校园春色| 成人看片黄a免费看在线| 欧美一区二区三区四区久久| 中文字幕中文字幕一区| 免费成人你懂的| www.66久久| 日韩欧美一区二区久久婷婷| 国产精品私人影院| 美国十次综合导航| 欧美性大战久久| 国产情人综合久久777777| 午夜精品久久久久久久| 国产精品一级二级三级| 中文天堂在线一区| 日韩精品久久久久久| 国产美女在线精品| 欧美精品一二三区| 亚洲自拍与偷拍| 91网站最新地址| 欧美国产激情一区二区三区蜜月| 另类的小说在线视频另类成人小视频在线 | 97精品久久久久中文字幕| 1024成人网| 欧美亚洲日本国产| 六月丁香婷婷久久| 中文在线资源观看网站视频免费不卡| 日本vs亚洲vs韩国一区三区二区| 91精品国产综合久久国产大片| 秋霞影院一区二区| 欧美tickling网站挠脚心| 国产精品资源站在线| 久久久欧美精品sm网站| 韩国v欧美v日本v亚洲v| 久久久精品天堂| 91视频免费播放| 亚洲高清不卡在线| 精品国产123| 欧美丝袜丝交足nylons图片| 亚洲第一电影网| 欧美国产在线观看| 欧美日韩在线直播| 成人综合婷婷国产精品久久蜜臀| 亚洲精品大片www| 国产精品久久久久久久久搜平片| 欧美三级电影精品| 国产一区二区三区香蕉| 亚洲欧美自拍偷拍| 精品成人一区二区| 在线观看日韩高清av| 成人性色生活片| 国产精品一区二区久久不卡| 亚洲午夜免费福利视频| 一区二区三区中文字幕精品精品 | 综合色中文字幕| 国产欧美久久久精品影院| 日韩一卡二卡三卡四卡| 在线看国产日韩| 911国产精品| 3d成人动漫网站| 日韩一区二区麻豆国产| 久久久久久久久免费| 国产精品久久影院| 国产精品精品国产色婷婷| 中文字幕欧美一区| 婷婷六月综合网| 国产一区高清在线| 色综合天天天天做夜夜夜夜做| 在线亚洲+欧美+日本专区| 日本韩国一区二区三区视频| 欧美日韩国产影片| 亚洲国产成人一区二区三区| 《视频一区视频二区| 亚洲高清久久久| av在线免费不卡| 3d动漫精品啪啪1区2区免费| 国产精品美女一区二区在线观看| 亚洲高清免费视频| 国产成人av影院| 欧美另类久久久品| 亚洲综合一区二区三区| 白白色亚洲国产精品| 久久久国产午夜精品| 石原莉奈在线亚洲三区| 国产福利一区二区三区| 日韩视频免费观看高清在线视频| 中文字幕在线观看不卡| 成人精品视频一区二区三区尤物| 精品国产一区二区国模嫣然| 丝袜美腿亚洲一区| 欧美群妇大交群中文字幕| 一个色综合av| 欧美综合视频在线观看| 亚洲一区二区欧美日韩| 在线观看日韩毛片| 亚洲综合一区二区| 欧美日韩国产一区二区三区地区| 亚洲日本丝袜连裤袜办公室| 成人免费视频免费观看| 亚洲视频每日更新| 色婷婷综合激情| 日韩电影在线看|