ConnectionManager¶
-
class
secsgem.hsms.connectionmanager.
HsmsConnectionManager
(event_handler=None)[source]¶ Bases:
secsgem.common.EventProducer
High level class that handles multiple active and passive connections and the model for them.
Parameters: event_handler ( secsgem.common.EventHandler
) – object for event handling-
has_connection_to
(index)[source]¶ Check if connection to certain peer exists.
Parameters: index (string) – Name of the reqested handler. Returns: Is peer available Return type: boolean
-
static
get_connection_id
(address)[source]¶ Generates connection ids used for internal indexing.
Parameters: address (string) – The IP address for the affected remote.
-
add_peer
(name, address, port, active, session_id, connection_handler=<class secsgem.hsms.handler.HsmsHandler>)[source]¶ Add a new connection
Parameters: - name (string) – Name of the peers configuration
- address (string) – IP address of peer
- port (integer) – TCP port of peer
- active (boolean) – Is the connection active (True) or passive (False)
- session_id (integer) – session / device ID of peer
- connection_handler (inherited from
secsgem.hsms.handler.HsmsHandler
) – Model handling this connection
-
remove_peer
(name, address, port)[source]¶ Remove a previously added connection
Parameters: - name (string) – Name of the peers configuration
- address (string) – IP address of peer
- port (integer) – TCP port of peer
-
fire_event
(event_name, data, async=False)¶ Fire an event
Parameters: - event_name (string) – event to fire
- data (dict) – parameters for event
-