This commit is contained in:
Jakob Meier 2021-06-24 17:39:23 +02:00
commit 36582621f2
9 changed files with 51 additions and 17 deletions

6
.gitignore vendored
View File

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

View File

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

View File

@ -9,7 +9,7 @@ import argparse
# All globals can be added here and will be part of a globals dictionary. # 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 config.custom_mode_op import CustomModeList
from tmtccmd.config.definitions import CoreComInterfaces from tmtccmd.config.definitions import CoreComInterfaces
from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \ 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): 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): 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]: Union[CommunicationInterface, None]:
from tmtccmd.config.com_if import create_communication_interface_default from tmtccmd.config.com_if import create_communication_interface_default
return 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): def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):

View File

@ -1,4 +1,4 @@
SW_NAME = "eive" SW_NAME = "eive"
VERSION_MAJOR = 1 VERSION_MAJOR = 1
VERSION_MINOR = 6 VERSION_MINOR = 6
VERSION_SUBMINOR = 0 VERSION_SUBMINOR = 1

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_3_housekeeping import Service3TM
from tmtccmd.pus_tm.service_5_event import Service5TM from tmtccmd.pus_tm.service_5_event import Service5TM
from tmtccmd.pus_tm.service_17_test import Service17TM 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() 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] service_type = raw_tm_packet[7]
tm_packet = None
if service_type == 1: if service_type == 1:
return Service1TM(raw_tm_packet) tm_packet = Service1TM(raw_tm_packet)
if service_type == 3: if service_type == 3:
return Service3TM(raw_tm_packet) tm_packet = Service3TM(raw_tm_packet)
if service_type == 5: if service_type == 5:
return Service5TM(raw_tm_packet) tm_packet = Service5TM(raw_tm_packet)
if service_type == 8: if service_type == 8:
service_8_tm = Service8TM(raw_tm_packet) tm_packet = Service8TM(raw_tm_packet)
return Service8TM(raw_tm_packet)
if service_type == 17: if service_type == 17:
return Service17TM(raw_tm_packet) tm_packet = Service17TM(raw_tm_packet)
LOGGER.info("The service " + str(service_type) + " is not implemented in Telemetry Factory") if tm_packet is None:
return PusTelemetry(raw_tm_packet) 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,29 @@ limitations under the License.
@author R. Mueller @author R. Mueller
""" """
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander import sys
from config.hook_implementations import EiveHookObject 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, add_ccsds_handler
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(): def main():
hook_obj = EiveHookObject() hook_obj = EiveHookObject()
initialize_tmtc_commander(hook_object=hook_obj) 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)
add_ccsds_handler(ccsds_handler)
run_tmtc_commander(False) run_tmtc_commander(False)

@ -1 +0,0 @@
Subproject commit bd46c5a85262140ab097b2704926745e1a0687d1

@ -1 +1 @@
Subproject commit 475ac3f8293fd92533e4d50c061d93b1c2b7f5e1 Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a