Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc into mueller/master
This commit is contained in:
commit
e67eb6633e
@ -13,7 +13,7 @@ from tmtccmd.pus.obj_id import ObjectIdDictT
|
|||||||
from tmtccmd.com_if.com_interface_base import CommunicationInterface
|
from tmtccmd.com_if.com_interface_base import CommunicationInterface
|
||||||
from tmtccmd.core.backend import TmTcHandler
|
from tmtccmd.core.backend import TmTcHandler
|
||||||
from tmtccmd.config.hook import TmTcHookBase
|
from tmtccmd.config.hook import TmTcHookBase
|
||||||
from tmtccmd.utility.tmtc_printer import TmTcPrinter
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
from tmtccmd.config.globals import OpCodeDictKeys
|
from tmtccmd.config.globals import OpCodeDictKeys
|
||||||
|
|
||||||
from config.definitions import CustomServiceList
|
from config.definitions import CustomServiceList
|
||||||
@ -50,13 +50,12 @@ class EiveHookObject(TmTcHookBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def assign_communication_interface(
|
def assign_communication_interface(
|
||||||
self, com_if_key: str, tmtc_printer: TmTcPrinter
|
self, com_if_key: str
|
||||||
) -> 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,
|
com_if_key=com_if_key,
|
||||||
tmtc_printer=tmtc_printer,
|
|
||||||
json_cfg_path=self.get_json_config_file_path(),
|
json_cfg_path=self.get_json_config_file_path(),
|
||||||
space_packet_ids=(0x0865,),
|
space_packet_ids=(0x0865,),
|
||||||
)
|
)
|
||||||
@ -88,19 +87,6 @@ class EiveHookObject(TmTcHookBase):
|
|||||||
object_id=object_id, action_id=action_id, custom_data=custom_data
|
object_id=object_id, action_id=action_id, custom_data=custom_data
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def handle_service_3_housekeeping(
|
|
||||||
object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
|
|
||||||
) -> HkReplyUnpacked:
|
|
||||||
from pus_tm.hk_handling import handle_user_hk_packet
|
|
||||||
|
|
||||||
return handle_user_hk_packet(
|
|
||||||
object_id=object_id,
|
|
||||||
set_id=set_id,
|
|
||||||
hk_data=hk_data,
|
|
||||||
service3_packet=service3_packet,
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def handle_service_5_event(
|
def handle_service_5_event(
|
||||||
object_id: bytes, event_id: int, param_1: int, param_2: int
|
object_id: bytes, event_id: int, param_1: int, param_2: int
|
||||||
|
@ -5,9 +5,10 @@
|
|||||||
"""
|
"""
|
||||||
import os.path
|
import os.path
|
||||||
from tmtccmd.pus.obj_id import ObjectIdDictT
|
from tmtccmd.pus.obj_id import ObjectIdDictT
|
||||||
from tmtccmd.utility.fsfw import parse_fsfw_objects_csv
|
from tmtccmd.fsfw import parse_fsfw_objects_csv
|
||||||
from tmtccmd.logging import get_console_logger
|
from tmtccmd.logging import get_console_logger
|
||||||
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
DEFAULT_OBJECTS_CSV_PATH = "config/objects.csv"
|
DEFAULT_OBJECTS_CSV_PATH = "config/objects.csv"
|
||||||
__OBJECT_ID_DICT = None
|
__OBJECT_ID_DICT = None
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from tmtccmd.utility.fsfw import parse_fsfw_returnvalues_csv, RetvalDictT
|
from tmtccmd.fsfw import parse_fsfw_returnvalues_csv, RetvalDictT
|
||||||
from tmtccmd.logging import get_console_logger
|
from tmtccmd.logging import get_console_logger
|
||||||
|
|
||||||
DEFAULT_RETVAL_CSV_NAME = "config/returnvalues.csv"
|
DEFAULT_RETVAL_CSV_NAME = "config/returnvalues.csv"
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from config.object_ids import get_object_ids
|
from config.object_ids import get_object_ids
|
||||||
|
|
||||||
from tmtccmd.logging import get_console_logger
|
from tmtccmd.logging import get_console_logger
|
||||||
from tmtccmd.utility.fsfw import parse_fsfw_events_csv, EventDictT, EventInfo
|
from tmtccmd.fsfw import parse_fsfw_events_csv, EventDictT, EventInfo
|
||||||
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
DEFAULT_EVENTS_CSV_PATH = "config/events.csv"
|
DEFAULT_EVENTS_CSV_PATH = "config/events.csv"
|
||||||
|
@ -13,7 +13,7 @@ from tmtccmd.tm.service_3_fsfw_housekeeping import Service3FsfwTm
|
|||||||
from tmtccmd.tm.service_20_fsfw_parameters import Service20FsfwTm
|
from tmtccmd.tm.service_20_fsfw_parameters import Service20FsfwTm
|
||||||
from tmtccmd.tm.service_5_event import Service5Tm
|
from tmtccmd.tm.service_5_event import Service5Tm
|
||||||
from tmtccmd.tm.service_200_fsfw_mode import Service200FsfwTm
|
from tmtccmd.tm.service_200_fsfw_mode import Service200FsfwTm
|
||||||
from tmtccmd.utility.tmtc_printer import TmTcPrinter, PrintFormats
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter, PrintFormats
|
||||||
|
|
||||||
from config.definitions import PUS_APID
|
from config.definitions import PUS_APID
|
||||||
|
|
||||||
@ -21,13 +21,13 @@ LOGGER = get_console_logger()
|
|||||||
|
|
||||||
|
|
||||||
def ccsds_tm_handler(
|
def ccsds_tm_handler(
|
||||||
apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter
|
apid: int, raw_tm_packet: bytes, tmtc_printer: FsfwTmTcPrinter
|
||||||
) -> None:
|
) -> None:
|
||||||
if apid == PUS_APID:
|
if apid == PUS_APID:
|
||||||
pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer)
|
pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer)
|
||||||
|
|
||||||
|
|
||||||
def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
|
def pus_factory_hook(raw_tm_packet: bytes, tmtc_printer: FsfwTmTcPrinter):
|
||||||
if len(raw_tm_packet) < 8:
|
if len(raw_tm_packet) < 8:
|
||||||
LOGGER.warning("Detected packet shorter than 8 bytes!")
|
LOGGER.warning("Detected packet shorter than 8 bytes!")
|
||||||
return
|
return
|
||||||
@ -56,9 +56,10 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
|
|||||||
)
|
)
|
||||||
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
|
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
|
||||||
tm_packet.print_source_data(PrintFormats.HEX)
|
tm_packet.print_source_data(PrintFormats.HEX)
|
||||||
tmtc_printer.print_telemetry(
|
LOGGER.info(f"Received packet with service {service_type}")
|
||||||
packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False
|
# tmtc_printer.print_telemetry(
|
||||||
)
|
# packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False
|
||||||
|
# )
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# TODO: Log faulty packet
|
# TODO: Log faulty packet
|
||||||
LOGGER.warning("Invalid packet format detected")
|
LOGGER.warning("Invalid packet format detected")
|
||||||
|
15
tmtccli.py
15
tmtccli.py
@ -26,6 +26,7 @@ limitations under the License.
|
|||||||
|
|
||||||
@author R. Mueller
|
@author R. Mueller
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@ -35,8 +36,8 @@ try:
|
|||||||
run_tmtc_commander,
|
run_tmtc_commander,
|
||||||
add_ccsds_handler,
|
add_ccsds_handler,
|
||||||
)
|
)
|
||||||
from tmtccmd.ccsds.handler import CcsdsTmHandler
|
from tmtccmd.ccsds.handler import CcsdsTmHandler, ApidHandler
|
||||||
from tmtccmd.logging import TMTC_LOGGER_NAME
|
from tmtccmd.logging import init_console_logger
|
||||||
except ImportError as error:
|
except ImportError as error:
|
||||||
run_tmtc_commander = None
|
run_tmtc_commander = None
|
||||||
initialize_tmtc_commander = None
|
initialize_tmtc_commander = None
|
||||||
@ -47,7 +48,6 @@ except ImportError as error:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import spacepackets
|
import spacepackets
|
||||||
from spacepackets.log import set_custom_console_logger_name
|
|
||||||
except ImportError as error:
|
except ImportError as error:
|
||||||
print(error)
|
print(error)
|
||||||
print("Python spacepackets module could not be imported")
|
print("Python spacepackets module could not be imported")
|
||||||
@ -63,17 +63,14 @@ from pus_tm.factory_hook import ccsds_tm_handler
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from pus_tm.event_handler import handle_event_packet
|
|
||||||
|
|
||||||
hook_obj = EiveHookObject()
|
hook_obj = EiveHookObject()
|
||||||
print(f"-- eive tmtc version {__version__} --")
|
print(f"-- eive tmtc version {__version__} --")
|
||||||
print(f"-- spacepackets version {spacepackets.__version__} --")
|
print(f"-- spacepackets version {spacepackets.__version__} --")
|
||||||
set_custom_console_logger_name(logger_name=TMTC_LOGGER_NAME)
|
|
||||||
initialize_tmtc_commander(hook_object=hook_obj)
|
initialize_tmtc_commander(hook_object=hook_obj)
|
||||||
ccsds_handler = CcsdsTmHandler()
|
ccsds_handler = CcsdsTmHandler()
|
||||||
ccsds_handler.add_tm_handler(
|
init_console_logger()
|
||||||
apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
|
pus_handler = ApidHandler(cb=ccsds_tm_handler, queue_len=50, user_args=None)
|
||||||
)
|
ccsds_handler.add_tm_handler(apid=PUS_APID, handler=pus_handler)
|
||||||
add_ccsds_handler(ccsds_handler)
|
add_ccsds_handler(ccsds_handler)
|
||||||
run_tmtc_commander(False)
|
run_tmtc_commander(False)
|
||||||
|
|
||||||
|
2
tmtccmd
2
tmtccmd
@ -1 +1 @@
|
|||||||
Subproject commit 1054a73859657bc18c9a215d1dea385121275b8a
|
Subproject commit 0107689ce4362a315fd06642322e0487ab17ca90
|
Loading…
Reference in New Issue
Block a user