SpaceTeam / STS1_COBC_SW

Software for the communication and onboard computer (COBC) of SpaceTeamSat1 (STS1)
MIT License
7 stars 2 forks source link

Add and use a strong type for program ID #272

Closed PatrickKa closed 6 days ago

PatrickKa commented 1 month ago

Description

Something like using ProgramId = fluent::NamedType<std::uint16_t, struct ProgramIdTag>; should do the trick. This type makes interfaces safer, as in easier to use correctly and more difficult to use incorrectly. Since the program ID shows up in a lot of files and also gets serialized, this refactoring is probably quite some work, but the longer we wait, the worse it gets. We also have to think about where we actually define the type. It will be used at least in the modules for the EDU, the file system and the RF command handling, so it should be in a separate component, but I am not sure what to call it yet since I don't know if and which other types might join later. We could use something like Sts1CobcSw/StrongTypedefs/StrongTypedefs.hpp or .../CommonTypes/CommonTypes.hpp or we think about the umbrella term later and just use .../ProgramId/ProgramId.hpp. I really don't know.

PatrickKa commented 6 days ago

Fixed by #277