Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed May 9, 2024
1 parent 0cbe4a1 commit 6fa6779
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
20 changes: 7 additions & 13 deletions examples/app/tmtcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
TcProcedureType,
TcQueueEntryType,
)
from tmtccmd.util import ObjectIdDictT
from spacepackets.seqcount import FileSeqCountProvider, PusFileSeqCountProvider

_LOGGER = logging.getLogger()
Expand All @@ -58,7 +57,7 @@

class ExampleHookClass(HookBase):
def __init__(self, json_cfg_path: str):
super().__init__(json_cfg_path=json_cfg_path)
super().__init__(cfg_file_path=json_cfg_path)

def get_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
assert self.cfg_path is not None
Expand Down Expand Up @@ -124,11 +123,6 @@ def perform_mode_operation(self, _tmtc_backend: CcsdsTmtcBackend, _mode: int):
_LOGGER.info("Mode operation hook was called")
pass

def get_object_ids(self) -> ObjectIdDictT:
from tmtccmd.config.objects import get_core_object_ids

return get_core_object_ids()


class PusTmHandler(SpecificApidHandlerBase):
def __init__(
Expand Down Expand Up @@ -238,15 +232,15 @@ def send_cb(self, send_params: SendCbParams):
log_entry = entry_helper.to_log_entry()
_LOGGER.info(log_entry.log_str)

def queue_finished_cb(self, helper: ProcedureWrapper):
if helper.proc_type == TcProcedureType.TREE_COMMANDING:
def_proc = helper.to_tree_commanding_procedure()
def queue_finished_cb(self, info: ProcedureWrapper):
if info.proc_type == TcProcedureType.TREE_COMMANDING:
def_proc = info.to_tree_commanding_procedure()
_LOGGER.info(f"Queue handling finished for command {def_proc.cmd_path}")

def feed_cb(self, helper: ProcedureWrapper, wrapper: FeedWrapper):
def feed_cb(self, info: ProcedureWrapper, wrapper: FeedWrapper):
self.queue_helper.queue_wrapper = wrapper.queue_wrapper
if helper.proc_type == TcProcedureType.TREE_COMMANDING:
def_proc = helper.to_tree_commanding_procedure()
if info.proc_type == TcProcedureType.TREE_COMMANDING:
def_proc = info.to_tree_commanding_procedure()
cmd_path = def_proc.cmd_path
assert cmd_path is not None
# Path starts with / so the first entry of the list will be an empty string. We cut
Expand Down
4 changes: 2 additions & 2 deletions tmtccmd/config/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def perform_mode_operation(self, tmtc_backend: BackendBase, mode: int):

@deprecated(version="8.0.0", reason="application specific code")
def get_object_ids(self) -> ObjectIdDictT:
from tmtccmd.config.objects import get_base_obj_id_mapping
from tmtccmd.config.objects import get_base_component_id_mapping

"""The user can specify an object ID dictionary here mapping object ID bytearrays to a
list. This list could contain containing the string representation or additional
information about that object ID.
"""
return get_base_obj_id_mapping()
return get_base_component_id_mapping()

@deprecated(
version="8.0.0rc0",
Expand Down
8 changes: 4 additions & 4 deletions tmtccmd/config/objects.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from tmtccmd.util.obj_id import ObjectIdMapping, ObjectIdU32
from tmtccmd.util.obj_id import ComponentIdMapping, ObjectIdU32


INVALID_ID = bytes([0xFF, 0xFF, 0xFF, 0xFF])


def get_base_obj_id_mapping() -> ObjectIdMapping:
def get_base_component_id_mapping() -> ComponentIdMapping:
"""These are the object IDs for the tmtccmd core. The core will usually take care of
inserting these into the object manager during the program initialization.
Expand All @@ -16,5 +16,5 @@ def get_base_obj_id_mapping() -> ObjectIdMapping:
return object_id_dict


def get_core_object_ids() -> ObjectIdMapping:
return get_base_obj_id_mapping()
def get_core_object_ids() -> ComponentIdMapping:
return get_base_component_id_mapping()

0 comments on commit 6fa6779

Please sign in to comment.