File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,16 @@ public void EnqueueAsdu(ASDU asdu)
255255 DebugLog ( "Queue contains " + numberOfAsduInQueue + " messages (oldest: " + oldestQueueEntry + " latest: " + latestQueueEntry + ")" ) ;
256256 }
257257
258+ public void Clear ( )
259+ {
260+ lock ( enqueuedASDUs )
261+ {
262+ numberOfAsduInQueue = 0 ;
263+ oldestQueueEntry = - 1 ;
264+ latestQueueEntry = - 1 ;
265+ }
266+ }
267+
258268 public void LockASDUQueue ( )
259269 {
260270 Monitor . Enter ( enqueuedASDUs ) ;
@@ -542,6 +552,30 @@ public void EnqueueASDU(ASDU asdu)
542552 asduQueue . EnqueueAsdu ( asdu ) ;
543553 }
544554 }
555+
556+ /// <summary>
557+ /// Checks if any of the connections is active, indicating that
558+ /// enqueued ASDUs actually are expected to be sent.
559+ /// </summary>
560+ public bool HasActiveConnection ( )
561+ {
562+ foreach ( ClientConnection connection in connections )
563+ if ( connection . IsActive )
564+ return true ;
565+ return false ;
566+ }
567+
568+ /// <summary>
569+ /// Clears asduQueue and closes all active connections, forcing SCADA to issue a (general) interrogation command
570+ /// </summary>
571+ public void Reset ( )
572+ {
573+ asduQueue . Clear ( ) ;
574+ foreach ( ClientConnection connection in connections )
575+ if ( connection . IsActive )
576+ connection . Close ( ) ;
577+ // SCADA system can now reactivate/reopen connections and must issue (general) interrogation command
578+ }
545579 }
546580
547581 /// <summary>
You can’t perform that action at this time.
0 commit comments