Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Oct 17, 2023
1 parent 547ebfd commit c075b47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
28 changes: 9 additions & 19 deletions src/app/clusters/scenes-server/scenes-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ CHIP_ERROR ScenesServer::Init()
}

// Explicit AttributeValuePairs is mandatory for matter so we force it here
featureMap |= to_underlying(Feature::kExplicit);
featureMap |= to_underlying(Feature::kExplicit) | to_underlying(Feature::kFabricScenes);
status = Attributes::FeatureMap::Set(endpoint, featureMap);
if (EMBER_ZCL_STATUS_SUCCESS != status)
{
Expand Down Expand Up @@ -270,8 +270,8 @@ void AddSceneParse(CommandHandlerInterface::HandlerContext & ctx, const CommandD
AddResponseOnError(ctx, response, sceneTable->SetSceneTableEntry(ctx.mCommandHandler.GetAccessingFabricIndex(), scene)));

// Update Attributes
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::SceneCount::Id);
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::RemainingCapacity::Id);
// TODO update the SceneInfoStruct SceneCount for given fabric
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::FabricSceneInfo::Id);

ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));

Expand Down Expand Up @@ -410,11 +410,8 @@ CHIP_ERROR StoreSceneParse(const FabricIndex & fabricIdx, const EndpointId & end
ReturnErrorOnFailure(sceneTable->SetSceneTableEntry(fabricIdx, scene));

// Update size attributes
MatterReportingAttributeChangeCallback(endpointID, Id, Attributes::SceneCount::Id);
MatterReportingAttributeChangeCallback(endpointID, Id, Attributes::RemainingCapacity::Id);

ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentScene::Set(endpointID, sceneID))).ToChipError());
ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentGroup::Set(endpointID, groupID))).ToChipError());
// TODO update the SceneInfoStruct SceneCount, CurrentScene, CurrentGroup for given fabric
MatterReportingAttributeChangeCallback(ctx.mRequestPath.mEndpointId, Id, Attributes::FabricSceneInfo::Id);

return CHIP_NO_ERROR;
}
Expand Down Expand Up @@ -455,9 +452,7 @@ CHIP_ERROR RecallSceneParse(const FabricIndex & fabricIdx, const EndpointId & en

ReturnErrorOnFailure(sceneTable->SceneApplyEFS(scene));

ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentScene::Set(endpointID, sceneID))).ToChipError());

ReturnErrorOnFailure(StatusIB(ToInteractionModelStatus(Attributes::CurrentGroup::Set(endpointID, groupID))).ToChipError());
// TODO update the SceneInfoStruct CurrentScene and CurrentGroup as well as SceneValid for given fabric

return CHIP_NO_ERROR;
}
Expand Down Expand Up @@ -523,21 +518,16 @@ CHIP_ERROR ScenesServer::Read(const ConcreteReadAttributePath & aPath, Attribute

switch (aPath.mAttributeId)
{
case Attributes::SceneCount::Id:
sceneTable = scenes::GetSceneTableImpl(aPath.mEndpointId, endpointTableSize);
ReturnErrorOnFailure(sceneTable->GetEndpointSceneCount(value));
return aEncoder.Encode(value);
case Attributes::RemainingCapacity::Id:
sceneTable = scenes::GetSceneTableImpl(aPath.mEndpointId, endpointTableSize);
ReturnErrorOnFailure(sceneTable->GetRemainingCapacity(aEncoder.AccessingFabricIndex(), value));
return aEncoder.Encode(value);
case Attributes::FabricSceneInfo::Id:
// TODO Handle attribute get and set here
default:
return CHIP_NO_ERROR;
}
}

void ScenesServer::GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId)
{
SceneInfoStruct sceneInfo;
// Get Scene Table Instance
SceneTable * sceneTable = scenes::GetSceneTableImpl(aEndpointId);
VerifyOrReturn(nullptr != sceneTable);
Expand Down
12 changes: 6 additions & 6 deletions src/app/tests/suites/certification/Test_TC_S_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,39 @@ tests:
value: nodeId

- label: "Step 2: TH reads from the DUT the (0x0000) SceneCount attribute"
PICS: S.S.A0000
PICS: S.S.A0000 && (!S.S.F03)
command: "readAttribute"
attribute: "SceneCount"
response:
constraints:
type: int8u

- label: "Step 3: TH reads from the DUT the (0x0001) CurrentScene attribute"
PICS: S.S.A0001
PICS: S.S.A0001 && (!S.S.F03)
command: "readAttribute"
attribute: "CurrentScene"
response:
constraints:
type: int8u

- label: "Step 4: TH reads from the DUT the (0x0002) CurrentGroup attribute"
PICS: S.S.A0002
PICS: S.S.A0002 && (!S.S.F03)
command: "readAttribute"
attribute: "CurrentGroup"
response:
constraints:
type: group_id

- label: "Step 5: TH reads from the DUT the (0x0003) SceneValid attribute"
PICS: S.S.A0003
PICS: S.S.A0003 && (!S.S.F03)
command: "readAttribute"
attribute: "SceneValid"
response:
constraints:
type: boolean

- label: "Step 6: TH reads from the DUT the (0x0004) NameSupport attribute"
PICS: S.S.A0003 && S.S.F00
PICS: S.S.A0004 && S.S.F00
command: "readAttribute"
attribute: "NameSupport"
response:
Expand Down Expand Up @@ -110,4 +110,4 @@ tests:
attribute: "FabricSceneInfo"
response:
constraints:
type: int8u
type: list

0 comments on commit c075b47

Please sign in to comment.