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

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

?? rs232.vb

?? 在vb.net 中如何使用計(jì)算機(jī)的串口
?? VB
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
Option Strict On

Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports System.ComponentModel
Imports System.IO

' This class provides all the necessary support for communicating
'   with the Comm Port (otherwise known as the Serial Port, or 
'   RS232 port).
Public Class Rs232
    ' Declare the necessary class variables, and their initial values.		
    Private mhRS As Integer = -1   ' Handle to Com Port									
    Private miPort As Integer = 1   ' Default is COM1	
    Private miTimeout As Integer = 70   ' Timeout in ms
    Private miBaudRate As Integer = 9600
    Private meParity As DataParity = 0
    Private meStopBit As DataStopBit = 0
    Private miDataBit As Integer = 8
    Private miBufferSize As Integer = 512   ' Buffers size default to 512 bytes
    Private mabtRxBuf As Byte()   ' Receive buffer	
    Private meMode As Mode  ' Class working mode	
    Private mbWaitOnRead As Boolean
    Private mbWaitOnWrite As Boolean
    Private mbWriteErr As Boolean
    Private muOverlapped As OVERLAPPED
    Private muOverlappedW As OVERLAPPED
    Private muOverlappedE As OVERLAPPED
    Private mabtTmpTxBuf As Byte()  ' Temporary buffer used by Async Tx
    Private moThreadTx As Thread
    Private moThreadRx As Thread
    Private miTmpBytes2Read As Integer
    Private meMask As EventMasks

#Region "Enums"

    ' This enumeration provides Data Parity values.
    Public Enum DataParity
        Parity_None = 0
        Pariti_Odd
        Parity_Even
        Parity_Mark
    End Enum

    ' This enumeration provides Data Stop Bit values.
    '   It is set to begin with a one, so that the enumeration values
    '   match the actual values.
    Public Enum DataStopBit
        StopBit_1 = 1
        StopBit_2
    End Enum

    ' This enumeration contains values used to purge the various buffers.
    Private Enum PurgeBuffers
        RXAbort = &H2
        RXClear = &H8
        TxAbort = &H1
        TxClear = &H4
    End Enum

    ' This enumeration provides values for the lines sent to the Comm Port
    Private Enum Lines
        SetRts = 3
        ClearRts = 4
        SetDtr = 5
        ClearDtr = 6
        ResetDev = 7   '	 Reset device if possible
        SetBreak = 8   '	 Set the device break line.
        ClearBreak = 9   '	 Clear the device break line.
    End Enum
    ' This enumeration provides values for the Modem Status, since
    '   we'll be communicating primarily with a modem.
    ' Note that the Flags() attribute is set to allow for a bitwise
    '   combination of values.
    <Flags()> Public Enum ModemStatusBits
        ClearToSendOn = &H10
        DataSetReadyOn = &H20
        RingIndicatorOn = &H40
        CarrierDetect = &H80
    End Enum

    ' This enumeration provides values for the Working mode
    Public Enum Mode
        NonOverlapped
        Overlapped
    End Enum

    ' This enumeration provides values for the Comm Masks used.
    ' Note that the Flags() attribute is set to allow for a bitwise
    '   combination of values.
    <Flags()> Public Enum EventMasks
        RxChar = &H1
        RXFlag = &H2
        TxBufferEmpty = &H4
        ClearToSend = &H8
        DataSetReady = &H10
        ReceiveLine = &H20
        Break = &H40
        StatusError = &H80
        Ring = &H100
    End Enum
#End Region

#Region "Structures"
    ' This is the DCB structure used by the calls to the Windows API.
    <StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure DCB
        Public DCBlength As Integer
        Public BaudRate As Integer
        Public Bits1 As Integer
        Public wReserved As Int16
        Public XonLim As Int16
        Public XoffLim As Int16
        Public ByteSize As Byte
        Public Parity As Byte
        Public StopBits As Byte
        Public XonChar As Byte
        Public XoffChar As Byte
        Public ErrorChar As Byte
        Public EofChar As Byte
        Public EvtChar As Byte
        Public wReserved2 As Int16
    End Structure

    ' This is the CommTimeOuts structure used by the calls to the Windows API.
    <StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure COMMTIMEOUTS
        Public ReadIntervalTimeout As Integer
        Public ReadTotalTimeoutMultiplier As Integer
        Public ReadTotalTimeoutConstant As Integer
        Public WriteTotalTimeoutMultiplier As Integer
        Public WriteTotalTimeoutConstant As Integer
    End Structure

    ' This is the CommConfig structure used by the calls to the Windows API.
    <StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure COMMCONFIG
        Public dwSize As Integer
        Public wVersion As Int16
        Public wReserved As Int16
        Public dcbx As DCB
        Public dwProviderSubType As Integer
        Public dwProviderOffset As Integer
        Public dwProviderSize As Integer
        Public wcProviderData As Byte
    End Structure

    ' This is the OverLapped structure used by the calls to the Windows API.
    <StructLayout(LayoutKind.Sequential, Pack:=1)> Public Structure OVERLAPPED
        Public Internal As Integer
        Public InternalHigh As Integer
        Public Offset As Integer
        Public OffsetHigh As Integer
        Public hEvent As Integer
    End Structure
#End Region

#Region "Exceptions"

    ' This class defines a customized channel exception. This exception is
    '   raised when a NACK is raised.
    Public Class CIOChannelException : Inherits ApplicationException
        Sub New(ByVal Message As String)
            MyBase.New(Message)
        End Sub
        Sub New(ByVal Message As String, ByVal InnerException As Exception)
            MyBase.New(Message, InnerException)
        End Sub
    End Class

    ' This class defines a customized timeout exception.
    Public Class IOTimeoutException : Inherits CIOChannelException
        Sub New(ByVal Message As String)
            MyBase.New(Message)
        End Sub
        Sub New(ByVal Message As String, ByVal InnerException As Exception)
            MyBase.New(Message, InnerException)
        End Sub
    End Class

#End Region

#Region "Events"
    ' These events allow the program using this class to react to Comm Port
    '   events.
    Public Event DataReceived(ByVal Source As Rs232, ByVal DataBuffer() As Byte)
    Public Event TxCompleted(ByVal Source As Rs232)
    Public Event CommEvent(ByVal Source As Rs232, ByVal Mask As EventMasks)
#End Region

#Region "Constants"
    ' These constants are used to make the code clearer.
    Private Const PURGE_RXABORT As Integer = &H2
    Private Const PURGE_RXCLEAR As Integer = &H8
    Private Const PURGE_TXABORT As Integer = &H1
    Private Const PURGE_TXCLEAR As Integer = &H4
    Private Const GENERIC_READ As Integer = &H80000000
    Private Const GENERIC_WRITE As Integer = &H40000000
    Private Const OPEN_EXISTING As Integer = 3
    Private Const INVALID_HANDLE_VALUE As Integer = -1
    Private Const IO_BUFFER_SIZE As Integer = 1024
    Private Const FILE_FLAG_OVERLAPPED As Integer = &H40000000
    Private Const ERROR_IO_PENDING As Integer = 997
    Private Const WAIT_OBJECT_0 As Integer = 0
    Private Const ERROR_IO_INCOMPLETE As Integer = 996
    Private Const WAIT_TIMEOUT As Integer = &H102&
    Private Const INFINITE As Integer = &HFFFFFFFF


#End Region

#Region "Properties"

    ' This property gets or sets the BaudRate
    Public Property BaudRate() As Integer
        Get
            Return miBaudRate
        End Get
        Set(ByVal Value As Integer)
            miBaudRate = Value
        End Set
    End Property

    ' This property gets or sets the BufferSize
    Public Property BufferSize() As Integer
        Get
            Return miBufferSize
        End Get
        Set(ByVal Value As Integer)
            miBufferSize = Value
        End Set
    End Property

    ' This property gets or sets the DataBit.
    Public Property DataBit() As Integer
        Get
            Return miDataBit
        End Get
        Set(ByVal Value As Integer)
            miDataBit = Value
        End Set
    End Property

    ' This write-only property sets or resets the DTR line.
    Public WriteOnly Property Dtr() As Boolean
        Set(ByVal Value As Boolean)
            If Not mhRS = -1 Then
                If Value Then
                    EscapeCommFunction(mhRS, Lines.SetDtr)
                Else
                    EscapeCommFunction(mhRS, Lines.ClearDtr)
                End If
            End If
        End Set
    End Property

    ' This read-only property returns an array of bytes that represents
    '   the input coming into the Comm Port.
    Overridable ReadOnly Property InputStream() As Byte()
        Get
            Return mabtRxBuf
        End Get
    End Property

    ' This read-only property returns a string that represents
    '   the data coming into to the Comm Port.
    Overridable ReadOnly Property InputStreamString() As String
        Get
            Dim oEncoder As New System.Text.ASCIIEncoding
            Return oEncoder.GetString(Me.InputStream)
        End Get
    End Property

    ' This property returns the open status of the Comm Port.
    ReadOnly Property IsOpen() As Boolean
        Get
            Return CBool(mhRS <> -1)
        End Get
    End Property

    ' This read-only property returns the status of the modem.
    Public ReadOnly Property ModemStatus() As ModemStatusBits
        Get
            If mhRS = -1 Then
                Throw New ApplicationException("Please initialize and open " + _
                    "port before using this method")

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线不卡欧美精品一区二区三区| 在线视频观看一区| 亚洲欧美色综合| 欧美一二三区在线观看| 91美女蜜桃在线| 精品一区二区影视| 亚洲精品水蜜桃| 久久久蜜臀国产一区二区| 在线视频国内自拍亚洲视频| 国产很黄免费观看久久| 午夜av区久久| 亚洲天堂2016| 国产日产精品1区| 欧美一区二区三区视频在线观看| 波多野结衣中文字幕一区 | 午夜精品久久久久久久久久久 | 国内精品国产成人| 亚洲永久精品国产| 亚洲欧洲在线观看av| 亚洲视频中文字幕| 精品国精品自拍自在线| 欧美日韩一区二区在线观看 | 精品国产伦一区二区三区观看方式| 日本高清不卡aⅴ免费网站| 国产精品99久久久久久有的能看 | 国产精品亚洲第一区在线暖暖韩国 | 麻豆成人综合网| 亚洲成人av电影| 亚洲一卡二卡三卡四卡五卡| 亚洲人成7777| 中文av一区特黄| 国产三级精品三级| 久久一夜天堂av一区二区三区 | 久久九九影视网| 久久综合资源网| 精品国产伦一区二区三区观看体验 | av中文字幕不卡| 国产成都精品91一区二区三| 激情图片小说一区| 另类小说视频一区二区| 美女网站一区二区| 狂野欧美性猛交blacked| 免费在线成人网| 奇米色一区二区| 麻豆精品蜜桃视频网站| 久久福利视频一区二区| 久88久久88久久久| 国产在线日韩欧美| 国产成人免费视频一区| 福利一区福利二区| www..com久久爱| 欧洲一区在线电影| 欧美老年两性高潮| 欧美一区二区三区喷汁尤物| 日韩一级欧美一级| 久久香蕉国产线看观看99| 久久影院视频免费| 日本一区二区免费在线 | 美女视频免费一区| 激情综合色综合久久| 国产麻豆精品视频| 成人av电影在线| 在线日韩国产精品| 欧美日韩国产大片| 精品人伦一区二区色婷婷| 国产拍揄自揄精品视频麻豆| 综合激情网...| 亚洲电影一区二区三区| 麻豆高清免费国产一区| 成人av在线播放网站| 色婷婷亚洲综合| 91精品国产一区二区三区| 精品捆绑美女sm三区| 国产精品久久毛片av大全日韩| 亚洲精品视频自拍| 亚洲国产三级在线| 韩国成人在线视频| 97精品久久久久中文字幕 | 91福利在线免费观看| 91精品国产色综合久久久蜜香臀| www日韩大片| 亚洲美女在线一区| 美女视频黄a大片欧美| 成人综合婷婷国产精品久久免费| 欧美在线短视频| 日韩欧美国产午夜精品| 国产精品国产三级国产| 日韩高清在线一区| 成人h动漫精品一区二| 91精品一区二区三区在线观看| 久久久精品国产免费观看同学| 一区二区三区在线不卡| 麻豆国产精品一区二区三区| 色哟哟一区二区三区| 精品福利在线导航| 亚洲国产精品欧美一二99| 国产成人福利片| 欧美高清dvd| 亚洲欧洲另类国产综合| 久久精品国产久精国产| 91极品美女在线| 国产亚洲欧美日韩在线一区| 亚洲午夜羞羞片| 丁香婷婷深情五月亚洲| 欧美一区二区三区免费大片| 亚洲女人小视频在线观看| 韩国视频一区二区| 欧美日韩高清一区| 日韩美女视频一区二区 | 9191久久久久久久久久久| 国产精品久久久久永久免费观看 | 一本色道久久加勒比精品| 久久久不卡网国产精品一区| 日韩高清在线观看| 欧美日韩亚洲综合一区二区三区| 日韩理论片网站| 高清shemale亚洲人妖| 久久综合九色综合久久久精品综合| 亚洲电影在线播放| 色美美综合视频| 中文字幕在线不卡一区| 国产成人亚洲精品青草天美| 欧美va亚洲va| 日本欧美一区二区| 欧美人伦禁忌dvd放荡欲情| 亚洲精品欧美在线| 成人avav在线| 中文字幕一区二区三区在线播放 | 国产成人自拍网| 26uuu亚洲综合色| 毛片一区二区三区| 欧美日韩你懂的| 亚洲国产日韩在线一区模特 | 91啪亚洲精品| 国产精品超碰97尤物18| 不卡视频在线观看| 亚洲视频一二三| 色综合久久精品| 一区二区国产视频| 在线视频综合导航| 亚洲图片有声小说| 欧美三级乱人伦电影| 午夜伊人狠狠久久| 91精品婷婷国产综合久久性色| 亚洲一区二区三区视频在线| 欧美视频精品在线| 偷拍亚洲欧洲综合| 日韩欧美一级二级三级久久久| 免费成人美女在线观看.| 日韩午夜av一区| 国精产品一区一区三区mba桃花 | 久久久久99精品一区| 国产成人免费视频一区| 亚洲欧洲精品一区二区三区| 日本高清不卡在线观看| 日本中文字幕一区二区有限公司| 538在线一区二区精品国产| 久久精品国产精品亚洲精品| 久久一区二区视频| av网站一区二区三区| 久久一区二区三区四区| 不卡视频在线观看| 亚洲高清免费观看高清完整版在线观看| 欧美嫩在线观看| 极品瑜伽女神91| 国产精品理论片在线观看| 日本高清无吗v一区| 六月丁香婷婷久久| 欧美国产国产综合| 日本电影欧美片| 看国产成人h片视频| 国产精品国产三级国产普通话蜜臀| 欧美专区日韩专区| 久久国产精品区| 1区2区3区精品视频| 欧美日韩免费不卡视频一区二区三区| 毛片av一区二区三区| 国产精品欧美一级免费| 欧美日韩一区小说| 国产一区二区在线影院| 亚洲裸体xxx| 精品成人免费观看| 一本色道a无线码一区v| 久久国产精品一区二区| 亚洲精品欧美激情| 久久综合九色综合欧美98| 在线欧美一区二区| 国产精品一区二区无线| 亚洲一本大道在线| 国产欧美日韩在线| 4438x亚洲最大成人网| jizzjizzjizz欧美| 极品少妇一区二区三区精品视频| 亚洲精品第一国产综合野| 精品久久久久av影院 | 色婷婷亚洲综合| 国产精品一区二区黑丝| 日韩中文字幕不卡| 亚洲视频一区在线观看| 精品国产乱码久久久久久闺蜜|