Class: Cosmos::BackgroundTask
- Includes:
- Api
- Defined in:
- lib/cosmos/tools/cmd_tlm_server/background_task.rb
Overview
Handles a user supplied thread to run in the background of the Command and Telemetry Server
Constant Summary
Constants included from Extract
Extract::SCANNING_REGULAR_EXPRESSION
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#thread ⇒ Object
Returns the value of attribute thread.
Instance Method Summary collapse
-
#call ⇒ Object
Subclasses should override the call method which is called once by the Command and Telemetry Server.
-
#initialize ⇒ BackgroundTask
constructor
Constructor.
-
#stop ⇒ Object
The Command and Telemetry Server calls the stop method before killing the Thread which is running the background tasks.
Methods included from Api
#cmd, #cmd_no_checks, #cmd_no_hazardous_check, #cmd_no_range_check, #cmd_raw, #cmd_raw_no_checks, #cmd_raw_no_hazardous_check, #cmd_raw_no_range_check, #connect_interface, #connect_router, #disable_limits, #disable_limits_group, #disconnect_interface, #disconnect_router, #enable_limits, #enable_limits_group, #get_cmd_hazardous, #get_cmd_list, #get_cmd_log_filename, #get_cmd_param_list, #get_cmd_time, #get_cmd_value, #get_interface_names, #get_limits, #get_limits_event, #get_limits_groups, #get_limits_set, #get_limits_sets, #get_out_of_limits, #get_overall_limits_state, #get_packet_data, #get_router_names, #get_server_message_log_filename, #get_stale, #get_target_list, #get_tlm_details, #get_tlm_item_list, #get_tlm_list, #get_tlm_log_filename, #get_tlm_packet, #get_tlm_values, #interface_state, #limits_enabled?, #map_target_to_interface, #router_state, #send_raw, #set_limits, #set_limits_set, #set_tlm, #set_tlm_raw, #start_cmd_log, #start_logging, #start_new_server_message_log, #start_raw_logging_interface, #start_raw_logging_router, #start_tlm_log, #stop_cmd_log, #stop_logging, #stop_raw_logging_interface, #stop_raw_logging_router, #stop_tlm_log, #subscribe_limits_events, #subscribe_packet_data, #tlm, #tlm_formatted, #tlm_raw, #tlm_variable, #tlm_with_units, #unsubscribe_limits_events, #unsubscribe_packet_data
Constructor Details
#initialize ⇒ BackgroundTask
Constructor
24 25 26 27 28 |
# File 'lib/cosmos/tools/cmd_tlm_server/background_task.rb', line 24 def initialize @name = nil @thread = nil @status = nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
19 20 21 |
# File 'lib/cosmos/tools/cmd_tlm_server/background_task.rb', line 19 def name @name end |
#status ⇒ Object
Returns the value of attribute status.
21 22 23 |
# File 'lib/cosmos/tools/cmd_tlm_server/background_task.rb', line 21 def status @status end |
#thread ⇒ Object
Returns the value of attribute thread.
20 21 22 |
# File 'lib/cosmos/tools/cmd_tlm_server/background_task.rb', line 20 def thread @thread end |
Instance Method Details
#call ⇒ Object
Subclasses should override the call method which is called once by the Command and Telemetry Server. Thus subclasses should add their own loop and sleep statements if they expect to run continuously.
33 34 35 |
# File 'lib/cosmos/tools/cmd_tlm_server/background_task.rb', line 33 def call raise "call method must be defined by subclass" end |
#stop ⇒ Object
The Command and Telemetry Server calls the stop method before killing the Thread which is running the background tasks. This method should be overriden by subclasses to do whatever shutdown is necessary.
40 41 42 |
# File 'lib/cosmos/tools/cmd_tlm_server/background_task.rb', line 40 def stop # Nothing to do by default end |