Public Access
refactor(ups-hid): test result constants
Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
4 files changed
+29
-19
No files matched your search
@@ -288,7 +288,7 @@ bool ApcHidProtocol::read_data(UpsData &data) {
|
||||
|
||||
// Set default test result
|
||||
if (data.test.ups_test_result.empty()) {
|
||||
data.test.ups_test_result = "No test initiated";
|
||||
data.test.ups_test_result = test::RESULT_NO_TEST;
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -1718,7 +1718,7 @@ bool ApcHidProtocol::stop_ups_test() {
|
||||
void ApcHidProtocol::parse_test_result_report(const HidReport &report, UpsData &data) {
|
||||
if (report.data.size() < 2) {
|
||||
ESP_LOGW(APC_HID_TAG, "Test result report too short: %zu bytes", report.data.size());
|
||||
data.test.ups_test_result = "Error reading test result";
|
||||
data.test.ups_test_result = test::RESULT_ERROR_READING;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1731,25 +1731,25 @@ void ApcHidProtocol::parse_test_result_report(const HidReport &report, UpsData &
|
||||
|
||||
switch (test_result_value) {
|
||||
case 1:
|
||||
data.test.ups_test_result = "Done and passed";
|
||||
data.test.ups_test_result = test::RESULT_DONE_PASSED;
|
||||
break;
|
||||
case 2:
|
||||
data.test.ups_test_result = "Done and warning";
|
||||
data.test.ups_test_result = test::RESULT_DONE_WARNING;
|
||||
break;
|
||||
case 3:
|
||||
data.test.ups_test_result = "Done and error";
|
||||
data.test.ups_test_result = test::RESULT_DONE_ERROR;
|
||||
break;
|
||||
case 4:
|
||||
data.test.ups_test_result = "Aborted";
|
||||
data.test.ups_test_result = test::RESULT_ABORTED;
|
||||
break;
|
||||
case 5:
|
||||
data.test.ups_test_result = "In progress";
|
||||
data.test.ups_test_result = test::RESULT_IN_PROGRESS;
|
||||
break;
|
||||
case 6:
|
||||
data.test.ups_test_result = "No test initiated";
|
||||
data.test.ups_test_result = test::RESULT_NO_TEST;
|
||||
break;
|
||||
case 7:
|
||||
data.test.ups_test_result = "Test scheduled";
|
||||
data.test.ups_test_result = test::RESULT_SCHEDULED;
|
||||
break;
|
||||
default:
|
||||
data.test.ups_test_result = "Unknown test result (" + std::to_string(test_result_value) + ")";
|
||||
|
||||
Reference in new issue
Block a user