Skip to content

Commit

Permalink
Applied fixes to be compliant with scenes test plan (#29598)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Jan 9, 2024
1 parent 5ef7d3e commit 7917539
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
16 changes: 8 additions & 8 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,6 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint)

updateCoupledColorTemp(endpoint);

#ifdef EMBER_AF_PLUGIN_SCENES
// The level has changed, so the scene is no longer valid.
if (emberAfContainsServer(endpoint, Scenes::Id))
{
Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint);
}
#endif // EMBER_AF_PLUGIN_SCENES

// Are we at the requested level?
if (currentLevel.Value() == state->moveToLevel)
{
Expand Down Expand Up @@ -918,6 +910,14 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8

state->callbackSchedule.runTime = System::Clock::Milliseconds32(0);

#ifdef EMBER_AF_PLUGIN_SCENES
// The level has changed, the scene is no longer valid.
if (emberAfContainsServer(endpoint, Scenes::Id))
{
Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint);
}
#endif // EMBER_AF_PLUGIN_SCENES

// The setup was successful, so mark the new state as active and return.
scheduleTimerCallbackMs(endpoint, computeCallbackWaitTimeMs(state->callbackSchedule, state->eventDurationMs));

Expand Down
4 changes: 3 additions & 1 deletion src/app/clusters/scenes-server/SceneTableImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,9 @@ CHIP_ERROR DefaultSceneTableImpl::DeleteAllScenesInGroup(FabricIndex fabric_inde
FabricSceneData fabric(mEndpointId, fabric_index, mMaxScenesPerFabric, mMaxScenesPerEndpoint);
SceneTableData scene(mEndpointId, fabric_index);

ReturnErrorOnFailure(fabric.Load(mStorage));
CHIP_ERROR err = fabric.Load(mStorage);
VerifyOrReturnValue(CHIP_ERROR_NOT_FOUND != err, CHIP_NO_ERROR);
ReturnErrorOnFailure(err);

for (uint16_t i = 0; i < mMaxScenesPerFabric; i++)
{
Expand Down
14 changes: 9 additions & 5 deletions src/app/clusters/scenes-server/scenes-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,15 @@ void ScenesServer::HandleRecallScene(HandlerContext & ctx, const Commands::Recal
if (CHIP_NO_ERROR == err)
{
status = Attributes::SceneValid::Set(ctx.mRequestPath.mEndpointId, true);
if (EMBER_ZCL_STATUS_SUCCESS != status)
{
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, ToInteractionModelStatus(status));
return;
}
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, ToInteractionModelStatus(status));
return;
}

if (CHIP_ERROR_NOT_FOUND == err)
{
// TODO : implement proper mapping between CHIP_ERROR and IM Status
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::NotFound);
return;
}

ctx.mCommandHandler.AddStatus(ctx.mRequestPath, StatusIB(err).mStatus);
Expand Down

0 comments on commit 7917539

Please sign in to comment.