This commit is contained in:
2026-06-15 16:35:28 +02:00
parent c0c0f56b93
commit d8bbbf1f43
2 changed files with 31 additions and 19 deletions
+30 -18
View File
@@ -27,7 +27,7 @@ std::string Outlet::readSetRecord() {
return this->stateToString(command);
}
bool Outlet::commandHasChange() {
bool Outlet::hasGetRecordChanged() {
return this->lastCommand != this->_getCommand();
}
@@ -71,23 +71,8 @@ void Outlet::restart() {
}
void Outlet::updateState() {
bool outputConnected = this->output.connected();
bool inputConnected = this->input.connected();
if (!outputConnected && this->isOutputConnected) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Outlet %d : Output channel disconnected",
this->index);
}
if (!inputConnected && this->isInputConnected) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Outlet %d : Input channel disconnected",
this->index);
}
this->isOutputConnected = outputConnected;
this->isInputConnected = inputConnected;
bool outputConnected = this->isOutputConnected();
bool inputConnected = this->isInputConnected();
if (!outputConnected || !inputConnected) {
// Error message are above
@@ -189,6 +174,8 @@ std::string Outlet::stateToString(State state) {
}
Outlet::State Outlet::_getCommand() {
if (this->isInputConnected())
return stringToState(this->lastCommand);
std::string value;
int returnCode = this->output.get(&value);
if (returnCode != CM_SUCCESS)
@@ -198,3 +185,28 @@ Outlet::State Outlet::_getCommand() {
this->index, returnCode);
return stringToState(value);
}
bool Outlet::isOutputConnected() {
bool outputConnected = this->output.connected();
if (!outputConnected && this->isOutputConnected) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Outlet %d : Output channel disconnected",
this->index);
}
this->isOutputConnected = outputConnected;
return outputConnected;
}
bool Outlet::isInputConnected() {
bool inputConnected = this->input.connected();
if (!inputConnected && this->isInputConnected) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Outlet %d : Input channel disconnected",
this->index);
}
this->isInputConnected = inputConnected;
}
+1 -1
View File
@@ -25,7 +25,7 @@ class Outlet {
* @brief return true if the last value readed from this object if not equal
* to the current device state
*/
bool commandHasChange();
bool hasGetRecordChanged();
/**
* @brief set to a new state the device
*/