Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
error_controller.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_ERROR_CONTROLLER_HPP_
25#define TAPROOT_ERROR_CONTROLLER_HPP_
26
29#include "tap/util_macros.hpp"
30
31#include "modm/container.hpp"
32
33#include "system_error.hpp"
34
35namespace tap
36{
37class Drivers;
38}
39
40namespace tap::errors
41{
49{
50public:
51 static constexpr std::size_t ERROR_LIST_MAX_SIZE = 16;
52 using error_index_t = modm::BoundedDeque<SystemError, ERROR_LIST_MAX_SIZE>::Index;
53
57
64 mockable void addToErrorList(const SystemError& error);
65
66 void init();
67
68 bool terminalSerialCallback(char* inputLine, modm::IOStream& outputStream, bool) override;
69
70 void terminalSerialStreamCallback(modm::IOStream&) override {}
71
72private:
73 static constexpr char USAGE[] =
74 "Usage: error <target>\n"
75 " Where <target> is one of:\n"
76 " - [-H]: displays possible commands.\n"
77 " - [printall]: prints all errors in errorList, displaying their"
78 "description, lineNumber, fileName, and index.\n"
79 " - [remove [index]]: removes the error at the given index. Example: error remove 1.\n"
80 " - [removeall]: removes all errors from the errorList.\n";
81
83
85
86 modm::BoundedDeque<SystemError, ERROR_LIST_MAX_SIZE> errorList;
87
88 bool removeSystemErrorAtIndex(error_index_t index);
89
90 void removeAllSystemErrors();
91
92 void displayAllErrors(modm::IOStream& outputStream);
93
94 void removeTerminalError(int index, modm::IOStream& outputStream);
95
96 void clearAllTerminalErrors(modm::IOStream& outputStream);
97}; // class ErrorController
98} // namespace tap::errors
99
100#endif // TAPROOT_ERROR_CONTROLLER_HPP_
Definition drivers.hpp:70
Definition error_controller.hpp:49
friend class ErrorControllerTester
Definition error_controller.hpp:82
void init()
Definition error_controller.cpp:55
static constexpr std::size_t ERROR_LIST_MAX_SIZE
Definition error_controller.hpp:51
mockable void addToErrorList(const SystemError &error)
Definition error_controller.cpp:34
bool terminalSerialCallback(char *inputLine, modm::IOStream &outputStream, bool) override
Definition error_controller.cpp:97
ErrorController(Drivers *drivers)
Definition error_controller.hpp:54
void terminalSerialStreamCallback(modm::IOStream &) override
Definition error_controller.hpp:70
modm::BoundedDeque< SystemError, ERROR_LIST_MAX_SIZE >::Index error_index_t
Definition error_controller.hpp:52
Definition system_error.hpp:30
Definition can.hpp:32
Definition create_errors.hpp:30
Definition ballistics.cpp:29
tap::Drivers Drivers
Definition drivers.hpp:11
fang::Drivers & drivers
Definition robot_singleton.cpp:45
#define mockable
Wrap class functions that are not already virtual in this function if you wish to mock them.
Definition util_macros.hpp:38
#define DISALLOW_COPY_AND_ASSIGN(Typename)
Definition util_macros.hpp:27