Skip to content
Snippets Groups Projects
Verified Commit 0d5eefaa authored by Zoe Michaela Dietmar Pfister's avatar Zoe Michaela Dietmar Pfister :gay_pride_flag:
Browse files

add missing ErrorTypes.cpp

parent 89b4ed72
No related branches found
No related tags found
2 merge requests!39Merge Develop into Main,!30Renamed Sentec Sensors, made RS485 serial connection a singleton shared...
Pipeline #102083 passed
...@@ -5,39 +5,42 @@ ...@@ -5,39 +5,42 @@
#include "ErrorTypes.h" #include "ErrorTypes.h"
namespace ErrorTypes { namespace ErrorTypes {
// INFO: If you add a new error type, add it here and to the documentation at https://git.uibk.ac.at/informatik/qe/forte/sensor-system/-/wikis/Error-Types as well // INFO: If you add a new error type, add it here and to the documentation at
std::string errorTypeToString(ErrorType errorType) { // https://git.uibk.ac.at/informatik/qe/forte/sensor-system/-/wikis/Error-Types as well
switch (errorType) { std::string errorTypeToString(ErrorType errorType) {
case ErrorType::SENSOR_NOT_FOUND: switch (errorType) {
return "SENSOR_NOT_FOUND"; case ErrorType::SENSOR_NOT_FOUND:
case ErrorType::SENSOR_NOT_CONNECTED: return "SENSOR_NOT_FOUND";
return "SENSOR_NOT_CONNECTED"; case ErrorType::SENSOR_NOT_CONNECTED:
case ErrorType::NO_DATA: return "SENSOR_NOT_CONNECTED";
return "NO_DATA"; case ErrorType::NO_DATA:
case ErrorType::DATA_OK: return "NO_DATA";
return "DATA_OK"; case ErrorType::DATA_OK:
case ErrorType::NULL_MESSAGE: return "DATA_OK";
return "NULL_MESSAGE"; case ErrorType::NULL_MESSAGE:
case ErrorType::SENSOR_DOES_NOT_RETURN_DATA: return "NULL_MESSAGE";
return "SENSOR_DOES_NOT_RETURN_DATA"; case ErrorType::SENSOR_DOES_NOT_RETURN_DATA:
case ErrorType::BATTERY_VOLTAGE_TOO_LOW: return "SENSOR_DOES_NOT_RETURN_DATA";
return "BATTERY_VOLTAGE_TOO_LOW"; case ErrorType::BATTERY_VOLTAGE_TOO_LOW:
case ErrorType::INVALID_VALUE: return "BATTERY_VOLTAGE_TOO_LOW";
return "INVALID_VALUE"; case ErrorType::INVALID_VALUE:
case ErrorType::SENSOR_INIT_FAILED: return "INVALID_VALUE";
return "SENSOR_INIT_FAILED"; case ErrorType::SENSOR_INIT_FAILED:
case ErrorType::INA219_OVERFLOW: return "SENSOR_INIT_FAILED";
return "INA219_OVERFLOW"; case ErrorType::INA219_OVERFLOW:
case ErrorType::CONNECTION_ENDED_PREMATURELY: return "INA219_OVERFLOW";
return "CONNECTION_ENDED_PREMATURELY"; case ErrorType::CONNECTION_ENDED_PREMATURELY:
case ErrorType::WRONG_CRC: return "CONNECTION_ENDED_PREMATURELY";
return "WRONG_CRC"; case ErrorType::WRONG_CRC:
case ErrorType::SEM404_COULD_NOT_RESET_PRECIPITATION: return "WRONG_CRC";
return "SEM404_COULD_NOT_RESET_PRECIPITATION"; case ErrorType::SEM404_COULD_NOT_RESET_PRECIPITATION:
case ErrorType::UNKNOWN: return "SEM404_COULD_NOT_RESET_PRECIPITATION";
default: case ErrorType::COULD_NOT_SET_ADDRESS:
return "UNKNOWN_ERROR_TYPE"; return "COULD_NOT_SET_ADDRESS";
} case ErrorType::UNKNOWN:
} default:
return "UNKNOWN_ERROR_TYPE";
}
}
} } // namespace ErrorTypes
\ No newline at end of file \ No newline at end of file
...@@ -7,26 +7,26 @@ ...@@ -7,26 +7,26 @@
#include <string> #include <string>
enum class ErrorType: char { enum class ErrorType : char {
SENSOR_NOT_FOUND, SENSOR_NOT_FOUND,
SENSOR_INIT_FAILED, SENSOR_INIT_FAILED,
SENSOR_NOT_CONNECTED, SENSOR_NOT_CONNECTED,
SEM404_COULD_NOT_RESET_PRECIPITATION, SEM404_COULD_NOT_RESET_PRECIPITATION,
NO_DATA, COULD_NOT_SET_ADDRESS,
DATA_OK, NO_DATA,
NULL_MESSAGE, // message that is sent as padding, should be thrown away DATA_OK,
SENSOR_DOES_NOT_RETURN_DATA, NULL_MESSAGE, // message that is sent as padding, should be thrown away
BATTERY_VOLTAGE_TOO_LOW, SENSOR_DOES_NOT_RETURN_DATA,
INVALID_VALUE, BATTERY_VOLTAGE_TOO_LOW,
INA219_OVERFLOW, INVALID_VALUE,
CONNECTION_ENDED_PREMATURELY, // connection ended prematurely INA219_OVERFLOW,
WRONG_CRC, // corrupted data package CONNECTION_ENDED_PREMATURELY, // connection ended prematurely
UNKNOWN, WRONG_CRC, // corrupted data package
UNKNOWN,
}; };
namespace ErrorTypes { namespace ErrorTypes {
std::string errorTypeToString(ErrorType errorType); std::string errorTypeToString(ErrorType errorType);
} }
#endif // CLIENT_MOCK_ERRORTYPES_H
#endif //CLIENT_MOCK_ERRORTYPES_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment