@@ -27,7 +27,7 @@ Public Class UPS_Device
27
27
28
28
Public ReadOnly Property IsAuthenticated As Boolean
29
29
Get
30
- Return Nut_Socket.Auth_Success
30
+ Return Nut_Socket.IsLoggedIn
31
31
End Get
32
32
End Property
33
33
@@ -61,6 +61,26 @@ Public Class UPS_Device
61
61
End Property
62
62
63
63
# End Region
64
+
65
+ # Region "Events"
66
+
67
+ ' Public Event Unknown_UPS()
68
+ Public Event DataUpdated()
69
+ Public Event Connected(sender As UPS_Device)
70
+ Public Event ReConnected(sender As UPS_Device)
71
+ ' Notify that the connection was closed gracefully.
72
+ Public Event Disconnected()
73
+ ' Notify of an unexpectedly lost connection (??)
74
+ Public Event Lost_Connect()
75
+ ' Error encountered when trying to connect.
76
+ Public Event ConnectionError(sender As UPS_Device, innerException As Exception)
77
+ Public Event EncounteredNUTException(ex As NutException, sender As Object )
78
+ Public Event New_Retry()
79
+ ' Public Event Shutdown_Condition()
80
+ ' Public Event Stop_Shutdown()
81
+
82
+ # End Region
83
+
64
84
Private Const CosPhi As Double = 0.6
65
85
' How many milliseconds to wait before the Reconnect routine tries again.
66
86
Private Const DEFAULT_RECONNECT_WAIT_MS As Double = 5000
@@ -81,73 +101,11 @@ Public Class UPS_Device
81
101
Public Retry As Integer = 0
82
102
Public MaxRetry As Integer = 30
83
103
Private WithEvents Reconnect_Nut As New System.Windows.Forms.Timer
84
- ' Private ReadOnly WatchDog As New System.Windows.Forms.Timer
85
- ' Private Socket_Status As Boolean = False
86
104
87
105
88
106
89
107
90
108
Private LogFile As Logger
91
- 'Private ConnectionStatus As Boolean = False
92
- 'Private Server As String
93
- 'Private Port As Integer
94
- 'Private UPSName As String
95
- 'Private Delay As Integer
96
- 'Private Login As String
97
- 'Private Password As String
98
- 'Private Mfr As String
99
- 'Private Model As String
100
- 'Private Serial As String
101
- 'Private Firmware As String
102
- 'Private BattCh As Double
103
- 'Private BattV As Double
104
- 'Private BattRuntime As Double
105
- 'Private BattCapacity As Double
106
- 'Private PowerFreq As Double
107
- 'Private InputV As Double
108
- 'Private OutputV As Double
109
- 'Private Load As Double
110
- 'Private Status As String
111
- 'Private OutPower As Double
112
- 'Private InputA As Double
113
- 'Private Low_Batt As Integer
114
- 'Private Low_Backup As Integer
115
- 'Private LConnect As Boolean = False
116
- 'Private AReconnect As Boolean = False
117
- 'Private MaxRetry As Integer = 30
118
- 'Private Retry As Integer = 0
119
- 'Private ErrorStatus As Boolean = False
120
- 'Private ErrorMsg As String = ""
121
- 'Private Update_Nut As New System.Windows.Forms.Timer
122
- 'Private Reconnect_Nut As New System.Windows.Forms.Timer
123
- 'Private NutSocket As System.Net.Sockets.Socket
124
- 'Private NutTCP As System.Net.Sockets.TcpClient
125
- 'Private NutStream As System.Net.Sockets.NetworkStream
126
- 'Private ReaderStream As System.IO.StreamReader
127
- 'Private WriterStream As System.IO.StreamWriter
128
- 'Private Follow_FSD As Boolean = False
129
- 'Private Unknown_UPS_Name As Boolean = False
130
- 'Private Invalid_Data As Boolean = False
131
- 'Private Invalid_Auth_Data As Boolean = False
132
-
133
- # Region "Properties"
134
-
135
- # End Region
136
-
137
- ' Public Event Unknown_UPS()
138
- Public Event DataUpdated()
139
- Public Event Connected(sender As UPS_Device)
140
- Public Event ReConnected(sender As UPS_Device)
141
- ' Notify that the connection was closed gracefully.
142
- Public Event Disconnected()
143
- ' Notify of an unexpectedly lost connection (??)
144
- Public Event Lost_Connect()
145
- ' Error encountered when trying to connect.
146
- Public Event ConnectionError(sender As UPS_Device, innerException As Exception)
147
- Public Event EncounteredNUTException(ex As NutException, sender As Object )
148
- Public Event New_Retry()
149
- ' Public Event Shutdown_Condition()
150
- ' Public Event Stop_Shutdown()
151
109
152
110
''' <summary>
153
111
''' Raise an event when a status code is added to the UPS that wasn't there before.
0 commit comments