Skip to content

Commit 8e8e132

Browse files
Removed the LastConfiguredBy attribute in the cpp code
1 parent 31a7d66 commit 8e8e132

File tree

3 files changed

+13
-52
lines changed

3 files changed

+13
-52
lines changed

src/app/clusters/scenes-server/SceneHandlerImpl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler
3838

3939
using AttributeValuePairType = app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type;
4040
using AttributeValuePairDecodableType = app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType;
41-
using ExtensionFieldSetDecodableType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType;
42-
using ExtensionFieldSetType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type;
41+
using ExtensionFieldSetDecodableType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSetStruct::DecodableType;
42+
using ExtensionFieldSetType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSetStruct::Type;
4343

4444
public:
4545
/// @brief Struct meant to map the state of a cluster to a specific endpoint. Meant to be used to apply scenes using a timer for

src/app/clusters/scenes-server/SceneTable.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ class SceneHandler : public IntrusiveListNodeBase<>
7979
/// the supported ones.
8080
///
8181
/// @param endpoint[in] Endpoint ID
82-
/// @param extensionFieldSet[in] ExtensionFieldSets provided by the AddScene Command, pre initialized
83-
/// @param serialisedBytes[out] Buffer to fill from the ExtensionFieldSet in command
82+
/// @param extensionFieldSet[in] ExtensionFieldSetStruct provided by the AddScene Command, pre initialized
83+
/// @param serialisedBytes[out] Buffer to fill from the ExtensionFieldSetStruct in command
8484
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR value otherwise
8585
/// @note Only gets called after the scene-cluster has previously verified that the endpoint,cluster pair is supported by
8686
/// the handler. It is therefore the implementation's reponsibility to also implement the SupportsCluster method.
8787
virtual CHIP_ERROR
8888
SerializeAdd(EndpointId endpoint,
89-
const app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType & extensionFieldSet,
89+
const app::Clusters::ScenesManagement::Structs::ExtensionFieldSetStruct::DecodableType & extensionFieldSet,
9090
MutableByteSpan & serialisedBytes) = 0;
9191

9292
/// @brief Called when handling StoreScene, and only if the handler supports the given endpoint and cluster.
@@ -101,24 +101,24 @@ class SceneHandler : public IntrusiveListNodeBase<>
101101
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR value otherwise
102102
virtual CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) = 0;
103103

104-
/// @brief Deserialize an ExtensionFieldSet into a cluster object (e.g. when handling ViewScene).
104+
/// @brief Deserialize an ExtensionFieldSetStruct into a cluster object (e.g. when handling ViewScene).
105105
///
106106
/// @param endpoint[in] Endpoint ID
107107
/// @param cluster[in] Cluster ID
108-
/// @param serializedBytes[in] ExtensionFieldSet stored in NVM
108+
/// @param serializedBytes[in] ExtensionFieldSetStruct stored in NVM
109109
///
110-
/// @param extensionFieldSet[out] ExtensionFieldSet in command format
110+
/// @param extensionFieldSet[out] ExtensionFieldSetStruct in command format
111111
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR value otherwise
112112
/// @note Only gets called for handlers for which SupportsCluster() is true for the given endpoint and cluster.
113113
virtual CHIP_ERROR Deserialize(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes,
114114

115-
app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type & extensionFieldSet) = 0;
115+
app::Clusters::ScenesManagement::Structs::ExtensionFieldSetStruct::Type & extensionFieldSet) = 0;
116116

117117
/// @brief Restore a stored scene for the given cluster instance, over timeMs milliseconds (e.g. when handling RecallScene)
118118
///
119119
/// @param endpoint[in] Endpoint ID
120120
/// @param cluster[in] Cluster ID
121-
/// @param serializedBytes[in] ExtensionFieldSet stored in NVM
121+
/// @param serializedBytes[in] ExtensionFieldSetStruct stored in NVM
122122
///
123123
/// @param timeMs[in] Transition time in ms to apply the scene
124124
/// @return CHIP_NO_ERROR if successful, CHIP_ERROR value otherwise

src/app/clusters/scenes-server/scenes-server.cpp

+3-42
Original file line numberDiff line numberDiff line change
@@ -104,28 +104,6 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res
104104
return AddResponseOnError(ctx, resp, StatusIB(status).ToChipError());
105105
}
106106

107-
Status SetLastConfiguredBy(HandlerContext & ctx)
108-
{
109-
const Access::SubjectDescriptor descriptor = ctx.mCommandHandler.GetSubjectDescriptor();
110-
111-
if (AuthMode::kCase == descriptor.authMode)
112-
{
113-
return Attributes::LastConfiguredBy::Set(ctx.mRequestPath.mEndpointId, descriptor.subject);
114-
}
115-
116-
return Attributes::LastConfiguredBy::SetNull(ctx.mRequestPath.mEndpointId);
117-
}
118-
119-
template <typename ResponseType>
120-
CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp)
121-
{
122-
Status status = SetLastConfiguredBy(ctx);
123-
124-
// LastConfiguredBy is optional, so we don't want to fail the command if it fails to update
125-
VerifyOrReturnValue(!(Status::Success == status || Status::UnsupportedAttribute == status), CHIP_NO_ERROR);
126-
return AddResponseOnError(ctx, resp, status);
127-
}
128-
129107
/// @brief Helper function to update the FabricSceneInfo attribute for a given Endpoint and fabric
130108
/// @param endpoint Endpoint to update
131109
/// @param fabric Fabric to update
@@ -471,8 +449,6 @@ void AddSceneParse(CommandHandlerInterface::HandlerContext & ctx, const CommandD
471449
UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(),
472450
Optional<GroupId>(), Optional<SceneId>(), Optional<bool>())));
473451

474-
ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));
475-
476452
// Write response
477453
response.status = to_underlying(Protocols::InteractionModel::Status::Success);
478454
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
@@ -521,7 +497,7 @@ void ViewSceneParse(HandlerContext & ctx, const CommandData & req, GroupDataProv
521497
SceneStorageId(req.sceneID, req.groupID), scene)));
522498

523499
// Response Extension Field Sets buffer
524-
Structs::ExtensionFieldSet::Type responseEFSBuffer[scenes::kMaxClustersPerScene];
500+
Structs::ExtensionFieldSetStruct::Type responseEFSBuffer[scenes::kMaxClustersPerScene];
525501
uint8_t deserializedEFSCount = 0;
526502

527503
// Adds extension field sets to the scene
@@ -550,8 +526,8 @@ void ViewSceneParse(HandlerContext & ctx, const CommandData & req, GroupDataProv
550526
response.transitionTime.SetValue(scene.mStorageData.mSceneTransitionTimeMs);
551527

552528
response.sceneName.SetValue(CharSpan(scene.mStorageData.mName, scene.mStorageData.mNameLength));
553-
Span<Structs::ExtensionFieldSet::Type> responseEFSSpan(responseEFSBuffer, deserializedEFSCount);
554-
response.extensionFieldSets.SetValue(responseEFSSpan);
529+
Span<Structs::ExtensionFieldSetStruct::Type> responseEFSSpan(responseEFSBuffer, deserializedEFSCount);
530+
response.extensionFieldSetStructs.SetValue(responseEFSSpan);
555531

556532
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
557533
}
@@ -888,7 +864,6 @@ void ScenesServer::HandleRemoveScene(HandlerContext & ctx, const Commands::Remov
888864
sceneValid.Emplace(false);
889865
}
890866

891-
ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));
892867
ReturnOnFailure(
893868
AddResponseOnError(ctx, response,
894869
UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(),
@@ -942,8 +917,6 @@ void ScenesServer::HandleRemoveAllScenes(HandlerContext & ctx, const Commands::R
942917
UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(),
943918
Optional<GroupId>(), Optional<SceneId>(), sceneValid)));
944919

945-
ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));
946-
947920
// Write response
948921
response.status = to_underlying(Protocols::InteractionModel::Status::Success);
949922
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
@@ -970,8 +943,6 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS
970943
req.sceneID, mGroupProvider);
971944

972945
ReturnOnFailure(AddResponseOnError(ctx, response, err));
973-
974-
ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));
975946
response.status = to_underlying(Protocols::InteractionModel::Status::Success);
976947
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
977948
}
@@ -1135,8 +1106,6 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce
11351106
Optional<GroupId>(), Optional<SceneId>(), Optional<bool>() /* = sceneValid*/)));
11361107
}
11371108

1138-
ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));
1139-
11401109
response.status = to_underlying(Protocols::InteractionModel::Status::Success);
11411110
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
11421111
return;
@@ -1157,8 +1126,6 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce
11571126
UpdateFabricSceneInfo(ctx.mRequestPath.mEndpointId, ctx.mCommandHandler.GetAccessingFabricIndex(),
11581127
Optional<GroupId>(), Optional<SceneId>(), Optional<bool>())));
11591128

1160-
ReturnOnFailure(UpdateLastConfiguredBy(ctx, response));
1161-
11621129
response.status = to_underlying(Protocols::InteractionModel::Status::Success);
11631130
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
11641131
}
@@ -1174,12 +1141,6 @@ using namespace chip::app::Clusters::ScenesManagement;
11741141

11751142
void emberAfScenesManagementClusterServerInitCallback(EndpointId endpoint)
11761143
{
1177-
Status status = Attributes::LastConfiguredBy::SetNull(endpoint);
1178-
if (Status::Success != status)
1179-
{
1180-
ChipLogDetail(Zcl, "ERR: setting LastConfiguredBy on Endpoint %hu Status: %x", endpoint, to_underlying(status));
1181-
}
1182-
11831144
// Initialize the FabricSceneInfo by getting the number of scenes and the remaining capacity for storing fabric scene data
11841145
for (auto & info : chip::Server::GetInstance().GetFabricTable())
11851146
{

0 commit comments

Comments
 (0)