Skip to content

Conversation

@greglucas
Copy link
Collaborator

This is an attempt to refactor our xtce parsing to be more generic and allow any RawDataObject, not just ccsds packets.

  • RawPacketData has the read_* methods, RawCCSDSPacketData subclasses that and adds on cached properties to access specific header items.
  • Moved the ccsds continuation packet logic into the ccsds_generator to try and keep all ccsds logic in one place.

Thoughts/suggestions on how to make this better for other packet types are welcome!

  • I was thinking it might be nice if a user could pass in raw bytes directly to definition.parse_packet(bytes) and not our wrapped classes that add the reading methods. Perhaps we could wrap the input bytes into our own container class within the function itself which would remove some of the user-facing need to create a RawPacketData-like object with read_* methods on it.

closes #130

Checklist

  • Changes are fully implemented without dangling issues or TODO items
  • Deprecated/superseded code is removed or marked with deprecation warning
  • Current dependencies have been properly specified and old dependencies removed
  • New code/functionality has accompanying tests and any old tests have been updated to match any new assumptions
  • The changelog.md has been updated

@greglucas greglucas requested a review from medley56 as a code owner February 13, 2025 04:57
@codecov
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 97.36264% with 12 lines in your changes missing coverage. Please review.

Project coverage is 92.11%. Comparing base (bc05878) to head (11dc83b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
space_packet_parser/ccsds.py 93.29% 11 Missing ⚠️
space_packet_parser/xtce/definitions.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
+ Coverage   91.89%   92.11%   +0.22%     
==========================================
  Files          36       37       +1     
  Lines        2553     2614      +61     
==========================================
+ Hits         2346     2408      +62     
+ Misses        207      206       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@medley56 medley56 mentioned this pull request Mar 8, 2025
4 tasks
Copy link
Member

@medley56 medley56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still am not convinced the packet_generator method on the definition object is truly generic because it's calling ccsds_generator internally to create the CCSDSPacketBytes objects for parsing. The parsing appears to be fully generic but the generation of the packet bytes seems to still rely on CCSDS.

@medley56 medley56 mentioned this pull request Mar 11, 2025
5 tasks
This moves towards a generic packet interface and removes the need
for passing in bytes with a read_* interface, we now wrap that in
our own reader class to simplify that interaction.
We can add these properties back onto the main "Packet" class and
add a user warning when being accessed to make it easier to
transition to the new style and provide a helpful message.
Deprecate parse_ccsds_packet() as the XTCE spec doesn't need to know
about the ccsds standard. We should handle parsing raw bytes objects
and create the underlying objects for the users ourselves.
It is specific to ccsds packets and hasn't been released yet, so
just keep it over there instead.
Copy link
Member

@medley56 medley56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get it now. I noted a few really minor things. There are a bunch of typehints that read Packet instead of SpacePacket. The example and associated test you added for fix length packet parsing for non CCSDS packets is what I needed to see. LGTM

@medley56 medley56 merged commit c85f721 into lasp:main Aug 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the ability to parse any binary packet from XTCE

2 participants