# -*- 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 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, tc_queue: TcQueueT, op_code: str): tc_queue.appendleft( ( QueueCommands.PRINT, "Testing PDEC handler with object id: 0x" + object_id.hex(), ) ) 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": 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) tc_queue.appendleft(command.pack_command_tuple())