📄 frmwik.frm
字号:
If IP_adr = "192.168.0.12" Then i = 5
If IP_adr = "192.168.0.13" Then i = 6
If IP_adr = "192.168.0.14" Then i = 7
If IP_adr = "192.168.0.15" Then i = 8
If IP_adr = "192.168.0.16" Then i = 9
If IP_adr = "192.168.0.17" Then i = 10
If IP_adr = "192.168.0.18" Then i = 11
If IP_adr = "192.168.0.19" Then i = 12
If IP_adr = "192.168.0.20" Then i = 13
If IP_adr = "192.168.0.21" Then i = 14
If IP_adr = "192.168.0.22" Then i = 15
If i <> 255 Then
'是否为关闭的。如果不是,在接受新的连接之前先关闭此连接。
If Winsock1(i).State <> sckClosed Then Winsock1(i).Close
Winsock1(i).Accept requestID '接受具有 requestID 参数的连接。
End If
End Sub
Private Sub Timer2_Timer()
Picture3.Left = Picture3.Left + 15
If Picture3.Left >= Picture2.Width Then Picture3.Left = Picture2.Left - 8000
Picture5.Left = Picture5.Left - 15
If Picture5.Left <= Picture4.Left - Picture5.ScaleWidth Then Picture5.Left = Picture4.ScaleWidth
rgbs = rgbs + 1
If rgbs = 100 Then
L = Int((255 - 0 + 1) * Rnd + 0)
Label25.ForeColor = RGB(L, L / 4, L / 2)
rgbs = 0
End If
End Sub
Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
'bytesTotal=获取的数据总数量 ( COM=23H bytesTotal=18)
'Index=Winsock(索引=0-15)
If Index = 15 Then
'################### DDC ###########################################
ReDim RxDDC(bytesTotal) '重定义维数。
Winsock1(Index).GetData RxDDC, vbArray + vbByte '数据类型为字节数组
If bytesTotal <= 15 Then Call Form1.收到本机帧
'##################################################################
Else
'********************** SRCU ************************************************
ReDim RxData(bytesTotal) '重定义维数。
Winsock1(Index).GetData RxData, vbArray + vbByte '数据类型为字节数组
If bytesTotal <= 18 Then
'=============================================================
If RxData(0) = &HFF Then
'---------------------------------------------------------
If RxData(2) = &H23 Then
If bytesTotal = 18 Then
Call 执行接收帧(Index, 18)
Else
For i = 0 To bytesTotal - 1
RxData_Temp(Index, i) = RxData(i) '存上半帧
拼帧接址(Index) = bytesTotal '存下半帧指针
Next
End If
Else
Call 执行接收帧(Index, bytesTotal) '其它命令
End If
'-------------------------------------------------------
Else
For i = 0 To bytesTotal - 1
RxData_Temp(Index, 拼帧接址(Index)) = RxData(i) ' 拼下半帧
拼帧接址(Index) = 拼帧接址(Index) + 1
Next
ReDim RxData(18) '重定义维数
For i = 0 To 17
RxData(i) = RxData_Temp(Index, i)
Next
Call 执行接收帧(Index, 18)
End If
'=================================================================
End If
'********************************************************************************
End If
End Sub
Private Sub Text27_Change()
T_Hub_Adr = Val(Text27)
End Sub
Private Sub Text9_Change()
T_Rcu_Adr = Val(Text9)
End Sub
Private Sub Winsock1_Close(Index As Integer)
Winsock1(Index).Close 'Index=索引属性
End Sub
Private Sub 执行接收帧(R_Hub_Adr As Integer, 帧长 As Long)
'-------------------- OSD 接收帧>> TEXT26 --------------
' For i = 0 To 帧长 - 1
' Text26.Text = Text26.Text + "," + Hex(RxData(i))
' Next
' Text26.Text = Text26.Text + Chr(13) + Chr(10)
'---------------------------------------------------------
' nn = nn + 1
' Text26.Text = nn
'-------------------------------------------------------------------
Select Case RxData(2)
Case &H20
Case &H21
Case &H22
Case &H23
R_Rcu_Adr = RxData(1) ' Rcu源址=2~32
SData(R_Hub_Adr, R_Rcu_Adr).操作码 = RxData(2)
SData(R_Hub_Adr, R_Rcu_Adr).返回码 = RxData(3)
SData(R_Hub_Adr, R_Rcu_Adr).开关机 = RxData(4)
SData(R_Hub_Adr, R_Rcu_Adr).冷热模式 = RxData(5)
SData(R_Hub_Adr, R_Rcu_Adr).风机 = RxData(6)
' SData(R_Hub_Adr, R_Rcu_Adr).客设温度H = RxData(7)
' SData(R_Hub_Adr, R_Rcu_Adr).客设温度L = RxData(8)
SData(R_Hub_Adr, R_Rcu_Adr).当前温度H = RxData(10)
SData(R_Hub_Adr, R_Rcu_Adr).当前温度L = RxData(11)
' SData(R_Hub_Adr, R_Rcu_Adr).下限H = RxData(12)
' SData(R_Hub_Adr, R_Rcu_Adr).下限L = RxData(13)
' SData(R_Hub_Adr, R_Rcu_Adr).上限H = RxData(14)
' SData(R_Hub_Adr, R_Rcu_Adr).上限L = RxData(15)
If SData(R_Hub_Adr, R_Rcu_Adr).错误码 <> RxData(16) Then
SData(R_Hub_Adr, R_Rcu_Adr).错误码 = RxData(16)
' If 显示通讯标志 = True Then Call OSD_SCOM.涂色(R_Hub_Adr, R_Rcu_Adr)
If 显示房态标志 = True Then Call OSD_LISK.涂色(R_Hub_Adr, R_Rcu_Adr)
End If
SData(R_Hub_Adr, R_Rcu_Adr).卡标 = RxData(17)
' If SData(R_Hub_Adr, R_Rcu_Adr).客设温度L = &HFE Then SData(R_Hub_Adr, R_Rcu_Adr).客设温度L = &HFF
' If SData(R_Hub_Adr, R_Rcu_Adr).当前温度L = &HFE Then SData(R_Hub_Adr, R_Rcu_Adr).当前温度L = &HFF
' If SData(R_Hub_Adr, R_Rcu_Adr).下限L = &HFE Then SData(R_Hub_Adr, R_Rcu_Adr).下限L = &HFF
' If SData(R_Hub_Adr, R_Rcu_Adr).上限L = &HFE Then SData(R_Hub_Adr, R_Rcu_Adr).上限L = &HFF
If SData(R_Hub_Adr, R_Rcu_Adr).房态 <> RxData(9) Then
SData(R_Hub_Adr, R_Rcu_Adr).房态 = RxData(9)
If 显示房态标志 = True Then Call OSD_LISK.涂色(R_Hub_Adr, R_Rcu_Adr)
End If
SData(R_Hub_Adr, R_Rcu_Adr).接收 = True
Case &H24
Text25 = ""
If (RxData(3) And &H2) = 0 Then Text25 = Text25 + "2" + ","
If (RxData(3) And &H4) = 0 Then Text25 = Text25 + "3" + ","
If (RxData(3) And &H8) = 0 Then Text25 = Text25 + "4" + ","
If (RxData(3) And &H10) = 0 Then Text25 = Text25 + "5" + ","
If (RxData(3) And &H20) = 0 Then Text25 = Text25 + "6" + ","
If (RxData(3) And &H40) = 0 Then Text25 = Text25 + "7" + ","
If (RxData(4) And &H1) = 0 Then Text25 = Text25 + "8" + ","
Text25 = Text25 + Chr(10) + Chr(13)
If (RxData(4) And &H2) = 0 Then Text25 = Text25 + "9" + ","
If (RxData(4) And &H4) = 0 Then Text25 = Text25 + "10" + ","
If (RxData(4) And &H8) = 0 Then Text25 = Text25 + "11" + ","
If (RxData(4) And &H10) = 0 Then Text25 = Text25 + "12" + ","
If (RxData(4) And &H20) = 0 Then Text25 = Text25 + "13" + ","
If (RxData(4) And &H40) = 0 Then Text25 = Text25 + "14" + ","
If (RxData(5) And &H1) = 0 Then Text25 = Text25 + "15" + ","
If (RxData(5) And &H2) = 0 Then Text25 = Text25 + "16" + ","
Text25 = Text25 + Chr(10) + Chr(13)
If (RxData(5) And &H4) = 0 Then Text25 = Text25 + "17" + ","
If (RxData(5) And &H8) = 0 Then Text25 = Text25 + "18" + ","
If (RxData(5) And &H10) = 0 Then Text25 = Text25 + "19" + ","
If (RxData(5) And &H20) = 0 Then Text25 = Text25 + "20" + ","
If (RxData(5) And &H40) = 0 Then Text25 = Text25 + "21" + ","
If (RxData(6) And &H1) = 0 Then Text25 = Text25 + "22" + ","
If (RxData(6) And &H2) = 0 Then Text25 = Text25 + "23" + ","
If (RxData(6) And &H4) = 0 Then Text25 = Text25 + "24" + ","
Text25 = Text25 + Chr(10) + Chr(13)
If (RxData(6) And &H8) = 0 Then Text25 = Text25 + "25" + ","
If (RxData(6) And &H10) = 0 Then Text25 = Text25 + "26" + ","
If (RxData(6) And &H20) = 0 Then Text25 = Text25 + "27" + ","
If (RxData(6) And &H40) = 0 Then Text25 = Text25 + "28" + ","
If (RxData(7) And &H1) = 0 Then Text25 = Text25 + "29" + ","
If (RxData(7) And &H2) = 0 Then Text25 = Text25 + "30" + ","
If (RxData(7) And &H4) = 0 Then Text25 = Text25 + "31" + ","
If (RxData(7) And &H8) = 0 Then Text25 = Text25 + "32"
Case &H25
Case &H26
Case Else
End Select
End Sub
Private Sub Winsock1_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1(Index).Close
End Sub
Private Sub 显示指定帧(K As Byte, J As Byte)
Call 清除
'--------------------------------------------------------
If SData(K, J).开关机 = 0 Then
Text10 = "关"
Else
Text10 = "开"
End If
'---------------------------------
If SData(K, J).冷热模式 = 1 Then
Text11 = "制热"
ElseIf SData(K, J).冷热模式 = 2 Then
Text11 = "制冷"
ElseIf SData(K, J).冷热模式 = 3 Then
Text11 = "自动"
End If
'--------------------------------
If SData(K, J).风机 = 1 Then
Text12 = "低速"
ElseIf SData(K, J).风机 = 2 Then
Text12 = "中速"
ElseIf SData(K, J).风机 = 3 Then
Text12 = "高速"
ElseIf SData(K, J).风机 = 4 Then
Text12 = "自动"
End If
'--------------------------------
Text13 = (256 * SData(K, J).客设温度H + SData(K, J).客设温度L) / 10
'--------------------------------
If SData(K, J).房态 = 0 Then
Text14 = "空房"
ElseIf SData(K, J).房态 = 1 Then
Text14 = "待租"
ElseIf SData(K, J).房态 = 2 Then
Text14 = "出租"
ElseIf SData(K, J).房态 = 3 Then
Text14 = "入住"
End If
'-----------------------------------------------
Text15 = (256 * SData(K, J).当前温度H + SData(K, J).当前温度L) / 10
Text16 = (256 * SData(K, J).下限H + SData(K, J).下限L) / 10
Text17 = (256 * SData(K, J).上限H + SData(K, J).上限L) / 10
'-----------------------------------------------
Text1 = "OK"
Text20 = "OK"
Text21 = "OK"
Text22 = "OK"
Text23 = "OK"
If (SData(K, J).错误码 And &H1) <> 0 Then Text1 = "ERROR"
If (SData(K, J).错误码 And &H2) <> 0 Then Text20 = "ERROR"
If (SData(K, J).错误码 And &H4) <> 0 Then Text21 = "ERROR"
If (SData(K, J).错误码 And &H8) <> 0 Then Text22 = "ERROR"
If (SData(K, J).错误码 And &H10) <> 0 Then Text23 = "ERROR"
'-----------------------------------------------
Text2 = SData(K, J).卡标
End Sub
Private Sub Command1_Click() '空房
ReDim TxData(6) '重定义维数
TxData(0) = &HFF
TxData(1) = 5 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H22 'com
TxData(4) = 0 'lisk
TxData(5) = 0
TxData(6) = 0
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command11_Click()
ReDim TxData(3) '重定义维数
TxData(0) = &HFF
TxData(1) = 2 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H26 'com
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command2_Click() '待租
ReDim TxData(6) '重定义维数
TxData(0) = &HFF
TxData(1) = 5 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H22 'com
TxData(4) = 1 'lisk
TxData(5) = 0
TxData(6) = 0
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command3_Click() '出租
ReDim TxData(6) '重定义维数
TxData(0) = &HFF
TxData(1) = 5 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H22 'com
TxData(4) = 2 'lisk
TxData(5) = 0
TxData(6) = 0
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command4_Click() '入住
ReDim TxData(6) '重定义维数
TxData(0) = &HFF
TxData(1) = 5 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H22 'com
TxData(4) = 3 'lisk
TxData(5) = 0
TxData(6) = 0
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command5_Click() '预置客房数据
ReDim TxData(16) '重定义维数
TxData(0) = &HFF
TxData(1) = 15 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H21 'com
TxData(4) = 10 * Val(Text3) \ 256 '待租温度下限_H
TxData(5) = 10 * Val(Text3) Mod 256 '待租温度下限_L
TxData(6) = 10 * Val(Text4) \ 256 '待租温度上限_H
TxData(7) = 10 * Val(Text4) Mod 256 '待租温度上限_L
TxData(8) = 10 * Val(Text5) \ 256 '出租温度下限_H
TxData(9) = 10 * Val(Text5) Mod 256 '出租温度下限_L
TxData(10) = 10 * Val(Text6) \ 256 '出租温度上限_H
TxData(11) = 10 * Val(Text6) Mod 256 '出租温度上限_L
TxData(12) = 10 * Val(Text7) \ 256 '入住温度_H
TxData(13) = 10 * Val(Text7) Mod 256 '入住温度_L
TxData(14) = Val(Text19) '初始房态
TxData(15) = Val(Text8) '拔卡延时
TxData(16) = Val(Text18) '廊灯延时
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command6_Click() '轮询
ReDim TxData(3) '重定义维数
TxData(0) = &HFF
TxData(1) = 2 'len
TxData(2) = T_Rcu_Adr
TxData(3) = &H20 'com
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command9_Click() 'R_RCU
ReDim TxData(3) '重定义维数
TxData(0) = &HFF
TxData(1) = 2 'len
TxData(2) = 2
TxData(3) = &H24 'com
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command10_Click() '读32个房态
ReDim TxData(3) '重定义维数
TxData(0) = &HFF
TxData(1) = 2 'len
TxData(2) = 2
TxData(3) = &H25 'com
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已连拨则发送
End Sub
Private Sub Command7_Click()
Call 清除
End Sub
Private Sub Command8_Click() 'CLR
Text26 = ""
End Sub
Private Sub Command12_Click()
Call 显示指定帧(T_Hub_Adr, T_Rcu_Adr)
End Sub
Private Sub 清除()
Text1 = ""
Text2 = ""
Text3 = "8"
Text4 = "38"
Text5 = "18"
Text6 = "28"
Text7 = "22"
Text8 = "20"
Text10 = ""
Text11 = ""
Text12 = ""
Text13 = ""
Text14 = ""
Text15 = ""
Text16 = ""
Text17 = ""
Text18 = "20"
Text19 = "0"
Text20 = ""
Text21 = ""
Text22 = ""
Text23 = ""
' Text9 = "2"
' Text27 = "0"
End Sub
Private Function 根据房号SS求SData地址(ss As String) As Boolean
Dim h As Byte, r As Byte
根据房号SS求SData地址 = False
'--------------------------------------------------------------
For h = 0 To 14
For r = 2 To 32
If SData(h, r).房号 = ss Then
根据房号SS求SData地址 = True
T_Hub_Adr = h
T_Rcu_Adr = r
Exit For
End If
Next
Next
'-------------------------------------------------------------
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -