Skip to content

Commit 0e0ee4e

Browse files
restyled-commitsarun-silabs
authored andcommitted
Restyled by clang-format
1 parent b1e9be0 commit 0e0ee4e

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

@@ -181,14 +181,15 @@ void OvenManager::OnOffAttributeChangeHandler(EndpointId endpointId, AttributeId
181181
case kCookSurfaceEndpoint1:
182182
case kCookSurfaceEndpoint2:
183183
// Handle On/Off attribute changes for the cook surface endpoints
184-
InitiateCookSurfaceAction(AppEvent::kEventType_CookSurface, *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION, value, endpointId);
184+
InitiateCookSurfaceAction(AppEvent::kEventType_CookSurface, *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION,
185+
value, endpointId);
185186
{
186187
bool cookSurfaceEndpoint1State;
187188
bool cookSurfaceEndpoint2State;
188189
mCookSurfaceEndpoint1.GetOnOffState(cookSurfaceEndpoint1State);
189190
mCookSurfaceEndpoint2.GetOnOffState(cookSurfaceEndpoint2State);
190191
// Check if both cooksurfaces are off. If yes, turn off the cooktop (call cooktop.TurnOffCookTop)
191-
if (cookSurfaceEndpoint1State == false && cookSurfaceEndpoint2State == false)
192+
if (cookSurfaceEndpoint1State == false && cookSurfaceEndpoint2State == false)
192193
{
193194
mCookTopEndpoint.SetOnOffState(false);
194195
}
@@ -287,11 +288,11 @@ bool OvenManager::InitiateCookSurfaceAction(int32_t aActor, Action_t aAction, ui
287288
*currentState = new_state;
288289

289290
AppEvent event;
290-
event.Type = AppEvent::kEventType_CookSurface;
291-
event.OvenEvent.Context = this;
292-
event.OvenEvent.Action = aAction;
293-
event.OvenEvent.Actor = endpointId; // Store endpoint ID in Actor field
294-
event.Handler = ActuatorMovementHandler;
291+
event.Type = AppEvent::kEventType_CookSurface;
292+
event.OvenEvent.Context = this;
293+
event.OvenEvent.Action = aAction;
294+
event.OvenEvent.Actor = endpointId; // Store endpoint ID in Actor field
295+
event.Handler = ActuatorMovementHandler;
295296
AppTask::GetAppTask().PostEvent(&event);
296297
}
297298

@@ -306,58 +307,56 @@ bool OvenManager::InitiateCookSurfaceAction(int32_t aActor, Action_t aAction, ui
306307
void OvenManager::ActuatorMovementHandler(AppEvent * aEvent)
307308
{
308309
Action_t actionCompleted = INVALID_ACTION;
309-
OvenManager * oven = static_cast<OvenManager *>(aEvent->OvenEvent.Context);
310+
OvenManager * oven = static_cast<OvenManager *>(aEvent->OvenEvent.Context);
310311

311312
switch (aEvent->Type)
312313
{
313-
case AppEvent::kEventType_CookTop:
314+
case AppEvent::kEventType_CookTop: {
315+
// Handle CookTop state transitions
316+
if (oven->mCookTopState == kCookTopState_OffInitiated)
314317
{
315-
// Handle CookTop state transitions
316-
if (oven->mCookTopState == kCookTopState_OffInitiated)
317-
{
318-
oven->mCookTopState = kCookTopState_OffCompleted;
319-
actionCompleted = OFF_ACTION;
320-
}
321-
else if (oven->mCookTopState == kCookTopState_OnInitiated)
322-
{
323-
oven->mCookTopState = kCookTopState_OnCompleted;
324-
actionCompleted = ON_ACTION;
325-
}
318+
oven->mCookTopState = kCookTopState_OffCompleted;
319+
actionCompleted = OFF_ACTION;
326320
}
327-
break;
328-
case AppEvent::kEventType_CookSurface:
321+
else if (oven->mCookTopState == kCookTopState_OnInitiated)
329322
{
330-
// Handle CookSurface state transitions
331-
chip::EndpointId endpointId = static_cast<chip::EndpointId>(aEvent->OvenEvent.Actor);
332-
State_t * currentState = nullptr;
333-
334-
// Get the appropriate state pointer based on endpoint
335-
if (endpointId == kCookSurfaceEndpoint1)
336-
{
337-
currentState = &oven->mCookSurfaceState1;
338-
}
339-
else if (endpointId == kCookSurfaceEndpoint2)
340-
{
341-
currentState = &oven->mCookSurfaceState2;
342-
}
343-
else
344-
{
345-
ChipLogError(AppServer, "Invalid CookSurface endpoint ID");
346-
return; // Invalid endpoint
347-
}
323+
oven->mCookTopState = kCookTopState_OnCompleted;
324+
actionCompleted = ON_ACTION;
325+
}
326+
}
327+
break;
328+
case AppEvent::kEventType_CookSurface: {
329+
// Handle CookSurface state transitions
330+
chip::EndpointId endpointId = static_cast<chip::EndpointId>(aEvent->OvenEvent.Actor);
331+
State_t * currentState = nullptr;
332+
333+
// Get the appropriate state pointer based on endpoint
334+
if (endpointId == kCookSurfaceEndpoint1)
335+
{
336+
currentState = &oven->mCookSurfaceState1;
337+
}
338+
else if (endpointId == kCookSurfaceEndpoint2)
339+
{
340+
currentState = &oven->mCookSurfaceState2;
341+
}
342+
else
343+
{
344+
ChipLogError(AppServer, "Invalid CookSurface endpoint ID");
345+
return; // Invalid endpoint
346+
}
348347

349-
if (*currentState == kCookSurfaceState_OffInitiated)
350-
{
351-
*currentState = kCookSurfaceState_OffCompleted;
352-
actionCompleted = OFF_ACTION;
353-
}
354-
else if (*currentState == kCookSurfaceState_OnInitiated)
355-
{
356-
*currentState = kCookSurfaceState_OnCompleted;
357-
actionCompleted = ON_ACTION;
358-
}
348+
if (*currentState == kCookSurfaceState_OffInitiated)
349+
{
350+
*currentState = kCookSurfaceState_OffCompleted;
351+
actionCompleted = OFF_ACTION;
359352
}
360-
break;
353+
else if (*currentState == kCookSurfaceState_OnInitiated)
354+
{
355+
*currentState = kCookSurfaceState_OnCompleted;
356+
actionCompleted = ON_ACTION;
357+
}
358+
}
359+
break;
361360
default:
362361
break;
363362
}
@@ -382,9 +381,12 @@ struct BlockedTransition
382381

383382
// Disallowed OvenMode Transitions.
384383
static constexpr BlockedTransition kBlockedTransitions[] = {
385-
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeGrill), to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing) },
386-
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing), to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean) },
387-
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean), to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeBake) },
384+
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeGrill),
385+
to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing) },
386+
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeProofing),
387+
to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean) },
388+
{ to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeClean),
389+
to_underlying(TemperatureControlledCabinet::OvenModeDelegate::OvenModes::kModeBake) },
388390
};
389391

390392
static bool IsTransitionBlocked(uint8_t fromMode, uint8_t toMode)

0 commit comments

Comments
 (0)