Protocol

class secsgem.hsms.protocol.HsmsProtocol(address, port, active, session_id, name, custom_connection_handler=None)[source]

Bases: secsgem.common.protocol.Protocol

Baseclass for creating Host/Equipment models.

This layer contains the HSMS functionality. Inherit from this class and override required functions.

timeouts

Property for timeout.

name

Property for name.

connection

Property for connection.

connection_state

Property for connection state.

get_next_system_counter()[source]

Return the next System.

Returns:System for the next command
Return type:integer
on_connection_established(_)[source]

Handle connection was established event.

on_connection_before_closed(_)[source]

Handle connection is about to be closed event.

on_connection_closed(_)[source]

Handle connection was closed event.

on_connection_packet_received(_, packet)[source]

Packet received by connection.

Parameters:packet (secsgem.hsms.HsmsPacket) – received data packet
serialize_data() → Dict[str, Any][source]

Return data for serialization.

Returns:data to serialize for this object
Return type:dict
enable()[source]

Enable the connection.

disable()[source]

Disable the connection.

send_stream_function(function: secsgem.secs.functions.base.SecsStreamFunction) → bool[source]

Send the packet and wait for the response.

Parameters:packet (secsgem.secs.functionbase.SecsStreamFunction) – packet to be sent
send_and_waitfor_response(function: secsgem.secs.functions.base.SecsStreamFunction) → Optional[secsgem.common.packet.Packet][source]

Send the packet and wait for the response.

Parameters:packet (secsgem.secs.functionbase.SecsStreamFunction) – packet to be sent
Returns:Packet that was received
Return type:secsgem.hsms.HsmsPacket
send_response(function: secsgem.secs.functions.base.SecsStreamFunction, system: int) → bool[source]

Send response function for system.

Parameters:
  • function (secsgem.secs.functionbase.SecsStreamFunction) – function to be sent
  • system (integer) – system to reply to
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
events

Property for event handling.

secs_decode

Get secs decode.

send_reject_rsp(system_id, s_type, reason)[source]

Send a Reject Response to the remote host.

Parameters:
  • system_id (integer) – System of the request to reply for
  • s_type (integer) – s_type of rejected message
  • reason (integer) – reason for rejection
send_separate_req()[source]

Send a Separate Request to the remote host.