-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serial interface: add command parser for protocol #60
Comments
13 tasks
13 tasks
dhebbeker
added a commit
that referenced
this issue
Dec 17, 2023
### Purpose Create a command parser which is capable to interpret the commands from serial interface according to the [defined protocol](https://github.com/Task-Tracker-Systems/Protocol-Serial-Interface/blob/631fc844a80ad5d707d14fb060660ac1e2c31cdd/serial-protocol.md#protocol-v001). Resolves #60 ### Acceptance criteria - [x] It is OK for this version to respond with dummy responses (format does not need to follow protocol) - [x] All arguments of the commands shall be understood (test by echo the values to serial interface) - [x] Dummy functions for the commands shall be called (test by echo a string on serial interface) ### Todos - [x] remove trim functionality as it is not used - [x] add member function to `Command` which generates a string which is intended to specify the correct use of the command (command line format) - [x] handle the case that the command line can not be correctly interpreted outside of `Command` by printing a message - [x] refactoring: check which function shall be member functions - [x] add documentation - [x] test: add appropriate test cases (check for code coverage) - [x] create dedicated namespace - [x] add test case for string helper functions - [x] add documentation for string helper functions - [x] add documentation on how to use the command line interpreter ### Changes - `.github/workflows/platformio.yml`: Added test execution to workflow. - `lib/3rd_party_adapters/serial_port.cpp`: Change line extraction to omit line ending characters and empty lines. - `lib/application_business_rules/Protocol.*`: This implements the protocol (here: dummies) by using the command line interpreter. - `lib/application_business_rules/command_line_interpreter.hpp`: Essentially provides `Option` and `Command` class templates which can be used to call a function with some arguments based on a command line. - `lib/enterprise_business_rules/string_helpers.*`: Add helper functions which can be used to operate on strings. - `platformio.ini`: Add configuration for unit tests. - `src/main.cpp`: Attach `ProtocolHandler` to serial port. - `test/test_cli/test_cli.cpp`: Unit test for command line interpreter. - `test/test_serial_port/test_serial_port.cpp`: Adjust to changed fetching of lines. The end of line character is omitted now. - `test/test_string_helpers/test_string_helpers.cpp`: Unit test for string helpers.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create a command parser which is capable to interpret the commands from serial interface according to the defined protocol.
See WIP.
Acceptance criteria:
Depends on:
std::ostream
adpater for ArduinoSerial
#58std::istream
adpater for ArduinoSerial
#59 or add adapter to read lines via ArduinoSerial
#77The text was updated successfully, but these errors were encountered: