-
Notifications
You must be signed in to change notification settings - Fork 4
/
Error.hh
93 lines (88 loc) · 3.29 KB
/
Error.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Copyright © 2018, Maciej Sopyło <[email protected]>
*
* This file is part of libb6.
*
* libb6 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libb6 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with libb6. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIB_B6_DEMO_ERROR_HH
#define LIB_B6_DEMO_ERROR_HH
#include <exception>
namespace b6 {
class ChargingError : public std::exception {
public:
virtual std::string message() { return "Charging Error"; };
};
class ErrorConnectionBroken : public ChargingError {
std::string message() { return "Connection broken!"; };
};
class ErrorCellVoltageInvalid : public ChargingError {
std::string message() { return "Cell voltage invalid!"; };
};
class ErrorBalanceConnection : public ChargingError {
std::string message() { return "Balance connection error!"; };
};
class ErrorNoBattery : public ChargingError {
std::string message() { return"No battery detected!"; };
};
class ErrorCellNumberIncorrect : public ChargingError {
std::string message() { return"Cell number incorrect!"; };
};
class ErrorConnectionMainPort : public ChargingError {
std::string message() { return"Main battery port disconnected!"; };
};
class ErrorBatteryFull : public ChargingError {
std::string message() { return"Battery full!"; };
};
class ErrorChargeNotNeeded : public ChargingError {
std::string message() { return"Charging not needed!"; };
};
class ErrorCellHighVoltage : public ChargingError {
std::string message() { return"Cell voltage high!"; };
};
class ErrorIntTempTooHigh : public ChargingError {
std::string message() { return"Internal temperature too high!"; };
};
class ErrorExtTempTooHigh : public ChargingError {
std::string message() { return"External temperature too high!"; };
};
class ErrorDCInTooLow : public ChargingError {
std::string message() { return"DC-in too low!"; };
};
class ErrorDCInTooHigh : public ChargingError {
std::string message() { return"DC-in too high!"; };
};
class ErrorOverTimeLimit : public ChargingError {
std::string message() { return"Time limit reached!"; };
};
class ErrorOverCapacityLimit : public ChargingError {
std::string message() { return"Capacity limit reached!"; };
};
class ErrorReversePolarity : public ChargingError {
std::string message() { return"Reverse polarity!"; };
};
// WTF LAND BELOW
class ErrorControlFail : public ChargingError {
std::string message() { return"WTF: Control Fail"; };
};
class ErrorBreakDown : public ChargingError {
std::string message() { return"WTF: Break Down"; };
};
class ErrorInputFail : public ChargingError {
std::string message() { return"WTF: Input Fail"; };
};
class ErrorUnknown : public ChargingError {
std::string message() { return"WTF: Unknown"; };
};
}
#endif //LIB_B6_DEMO_ERROR_HH