Settings: The device can report when defaults were applied

v0.3.0-dev
Paul Hollinsky 2022-02-24 15:29:12 -05:00
parent 80362e7f81
commit 6cc0f08e2b
4 changed files with 10 additions and 3 deletions

View File

@ -103,6 +103,7 @@ static constexpr const char* TERMINATION_NOT_SUPPORTED_DEVICE = "This device doe
static constexpr const char* TERMINATION_NOT_SUPPORTED_NETWORK = "This network does not support software selectable termination on this device.";
static constexpr const char* ANOTHER_IN_TERMINATION_GROUP_ENABLED = "A mutually exclusive network already has termination enabled.";
static constexpr const char* ETH_PHY_REGISTER_CONTROL_NOT_AVAILABLE = "Ethernet PHY register control is not available for this device.";
static constexpr const char* SETTINGS_DEFAULTS_USED = "The device settings could not be loaded, the default settings have been applied.";
// Transport Errors
static constexpr const char* FAILED_TO_READ = "A read operation failed.";
@ -214,6 +215,8 @@ const char* APIEvent::DescriptionForType(Type type) {
return NO_SERIAL_NUMBER_FW_12V;
case Type::EthPhyRegisterControlNotAvailable:
return ETH_PHY_REGISTER_CONTROL_NOT_AVAILABLE;
case Type::SettingsDefaultsUsed:
return SETTINGS_DEFAULTS_USED;
// Transport Errors
case Type::FailedToRead:

View File

@ -125,8 +125,10 @@ bool Communication::getSettingsSync(std::vector<uint8_t>& data, std::chrono::mil
return false;
}
if(gsmsg->response != ReadSettingsMessage::Response::OK) {
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
if(gsmsg->response == ReadSettingsMessage::Response::OKDefaultsUsed) {
report(APIEvent::Type::SettingsDefaultsUsed, APIEvent::Severity::EventInfo);
} else if(gsmsg->response != ReadSettingsMessage::Response::OK) {
report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error);
return false;
}

View File

@ -80,6 +80,7 @@ public:
NoSerialNumber12V = 0x2028, // The device must be powered with 12V for communication to be established
NoSerialNumberFW12V = 0x2029, // The device must be powered with 12V for communication to be established, a firmware update was already attempted
EthPhyRegisterControlNotAvailable = 0x2030, //The device doesn't support Ethernet PHY MDIO access
SettingsDefaultsUsed = 0x2033,
// Transport Events
FailedToRead = 0x3000,

View File

@ -19,7 +19,8 @@ public:
InvalidSubversion = 3,
NotEnoughMemory = 4,
APIFailure = 5,
APIUnsupported = 6
APIUnsupported = 6,
OKDefaultsUsed = 7, // Got the settings okay, but the defaults were used (after firmware upgrade or a checksum error)
};
Response response;