eive-tmtc/pus_tc/ploc_supervisor.py

49 lines
1.3 KiB
Python
Raw Normal View History

2021-07-11 14:29:11 +02:00
# -*- coding: utf-8 -*-
"""
@file ploc_supervisor.py
@brief Tests for commanding the supervisor of the PLOC.
The supervisor is programmed by Thales.
@author J. Meier
@date 10.07.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
class PlocTestProcedure:
"""
@brief Use this class to define the tests to perform for the PLOC.
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
test_tc_mem_write = False
test_tc_mem_read = True
class SupvActionIds:
HK_REPORT = 1
class SupvHkIds:
HK_REPORT = 52
def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing PLOC Supervisor with object id: 0x" + object_id.hex())
)
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report"))
command = object_id + struct.pack('!I', SupvActionIds.HK_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue