44 lines
1.8 KiB
VB.net
44 lines
1.8 KiB
VB.net
Imports _485_BurningTool.CommunicationFlow
|
|
|
|
Public MustInherit Class Transmitter
|
|
Public mCommunicationFlow As CommunicationProtocol
|
|
|
|
' 发送数据方法
|
|
Public MustOverride Sub SendData(data As Cmdconfig)
|
|
Public MustOverride Function SendData(data As Byte()) As Boolean
|
|
'获取发送器接收数据
|
|
Public MustOverride Function ReceiveData(g_comfig As Cmdconfig) As Cmdconfig
|
|
'判断发送器实体化没有
|
|
Public MustOverride Function IsTransmitter() As Boolean
|
|
'打开发送器
|
|
Public MustOverride Function OpenTransmitter() As Boolean
|
|
'关闭发送器
|
|
Public MustOverride Sub CloseTransmitter()
|
|
'获取发送器状态
|
|
Public MustOverride Function GetTransmitterStatus() As Boolean
|
|
'设置发送器参数
|
|
Public MustOverride Function SetTransmitterParameter(ParamArray params() As Object) As Boolean
|
|
' 清楚发送数据
|
|
Public MustOverride Sub ClearSendData()
|
|
Public MustOverride Sub ClearReadData()
|
|
Public CommunicationTypeindex As Integer
|
|
|
|
'创建发送器对象
|
|
Public Shared Function CreateTransmitter(TransmitterType As CommunicationType, gControl As Control) As Transmitter
|
|
'CommunicationTypeindex = TransmitterType
|
|
Select Case TransmitterType
|
|
Case CommunicationType.SerialPort
|
|
Return New SerialController(gControl)
|
|
Case CommunicationType.Udp
|
|
Return New DevNetworkCommunication(gControl)
|
|
Case Else
|
|
Return Nothing
|
|
End Select
|
|
End Function
|
|
Public Sub AddQueue(c As Control, rl As RuningLogConfig, Optional lev As Integer = 0)
|
|
If IsNothing(mCommunicationFlow) OrElse IsNothing(mCommunicationFlow.UpdateUIqueue) OrElse IsNothing(c) OrElse IsNothing(rl) Then Return
|
|
mCommunicationFlow.UpdateUIqueue.Enqueue((c, rl, lev))
|
|
End Sub
|
|
|
|
End Class
|