HostHandler
- class secsgem.gem.hosthandler.GemHostHandler(settings)[source]
Baseclass for creating host models. Inherit from this class and override required functions.
- subscribe_collection_event(ceid, dvs, report_id=None)[source]
Subscribe to a collection event.
- Parameters:
ceid (integer) – ID of the collection event
dvs (list of integers) – DV IDs to add for collection event
report_id (integer) – optional - ID for report, autonumbering if None
- send_remote_command(rcmd, params)[source]
Send a remote command.
- Parameters:
rcmd (string) – Name of command
params (list of strings) – DV IDs to add for collection event
- delete_process_programs(ppids)[source]
Delete a list of process program.
- Parameters:
ppids (list of strings) – Process programs to delete
- enable_alarm(alid)[source]
Enable alarm.
- Parameters:
alid (
secsgem.secs.dataitems.ALID) – alarm id to enable
- disable_alarm(alid)[source]
Disable alarm.
- Parameters:
alid (
secsgem.secs.dataitems.ALID) – alarm id to disable
- list_alarms(alids=None)[source]
List alarms.
- Parameters:
alids (array of int/str) – alarms to list details for
- are_you_there()
Check if remote is still replying.
- property callbacks
Property for callback handling.
- property communication_state: CommunicationStateMachine
Get the communication state model.
- property data_items: DataItems
Get class for stream and function.
- Parameters:
stream – stream to get class for
function – function to get class for
- Returns:
class for function
- disable()
Disable the connection.
- Return type:
None
- disable_ceid_reports()
Disable all Collection Event Reports.
- disable_ceids()
Disable all Collection Events.
- enable()
Enable the connection.
- Return type:
None
- property events
Wrapper for connections events.
- list_ecs(ecs=None)
Get list of available Equipment Constants.
- Returns:
available Equipment Constants
- Return type:
list
- list_svs(svs=None)
Get list of available Service Variables.
- Returns:
available Service Variables
- Return type:
list
- on_commack_requested()
Get the acknowledgement code for the connection request.
override to accept or deny connection request
- Return type:
int- Returns:
0 when connection is accepted, 1 when connection is denied
- on_connection_closed(_)
Handle connection was closed event.
- register_stream_function(stream, function, callback)
Register the function callback for stream and function.
- Parameters:
stream (integer) – stream to register callback for
function (integer) – function to register callback for
callback (def callback(connection)) – method to call when stream and functions is received
- request_ec(ec_id)
Request contents of one Equipment Constant.
- Parameters:
ec_id (int) – id of Equipment Constant
- Returns:
value of requested Equipment Constant
- Return type:
various
- request_ecs(ecs)
Request contents of supplied Equipment Constants.
- Parameters:
ecs (list) – Equipment Constants to request
- Returns:
values of requested Equipment Constants
- Return type:
list
- request_process_program(ppid)
Request a process program.
ppid: Transferred process programs ID
- Return type:
tuple[int|str,str]
- request_sv(sv_id)
Request contents of one Service Variable.
- Parameters:
sv_id (int) – id of Service Variable
- Returns:
value of requested Service Variable
- Return type:
various
- request_svs(svs)
Request contents of supplied Service Variables.
- Parameters:
svs (list) – Service Variables to request
- Returns:
values of requested Service Variables
- Return type:
list
- send_and_waitfor_response(*args, **kwargs)
Wrapper for connections send_and_waitfor_response function.
- send_equipment_terminal(terminal_id, text)
Set text to equipment terminal.
- Parameters:
terminal_id (int) – ID of terminal
text (string) – text to send
- send_process_program(ppid, ppbody)
Send a process program.
- Parameters:
ppid (
int|str) – Transferred process programs IDppbody (
str) – Content of process program
- send_response(*args, **kwargs)
Wrapper for connections send_response function.
- send_stream_function(*args, **kwargs)
Wrapper for connections send_stream_function function.
- serialize_data()
Get serialized data.
- Return type:
dict[str,Any]- Returns:
data to serialize for this object
- set_ec(ec_id, value)
Set contents of one Equipment Constant.
- Parameters:
ec_id (int) – id of Equipment Constant
value (various) – new content of Equipment Constant
- set_ecs(ecs)
Set contents of supplied Equipment Constants.
- Parameters:
ecs (list) – list containing list of id / value pairs
- stream_function(stream, function)
Get class for stream and function.
- Parameters:
stream (
int) – stream to get class forfunction (
int) – function to get class for
- Return type:
type[SecsStreamFunction]- Returns:
class for function
- unregister_stream_function(stream, function)
Unregister the function callback for stream and function.
- Parameters:
stream (integer) – stream to unregister callback for
function (integer) – function to register callback for
- waitfor_communicating(timeout=None)
Wait until connection gets into communicating state. Returns immediately if state is communicating.
- Parameters:
timeout (
float|None) – seconds to wait before aborting- Return type:
bool- Returns:
True if state is communicating, False if timed out