Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linux]: Implement the optional attributes for software diagnostic cluster #11706

Merged
merged 2 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down Expand Up @@ -1921,6 +1921,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down Expand Up @@ -8380,7 +8395,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down
15 changes: 15 additions & 0 deletions examples/bridge-app/bridge-common/bridge-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
15 changes: 15 additions & 0 deletions examples/lighting-app/lighting-common/lighting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
15 changes: 15 additions & 0 deletions examples/lock-app/lock-common/lock-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
15 changes: 15 additions & 0 deletions examples/pump-app/pump-common/pump-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
19 changes: 17 additions & 2 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down Expand Up @@ -1801,6 +1801,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down Expand Up @@ -7821,7 +7836,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down
17 changes: 16 additions & 1 deletion examples/tv-app/tv-common/tv-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down Expand Up @@ -1786,6 +1786,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
19 changes: 17 additions & 2 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down Expand Up @@ -1801,6 +1801,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down Expand Up @@ -7821,7 +7836,7 @@
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"name": "ApplyUpdateResponse",
"code": 4,
"mfgCode": null,
"source": "server",
Expand Down
15 changes: 15 additions & 0 deletions examples/window-app/common/window-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SoftwareDiagosticsAttrAccess : public AttributeAccessInterface

private:
CHIP_ERROR ReadIfSupported(CHIP_ERROR (PlatformManager::*getter)(uint64_t &), AttributeValueEncoder & aEncoder);
CHIP_ERROR ReadThreadMetrics(AttributeValueEncoder & aEncoder);
};

SoftwareDiagosticsAttrAccess gAttrAccess;
Expand All @@ -69,6 +70,9 @@ CHIP_ERROR SoftwareDiagosticsAttrAccess::Read(const ConcreteAttributePath & aPat
case CurrentHeapHighWatermark::Id: {
return ReadIfSupported(&PlatformManager::GetCurrentHeapHighWatermark, aEncoder);
}
case ThreadMetrics::Id: {
return ReadThreadMetrics(aEncoder);
}
default: {
break;
}
Expand All @@ -92,6 +96,32 @@ CHIP_ERROR SoftwareDiagosticsAttrAccess::ReadIfSupported(CHIP_ERROR (PlatformMan

return aEncoder.Encode(data);
}

CHIP_ERROR SoftwareDiagosticsAttrAccess::ReadThreadMetrics(AttributeValueEncoder & aEncoder)
{
CHIP_ERROR err = CHIP_NO_ERROR;
DeviceLayer::ThreadMetrics * threadMetrics;

if (DeviceLayer::PlatformMgr().GetThreadMetrics(&threadMetrics) == CHIP_NO_ERROR)
{
err = aEncoder.EncodeList([&threadMetrics](const TagBoundEncoder & encoder) -> CHIP_ERROR {
for (DeviceLayer::ThreadMetrics * thread = threadMetrics; thread != nullptr; thread = thread->Next)
{
ReturnErrorOnFailure(encoder.Encode(*thread));
}

return CHIP_NO_ERROR;
});

DeviceLayer::PlatformMgr().ReleaseThreadMetrics(threadMetrics);
}
else
{
err = aEncoder.Encode(DataModel::List<EndpointId>());
}

return err;
}
} // anonymous namespace

bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(app::CommandHandler * commandObj,
Expand Down
15 changes: 15 additions & 0 deletions src/controller/data_model/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -3148,6 +3148,21 @@
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "ThreadMetrics",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "CurrentHeapFree",
"code": 1,
Expand Down
34 changes: 34 additions & 0 deletions src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading