Skip to content

Commit f120dc2

Browse files
restyled-commitsarun-silabs
authored andcommitted
Restyled by clang-format
1 parent 9a873b7 commit f120dc2

File tree

4 files changed

+64
-59
lines changed

4 files changed

+64
-59
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CookSurfaceEndpoint
4545
* @return Returns Status::Success on success, or an error code on failure.
4646
*/
4747

48-
chip::Protocols::InteractionModel::Status GetOnOffState(bool &state);
48+
chip::Protocols::InteractionModel::Status GetOnOffState(bool & state);
4949

5050
/**
5151
* @brief Set On/Off state for the CookSurface.

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ class TemperatureControlledCabinetEndpoint
8989
{}
9090

9191
/**
92-
* @brief Initialize the temperature controlled cabinet endpoint. Sets the oven mode cluster instance with the appropriate delegate.
92+
* @brief Initialize the temperature controlled cabinet endpoint. Sets the oven mode cluster instance with the appropriate
93+
* delegate.
9394
*
9495
* @return returns CHIP_NO_ERROR on success, or an error code on failure.
9596
*/
@@ -100,7 +101,9 @@ class TemperatureControlledCabinetEndpoint
100101
*
101102
* @return Reference to the oven mode delegate.
102103
*/
103-
OvenModeDelegate & GetOvenModeDelegate() { return mOvenModeDelegate; }private:
104+
OvenModeDelegate & GetOvenModeDelegate() { return mOvenModeDelegate; }
105+
106+
private:
104107
EndpointId mEndpointId = kInvalidEndpointId;
105108
OvenModeDelegate mOvenModeDelegate;
106109
ModeBase::Instance mOvenModeInstance;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CHIP_ERROR CookSurfaceEndpoint::Init()
2929
return CHIP_NO_ERROR;
3030
}
3131

32-
chip::Protocols::InteractionModel::Status CookSurfaceEndpoint::GetOnOffState(bool &state)
32+
chip::Protocols::InteractionModel::Status CookSurfaceEndpoint::GetOnOffState(bool & state)
3333
{
3434
auto status = OnOffServer::Instance().getOnOffValue(mEndpointId, &state);
3535
VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, status,

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

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void OvenManager::Init()
4747
DeviceLayer::PlatformMgr().LockChipStack();
4848

4949
// Initialize states
50-
mCookTopState = kCookTopState_OffCompleted;
50+
mCookTopState = kCookTopState_OffCompleted;
5151
mCookSurfaceState1 = kCookSurfaceState_OffCompleted;
5252
mCookSurfaceState2 = kCookSurfaceState_OffCompleted;
5353

@@ -161,14 +161,15 @@ void OvenManager::OnOffAttributeChangeHandler(EndpointId endpointId, AttributeId
161161
case kCookSurfaceEndpoint1:
162162
case kCookSurfaceEndpoint2:
163163
// Handle On/Off attribute changes for the cook surface endpoints
164-
InitiateCookSurfaceAction(AppEvent::kEventType_CookSurface, *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION, value, endpointId);
164+
InitiateCookSurfaceAction(AppEvent::kEventType_CookSurface, *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION,
165+
value, endpointId);
165166
{
166167
bool cookSurfaceEndpoint1State;
167168
bool cookSurfaceEndpoint2State;
168169
mCookSurfaceEndpoint1.GetOnOffState(cookSurfaceEndpoint1State);
169170
mCookSurfaceEndpoint2.GetOnOffState(cookSurfaceEndpoint2State);
170171
// Check if both cooksurfaces are off. If yes, turn off the cooktop (call cooktop.TurnOffCookTop)
171-
if (cookSurfaceEndpoint1State == false && cookSurfaceEndpoint2State == false)
172+
if (cookSurfaceEndpoint1State == false && cookSurfaceEndpoint2State == false)
172173
{
173174
mCookTopEndpoint.SetOnOffState(false);
174175
}
@@ -267,11 +268,11 @@ bool OvenManager::InitiateCookSurfaceAction(int32_t aActor, Action_t aAction, ui
267268
*currentState = new_state;
268269

269270
AppEvent event;
270-
event.Type = AppEvent::kEventType_CookSurface;
271-
event.OvenEvent.Context = this;
272-
event.OvenEvent.Action = aAction;
273-
event.OvenEvent.Actor = endpointId; // Store endpoint ID in Actor field
274-
event.Handler = ActuatorMovementHandler;
271+
event.Type = AppEvent::kEventType_CookSurface;
272+
event.OvenEvent.Context = this;
273+
event.OvenEvent.Action = aAction;
274+
event.OvenEvent.Actor = endpointId; // Store endpoint ID in Actor field
275+
event.Handler = ActuatorMovementHandler;
275276
AppTask::GetAppTask().PostEvent(&event);
276277
}
277278

@@ -286,58 +287,56 @@ bool OvenManager::InitiateCookSurfaceAction(int32_t aActor, Action_t aAction, ui
286287
void OvenManager::ActuatorMovementHandler(AppEvent * aEvent)
287288
{
288289
Action_t actionCompleted = INVALID_ACTION;
289-
OvenManager * oven = static_cast<OvenManager *>(aEvent->OvenEvent.Context);
290+
OvenManager * oven = static_cast<OvenManager *>(aEvent->OvenEvent.Context);
290291

291292
switch (aEvent->Type)
292293
{
293-
case AppEvent::kEventType_CookTop:
294+
case AppEvent::kEventType_CookTop: {
295+
// Handle CookTop state transitions
296+
if (oven->mCookTopState == kCookTopState_OffInitiated)
294297
{
295-
// Handle CookTop state transitions
296-
if (oven->mCookTopState == kCookTopState_OffInitiated)
297-
{
298-
oven->mCookTopState = kCookTopState_OffCompleted;
299-
actionCompleted = OFF_ACTION;
300-
}
301-
else if (oven->mCookTopState == kCookTopState_OnInitiated)
302-
{
303-
oven->mCookTopState = kCookTopState_OnCompleted;
304-
actionCompleted = ON_ACTION;
305-
}
298+
oven->mCookTopState = kCookTopState_OffCompleted;
299+
actionCompleted = OFF_ACTION;
306300
}
307-
break;
308-
case AppEvent::kEventType_CookSurface:
301+
else if (oven->mCookTopState == kCookTopState_OnInitiated)
309302
{
310-
// Handle CookSurface state transitions
311-
chip::EndpointId endpointId = static_cast<chip::EndpointId>(aEvent->OvenEvent.Actor);
312-
State_t * currentState = nullptr;
313-
314-
// Get the appropriate state pointer based on endpoint
315-
if (endpointId == kCookSurfaceEndpoint1)
316-
{
317-
currentState = &oven->mCookSurfaceState1;
318-
}
319-
else if (endpointId == kCookSurfaceEndpoint2)
320-
{
321-
currentState = &oven->mCookSurfaceState2;
322-
}
323-
else
324-
{
325-
ChipLogError(AppServer, "Invalid CookSurface endpoint ID");
326-
return; // Invalid endpoint
327-
}
303+
oven->mCookTopState = kCookTopState_OnCompleted;
304+
actionCompleted = ON_ACTION;
305+
}
306+
}
307+
break;
308+
case AppEvent::kEventType_CookSurface: {
309+
// Handle CookSurface state transitions
310+
chip::EndpointId endpointId = static_cast<chip::EndpointId>(aEvent->OvenEvent.Actor);
311+
State_t * currentState = nullptr;
312+
313+
// Get the appropriate state pointer based on endpoint
314+
if (endpointId == kCookSurfaceEndpoint1)
315+
{
316+
currentState = &oven->mCookSurfaceState1;
317+
}
318+
else if (endpointId == kCookSurfaceEndpoint2)
319+
{
320+
currentState = &oven->mCookSurfaceState2;
321+
}
322+
else
323+
{
324+
ChipLogError(AppServer, "Invalid CookSurface endpoint ID");
325+
return; // Invalid endpoint
326+
}
328327

329-
if (*currentState == kCookSurfaceState_OffInitiated)
330-
{
331-
*currentState = kCookSurfaceState_OffCompleted;
332-
actionCompleted = OFF_ACTION;
333-
}
334-
else if (*currentState == kCookSurfaceState_OnInitiated)
335-
{
336-
*currentState = kCookSurfaceState_OnCompleted;
337-
actionCompleted = ON_ACTION;
338-
}
328+
if (*currentState == kCookSurfaceState_OffInitiated)
329+
{
330+
*currentState = kCookSurfaceState_OffCompleted;
331+
actionCompleted = OFF_ACTION;
339332
}
340-
break;
333+
else if (*currentState == kCookSurfaceState_OnInitiated)
334+
{
335+
*currentState = kCookSurfaceState_OnCompleted;
336+
actionCompleted = ON_ACTION;
337+
}
338+
}
339+
break;
341340
default:
342341
break;
343342
}
@@ -362,9 +361,12 @@ struct BlockedTransition
362361

363362
// Disallowed OvenMode Transitions.
364363
static constexpr BlockedTransition kBlockedTransitions[] = {
365-
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeGrill), to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing) },
366-
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing), to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean) },
367-
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean), to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeBake) },
364+
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeGrill),
365+
to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing) },
366+
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing),
367+
to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean) },
368+
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean),
369+
to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeBake) },
368370
};
369371

370372
static bool IsTransitionBlocked(uint8_t fromMode, uint8_t toMode)

0 commit comments

Comments
 (0)