eive-tmtc/pus_tc/devs/pdec_handler.py

29 lines
1.0 KiB
Python
Raw Normal View History

2021-11-24 15:56:25 +01:00
# -*- 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
2022-07-04 15:22:53 +02:00
from tmtccmd.tc import QueueHelper
2021-11-24 15:56:25 +01:00
class CommandIds:
# prints the clcw to the console. Useful for debugging
2022-01-18 11:57:58 +01:00
PRINT_CLCW = bytearray([0x0, 0x0, 0x0, 0x0])
# Print PDEC monitor register
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
2021-11-24 15:56:25 +01:00
2022-07-04 15:22:53 +02:00
def pack_pdec_handler_test(object_id: bytearray, q: QueueHelper, op_code: str):
q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
2021-11-24 15:56:25 +01:00
if op_code == "0":
2022-07-04 15:22:53 +02:00
q.add_log_cmd("PDEC Handler: Print CLCW")
2021-11-24 15:56:25 +01:00
command = object_id + CommandIds.PRINT_CLCW
2022-07-04 15:22:53 +02:00
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "1":
2022-07-04 15:22:53 +02:00
q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
command = object_id + CommandIds.PRINT_PDEC_MON
2022-07-04 15:22:53 +02:00
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))