diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index c62138858f3076..184121fda55581 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2938,6 +2938,10 @@ server cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index b84db63ef9cd46..15da94f43bb5e7 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -2425,6 +2425,10 @@ server cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + info event SoftwareFault = 0 { SoftwareFaultStruct softwareFault = 0; } diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index dfaa58a9339f8c..a6fdec941c6099 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -834,6 +834,10 @@ server cluster OperationalCredentials = 62 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index db5786338406a9..5b089349467146 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -1376,6 +1376,10 @@ client cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index c2e538172c6fe9..4bccb2b2f385bc 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1358,6 +1358,10 @@ server cluster OperationalCredentials = 62 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index cb45c3bf8703ad..5cd6c2ca19741e 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -1568,6 +1568,10 @@ server cluster PowerSourceConfiguration = 46 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 55bf994b0b9c85..832f9ca426152c 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -2085,6 +2085,10 @@ server cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 55bf994b0b9c85..832f9ca426152c 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -2085,6 +2085,10 @@ server cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 1641761335a0a9..bd4f0b6618d76a 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -1065,6 +1065,10 @@ client cluster PumpConfigurationAndControl = 512 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter index 1dc2c37d75f3a6..c16c8aad728bde 100644 --- a/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter +++ b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter @@ -632,6 +632,10 @@ server cluster OperationalCredentials = 62 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + info event SoftwareFault = 0 { SoftwareFaultStruct softwareFault = 0; } diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index b766963cfe0f49..6dcea48abc753b 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -977,6 +977,10 @@ server cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index cc1757e6ce0cd6..42ab82c4a506e1 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1716,6 +1716,10 @@ server cluster RelativeHumidityMeasurement = 1029 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index fd096ac1b9ed9b..48d649e332b860 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1770,6 +1770,10 @@ server cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index f8f49fb9f63916..dbf89c3d999e7f 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -1120,6 +1120,10 @@ client cluster Scenes = 5 { } server cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp b/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp index 5639622f99fe6d..21298d2975857e 100644 --- a/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp +++ b/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp @@ -63,22 +63,27 @@ CHIP_ERROR SoftwareDiagosticsAttrAccess::Read(const ConcreteReadAttributePath & switch (aPath.mAttributeId) { - case CurrentHeapFree::Id: { + case CurrentHeapFree::Id: return ReadIfSupported(&DiagnosticDataProvider::GetCurrentHeapFree, aEncoder); - } - case CurrentHeapUsed::Id: { + case CurrentHeapUsed::Id: return ReadIfSupported(&DiagnosticDataProvider::GetCurrentHeapUsed, aEncoder); - } - case CurrentHeapHighWatermark::Id: { + case CurrentHeapHighWatermark::Id: return ReadIfSupported(&DiagnosticDataProvider::GetCurrentHeapHighWatermark, aEncoder); - } - case ThreadMetrics::Id: { + case ThreadMetrics::Id: return ReadThreadMetrics(aEncoder); + case Clusters::Globals::Attributes::FeatureMap::Id: { + BitFlags features; + + if (DeviceLayer::GetDiagnosticDataProvider().SupportsWatermarks()) + { + features.Set(SoftwareDiagnosticsFeature::kWaterMarks); + } + + return aEncoder.Encode(features); } - default: { + default: break; } - } return CHIP_NO_ERROR; } diff --git a/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml index 03169277946b9a..e8bdc18b633f3c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml @@ -49,6 +49,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index c45fdb77fdcfc1..e0c451a858b09d 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -164,8 +164,9 @@ ], "Software Diagnostics": [ "CurrentHeapFree", - "CurrentHeapUsed", "CurrentHeapHighWatermark", + "CurrentHeapUsed", + "FeatureMap", "ThreadMetrics" ], "Test Cluster": [ diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 399e4923c20efe..e3e068b3568be7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3362,6 +3362,10 @@ client cluster Scenes = 5 { } client cluster SoftwareDiagnostics = 52 { + bitmap SoftwareDiagnosticsFeature : BITMAP32 { + kWaterMarks = 0x1; + } + struct ThreadMetrics { int64u id = 0; optional char_string<8> name = 1; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index eb8561fc89bd2e..2827cafaef8d10 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -21610,6 +21610,10 @@ typedef NS_ENUM(uint8_t, CHIPGeneralDiagnosticsRadioFaultType) { CHIPGeneralDiagnosticsRadioFaultTypeEthernetFault = 0x06, }; +typedef NS_OPTIONS(uint32_t, CHIPSoftwareDiagnosticsFeature) { + CHIPSoftwareDiagnosticsFeatureWaterMarks = 0x1, +}; + typedef NS_ENUM(uint8_t, CHIPThreadNetworkDiagnosticsNetworkFault) { CHIPThreadNetworkDiagnosticsNetworkFaultUnspecified = 0x00, CHIPThreadNetworkDiagnosticsNetworkFaultLinkDown = 0x01, diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index 599139ed6c4880..a23b6c252715c8 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -177,6 +177,10 @@ class DiagnosticDataProvider /** * Software Diagnostics methods. */ + + /// Feature support - this returns support gor GetCurrentHeapHighWatermark and ResetWatermarks() + virtual bool SupportsWatermarks() { return false; } + virtual CHIP_ERROR GetCurrentHeapFree(uint64_t & currentHeapFree); virtual CHIP_ERROR GetCurrentHeapUsed(uint64_t & currentHeapUsed); virtual CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark); diff --git a/src/platform/Darwin/DiagnosticDataProviderImpl.h b/src/platform/Darwin/DiagnosticDataProviderImpl.h index 7031fa7bd2a847..2bc8a5d73d26bc 100644 --- a/src/platform/Darwin/DiagnosticDataProviderImpl.h +++ b/src/platform/Darwin/DiagnosticDataProviderImpl.h @@ -40,6 +40,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override; // ===== Methods that implement the DiagnosticDataProvider abstract interface. + bool SupportsWatermarks() override { return true; } CHIP_ERROR ResetWatermarks() override; }; diff --git a/src/platform/EFR32/DiagnosticDataProviderImpl.h b/src/platform/EFR32/DiagnosticDataProviderImpl.h index 600b170fc295de..62223861e5679e 100644 --- a/src/platform/EFR32/DiagnosticDataProviderImpl.h +++ b/src/platform/EFR32/DiagnosticDataProviderImpl.h @@ -39,6 +39,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider // ===== Methods that implement the PlatformManager abstract interface. + bool SupportsWatermarks() override { return true; } CHIP_ERROR GetCurrentHeapFree(uint64_t & currentHeapFree) override; CHIP_ERROR GetCurrentHeapUsed(uint64_t & currentHeapUsed) override; CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override; diff --git a/src/platform/Linux/DiagnosticDataProviderImpl.h b/src/platform/Linux/DiagnosticDataProviderImpl.h index 02b43cdf448f82..f47e41c8f8e9a4 100644 --- a/src/platform/Linux/DiagnosticDataProviderImpl.h +++ b/src/platform/Linux/DiagnosticDataProviderImpl.h @@ -39,6 +39,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider // ===== Methods that implement the DiagnosticDataProvider abstract interface. + bool SupportsWatermarks() override { return true; } CHIP_ERROR GetCurrentHeapFree(uint64_t & currentHeapFree) override; CHIP_ERROR GetCurrentHeapUsed(uint64_t & currentHeapUsed) override; CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 4b68a74a5abb9e..979639f7a2e01a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -755,6 +755,12 @@ using RadioFaultType = EmberAfRadioFaultType; } // namespace GeneralDiagnostics namespace SoftwareDiagnostics { + +// Bitmap for SoftwareDiagnosticsFeature +enum class SoftwareDiagnosticsFeature : uint32_t +{ + kWaterMarks = 0x1, +}; } // namespace SoftwareDiagnostics namespace ThreadNetworkDiagnostics {