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 @@
#include "ErrorTypes.h"
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
std::string errorTypeToString(ErrorType errorType) {
switch (errorType) {
case ErrorType::SENSOR_NOT_FOUND:
return "SENSOR_NOT_FOUND";
case ErrorType::SENSOR_NOT_CONNECTED:
return "SENSOR_NOT_CONNECTED";
case ErrorType::NO_DATA:
return "NO_DATA";
case ErrorType::DATA_OK:
return "DATA_OK";
case ErrorType::NULL_MESSAGE:
return "NULL_MESSAGE";
case ErrorType::SENSOR_DOES_NOT_RETURN_DATA:
return "SENSOR_DOES_NOT_RETURN_DATA";
case ErrorType::BATTERY_VOLTAGE_TOO_LOW:
return "BATTERY_VOLTAGE_TOO_LOW";
case ErrorType::INVALID_VALUE:
return "INVALID_VALUE";
case ErrorType::SENSOR_INIT_FAILED:
return "SENSOR_INIT_FAILED";
case ErrorType::INA219_OVERFLOW:
return "INA219_OVERFLOW";
case ErrorType::CONNECTION_ENDED_PREMATURELY:
return "CONNECTION_ENDED_PREMATURELY";
case ErrorType::WRONG_CRC:
return "WRONG_CRC";
case ErrorType::SEM404_COULD_NOT_RESET_PRECIPITATION:
return "SEM404_COULD_NOT_RESET_PRECIPITATION";
case ErrorType::UNKNOWN:
default:
return "UNKNOWN_ERROR_TYPE";
}
}
// 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
std::string errorTypeToString(ErrorType errorType) {
switch (errorType) {
case ErrorType::SENSOR_NOT_FOUND:
return "SENSOR_NOT_FOUND";
case ErrorType::SENSOR_NOT_CONNECTED:
return "SENSOR_NOT_CONNECTED";
case ErrorType::NO_DATA:
return "NO_DATA";
case ErrorType::DATA_OK:
return "DATA_OK";
case ErrorType::NULL_MESSAGE:
return "NULL_MESSAGE";
case ErrorType::SENSOR_DOES_NOT_RETURN_DATA:
return "SENSOR_DOES_NOT_RETURN_DATA";
case ErrorType::BATTERY_VOLTAGE_TOO_LOW:
return "BATTERY_VOLTAGE_TOO_LOW";
case ErrorType::INVALID_VALUE:
return "INVALID_VALUE";
case ErrorType::SENSOR_INIT_FAILED:
return "SENSOR_INIT_FAILED";
case ErrorType::INA219_OVERFLOW:
return "INA219_OVERFLOW";
case ErrorType::CONNECTION_ENDED_PREMATURELY:
return "CONNECTION_ENDED_PREMATURELY";
case ErrorType::WRONG_CRC:
return "WRONG_CRC";
case ErrorType::SEM404_COULD_NOT_RESET_PRECIPITATION:
return "SEM404_COULD_NOT_RESET_PRECIPITATION";
case ErrorType::COULD_NOT_SET_ADDRESS:
return "COULD_NOT_SET_ADDRESS";
case ErrorType::UNKNOWN:
default:
return "UNKNOWN_ERROR_TYPE";
}
}
}
\ No newline at end of file
} // namespace ErrorTypes
\ No newline at end of file
......@@ -7,26 +7,26 @@
#include <string>
enum class ErrorType: char {
SENSOR_NOT_FOUND,
SENSOR_INIT_FAILED,
SENSOR_NOT_CONNECTED,
SEM404_COULD_NOT_RESET_PRECIPITATION,
NO_DATA,
DATA_OK,
NULL_MESSAGE, // message that is sent as padding, should be thrown away
SENSOR_DOES_NOT_RETURN_DATA,
BATTERY_VOLTAGE_TOO_LOW,
INVALID_VALUE,
INA219_OVERFLOW,
CONNECTION_ENDED_PREMATURELY, // connection ended prematurely
WRONG_CRC, // corrupted data package
UNKNOWN,
enum class ErrorType : char {
SENSOR_NOT_FOUND,
SENSOR_INIT_FAILED,
SENSOR_NOT_CONNECTED,
SEM404_COULD_NOT_RESET_PRECIPITATION,
COULD_NOT_SET_ADDRESS,
NO_DATA,
DATA_OK,
NULL_MESSAGE, // message that is sent as padding, should be thrown away
SENSOR_DOES_NOT_RETURN_DATA,
BATTERY_VOLTAGE_TOO_LOW,
INVALID_VALUE,
INA219_OVERFLOW,
CONNECTION_ENDED_PREMATURELY, // connection ended prematurely
WRONG_CRC, // corrupted data package
UNKNOWN,
};
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