81 lines
3.8 KiB
Python
81 lines
3.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
@file syrlinks_hk_handler.py
|
|
@brief Syrlinks Hk Handler tests
|
|
@author J. Meier
|
|
@date 13.12.2020
|
|
"""
|
|
|
|
from tmtccmd.config.definitions import QueueCommands
|
|
from tmtccmd.tc.definitions import TcQueueT
|
|
from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command
|
|
from spacepackets.ecss.tc import PusTelecommand
|
|
|
|
|
|
class SetIds:
|
|
RX_REGISTERS_DATASET = 1
|
|
TX_REGISTERS_DATASET = 2
|
|
|
|
|
|
class CommandIds:
|
|
SET_TX_MODE_STANDBY = bytearray([0x0, 0x0, 0x0, 0x3])
|
|
SET_TX_MODE_MODULATION = bytearray([0x0, 0x0, 0x0, 0x4])
|
|
SET_TX_MODE_CW = bytearray([0x0, 0x0, 0x0, 0x5])
|
|
READ_TX_STATUS = bytearray([0x0, 0x0, 0x0, 0x7])
|
|
READ_TX_WAVEFORM = bytearray([0x0, 0x0, 0x0, 0x8])
|
|
READ_TX_AGC_VALUE_HIGH_BYTE = bytearray([0x0, 0x0, 0x0, 0x9])
|
|
READ_TX_AGC_VALUE_LOW_BYTE = bytearray([0x0, 0x0, 0x0, 0x9])
|
|
|
|
|
|
def pack_syrlinks_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
|
tc_queue.appendleft(
|
|
(QueueCommands.PRINT,
|
|
"Testing PLOC memory dumper with object id: 0x" + object_id.hex())
|
|
)
|
|
|
|
if op_code == "0":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode standby"))
|
|
command = object_id + CommandIds.SET_TX_MODE_STANDBY
|
|
command = PusTelecommand(service=8, subservice=128, ssc=10, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "1":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode modulation"))
|
|
command = object_id + CommandIds.SET_TX_MODE_MODULATION
|
|
command = PusTelecommand(service=8, subservice=128, ssc=11, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "2":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode CW"))
|
|
command = object_id + CommandIds.SET_TX_MODE_CW
|
|
command = PusTelecommand(service=8, subservice=128, ssc=12, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "3":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Get RX Registers"))
|
|
sid = make_sid(object_id, SetIds.RX_REGISTERS_DATASET)
|
|
command = generate_one_hk_command(sid, 200)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "4":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Get TX Registers"))
|
|
sid = make_sid(object_id, SetIds.TX_REGISTERS_DATASET)
|
|
command = generate_one_hk_command(sid, 201)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "5":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX status"))
|
|
command = object_id + CommandIds.READ_TX_STATUS
|
|
command = PusTelecommand(service=8, subservice=128, ssc=13, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "6":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX waveform"))
|
|
command = object_id + CommandIds.READ_TX_WAVEFORM
|
|
command = PusTelecommand(service=8, subservice=128, ssc=14, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "7":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte"))
|
|
command = object_id + CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE
|
|
command = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
if op_code == "8":
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte"))
|
|
command = object_id + CommandIds.READ_TX_AGC_VALUE_LOW_BYTE
|
|
command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
|
|
tc_queue.appendleft(command.pack_command_tuple())
|