Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scenes]Applied fixes to be compliant with scenes test plan #29598

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -715,11 +715,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
Loading