eive-tmtc/eive_tmtc/tmtc/com/pdec_handler.py

31 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-08-08 16:32:18 +02:00
from tmtccmd.tc import DefaultPusQueueHelper
2021-11-24 15:56:25 +01:00
2023-01-16 14:13:06 +01:00
class CommandId:
2021-11-24 15:56:25 +01:00
# 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-08-08 16:32:18 +02:00
def pack_pdec_handler_test(
object_id: bytearray, q: DefaultPusQueueHelper, op_code: str
):
2022-07-04 15:22:53 +02:00
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")
2023-01-16 14:13:06 +01:00
command = object_id + CommandId.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")
2023-01-16 14:13:06 +01:00
command = object_id + CommandId.PRINT_PDEC_MON
2022-07-04 15:22:53 +02:00
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))