Skip to content

Commit ba72490

Browse files
committed
Address review comments
1 parent d3cb6fa commit ba72490

File tree

5 files changed

+26
-32
lines changed

5 files changed

+26
-32
lines changed

examples/oven-app/oven-app-common/include/OvenEndpoint.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ class OvenModeDelegate : public ModeBase::Delegate
8484
class TemperatureControlledCabinetEndpoint
8585
{
8686
public:
87+
static constexpr uint8_t kModeBaseFeatures = 0; // No specific features for ModeBase::Instance
8788
TemperatureControlledCabinetEndpoint(EndpointId endpointId) :
88-
mEndpointId(endpointId), mOvenModeDelegate(mEndpointId), mOvenModeInstance(&mOvenModeDelegate, mEndpointId, OvenMode::Id, 0)
89+
mEndpointId(endpointId), mOvenModeDelegate(mEndpointId), mOvenModeInstance(&mOvenModeDelegate, mEndpointId, OvenMode::Id, kModeBaseFeatures)
8990
{}
9091

9192
/**

examples/oven-app/oven-app-common/src/CookSurfaceEndpoint.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,11 @@ CHIP_ERROR CookSurfaceEndpoint::Init()
3232

3333
chip::Protocols::InteractionModel::Status CookSurfaceEndpoint::GetOnOffState(bool & state)
3434
{
35-
auto status = OnOffServer::Instance().getOnOffValue(mEndpointId, &state);
36-
VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, status,
37-
ChipLogError(AppServer, "ERR: reading on/off %x", to_underlying(status)));
38-
return status;
35+
return OnOffServer::Instance().getOnOffValue(mEndpointId, &state);
3936
}
4037

4138
chip::Protocols::InteractionModel::Status CookSurfaceEndpoint::SetOnOffState(bool state)
4239
{
4340
CommandId commandId = state ? OnOff::Commands::On::Id : OnOff::Commands::Off::Id;
44-
auto status = OnOffServer::Instance().setOnOffValue(mEndpointId, commandId, false);
45-
VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, status,
46-
ChipLogError(AppServer, "ERR: updating on/off %x", to_underlying(status)));
47-
return status;
41+
return OnOffServer::Instance().setOnOffValue(mEndpointId, commandId, false);
4842
}

examples/oven-app/oven-app-common/src/CookTopEndpoint.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ using namespace chip::app::Clusters::CookTop;
2424

2525
CHIP_ERROR CookTopEndpoint::Init()
2626
{
27+
// Placeholder for user Init
2728
return CHIP_NO_ERROR;
2829
}
2930

3031
chip::Protocols::InteractionModel::Status CookTopEndpoint::SetOnOffState(bool state)
3132
{
3233
CommandId commandId = state ? OnOff::Commands::On::Id : OnOff::Commands::Off::Id;
33-
auto status = OnOffServer::Instance().setOnOffValue(mEndpointId, commandId, false);
34-
VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, status,
35-
ChipLogError(AppServer, "ERR: updating on/off %x", to_underlying(status)));
36-
return status;
34+
return OnOffServer::Instance().setOnOffValue(mEndpointId, commandId, false);
3735
}

examples/oven-app/oven-app-common/src/OvenEndpoint.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,59 +32,60 @@ using namespace chip::app::Clusters::Oven;
3232
using namespace chip::app::Clusters::OvenMode;
3333
using namespace chip::app::Clusters::TemperatureControlledCabinet;
3434
using chip::Protocols::InteractionModel::Status;
35+
using detail::Structs::ModeTagStruct::Type;
3536

3637
// Static member definitions
37-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsBake[1] = { { .value = to_underlying(ModeTag::kBake) } };
38+
const Type OvenModeDelegate::sModeTagsBake[1] = { { .value = to_underlying(ModeTag::kBake) } };
3839

39-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsConvection[1] = { { .value = to_underlying(
40+
const Type OvenModeDelegate::sModeTagsConvection[1] = { { .value = to_underlying(
4041
ModeTag::kConvection) } };
4142

42-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsGrill[1] = { { .value = to_underlying(ModeTag::kGrill) } };
43+
const Type OvenModeDelegate::sModeTagsGrill[1] = { { .value = to_underlying(ModeTag::kGrill) } };
4344

44-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsRoast[1] = { { .value = to_underlying(ModeTag::kRoast) } };
45+
const Type OvenModeDelegate::sModeTagsRoast[1] = { { .value = to_underlying(ModeTag::kRoast) } };
4546

46-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsClean[1] = { { .value = to_underlying(ModeTag::kClean) } };
47+
const Type OvenModeDelegate::sModeTagsClean[1] = { { .value = to_underlying(ModeTag::kClean) } };
4748

48-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsConvectionBake[1] = { { .value = to_underlying(
49+
const Type OvenModeDelegate::sModeTagsConvectionBake[1] = { { .value = to_underlying(
4950
ModeTag::kConvectionBake) } };
5051

51-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsConvectionRoast[1] = { { .value = to_underlying(
52+
const Type OvenModeDelegate::sModeTagsConvectionRoast[1] = { { .value = to_underlying(
5253
ModeTag::kConvectionRoast) } };
5354

54-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsWarming[1] = { { .value =
55+
const Type OvenModeDelegate::sModeTagsWarming[1] = { { .value =
5556
to_underlying(ModeTag::kWarming) } };
5657

57-
const detail::Structs::ModeTagStruct::Type OvenModeDelegate::sModeTagsProofing[1] = { { .value =
58+
const Type OvenModeDelegate::sModeTagsProofing[1] = { { .value =
5859
to_underlying(ModeTag::kProofing) } };
5960

6061
const detail::Structs::ModeOptionStruct::Type OvenModeDelegate::skModeOptions[to_underlying(OvenModes::kModeCount)] = {
6162
{ .label = CharSpan::fromCharString("Bake"),
6263
.mode = to_underlying(OvenModes::kModeBake),
63-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsBake) },
64+
.modeTags = DataModel::List<const Type>(sModeTagsBake) },
6465
{ .label = CharSpan::fromCharString("Convection"),
6566
.mode = to_underlying(OvenModes::kModeConvection),
66-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsConvection) },
67+
.modeTags = DataModel::List<const Type>(sModeTagsConvection) },
6768
{ .label = CharSpan::fromCharString("Grill"),
6869
.mode = to_underlying(OvenModes::kModeGrill),
69-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsGrill) },
70+
.modeTags = DataModel::List<const Type>(sModeTagsGrill) },
7071
{ .label = CharSpan::fromCharString("Roast"),
7172
.mode = to_underlying(OvenModes::kModeRoast),
72-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsRoast) },
73+
.modeTags = DataModel::List<const Type>(sModeTagsRoast) },
7374
{ .label = CharSpan::fromCharString("Clean"),
7475
.mode = to_underlying(OvenModes::kModeClean),
75-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsClean) },
76+
.modeTags = DataModel::List<const Type>(sModeTagsClean) },
7677
{ .label = CharSpan::fromCharString("Convection Bake"),
7778
.mode = to_underlying(OvenModes::kModeConvectionBake),
78-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsConvectionBake) },
79+
.modeTags = DataModel::List<const Type>(sModeTagsConvectionBake) },
7980
{ .label = CharSpan::fromCharString("Convection Roast"),
8081
.mode = to_underlying(OvenModes::kModeConvectionRoast),
81-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsConvectionRoast) },
82+
.modeTags = DataModel::List<const Type>(sModeTagsConvectionRoast) },
8283
{ .label = CharSpan::fromCharString("Warming"),
8384
.mode = to_underlying(OvenModes::kModeWarming),
84-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsWarming) },
85+
.modeTags = DataModel::List<const Type>(sModeTagsWarming) },
8586
{ .label = CharSpan::fromCharString("Proofing"),
8687
.mode = to_underlying(OvenModes::kModeProofing),
87-
.modeTags = DataModel::List<const detail::Structs::ModeTagStruct::Type>(sModeTagsProofing) }
88+
.modeTags = DataModel::List<const Type>(sModeTagsProofing) }
8889
};
8990

9091
CHIP_ERROR OvenModeDelegate::Init()

examples/oven-app/silabs/src/AppSupportedTemperatureLevelsDelegate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CHIP_ERROR AppSupportedTemperatureLevelsDelegate::RegisterSupportedLevels(Endpoi
3131
ChipLogError(AppServer, "RegisterSupportedLevels: invalid levels/null or count=0"));
3232

3333
VerifyOrReturnError(mRegisteredEndpointCount < kNumCookSurfaceEndpoints, CHIP_ERROR_NO_MEMORY,
34-
ChipLogError(AppServer, "RegisterSupportedLevels: capacity exceeded (%zu)", mRegisteredEndpointCount));
34+
ChipLogError(AppServer, "RegisterSupportedLevels: capacity exceeded (%u)", static_cast<unsigned>(mRegisteredEndpointCount)));
3535
// Prevent duplicate endpoints
3636
for (size_t i = 0; i < mRegisteredEndpointCount; ++i)
3737
{

0 commit comments

Comments
 (0)