Sha256: bc52386b58dda7bb2dc2f5bc5e8383a46c8956fddfa66dd1132153f3e002d803

Contents?: true

Size: 1.61 KB

Versions: 43

Compression:

Stored size: 1.61 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/conversions/conversion'
require 'cosmos/packet_logs'
require 'cosmos/tools/cmd_tlm_server/cmd_tlm_server'

module Cosmos

  # Creates new packet logs whenever it executes
  class NewPacketLogConversion < Conversion

    # Initializes converted_type to :FLOAT and converted_bit_size to 64
    #
    # @param packet_log_writer_name [String] Name of the packet log writer to start new logs on
    def initialize(packet_log_writer_name = 'ALL')
      super()
      @packet_log_writer_name = packet_log_writer_name
    end

    # @param (see Conversion#call)
    # @return [Varies] The value given
    def call(value, packet, buffer)
      if CmdTlmServer.instance and CmdTlmServer.packet_logging
        CmdTlmServer.instance.start_logging(@packet_log_writer_name)
      end
      value
    end

    # @return [String] The name of the class and the associated packet log writer name
    def to_s
      result = super()
      result << " (#{@packet_log_writer_name})"
      result
    end

    # @param (see Conversion#to_config)
    # @return [String] Config fragment for this conversion
    def to_config(read_or_write)
      "    #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename} #{@packet_log_write_name}\n"
    end

  end # class NewPacketLogConversion

end # module Cosmos

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
cosmos-4.5.2-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.5.2 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.5.1-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.5.1 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.5.0-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.5.0 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.4.2-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.4.2 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.4.1-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.4.1 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.4.0-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.4.0 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.3.0-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.3.0 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.2.4-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.2.4 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.2.3-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.2.3 lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.2.2-java lib/cosmos/conversions/new_packet_log_conversion.rb
cosmos-4.2.2 lib/cosmos/conversions/new_packet_log_conversion.rb