Skip to content

Commit

Permalink
Implement command ResetWatermarks for Software Diagnostics Cluster (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Sep 1, 2021
1 parent 70c558a commit 4a24c71
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/lighting-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ target_sources(${APP_TARGET} PRIVATE
${APP_ROOT}/lighting-common/gen/callback-stub.cpp
${LIGHTING_COMMON}/gen/IMClusterCommandHandler.cpp
${MBED_COMMON}/util/LEDWidget.cpp
${CHIP_ROOT}/src/app/common/gen/attributes/Accessors.cpp
${CHIP_ROOT}/src/app/util/DataModelHandler.cpp
${CHIP_ROOT}/src/app/reporting/reporting-default-configuration.cpp
${CHIP_ROOT}/src/app/reporting/reporting.cpp
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ target_sources(app PRIVATE
${LIGHTING_COMMON}/gen/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
${NRFCONNECT_COMMON}/util/ThreadUtil.cpp
${CHIP_ROOT}/src/app/common/gen/attributes/Accessors.cpp
${CHIP_ROOT}/src/app/util/DataModelHandler.cpp
${CHIP_ROOT}/src/app/reporting/reporting-default-configuration.cpp
${CHIP_ROOT}/src/app/reporting/reporting.cpp
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ target_sources(app PRIVATE
${TELINK_COMMON}/util/src/LEDWidget.cpp
${TELINK_COMMON}/util/src/ButtonManager.cpp
${TELINK_COMMON}/util/src/ThreadUtil.cpp
${CHIP_ROOT}/src/app/common/gen/attributes/Accessors.cpp
${CHIP_ROOT}/src/app/util/DataModelHandler.cpp
${CHIP_ROOT}/src/app/reporting/reporting-default-configuration.cpp
${CHIP_ROOT}/src/app/reporting/reporting.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,27 @@
*/

#include <app/CommandHandler.h>
#include <app/common/gen/attributes/Accessors.h>
#include <app/util/af.h>

using namespace chip::app::Clusters;

bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj)
{
// TODO: Implement the ResetWatermarks in the platform layer.
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
uint64_t currentHeapUsed;

EmberAfStatus status = SoftwareDiagnostics::Attributes::GetCurrentHeapUsed(endpoint, &currentHeapUsed);
VerifyOrExit(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, "Failed to get the value of the CurrentHeapUsed attribute"));

status = SoftwareDiagnostics::Attributes::SetCurrentHeapHighWatermark(endpoint, currentHeapUsed);
VerifyOrExit(
status == EMBER_ZCL_STATUS_SUCCESS,
ChipLogError(
Zcl,
"Failed to reset the value of the CurrentHeapHighWaterMark attribute to the value of the CurrentHeapUsed attribute"));

exit:
emberAfSendImmediateDefaultResponse(status);

return true;
}

0 comments on commit 4a24c71

Please sign in to comment.