eive-tmtc/pus_tc/tmtcc_tc_packer_hook.py

35 lines
1.2 KiB
Python

"""
@brief This file transfers control of TC packing to the user
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
it to your needs.
"""
import os
from collections import deque
from typing import Union
from config.tmtcc_definitions import ServiceList
from tmtc_core.utility.tmtcc_logger import get_logger
from tmtc_core.pus_tc.tmtcc_pus_tc_base import TcQueueT
from tmtc_core.pus_tc.tmtcc_tc_service5_event import pack_service5_test_into
from tmtc_core.pus_tc.tmtcc_tc_service17_test import pack_service17_ping_command
LOGGER = get_logger()
def pack_service_queue_user(service: Union[int, str], op_code: int, service_queue: TcQueueT):
if service == ServiceList.SERVICE_5:
return pack_service5_test_into(service_queue)
if service == ServiceList.SERVICE_17:
return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
LOGGER.warning("Invalid Service !")
def create_total_tc_queue_user() -> TcQueueT:
if not os.path.exists("log"):
os.mkdir("log")
tc_queue = deque()
pack_service5_test_into(tc_queue)
tc_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
return tc_queue