Skip to content

Commit 97a74b2

Browse files
committed
Skip SetCurrentHeapHighWatermark if GetCurrentHeapUsed is not implemented
1 parent 8faa780 commit 97a74b2

File tree

3 files changed

+15
-37
lines changed

3 files changed

+15
-37
lines changed

src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,23 @@ bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(app::CommandHandle
158158

159159
uint64_t currentHeapUsed;
160160
CHIP_ERROR err = DeviceLayer::GetDiagnosticDataProvider().GetCurrentHeapUsed(currentHeapUsed);
161-
VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE);
162161

163-
err = DeviceLayer::GetDiagnosticDataProvider().SetCurrentHeapHighWatermark(currentHeapUsed);
164-
VerifyOrExit(err == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE);
162+
// Skip SetCurrentHeapHighWatermark if GetCurrentHeapUsed is not implemented
163+
if (err != CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE && err != CHIP_ERROR_NOT_IMPLEMENTED)
164+
{
165+
if (err == CHIP_NO_ERROR)
166+
{
167+
if (CHIP_NO_ERROR != DeviceLayer::GetDiagnosticDataProvider().SetCurrentHeapHighWatermark(currentHeapUsed))
168+
{
169+
status = EMBER_ZCL_STATUS_FAILURE;
170+
}
171+
}
172+
else
173+
{
174+
status = EMBER_ZCL_STATUS_FAILURE;
175+
}
176+
}
165177

166-
exit:
167178
emberAfSendImmediateDefaultResponse(status);
168179

169180
return true;

src/platform/Darwin/DiagnosticDataProviderImpl.cpp

-27
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,5 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetTotalOperationalHours(uint32_t & total
6868
return CHIP_ERROR_INVALID_TIME;
6969
}
7070

71-
CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeapFree)
72-
{
73-
// Overide with dummy value to pass CI
74-
currentHeapFree = 0;
75-
return CHIP_NO_ERROR;
76-
}
77-
78-
CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeapUsed)
79-
{
80-
// Overide with dummy value to pass CI
81-
currentHeapUsed = 0;
82-
return CHIP_NO_ERROR;
83-
}
84-
85-
CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark)
86-
{
87-
// Overide with dummy value to pass CI
88-
currentHeapHighWatermark = 0;
89-
return CHIP_NO_ERROR;
90-
}
91-
92-
CHIP_ERROR DiagnosticDataProviderImpl::SetCurrentHeapHighWatermark(uint64_t heapHighWatermark)
93-
{
94-
// Overide to pass CI
95-
return CHIP_NO_ERROR;
96-
}
97-
9871
} // namespace DeviceLayer
9972
} // namespace chip

src/platform/Darwin/DiagnosticDataProviderImpl.h

-6
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
3838
// ===== Methods that implement the PlatformManager abstract interface.
3939
CHIP_ERROR GetUpTime(uint64_t & upTime) override;
4040
CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override;
41-
42-
// ===== Methods that implement the DiagnosticDataProvider abstract interface.
43-
CHIP_ERROR GetCurrentHeapFree(uint64_t & currentHeapFree) override;
44-
CHIP_ERROR GetCurrentHeapUsed(uint64_t & currentHeapUsed) override;
45-
CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override;
46-
CHIP_ERROR SetCurrentHeapHighWatermark(uint64_t heapHighWatermark) override;
4741
};
4842

4943
} // namespace DeviceLayer

0 commit comments

Comments
 (0)