eive-tmtc/pus_tc/devs/pdec_handler.py

31 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
"""
@file pdec_handler.py
@brief Test commanding of PDEC Handler
@author J. Meier
@date 22.11.2021
"""
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper
class CommandIds:
# prints the clcw to the console. Useful for debugging
PRINT_CLCW = bytearray([0x0, 0x0, 0x0, 0x0])
# Print PDEC monitor register
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
def pack_pdec_handler_test(
object_id: bytearray, q: DefaultPusQueueHelper, op_code: str
):
q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
if op_code == "0":
q.add_log_cmd("PDEC Handler: Print CLCW")
command = object_id + CommandIds.PRINT_CLCW
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "1":
q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
command = object_id + CommandIds.PRINT_PDEC_MON
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))