refactor: Enhance Meade command parsing and response handling#291
Open
andre-stefanov wants to merge 37 commits into
Open
refactor: Enhance Meade command parsing and response handling#291andre-stefanov wants to merge 37 commits into
andre-stefanov wants to merge 37 commits into
Conversation
…y layer responsibilities
- Introduced MeadeParser.hpp to define enums and structures for parsing Meade commands. - Implemented parsing functions for various command types including Get, Set, Movement, and more. - Created unit tests in test_MeadeParser.cpp to validate the parsing logic and ensure correct command classification. - Added assertions for valid and invalid command inputs, covering all command families and their respective payloads.
- Moved MeadeParser related code into a new 'meade' namespace for better organization. - Added comprehensive unit tests for MeadeParser functionality, covering various command parsing scenarios. - Implemented assertions for valid and invalid command parsing, ensuring robustness of the parser. - Included tests for all command families, including Get, Set, Sync, Movement, Home, Quit, Slew Rate, Focus, and Extra commands.
- Implemented MeadeResponse class for type-safe Meade replies with fixed capacity. - Defined response shapes using zero-size tag types in the response namespace. - Created makeResponse overloads for various response shapes. - Added traits for mapping command kinds to response tags. - Implemented entry points for responding to different command families. - Developed unit tests to validate response shapes and command bindings, ensuring correct wire formatting.
…er and MeadeResponse for AVR compatibility
- Consolidated response trait mappings into a single primary template `Response<K>`, replacing multiple family-specific templates. - Updated entry point function from `respondGet<K>` and `respondSet<K>` to a unified `respond<K>`. - Adjusted macro definitions for binding command kinds to response tags to accommodate the new structure. - Modified unit tests to reflect changes in response function calls and ensure consistent behavior across all command kinds.
- Removed MeadeGet command parsing and related tests from MeadeParser unit tests. - Introduced new unit tests for MeadeGet command handling in test_MeadeGetDispatcher.cpp. - Added comprehensive wire-byte tests for Meade Get-family commands in test_MeadeGet.cpp. - Updated MeadeResponse tests to remove redundant Get command assertions. - Ensured all tests maintain coverage for command routing and response formatting.
- Removed the MeadeSetCommandKind enum and associated MeadeSetParseResult structure from MeadeParser.hpp. - Introduced IMeadeSetHandlers interface for handling Meade Set commands, with methods for each command type. - Implemented handleMeadeSet function to parse and dispatch Meade Set commands directly, returning a MeadeResponse. - Updated MeadeResponse to remove bindings related to MeadeSetCommandKind. - Added unit tests for the new handleMeadeSet functionality, covering various command scenarios and edge cases. - Removed obsolete unit tests related to the old Meade Set command parsing.
- Implement tests for Meade Focus dispatcher covering commands such as continuous motion, MoveBy, speed settings, GetPosition, SetPosition, GetState, and Stop. - Add tests for Meade GPS dispatcher to validate GPS acquisition commands and payload handling. - Create tests for Meade Home dispatcher to verify park, slew-to-home, unpark, and setting Az/Alt home commands. - Introduce tests for Meade Init dispatcher to ensure proper handling of serial control commands. - Develop tests for Meade Movement dispatcher to cover slew, tracking, guide pulse, and stepper movement commands. - Add tests for Meade SetSlewRate dispatcher to validate mapping of slew rates to commands. - Implement tests for Meade SyncControl dispatcher to check synchronization commands and responses. - Remove outdated MeadeResponse tests as they are no longer needed.
- Removed #include "core/MeadeResponse.hpp" from multiple unit test files. - Updated includes to only reference "core/MeadeParser.hpp" where applicable.
… switch-case structure
…on and consolidating handler interfaces
…mplify coordinate reading functions
…age in handleMeadeFocus
b130820 to
a362dfe
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the Meade command parser and response system for improved organization and maintainability. Introduce new command handlers, enhance unit test coverage, and update documentation to clarify layer responsibilities. This update aims to streamline command processing and ensure robust handling of various Meade commands.