-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
97 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,42 @@ | ||
import logging | ||
import struct | ||
from spacepackets.ecss.pus_3_hk import Subservice | ||
from spacepackets.ecss import PusService, PusTc | ||
|
||
|
||
def create_request_one_shot_hk_cmd(apid: int, unique_id: int, set_id: int) -> PusTc: | ||
app_data = bytearray() | ||
app_data.extend(struct.pack("!I", unique_id)) | ||
app_data.extend(struct.pack("!I", set_id)) | ||
return PusTc( | ||
service=PusService.S3_HOUSEKEEPING, | ||
subservice=Subservice.TC_GENERATE_ONE_PARAMETER_REPORT, | ||
apid=apid, | ||
app_data=app_data, | ||
from spacepackets.ecss import PusTm | ||
|
||
from pytmtc.common import AcsId, Apid | ||
from pytmtc.mgms import handle_mgm_hk_report | ||
|
||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def handle_hk_packet(pus_tm: PusTm): | ||
if len(pus_tm.source_data) < 4: | ||
raise ValueError("no unique ID in HK packet") | ||
unique_id = struct.unpack("!I", pus_tm.source_data[:4])[0] | ||
if ( | ||
pus_tm.subservice == Subservice.TM_HK_REPORT | ||
or pus_tm.subservice == Subservice.TM_DIAGNOSTICS_REPORT | ||
): | ||
if len(pus_tm.source_data) < 8: | ||
raise ValueError("no set ID in HK packet") | ||
set_id = struct.unpack("!I", pus_tm.source_data[4:8])[0] | ||
handle_hk_report(pus_tm, unique_id, set_id) | ||
_LOGGER.warning( | ||
f"handling for HK packet with subservice {pus_tm.subservice} not implemented yet" | ||
) | ||
|
||
|
||
def handle_hk_report(pus_tm: PusTm, unique_id: int, set_id: int): | ||
hk_data = pus_tm.source_data[8:] | ||
if pus_tm.apid == Apid.ACS: | ||
if unique_id == AcsId.MGM_0: | ||
handle_mgm_hk_report(pus_tm, set_id, hk_data) | ||
else: | ||
_LOGGER.warning( | ||
f"handling for HK report with unique ID {unique_id} not implemented yet" | ||
) | ||
else: | ||
_LOGGER.warning( | ||
f"handling for HK report with apid {pus_tm.apid} not implemented yet" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import struct | ||
|
||
from spacepackets.ecss import PusService, PusTc | ||
from spacepackets.ecss.pus_3_hk import Subservice | ||
|
||
|
||
def create_request_one_shot_hk_cmd(apid: int, unique_id: int, set_id: int) -> PusTc: | ||
app_data = bytearray() | ||
app_data.extend(struct.pack("!I", unique_id)) | ||
app_data.extend(struct.pack("!I", set_id)) | ||
return PusTc( | ||
service=PusService.S3_HOUSEKEEPING, | ||
subservice=Subservice.TC_GENERATE_ONE_PARAMETER_REPORT, | ||
apid=apid, | ||
app_data=app_data, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters