Sha256: 0691afe1c67ea352ccf22a1fea9204a18a53e42b29f47269faa7ae1c31269d0f

Contents?: true

Size: 1.53 KB

Versions: 14

Compression:

Stored size: 1.53 KB

Contents

# encoding: ascii-8bit

# Copyright 2018 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/config/config_parser'
require 'cosmos/interfaces/protocols/protocol'
require 'cosmos/utilities/crc'
require 'thread'

module Cosmos
  # Ignore a specific packet by not letting it through the protocol
  class IgnorePacketProtocol < Protocol
    # @param target_name [String] Target name
    # @param packet_name [String] Packet name
    def initialize(target_name, packet_name, allow_empty_data = nil)
      super(allow_empty_data)
      System.telemetry.packet(target_name, packet_name)
      @target_name = target_name
      @packet_name = packet_name
    end

    def read_packet(packet)
      # Need to make sure packet is identified and defined
      target_names = nil
      target_names = @interface.target_names if @interface
      identified_packet = System.telemetry.identify_and_define_packet(packet, target_names)
      if identified_packet
        if identified_packet.target_name == @target_name && identified_packet.packet_name == @packet_name
          return :STOP
        end
      end
      return super(packet)
    end

    def write_packet(packet)
      return :STOP if packet.target_name == @target_name && packet.packet_name == @packet_name
      return super(packet)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cosmos-4.5.2-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.5.2 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.5.1-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.5.1 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.5.0-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.5.0 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.4.2-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.4.2 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.4.1-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.4.1 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.4.0-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.4.0 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.3.0-java lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb
cosmos-4.3.0 lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb