Commit 628fe150 authored by Robin Mueller's avatar Robin Mueller
Browse files

Merge remote-tracking branch 'upstream/mueller/master' into mueller/master

parents ac4faeca 3d5f9add
......@@ -31,6 +31,7 @@ class Service3TM(Service3Base):
STRUCTURE_REPORT_FIXED_HEADER_SIZE = MINIMAL_PACKET_SIZE + 7
def __init__(self, byte_array: bytearray):
from tmtc_core.core.tmtcc_object_id_manager import get_key_from_raw_object_id
super().__init__(byte_array)
if len(self._tm_data) < 8:
warning = "Service3TM: handle_filling_definition_arrays: Invalid Service 3 packet," \
......@@ -39,7 +40,7 @@ class Service3TM(Service3Base):
return
self.object_id = struct.unpack('!I', self._tm_data[0:4])[0]
self.object_id_raw = self._tm_data[0:4]
self.object_id_key = get_key_from_raw_object_id(self.object_id)
self.set_id = struct.unpack('!I', self._tm_data[4:8])[0]
self.specify_packet_info("Housekeeping Packet")
......@@ -103,14 +104,14 @@ class Service3TM(Service3Base):
def handle_filling_hk_arrays(self):
try:
from pus_tm.tmtcc_pus_hk_handling import handle_user_hk_packet
from pus_tm.tmtcc_pus_hk_handling_hook import handle_user_hk_packet
except ImportError:
LOGGER.warning("Service3TM: User HK handling file missing!")
return
self.param_length = len(self._tm_data) - 8
(self.hk_header, self.hk_content, self.validity_buffer) = \
handle_user_hk_packet(self.object_id_raw, self._tm_data[8:], self)
handle_user_hk_packet(self.object_id_key, self._tm_data[8:], self)
Service3TM: Type[PusTelemetry]
......@@ -5,7 +5,7 @@
it to your needs.
"""
from typing import Tuple
from config.tmtcc_object_ids import ObjectIds
from tmtc_core.pus_tm.tmtcc_pus_service_3 import Service3Base
from tmtc_core.utility.tmtcc_logger import get_logger
......@@ -13,10 +13,18 @@ LOGGER = get_logger()
def handle_user_hk_packet(
object_id: bytearray, hk_data: bytearray,
service3_packet: Service3Base) -> Tuple[list, list, bytearray]:
object_id: ObjectIds, hk_data: bytearray, service3_packet: Service3Base
) -> Tuple[list, list, bytearray]:
"""
This function is called when a Service 3 Housekeeping packet is received.
Please note that the object IDs should be compared by value because direct comparison of
enumerations does not work in Python. For example use:
if object_id.value == ObjectIds.TEST_OBJECT.value
to test equality based on the object ID list.
@param object_id:
@param hk_data:
@param service3_packet:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment