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

Error type strings

parent 6be64b61
No related branches found
No related tags found
2 merge requests!39Merge Develop into Main,!27Move from json-string based transfer between client and host to C struct / class based transfer
......@@ -3,3 +3,30 @@
//
#include "ErrorTypes.h"
namespace ErrorTypes {
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";
default:
return "UNKNOWN_ERROR_TYPE";
}
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
#ifndef CLIENT_MOCK_ERRORTYPES_H
#define CLIENT_MOCK_ERRORTYPES_H
#include <string>
enum class ErrorType: char {
SENSOR_NOT_FOUND,
......@@ -17,5 +18,9 @@ enum class ErrorType: char {
INVALID_VALUE,
};
namespace ErrorTypes {
std::string errorTypeToString(ErrorType errorType);
}
#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