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])
|
2021-12-02 12:07:16 +01:00
|
|
|
# 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))
|
2021-12-02 12:07:16 +01:00
|
|
|
if op_code == "1":
|
2022-07-04 15:22:53 +02:00
|
|
|
q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
|
2021-12-02 12:07:16 +01:00
|
|
|
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))
|