Class: OpenC3::LimitsParser
- Defined in:
- lib/openc3/packets/parsers/limits_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_limits(packet, item, warnings) ⇒ Object
-
#initialize(parser) ⇒ LimitsParser
constructor
A new instance of LimitsParser.
- #verify_parameters(cmd_or_tlm) ⇒ Object
Constructor Details
#initialize(parser) ⇒ LimitsParser
Returns a new instance of LimitsParser.
39 40 41 |
# File 'lib/openc3/packets/parsers/limits_parser.rb', line 39 def initialize(parser) @parser = parser end |
Class Method Details
.parse(parser, packet, cmd_or_tlm, item, warnings) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/openc3/packets/parsers/limits_parser.rb', line 31 def self.parse(parser, packet, cmd_or_tlm, item, warnings) raise parser.error("Items with STATE can't define LIMITS") if item.states parser = LimitsParser.new(parser) parser.verify_parameters(cmd_or_tlm) parser.create_limits(packet, item, warnings) end |
Instance Method Details
#create_limits(packet, item, warnings) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/openc3/packets/parsers/limits_parser.rb', line 54 def create_limits(packet, item, warnings) limits_set = get_limits_set() initialize_limits_values(packet, item) ensure_consistency_with_default(packet, item, warnings) item.limits.values[limits_set] = get_values() item.limits.enabled = get_enabled() item.limits.persistence_setting = get_persistence() item.limits.persistence_count = 0 packet.update_limits_items_cache(item) limits_set end |
#verify_parameters(cmd_or_tlm) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/openc3/packets/parsers/limits_parser.rb', line 44 def verify_parameters(cmd_or_tlm) if cmd_or_tlm == PacketConfig::COMMAND raise @parser.error("LIMITS only applies to telemetry items") end @usage = "LIMITS <LIMITS SET> <PERSISTENCE> <ENABLED/DISABLED> <RED LOW LIMIT> <YELLOW LOW LIMIT> <YELLOW HIGH LIMIT> <RED HIGH LIMIT> <GREEN LOW LIMIT (Optional)> <GREEN HIGH LIMIT (Optional)>" @parser.verify_num_parameters(7, 9, @usage) end |