Sha256: 34b2e41b69184851ae64f8293916e1942ac4f47a9d8ef01cd83f4f7043facdc2

Contents?: true

Size: 1.29 KB

Versions: 25

Compression:

Stored size: 1.29 KB

Contents

# encoding: ascii-8bit

# Copyright 2014 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

require 'cosmos/tools/cmd_tlm_server/api'

module Cosmos
  # Handles a user supplied thread to run in the background of the
  # Command and Telemetry Server
  class BackgroundTask
    include Api

    attr_accessor :name
    attr_accessor :thread
    attr_accessor :status

    # Constructor
    def initialize
      @name = nil
      @thread = nil
      @status = nil
    end

    # 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.
    def call
      raise "call method must be defined by subclass"
    end

    # 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.
    def stop
      # Nothing to do by default
    end

  end # class BackgroundTask

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
cosmos-3.8.3 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.8.2 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.8.1 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.8.0 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.7.1 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.7.0 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.6.3 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.6.2 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.6.1 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.6.0 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.5.3 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.5.2 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.5.0 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.4.2 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.4.1 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.4.0 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.3.3 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.3.2 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.3.1 lib/cosmos/tools/cmd_tlm_server/background_task.rb
cosmos-3.3.0 lib/cosmos/tools/cmd_tlm_server/background_task.rb