diff m-toolbox/classes/@LTPDARepositoryManager/cb_timerDisconnect.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@LTPDARepositoryManager/cb_timerDisconnect.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,35 @@
+% cb_timerDisconnect callback method which disconnects the connections
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% description: callback method which disconnects the connections
+%
+% version:     $Id: cb_timerDisconnect.m,v 1.5 2010/06/25 08:55:52 hewitson Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = cb_timerDisconnect(varargin)
+  
+  rm    = LTPDARepositoryManager();
+  conns = rm.manager.getConnections();
+  
+  if ~isempty(conns)
+    
+    for ii=1:conns.size
+      conn = conns.get(ii-1);
+      
+      % Clear the password only if the connection is not locked
+      if ~conn.isLocked
+        if (conn.ageConnected > rm.DISCONNECT)
+          conn.closeConnection();
+          if ~isempty(rm.gui)
+            rm.gui.reloadConnectionTable();
+          end
+        end
+      end
+    end
+    
+  end
+  
+end
+
+