Skip to content

Commit

Permalink
Fix TC-OPSTATE-2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmelveilleux committed Jul 30, 2024
1 parent 1119f10 commit 3770e2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <app/InteractionModelEngine.h>
#include <app/reporting/reporting.h>
#include <app/util/attribute-storage.h>
#include <lib/support/logging/CHIPLogging.h>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -100,11 +101,11 @@ CHIP_ERROR Instance::SetOperationalState(uint8_t aOpState)
return CHIP_ERROR_INVALID_ARGUMENT;
}

bool runUpdateCountdownTime = false;
bool countdownTimeUpdateNeeded = false;
if (mOperationalError.errorStateID != to_underlying(ErrorStateEnum::kNoError))
{
mOperationalError.Set(to_underlying(ErrorStateEnum::kNoError));
runUpdateCountdownTime = true;
countdownTimeUpdateNeeded = true;
MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalError::Id);
}

Expand All @@ -113,10 +114,10 @@ CHIP_ERROR Instance::SetOperationalState(uint8_t aOpState)
if (mOperationalState != oldState)
{
MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalState::Id);
runUpdateCountdownTime = true;
countdownTimeUpdateNeeded = true;
}

if (runUpdateCountdownTime)
if (countdownTimeUpdateNeeded)
{
UpdateCountdownTimeFromClusterLogic();
}
Expand Down Expand Up @@ -348,18 +349,18 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
}
return err;
});
break;
}
break;

case OperationalState::Attributes::OperationalState::Id: {
ReturnErrorOnFailure(aEncoder.Encode(GetCurrentOperationalState()));
break;
}
break;

case OperationalState::Attributes::OperationalError::Id: {
ReturnErrorOnFailure(aEncoder.Encode(mOperationalError));
break;
}
break;

case OperationalState::Attributes::PhaseList::Id: {

Expand All @@ -386,18 +387,19 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
ReturnErrorOnFailure(encoder.Encode(phase2));
}
});
break;
}
break;

case OperationalState::Attributes::CurrentPhase::Id: {
ReturnErrorOnFailure(aEncoder.Encode(GetCurrentPhase()));
break;
}
break;

case OperationalState::Attributes::CountdownTime::Id: {
ReturnErrorOnFailure(aEncoder.Encode(mCountdownTime.value()));
// Read through to get value closest to reality.
ReturnErrorOnFailure(aEncoder.Encode(mDelegate->GetCountdownTime()));
break;
}
break;
}
return CHIP_NO_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_OpstateCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1):
if phase_list is not NullValue:
phase_list_len = len(phase_list)
asserts.assert_less_equal(phase_list_len, 32,
f"PhaseList length({phase_list_len}) must be at most than 32 entries!")
f"PhaseList length({phase_list_len}) must be at most 32 entries!")

# STEP 3: TH reads from the DUT the CurrentPhase attribute
self.step(3)
Expand Down

0 comments on commit 3770e2c

Please sign in to comment.