Handler¶
-
class
secsgem.hsms.handler.
HsmsHandler
(address, port, active, session_id, name, custom_connection_handler=None)[source]¶ Bases:
object
Baseclass for creating Host/Equipment models.
This layer contains the HSMS functionality. Inherit from this class and override required functions.
Parameters: - address (string) – IP address of remote host
- port (integer) – TCP port of remote host
- active (boolean) – Is the connection active (True) or passive (False)
- session_id (integer) – session / device ID to use for connection
- name (string) – Name of the underlying configuration
- custom_connection_handler (
secsgem.hsms.connections.HsmsMultiPassiveServer
) – object for connection handling (ie multi server)
Example:
import secsgem def onConnect(event, data): print "Connected" client = secsgem.HsmsHandler("10.211.55.33", 5000, True, 0, "test") client.events.hsms_connected += onConnect client.enable() time.sleep(3) client.disable()
-
events
¶ Property for event handling
-
callbacks
¶ Property for callback handling
-
get_next_system_counter
()[source]¶ Returns the next System.
Returns: System for the next command Return type: integer
-
on_connection_packet_received
(_, packet)[source]¶ Packet received by connection
Parameters: packet ( secsgem.hsms.packets.HsmsPacket
) – received data packet
-
send_stream_function
(packet)[source]¶ Send the packet and wait for the response
Parameters: packet ( secsgem.secs.functionbase.SecsStreamFunction
) – packet to be sent
-
send_and_waitfor_response
(packet)[source]¶ Send the packet and wait for the response
Parameters: packet ( secsgem.secs.functionbase.SecsStreamFunction
) – packet to be sentReturns: Packet that was received Return type: secsgem.hsms.packets.HsmsPacket
-
send_response
(function, system)[source]¶ Send response function for system
Parameters: - function (
secsgem.secs.functionbase.SecsStreamFunction
) – function to be sent - system (integer) – system to reply to
- function (
-
send_select_req
()[source]¶ Send a Select Request to the remote host
Returns: System of the sent request Return type: integer
-
send_select_rsp
(system_id)[source]¶ Send a Select Response to the remote host
Parameters: system_id (integer) – System of the request to reply for
-
send_linktest_req
()[source]¶ Send a Linktest Request to the remote host
Returns: System of the sent request Return type: integer
-
send_linktest_rsp
(system_id)[source]¶ Send a Linktest Response to the remote host
Parameters: system_id (integer) – System of the request to reply for
-
send_deselect_req
()[source]¶ Send a Deselect Request to the remote host
Returns: System of the sent request Return type: integer
-
send_deselect_rsp
(system_id)[source]¶ Send a Deselect Response to the remote host
Parameters: system_id (integer) – System of the request to reply for