Skip to content

Commit

Permalink
Implement RebootCount storage on Darwin. (#29134)
Browse files Browse the repository at this point in the history
* Implement RebootCount storage on Darwin.

Fixes #29108

* Address review comment.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Dec 5, 2023
1 parent 1e27e13 commit 4877705
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/platform/Darwin/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWatermarks()
return CHIP_NO_ERROR;
}

CHIP_ERROR DiagnosticDataProviderImpl::GetRebootCount(uint16_t & rebootCount)
{
uint32_t count = 0;

ReturnErrorOnFailure(ConfigurationMgr().GetRebootCount(count));
VerifyOrReturnError(count <= UINT16_MAX, CHIP_ERROR_INVALID_INTEGER_VALUE);
rebootCount = static_cast<uint16_t>(count);

return CHIP_NO_ERROR;
}

DiagnosticDataProvider & GetDiagnosticDataProviderImpl()
{
return DiagnosticDataProviderImpl::GetDefaultInstance();
Expand Down
1 change: 1 addition & 0 deletions src/platform/Darwin/DiagnosticDataProviderImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
// ===== Methods that implement the DiagnosticDataProvider abstract interface.
bool SupportsWatermarks() override { return true; }
CHIP_ERROR ResetWatermarks() override;
CHIP_ERROR GetRebootCount(uint16_t & rebootCount) override;
};

/**
Expand Down

0 comments on commit 4877705

Please sign in to comment.