Skip to content

Commit a3b2fe3

Browse files
committed
Update based on copilot reviews.
1 parent ac61638 commit a3b2fe3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ using namespace chip::DeviceLayer;
5252

5353
namespace {
5454

55+
// Maximum value for TotalOperationalHours per specification (0xFFFFFFFE)
56+
constexpr uint32_t kMaxTotalOperationalHours = 0xFFFFFFFE;
57+
5558
std::unique_ptr<ButtonEventsSimulator> sButtonSimulatorInstance{ nullptr };
5659

5760
bool HasNumericField(Json::Value & jsonValue, const std::string & field)
@@ -606,9 +609,10 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context)
606609

607610
uint32_t hours = static_cast<uint32_t>(self->mJsonValue["Hours"].asUInt());
608611
// Validate the value is within valid range (max value is 0xFFFFFFFE per specification)
609-
if (hours > 0xFFFFFFFE)
612+
if (hours > kMaxTotalOperationalHours)
610613
{
611-
ChipLogError(NotSpecified, "TotalOperationalHours value %u is out of valid range (0 to 0xFFFFFFFE)", hours);
614+
ChipLogError(NotSpecified, "TotalOperationalHours value %u is out of valid range (0 to %u)", hours,
615+
kMaxTotalOperationalHours);
612616
return;
613617
}
614618

0 commit comments

Comments
 (0)