Refactor network packets into structs #122

Closed
opened 2026-04-05 17:51:53 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @gorbit99 on 3/14/2025

This PR aims to make changing packet code less error prone by introducing structs that describe most packets used for communication. Since communication is done using big endian data, steps are also taken, so that this is more or less automatically handled as well.

The only packets that didn't get turned into structs are the heartbeat packet (since it's empty, and 0 byte structs aren't supported by C++), the feature flags packet (since its length is complicated) and the handshake or tracker discovery packet (since this has a variable length string inside it).

The PR also cleans up some of the code surrounding these changes, for example by creating enum classes for the various packet values.

*Originally created by @gorbit99 on 3/14/2025* This PR aims to make changing packet code less error prone by introducing structs that describe most packets used for communication. Since communication is done using big endian data, steps are also taken, so that this is more or less automatically handled as well. The only packets that didn't get turned into structs are the heartbeat packet (since it's empty, and 0 byte structs aren't supported by C++), the feature flags packet (since its length is complicated) and the handshake or tracker discovery packet (since this has a variable length string inside it). The PR also cleans up some of the code surrounding these changes, for example by creating enum classes for the various packet values.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/SlimeVR-Tracker-ESP#122