Skip to content

Commit 30b8027

Browse files
tehampsonrestyled-commits
authored andcommitted
Remove RemovedOn attribute from ECOINFO cluster (project-chip#34988)
* Remove RemovedOn attribute from ECOINFO cluster * Restyled by autopep8 * Remove artifact that were only initially used to debug script locally * Move attr IDs after RemovedOn removal * Empty-Commit --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 1a895a4 commit 30b8027

File tree

31 files changed

+147
-727
lines changed

31 files changed

+147
-727
lines changed

examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceManager.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();
116116

117117
// Declare Ecosystem Information cluster attributes
118118
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(ecosystemInformationBasicAttrs)
119-
DECLARE_DYNAMIC_ATTRIBUTE(EcosystemInformation::Attributes::RemovedOn::Id, EPOCH_US, kNodeLabelSize, ATTRIBUTE_MASK_NULLABLE),
120119
DECLARE_DYNAMIC_ATTRIBUTE(EcosystemInformation::Attributes::DeviceDirectory::Id, ARRAY, kDescriptorAttributeArraySize, 0),
121120
DECLARE_DYNAMIC_ATTRIBUTE(EcosystemInformation::Attributes::LocationDirectory::Id, ARRAY, kDescriptorAttributeArraySize, 0),
122121
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp

+2-35
Original file line numberDiff line numberDiff line change
@@ -287,21 +287,10 @@ CHIP_ERROR EcosystemInformationServer::AddLocationInfo(EndpointId aEndpoint, con
287287
return CHIP_NO_ERROR;
288288
}
289289

290-
CHIP_ERROR EcosystemInformationServer::RemoveDevice(EndpointId aEndpoint, uint64_t aEpochUs)
291-
{
292-
auto it = mDevicesMap.find(aEndpoint);
293-
VerifyOrReturnError((it != mDevicesMap.end()), CHIP_ERROR_INVALID_ARGUMENT);
294-
auto & deviceInfo = it->second;
295-
deviceInfo.mRemovedOn.SetValue(aEpochUs);
296-
return CHIP_NO_ERROR;
297-
}
298-
299290
CHIP_ERROR EcosystemInformationServer::ReadAttribute(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
300291
{
301292
switch (aPath.mAttributeId)
302293
{
303-
case Attributes::RemovedOn::Id:
304-
return EncodeRemovedOnAttribute(aPath.mEndpointId, aEncoder);
305294
case Attributes::DeviceDirectory::Id:
306295
return EncodeDeviceDirectoryAttribute(aPath.mEndpointId, aEncoder);
307296
case Attributes::LocationDirectory::Id:
@@ -320,28 +309,6 @@ CHIP_ERROR EcosystemInformationServer::ReadAttribute(const ConcreteReadAttribute
320309
return CHIP_NO_ERROR;
321310
}
322311

323-
CHIP_ERROR EcosystemInformationServer::EncodeRemovedOnAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder)
324-
{
325-
auto it = mDevicesMap.find(aEndpoint);
326-
if (it == mDevicesMap.end())
327-
{
328-
// We are always going to be given a valid endpoint. If the endpoint
329-
// doesn't exist in our map that indicate that the cluster was not
330-
// added on this endpoint, hence UnsupportedCluster.
331-
return CHIP_IM_GLOBAL_STATUS(UnsupportedCluster);
332-
}
333-
334-
auto & deviceInfo = it->second;
335-
if (!deviceInfo.mRemovedOn.HasValue())
336-
{
337-
aEncoder.EncodeNull();
338-
return CHIP_NO_ERROR;
339-
}
340-
341-
aEncoder.Encode(deviceInfo.mRemovedOn.Value());
342-
return CHIP_NO_ERROR;
343-
}
344-
345312
CHIP_ERROR EcosystemInformationServer::EncodeDeviceDirectoryAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder)
346313
{
347314

@@ -355,7 +322,7 @@ CHIP_ERROR EcosystemInformationServer::EncodeDeviceDirectoryAttribute(EndpointId
355322
}
356323

357324
auto & deviceInfo = it->second;
358-
if (deviceInfo.mDeviceDirectory.empty() || deviceInfo.mRemovedOn.HasValue())
325+
if (deviceInfo.mDeviceDirectory.empty())
359326
{
360327
return aEncoder.EncodeEmptyList();
361328
}
@@ -381,7 +348,7 @@ CHIP_ERROR EcosystemInformationServer::EncodeLocationStructAttribute(EndpointId
381348
}
382349

383350
auto & deviceInfo = it->second;
384-
if (deviceInfo.mLocationDirectory.empty() || deviceInfo.mRemovedOn.HasValue())
351+
if (deviceInfo.mLocationDirectory.empty())
385352
{
386353
return aEncoder.EncodeEmptyList();
387354
}

src/app/clusters/ecosystem-information-server/ecosystem-information-server.h

-12
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,6 @@ class EcosystemInformationServer
186186
*/
187187
CHIP_ERROR AddLocationInfo(EndpointId aEndpoint, const std::string & aLocationId, FabricIndex aFabricIndex,
188188
std::unique_ptr<EcosystemLocationStruct> aLocation);
189-
190-
/**
191-
* @brief Removes device at the provided endpoint.
192-
*
193-
* @param aEndpoint Endpoint of the associated device that has been removed.
194-
* @param aEpochUs Epoch time in micro seconds assoicated with when device was removed.
195-
* @return #CHIP_NO_ERROR on success.
196-
* @return Other CHIP_ERROR associated with issue.
197-
*/
198-
CHIP_ERROR RemoveDevice(EndpointId aEndpoint, uint64_t aEpochUs);
199189
// TODO(#33223) Add removal and update counterparts to AddDeviceInfo and AddLocationInfo.
200190

201191
CHIP_ERROR ReadAttribute(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder);
@@ -214,12 +204,10 @@ class EcosystemInformationServer
214204

215205
struct DeviceInfo
216206
{
217-
Optional<uint64_t> mRemovedOn = NullOptional;
218207
std::vector<std::unique_ptr<EcosystemDeviceStruct>> mDeviceDirectory;
219208
std::map<EcosystemLocationKey, std::unique_ptr<EcosystemLocationStruct>> mLocationDirectory;
220209
};
221210

222-
CHIP_ERROR EncodeRemovedOnAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder);
223211
CHIP_ERROR EncodeDeviceDirectoryAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder);
224212
CHIP_ERROR EncodeLocationStructAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder);
225213

src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml

+2-6
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,11 @@ limitations under the License.
4444
<server init="false" tick="false">true</server>
4545
<!-- cluster revision -->
4646
<globalAttribute code="0xFFFD" side="either" value="1"/>
47-
<attribute code="0x0000" side="server" define="REMOVED_ON" type="epoch_us" isNullable="true" optional="true">
48-
<description>RemovedOn</description>
49-
<access op="read" privilege="manage"/>
50-
</attribute>
51-
<attribute code="0x0001" side="server" define="DEVICE_DIRECTORY" type="array" entryType="EcosystemDeviceStruct" length="256" minLength="1">
47+
<attribute code="0x0000" side="server" define="DEVICE_DIRECTORY" type="array" entryType="EcosystemDeviceStruct" length="256" minLength="1">
5248
<description>DeviceDirectory</description>
5349
<access op="read" privilege="manage"/>
5450
</attribute>
55-
<attribute code="0x0002" side="server" define="LOCATION_DIRECTORY" type="array" entryType="EcosystemLocationStruct" length="64" minLength="1">
51+
<attribute code="0x0001" side="server" define="LOCATION_DIRECTORY" type="array" entryType="EcosystemLocationStruct" length="64" minLength="1">
5652
<description>LocationDirectory</description>
5753
<access op="read" privilege="manage"/>
5854
</attribute>

src/controller/data_model/controller-clusters.matter

+2-3
Original file line numberDiff line numberDiff line change
@@ -9407,9 +9407,8 @@ provisional cluster EcosystemInformation = 1872 {
94079407
fabric_idx fabricIndex = 254;
94089408
}
94099409

9410-
readonly attribute access(read: manage) optional nullable epoch_us removedOn = 0;
9411-
readonly attribute access(read: manage) EcosystemDeviceStruct deviceDirectory[] = 1;
9412-
readonly attribute access(read: manage) EcosystemLocationStruct locationDirectory[] = 2;
9410+
readonly attribute access(read: manage) EcosystemDeviceStruct deviceDirectory[] = 0;
9411+
readonly attribute access(read: manage) EcosystemLocationStruct locationDirectory[] = 1;
94139412
readonly attribute command_id generatedCommandList[] = 65528;
94149413
readonly attribute command_id acceptedCommandList[] = 65529;
94159414
readonly attribute event_id eventList[] = 65530;

src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java

+2-33
Original file line numberDiff line numberDiff line change
@@ -60772,9 +60772,8 @@ public void onSuccess(byte[] tlv) {
6077260772
public static class EcosystemInformationCluster extends BaseChipCluster {
6077360773
public static final long CLUSTER_ID = 1872L;
6077460774

60775-
private static final long REMOVED_ON_ATTRIBUTE_ID = 0L;
60776-
private static final long DEVICE_DIRECTORY_ATTRIBUTE_ID = 1L;
60777-
private static final long LOCATION_DIRECTORY_ATTRIBUTE_ID = 2L;
60775+
private static final long DEVICE_DIRECTORY_ATTRIBUTE_ID = 0L;
60776+
private static final long LOCATION_DIRECTORY_ATTRIBUTE_ID = 1L;
6077860777
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
6077960778
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
6078060779
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
@@ -60792,10 +60791,6 @@ public long initWithDevice(long devicePtr, int endpointId) {
6079260791
return 0L;
6079360792
}
6079460793

60795-
public interface RemovedOnAttributeCallback extends BaseAttributeCallback {
60796-
void onSuccess(@Nullable Long value);
60797-
}
60798-
6079960794
public interface DeviceDirectoryAttributeCallback extends BaseAttributeCallback {
6080060795
void onSuccess(List<ChipStructs.EcosystemInformationClusterEcosystemDeviceStruct> value);
6080160796
}
@@ -60820,32 +60815,6 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
6082060815
void onSuccess(List<Long> value);
6082160816
}
6082260817

60823-
public void readRemovedOnAttribute(
60824-
RemovedOnAttributeCallback callback) {
60825-
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMOVED_ON_ATTRIBUTE_ID);
60826-
60827-
readAttribute(new ReportCallbackImpl(callback, path) {
60828-
@Override
60829-
public void onSuccess(byte[] tlv) {
60830-
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
60831-
callback.onSuccess(value);
60832-
}
60833-
}, REMOVED_ON_ATTRIBUTE_ID, true);
60834-
}
60835-
60836-
public void subscribeRemovedOnAttribute(
60837-
RemovedOnAttributeCallback callback, int minInterval, int maxInterval) {
60838-
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMOVED_ON_ATTRIBUTE_ID);
60839-
60840-
subscribeAttribute(new ReportCallbackImpl(callback, path) {
60841-
@Override
60842-
public void onSuccess(byte[] tlv) {
60843-
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
60844-
callback.onSuccess(value);
60845-
}
60846-
}, REMOVED_ON_ATTRIBUTE_ID, minInterval, maxInterval);
60847-
}
60848-
6084960818
public void readDeviceDirectoryAttribute(
6085060819
DeviceDirectoryAttributeCallback callback) {
6085160820
readDeviceDirectoryAttributeWithFabricFilter(callback, true);

src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -17238,9 +17238,8 @@ public long getID() {
1723817238
}
1723917239

1724017240
public enum Attribute {
17241-
RemovedOn(0L),
17242-
DeviceDirectory(1L),
17243-
LocationDirectory(2L),
17241+
DeviceDirectory(0L),
17242+
LocationDirectory(1L),
1724417243
GeneratedCommandList(65528L),
1724517244
AcceptedCommandList(65529L),
1724617245
EventList(65530L),

src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java

-21
Original file line numberDiff line numberDiff line change
@@ -20222,27 +20222,6 @@ public void onError(Exception ex) {
2022220222
}
2022320223
}
2022420224

20225-
public static class DelegatedEcosystemInformationClusterRemovedOnAttributeCallback implements ChipClusters.EcosystemInformationCluster.RemovedOnAttributeCallback, DelegatedClusterCallback {
20226-
private ClusterCommandCallback callback;
20227-
@Override
20228-
public void setCallbackDelegate(ClusterCommandCallback callback) {
20229-
this.callback = callback;
20230-
}
20231-
20232-
@Override
20233-
public void onSuccess(@Nullable Long value) {
20234-
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
20235-
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
20236-
responseValues.put(commandResponseInfo, value);
20237-
callback.onSuccess(responseValues);
20238-
}
20239-
20240-
@Override
20241-
public void onError(Exception ex) {
20242-
callback.onFailure(ex);
20243-
}
20244-
}
20245-
2024620225
public static class DelegatedEcosystemInformationClusterDeviceDirectoryAttributeCallback implements ChipClusters.EcosystemInformationCluster.DeviceDirectoryAttributeCallback, DelegatedClusterCallback {
2024720226
private ClusterCommandCallback callback;
2024820227
@Override

src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java

+1-12
Original file line numberDiff line numberDiff line change
@@ -18678,18 +18678,7 @@ private static Map<String, InteractionInfo> readContentAppObserverInteractionInf
1867818678
return result;
1867918679
}
1868018680
private static Map<String, InteractionInfo> readEcosystemInformationInteractionInfo() {
18681-
Map<String, InteractionInfo> result = new LinkedHashMap<>();Map<String, CommandParameterInfo> readEcosystemInformationRemovedOnCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
18682-
InteractionInfo readEcosystemInformationRemovedOnAttributeInteractionInfo = new InteractionInfo(
18683-
(cluster, callback, commandArguments) -> {
18684-
((ChipClusters.EcosystemInformationCluster) cluster).readRemovedOnAttribute(
18685-
(ChipClusters.EcosystemInformationCluster.RemovedOnAttributeCallback) callback
18686-
);
18687-
},
18688-
() -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterRemovedOnAttributeCallback(),
18689-
readEcosystemInformationRemovedOnCommandParams
18690-
);
18691-
result.put("readRemovedOnAttribute", readEcosystemInformationRemovedOnAttributeInteractionInfo);
18692-
Map<String, CommandParameterInfo> readEcosystemInformationDeviceDirectoryCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
18681+
Map<String, InteractionInfo> result = new LinkedHashMap<>();Map<String, CommandParameterInfo> readEcosystemInformationDeviceDirectoryCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
1869318682
InteractionInfo readEcosystemInformationDeviceDirectoryAttributeInteractionInfo = new InteractionInfo(
1869418683
(cluster, callback, commandArguments) -> {
1869518684
((ChipClusters.EcosystemInformationCluster) cluster).readDeviceDirectoryAttribute(

0 commit comments

Comments
 (0)