You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if isHomeManager, lastRequestReceived.timeIntervalSinceNow >-1.0
129
130
{
130
-
JLog.debug("\(address): isHomeManager and received already at\(lastRequestReceived) - ignoring")
131
+
JLog.debug("\(address): isHomeManager and received already at:\(lastRequestReceived) - ignoring")
131
132
returnnil
132
133
}
133
134
lastRequestReceived =Date()
@@ -141,12 +142,59 @@ public extension SMADevice
141
142
{
142
143
iflet netPacket = smaPacket.netPacket
143
144
{
144
-
udpLoggedIn = netPacket.isLoggedIn
145
-
udpSystemId = netPacket.header.sourceSystemId
146
-
udpSerial = netPacket.header.sourceSerial
145
+
JLog.debug("\(address): received netPacket: objectid:\(currentRequestedObjectID) result:\(String(format:"0x%04x", netPacket.header.u16result)) command:\(String(format:"0x%04x", netPacket.header.u16command)) packetid:\(String(format:"0x%04x", netPacket.header.packetId))")
146
+
147
+
if udpPacketCounter !=(0x7FFF& netPacket.header.packetId)
148
+
{
149
+
JLog.notice("\(address): received netPacket: we did not await:\(String(format:"0x%04x", udpPacketCounter)) packet command:\(String(format:"0x%04x", netPacket.header.u16command)) packetid:\(String(format:"0x%04x", netPacket.header.packetId))")
150
+
returnnil
151
+
}
147
152
148
153
if netPacket.header.u16command ==0xFFFD
149
154
{
155
+
if currentRequestedObjectID =="LOGIN"
156
+
{
157
+
guard netPacket.header.resultIsOk
158
+
else
159
+
{
160
+
JLog.error("\(address): login failed.")
161
+
udpLoggedIn =false
162
+
returnnil
163
+
}
164
+
JLog.notice("\(address): login success.")
165
+
udpLoggedIn =true
166
+
udpSystemId = netPacket.header.sourceSystemId
167
+
udpSerial = netPacket.header.sourceSerial
168
+
returnnil
169
+
}
170
+
JLog.debug("\(address): login required")
171
+
udpLoggedIn =false
172
+
returnnil
173
+
}
174
+
175
+
if !udpLoggedIn
176
+
{
177
+
JLog.error("\(address): received correct packet even though we are logged out - ignoring.")
JLog.debug("\(address): result not ok. logging out. objectId:\(currentRequestedObjectID) : \(tagTranslator.objectsAndPaths[currentRequestedObjectID]?.path ??"unknown")")
0 commit comments