updated tmtc

This commit is contained in:
Robin Müller 2021-06-21 17:30:37 +02:00
parent 0b9bbf6212
commit d241101d88
No known key found for this signature in database
GPG Key ID: FC76078F520434A5
7 changed files with 49 additions and 15 deletions

6
.gitignore vendored
View File

@ -8,4 +8,8 @@ log
/Lib
/Scripts
/pyvenv.cfg
/pyvenv.cfg
/bin
/lib
/lib64
/share

View File

@ -7,6 +7,9 @@
import enum
PUS_APID = 0x65
class CustomServiceList(enum.Enum):
TEST_DEVICE = "test",
P60DOCK = "p60dock"

View File

@ -9,7 +9,7 @@ import argparse
# All globals can be added here and will be part of a globals dictionary.
from config.definitions import CustomServiceList
from config.definitions import CustomServiceList, PUS_APID
from config.custom_mode_op import CustomModeList
from tmtccmd.config.definitions import CoreComInterfaces
from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \
@ -25,7 +25,8 @@ class CustomGlobalIds(enum.Enum):
def set_globals_pre_args_parsing(gui: bool = False):
set_default_globals_pre_args_parsing(gui=gui, apid=0x65, com_if_id=CoreComInterfaces.TCPIP_UDP.value)
set_default_globals_pre_args_parsing(
gui=gui, apid=PUS_APID, com_if_id=CoreComInterfaces.TCPIP_UDP.value)
def add_globals_post_args_parsing(args: argparse.Namespace, json_cfg_path: str):

View File

@ -97,7 +97,8 @@ class EiveHookObject(TmTcHookBase):
Union[CommunicationInterface, None]:
from tmtccmd.config.com_if import create_communication_interface_default
return create_communication_interface_default(
com_if_key=com_if_key, tmtc_printer=tmtc_printer, json_cfg_path=self.get_json_config_file_path()
com_if_key=com_if_key, tmtc_printer=tmtc_printer,
json_cfg_path=self.get_json_config_file_path()
)
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):

View File

@ -11,22 +11,32 @@ from tmtccmd.pus_tm.service_1_verification import Service1TM
from tmtccmd.pus_tm.service_3_housekeeping import Service3TM
from tmtccmd.pus_tm.service_5_event import Service5TM
from tmtccmd.pus_tm.service_17_test import Service17TM
from tmtccmd.utility.tmtc_printer import TmTcPrinter
from config.definitions import PUS_APID
LOGGER = get_logger()
def tm_user_factory_hook(raw_tm_packet: bytearray) -> PusTelemetry:
def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter) -> None:
if apid == PUS_APID:
pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer)
def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
service_type = raw_tm_packet[7]
tm_packet = None
if service_type == 1:
return Service1TM(raw_tm_packet)
tm_packet = Service1TM(raw_tm_packet)
if service_type == 3:
return Service3TM(raw_tm_packet)
tm_packet = Service3TM(raw_tm_packet)
if service_type == 5:
return Service5TM(raw_tm_packet)
tm_packet = Service5TM(raw_tm_packet)
if service_type == 8:
service_8_tm = Service8TM(raw_tm_packet)
return Service8TM(raw_tm_packet)
tm_packet = Service8TM(raw_tm_packet)
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)
tm_packet = Service17TM(raw_tm_packet)
if tm_packet is None:
LOGGER.info(f'The service {service_type} is not implemented in Telemetry Factory')
tm_packet = PusTelemetry(raw_tm_packet)
tmtc_printer.print_telemetry(packet=tm_packet)

View File

@ -26,13 +26,28 @@ limitations under the License.
@author R. Mueller
"""
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander
import sys
from config.hook_implementations import EiveHookObject
from config.definitions import PUS_APID
from pus_tm.factory_hook import ccsds_tm_handler
try:
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander
from tmtccmd.ccsds.handler import CcsdsTmHandler
except ImportError as error:
run_tmtc_commander = None
initialize_tmtc_commander = None
print(error)
print("Python tmtccmd submodule could not be imported")
print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation")
sys.exit(0)
def main():
hook_obj = EiveHookObject()
initialize_tmtc_commander(hook_object=hook_obj)
ccsds_handler = CcsdsTmHandler()
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50)
run_tmtc_commander(False)

@ -1 +1 @@
Subproject commit 9415eac9eeb17dffed31f3a7a1ef849902eeb5c1
Subproject commit ec23093bff4c70ab0044f1bb049c64a2376ec927