eive-tmtc/pus_tc/pdec_handler.py

41 lines
1.3 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 tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
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-01-18 14:03:56 +01:00
def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
2021-11-24 15:56:25 +01:00
tc_queue.appendleft(
2022-01-18 14:03:56 +01:00
(
QueueCommands.PRINT,
"Testing PDEC handler with object id: 0x" + object_id.hex(),
)
2021-11-24 15:56:25 +01:00
)
if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PDEC Handler: Print CLCW"))
command = object_id + CommandIds.PRINT_CLCW
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
2022-01-18 14:03:56 +01:00
tc_queue.appendleft(
(QueueCommands.PRINT, "PDEC Handler: Print PDEC monitor register")
)
command = object_id + CommandIds.PRINT_PDEC_MON
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
2022-01-18 14:03:56 +01:00
tc_queue.appendleft(command.pack_command_tuple())