?? 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 '數據類型為字節(jié)數組
If bytesTotal <= 15 Then Call Form1.收到本機幀
'##################################################################
Else
'********************** SRCU ************************************************
ReDim RxData(bytesTotal) '重定義維數。
Winsock1(Index).GetData RxData, vbArray + vbByte '數據類型為字節(jié)數組
If bytesTotal <= 18 Then
'=============================================================
If RxData(0) = &HFF Then
'---------------------------------------------------------
If RxData(2) = &H23 Then
If bytesTotal = 18 Then
Call 執(zhí)行接收幀(Index, 18)
Else
For i = 0 To bytesTotal - 1
RxData_Temp(Index, i) = RxData(i) '存上半幀
拼幀接址(Index) = bytesTotal '存下半幀指針
Next
End If
Else
Call 執(zhí)行接收幀(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 執(zhí)行接收幀(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 執(zhí)行接收幀(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 顯示房態(tài)標志 = 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).房態(tài) <> RxData(9) Then
SData(R_Hub_Adr, R_Rcu_Adr).房態(tài) = RxData(9)
If 顯示房態(tài)標志 = 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).房態(tài) = 0 Then
Text14 = "空房"
ElseIf SData(K, J).房態(tài) = 1 Then
Text14 = "待租"
ElseIf SData(K, J).房態(tài) = 2 Then
Text14 = "出租"
ElseIf SData(K, J).房態(tài) = 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() '如已連撥則發(fā)送
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() '如已連撥則發(fā)送
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() '如已連撥則發(fā)送
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() '如已連撥則發(fā)送
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() '如已連撥則發(fā)送
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) '初始房態(tài)
TxData(15) = Val(Text8) '拔卡延時
TxData(16) = Val(Text18) '廊燈延時
If Winsock1(T_Hub_Adr).State = sckConnected Then Winsock1(T_Hub_Adr).SendData TxData() '如已連撥則發(fā)送
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() '如已連撥則發(fā)送
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() '如已連撥則發(fā)送
End Sub
Private Sub Command10_Click() '讀32個房態(tài)
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() '如已連撥則發(fā)送
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 + -