eive-tmtc/pus_tm/factory_hook.py

30 lines
1.1 KiB
Python
Raw Normal View History

2020-12-17 17:50:00 +01:00
"""
@brief This file transfers control of TM parsing to the user
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
it to your needs.
"""
2021-03-19 17:39:52 +01:00
from tmtccmd.pus_tm.service_8_functional_cmd import Service8TM
from tmtccmd.pus_tm.base import PusTelemetry
from tmtccmd.utility.tmtcc_logger import get_logger
2020-12-17 17:50:00 +01:00
2021-03-19 17:39:52 +01:00
from tmtccmd.pus_tm.service_1_verification import Service1TM
from tmtccmd.pus_tm.service_5_event import Service5TM
from tmtccmd.pus_tm.service_17_test import Service17TM
2020-12-17 17:50:00 +01:00
LOGGER = get_logger()
def tm_user_factory_hook(raw_tm_packet: bytearray) -> PusTelemetry:
service_type = raw_tm_packet[7]
if service_type == 1:
return Service1TM(raw_tm_packet)
if service_type == 5:
return Service5TM(raw_tm_packet)
2021-02-09 12:35:10 +01:00
if service_type == 8:
2021-03-19 17:39:52 +01:00
service_8_tm = Service8TM(raw_tm_packet)
2021-02-09 12:35:10 +01:00
return Service8TM(raw_tm_packet)
2020-12-17 17:50:00 +01:00
if service_type == 17:
return Service17TM(raw_tm_packet)
LOGGER.info("The service " + str(service_type) + " is not implemented in Telemetry Factory")
return PusTelemetry(raw_tm_packet)