Skip to content

Commit 5d4bade

Browse files
authored
[linux]: Implement the optional attributes for software diagnostic cluster (#11706)
* [linux]: Implement the optional attributes for software diagnostic cluster * Run codegen
1 parent 7ca6e28 commit 5d4bade

File tree

54 files changed

+1502
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1502
-257
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.zap

+17-2
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@
12941294
"outgoing": 1
12951295
},
12961296
{
1297-
"name": "ApplyUpdateRequestResponse",
1297+
"name": "ApplyUpdateResponse",
12981298
"code": 4,
12991299
"mfgCode": null,
13001300
"source": "server",
@@ -1921,6 +1921,21 @@
19211921
"enabled": 1,
19221922
"commands": [],
19231923
"attributes": [
1924+
{
1925+
"name": "ThreadMetrics",
1926+
"code": 0,
1927+
"mfgCode": null,
1928+
"side": "server",
1929+
"included": 1,
1930+
"storageOption": "External",
1931+
"singleton": 0,
1932+
"bounded": 0,
1933+
"defaultValue": "",
1934+
"reportable": 0,
1935+
"minInterval": 1,
1936+
"maxInterval": 65534,
1937+
"reportableChange": 0
1938+
},
19241939
{
19251940
"name": "CurrentHeapFree",
19261941
"code": 1,
@@ -8380,7 +8395,7 @@
83808395
"outgoing": 1
83818396
},
83828397
{
8383-
"name": "ApplyUpdateRequestResponse",
8398+
"name": "ApplyUpdateResponse",
83848399
"code": 4,
83858400
"mfgCode": null,
83868401
"source": "server",

examples/bridge-app/bridge-common/bridge-app.zap

+15
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,21 @@
894894
"enabled": 1,
895895
"commands": [],
896896
"attributes": [
897+
{
898+
"name": "ThreadMetrics",
899+
"code": 0,
900+
"mfgCode": null,
901+
"side": "server",
902+
"included": 1,
903+
"storageOption": "External",
904+
"singleton": 0,
905+
"bounded": 0,
906+
"defaultValue": "",
907+
"reportable": 0,
908+
"minInterval": 1,
909+
"maxInterval": 65534,
910+
"reportableChange": 0
911+
},
897912
{
898913
"name": "CurrentHeapFree",
899914
"code": 1,

examples/lighting-app/lighting-common/lighting-app.zap

+15
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,21 @@
17801780
"enabled": 1,
17811781
"commands": [],
17821782
"attributes": [
1783+
{
1784+
"name": "ThreadMetrics",
1785+
"code": 0,
1786+
"mfgCode": null,
1787+
"side": "server",
1788+
"included": 1,
1789+
"storageOption": "External",
1790+
"singleton": 0,
1791+
"bounded": 0,
1792+
"defaultValue": "",
1793+
"reportable": 0,
1794+
"minInterval": 1,
1795+
"maxInterval": 65534,
1796+
"reportableChange": 0
1797+
},
17831798
{
17841799
"name": "CurrentHeapFree",
17851800
"code": 1,

examples/lock-app/lock-common/lock-app.zap

+15
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,21 @@
16881688
"enabled": 1,
16891689
"commands": [],
16901690
"attributes": [
1691+
{
1692+
"name": "ThreadMetrics",
1693+
"code": 0,
1694+
"mfgCode": null,
1695+
"side": "server",
1696+
"included": 1,
1697+
"storageOption": "External",
1698+
"singleton": 0,
1699+
"bounded": 0,
1700+
"defaultValue": "",
1701+
"reportable": 0,
1702+
"minInterval": 1,
1703+
"maxInterval": 65534,
1704+
"reportableChange": 0
1705+
},
16911706
{
16921707
"name": "CurrentHeapFree",
16931708
"code": 1,

examples/pump-app/pump-common/pump-app.zap

+15
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,21 @@
16021602
"enabled": 1,
16031603
"commands": [],
16041604
"attributes": [
1605+
{
1606+
"name": "ThreadMetrics",
1607+
"code": 0,
1608+
"mfgCode": null,
1609+
"side": "server",
1610+
"included": 1,
1611+
"storageOption": "External",
1612+
"singleton": 0,
1613+
"bounded": 0,
1614+
"defaultValue": "",
1615+
"reportable": 0,
1616+
"minInterval": 1,
1617+
"maxInterval": 65534,
1618+
"reportableChange": 0
1619+
},
16051620
{
16061621
"name": "CurrentHeapFree",
16071622
"code": 1,

examples/pump-controller-app/pump-controller-common/pump-controller-app.zap

+15
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,21 @@
16021602
"enabled": 1,
16031603
"commands": [],
16041604
"attributes": [
1605+
{
1606+
"name": "ThreadMetrics",
1607+
"code": 0,
1608+
"mfgCode": null,
1609+
"side": "server",
1610+
"included": 1,
1611+
"storageOption": "External",
1612+
"singleton": 0,
1613+
"bounded": 0,
1614+
"defaultValue": "",
1615+
"reportable": 0,
1616+
"minInterval": 1,
1617+
"maxInterval": 65534,
1618+
"reportableChange": 0
1619+
},
16051620
{
16061621
"name": "CurrentHeapFree",
16071622
"code": 1,

examples/thermostat/thermostat-common/thermostat.zap

+17-2
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@
12711271
"outgoing": 1
12721272
},
12731273
{
1274-
"name": "ApplyUpdateRequestResponse",
1274+
"name": "ApplyUpdateResponse",
12751275
"code": 4,
12761276
"mfgCode": null,
12771277
"source": "server",
@@ -1801,6 +1801,21 @@
18011801
"enabled": 1,
18021802
"commands": [],
18031803
"attributes": [
1804+
{
1805+
"name": "ThreadMetrics",
1806+
"code": 0,
1807+
"mfgCode": null,
1808+
"side": "server",
1809+
"included": 1,
1810+
"storageOption": "External",
1811+
"singleton": 0,
1812+
"bounded": 0,
1813+
"defaultValue": "",
1814+
"reportable": 0,
1815+
"minInterval": 1,
1816+
"maxInterval": 65534,
1817+
"reportableChange": 0
1818+
},
18041819
{
18051820
"name": "CurrentHeapFree",
18061821
"code": 1,
@@ -7821,7 +7836,7 @@
78217836
"outgoing": 1
78227837
},
78237838
{
7824-
"name": "ApplyUpdateRequestResponse",
7839+
"name": "ApplyUpdateResponse",
78257840
"code": 4,
78267841
"mfgCode": null,
78277842
"source": "server",

examples/tv-app/tv-common/tv-app.zap

+16-1
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@
12561256
"outgoing": 1
12571257
},
12581258
{
1259-
"name": "ApplyUpdateRequestResponse",
1259+
"name": "ApplyUpdateResponse",
12601260
"code": 4,
12611261
"mfgCode": null,
12621262
"source": "server",
@@ -1786,6 +1786,21 @@
17861786
"enabled": 1,
17871787
"commands": [],
17881788
"attributes": [
1789+
{
1790+
"name": "ThreadMetrics",
1791+
"code": 0,
1792+
"mfgCode": null,
1793+
"side": "server",
1794+
"included": 1,
1795+
"storageOption": "External",
1796+
"singleton": 0,
1797+
"bounded": 0,
1798+
"defaultValue": "",
1799+
"reportable": 0,
1800+
"minInterval": 1,
1801+
"maxInterval": 65534,
1802+
"reportableChange": 0
1803+
},
17891804
{
17901805
"name": "CurrentHeapFree",
17911806
"code": 1,

examples/tv-casting-app/tv-casting-common/tv-casting-app.zap

+17-2
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@
12711271
"outgoing": 1
12721272
},
12731273
{
1274-
"name": "ApplyUpdateRequestResponse",
1274+
"name": "ApplyUpdateResponse",
12751275
"code": 4,
12761276
"mfgCode": null,
12771277
"source": "server",
@@ -1801,6 +1801,21 @@
18011801
"enabled": 1,
18021802
"commands": [],
18031803
"attributes": [
1804+
{
1805+
"name": "ThreadMetrics",
1806+
"code": 0,
1807+
"mfgCode": null,
1808+
"side": "server",
1809+
"included": 1,
1810+
"storageOption": "External",
1811+
"singleton": 0,
1812+
"bounded": 0,
1813+
"defaultValue": "",
1814+
"reportable": 0,
1815+
"minInterval": 1,
1816+
"maxInterval": 65534,
1817+
"reportableChange": 0
1818+
},
18041819
{
18051820
"name": "CurrentHeapFree",
18061821
"code": 1,
@@ -7821,7 +7836,7 @@
78217836
"outgoing": 1
78227837
},
78237838
{
7824-
"name": "ApplyUpdateRequestResponse",
7839+
"name": "ApplyUpdateResponse",
78257840
"code": 4,
78267841
"mfgCode": null,
78277842
"source": "server",

examples/window-app/common/window-app.zap

+15
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,21 @@
13501350
"enabled": 1,
13511351
"commands": [],
13521352
"attributes": [
1353+
{
1354+
"name": "ThreadMetrics",
1355+
"code": 0,
1356+
"mfgCode": null,
1357+
"side": "server",
1358+
"included": 1,
1359+
"storageOption": "External",
1360+
"singleton": 0,
1361+
"bounded": 0,
1362+
"defaultValue": "",
1363+
"reportable": 0,
1364+
"minInterval": 1,
1365+
"maxInterval": 65534,
1366+
"reportableChange": 0
1367+
},
13531368
{
13541369
"name": "CurrentHeapFree",
13551370
"code": 1,

src/app/clusters/software_diagnostics_server/software_diagnostics_server.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class SoftwareDiagosticsAttrAccess : public AttributeAccessInterface
4646

4747
private:
4848
CHIP_ERROR ReadIfSupported(CHIP_ERROR (PlatformManager::*getter)(uint64_t &), AttributeValueEncoder & aEncoder);
49+
CHIP_ERROR ReadThreadMetrics(AttributeValueEncoder & aEncoder);
4950
};
5051

5152
SoftwareDiagosticsAttrAccess gAttrAccess;
@@ -69,6 +70,9 @@ CHIP_ERROR SoftwareDiagosticsAttrAccess::Read(const ConcreteAttributePath & aPat
6970
case CurrentHeapHighWatermark::Id: {
7071
return ReadIfSupported(&PlatformManager::GetCurrentHeapHighWatermark, aEncoder);
7172
}
73+
case ThreadMetrics::Id: {
74+
return ReadThreadMetrics(aEncoder);
75+
}
7276
default: {
7377
break;
7478
}
@@ -92,6 +96,32 @@ CHIP_ERROR SoftwareDiagosticsAttrAccess::ReadIfSupported(CHIP_ERROR (PlatformMan
9296

9397
return aEncoder.Encode(data);
9498
}
99+
100+
CHIP_ERROR SoftwareDiagosticsAttrAccess::ReadThreadMetrics(AttributeValueEncoder & aEncoder)
101+
{
102+
CHIP_ERROR err = CHIP_NO_ERROR;
103+
DeviceLayer::ThreadMetrics * threadMetrics;
104+
105+
if (DeviceLayer::PlatformMgr().GetThreadMetrics(&threadMetrics) == CHIP_NO_ERROR)
106+
{
107+
err = aEncoder.EncodeList([&threadMetrics](const TagBoundEncoder & encoder) -> CHIP_ERROR {
108+
for (DeviceLayer::ThreadMetrics * thread = threadMetrics; thread != nullptr; thread = thread->Next)
109+
{
110+
ReturnErrorOnFailure(encoder.Encode(*thread));
111+
}
112+
113+
return CHIP_NO_ERROR;
114+
});
115+
116+
DeviceLayer::PlatformMgr().ReleaseThreadMetrics(threadMetrics);
117+
}
118+
else
119+
{
120+
err = aEncoder.Encode(DataModel::List<EndpointId>());
121+
}
122+
123+
return err;
124+
}
95125
} // anonymous namespace
96126

97127
bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(app::CommandHandler * commandObj,

src/controller/data_model/controller-clusters.zap

+15
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,21 @@
31483148
"enabled": 0,
31493149
"commands": [],
31503150
"attributes": [
3151+
{
3152+
"name": "ThreadMetrics",
3153+
"code": 0,
3154+
"mfgCode": null,
3155+
"side": "server",
3156+
"included": 1,
3157+
"storageOption": "External",
3158+
"singleton": 0,
3159+
"bounded": 0,
3160+
"defaultValue": "",
3161+
"reportable": 0,
3162+
"minInterval": 1,
3163+
"maxInterval": 65534,
3164+
"reportableChange": 0
3165+
},
31513166
{
31523167
"name": "CurrentHeapFree",
31533168
"code": 1,

src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)