Sha256: 2eb3b91a1c5613411e596a8f347d9c01dca318f2e4853307e37ffc47b49d6499

Contents?: true

Size: 1.76 KB

Versions: 8

Compression:

Stored size: 1.76 KB

Contents

# Copyright 2024 OpenC3, Inc.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

from openc3.packets.command_validator import CommandValidator
from openc3.api import *


class Inst2CmdValidator(CommandValidator):
    def pre_check(self, command):
        # Record the current value of CMD_ACPT_CNT for comparison in post_check
        self.cmd_acpt_cnt = tlm("<%= target_name %> HEALTH_STATUS CMD_ACPT_CNT")
        return [True, None]

    def post_check(self, command):
        if command.packet_name == "TIME_OFFSET":
            # Return Failure with a message
            return [False, "TIME_OFFSET failure description"]
        if command.packet_name == "MEMLOAD":
            # Return Unknown with a message
            return [None, "MEMLOAD validation unknown"]
        if command.packet_name == "CLEAR":
            wait_check("<%= target_name %> HEALTH_STATUS CMD_ACPT_CNT == 0", 10)
            # Return Success with a message
            return [True, "CMD_ACPT_CNT cleared"]
        else:
            wait_check(
                f"<%= target_name %> HEALTH_STATUS CMD_ACPT_CNT > {self.cmd_acpt_cnt}",
                10,
            )
            # Return Success without a message
            return [True, None]

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
openc3-cosmos-demo-6.2.1 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-6.2.0 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-6.1.0 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-6.0.2 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-6.0.1 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-6.0.0 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-5.20.0 targets/INST2/lib/inst2_cmd_validator.py
openc3-cosmos-demo-5.19.0 targets/INST2/lib/inst2_cmd_validator.py