Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serial interface: add command parser for protocol (#82)
### 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.
- Loading branch information