1717 */
1818
1919#include " OvenManager.h"
20- // Corrected relative paths to shared oven-app-common headers (src/ -> ../../)
2120#include " CookSurfaceEndpoint.h"
2221#include " CookTopEndpoint.h"
2322#include " OvenEndpoint.h"
@@ -145,21 +144,9 @@ CHIP_ERROR OvenManager::SetTemperatureControlledCabinetInitialState(EndpointId t
145144
146145void OvenManager::TempCtrlAttributeChangeHandler (EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size)
147146{
148- if (endpointId == kCookSurfaceEndpoint4 || endpointId == kCookSurfaceEndpoint5 )
147+ if (endpointId == kTemperatureControlledCabinetEndpoint2 )
149148 {
150- // Handle temperature control attribute changes for the cook surface endpoints
151- if (*value == 0 ) // low
152- {
153- // TODO: Adjust the temperature-setpoint value in TemperatureControl Cluster accordingly
154- }
155- else if (*value == 1 ) // medium
156- {
157- // TODO: Adjust the temperature-setpoint value in TemperatureControl Cluster accordingly
158- }
159- else if (*value == 2 ) // high
160- {
161- // TODO: Adjust the temperature-setpoint value in TemperatureControl Cluster accordingly
162- }
149+ // TODO: Update the LCD with the new Temperature Control attribute value
163150 }
164151 return ;
165152}
@@ -168,7 +155,6 @@ void OvenManager::OnOffAttributeChangeHandler(EndpointId endpointId, AttributeId
168155{
169156 if (endpointId == kCookTopEndpoint3 )
170157 {
171- // Handle LCD and LED Actions
172158 InitiateAction (AppEvent::kEventType_Oven , *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION, value);
173159
174160 // Update CookSurface states accordingly
@@ -209,27 +195,24 @@ bool OvenManager::InitiateAction(int32_t aActor, Action_t aAction, uint8_t * aVa
209195 State_t new_state;
210196
211197 // Initiate Turn On/Off Action only when the previous one is complete.
212- // if (((mState == kState_OffCompleted) || mOffEffectArmed) && aAction == ON_ACTION)
213198 if (mState == kState_OffCompleted && aAction == ON_ACTION)
214199 {
215200 action_initiated = true ;
216-
217- new_state = kState_OnInitiated ;
201+ new_state = kState_OnInitiated ;
218202 }
219203 else if (mState == kState_OnCompleted && aAction == OFF_ACTION)
220204 {
221205 action_initiated = true ;
222-
223- new_state = kState_OffInitiated ;
206+ new_state = kState_OffInitiated ;
224207 }
225208
226209 if (action_initiated && (aAction == ON_ACTION || aAction == OFF_ACTION))
227210 {
228211 mState = new_state;
229212
230213 AppEvent event;
231- event.Type = AppEvent::kEventType_Oven ; // Assuming a distinct action type exists; fallback to Timer if not.
232- event.OvenEvent .Context = this ; // Reuse Context field; adjust if a specific union member exists for action.
214+ event.Type = AppEvent::kEventType_Oven ;
215+ event.OvenEvent .Context = this ;
233216 event.Handler = ActuatorMovementHandler;
234217 AppTask::GetAppTask ().PostEvent (&event);
235218 }
@@ -246,17 +229,16 @@ void OvenManager::ActuatorMovementHandler(AppEvent * aEvent)
246229{
247230 Action_t actionCompleted = INVALID_ACTION;
248231
249- // Correct union member: event posted stored context in OvenEvent.Context, not TimerEvent.Context.
250232 OvenManager * oven = static_cast <OvenManager *>(aEvent->OvenEvent .Context );
251233
252234 if (oven->mState == kState_OffInitiated )
253235 {
254- oven->mState = kState_OffCompleted ;
236+ oven->mState = kState_OffCompleted ;
255237 actionCompleted = OFF_ACTION;
256238 }
257239 else if (oven->mState == kState_OnInitiated )
258240 {
259- oven->mState = kState_OnCompleted ;
241+ oven->mState = kState_OnCompleted ;
260242 actionCompleted = ON_ACTION;
261243 }
262244
@@ -305,15 +287,15 @@ void OvenManager::ProcessOvenModeChange(chip::EndpointId endpointId, uint8_t new
305287 using chip::Protocols::InteractionModel::Status;
306288 ChipLogProgress (AppServer, " OvenManager::ProcessOvenModeChange ep=%u newMode=%u" , endpointId, newMode);
307289
308- // 1. Verify newMode is among supported modes
290+ // Verify newMode is among supported modes
309291 bool supported = TemperatureControlledCabinet::OvenModeDelegate::IsSupportedMode (newMode);
310292 if (!supported)
311293 {
312294 response.status = to_underlying (ModeBase::StatusCode::kUnsupportedMode );
313295 return ;
314296 }
315297
316- // 2. Read current mode
298+ // Read Current Oven Mode
317299 uint8_t currentMode;
318300 Status attrStatus = OvenMode::Attributes::CurrentMode::Get (endpointId, ¤tMode);
319301 if (attrStatus != Status::Success)
@@ -324,14 +306,14 @@ void OvenManager::ProcessOvenModeChange(chip::EndpointId endpointId, uint8_t new
324306 return ;
325307 }
326308
327- // 3. No-op
309+ // No action needed if current mode is the same as new mode
328310 if (currentMode == newMode)
329311 {
330312 response.status = to_underlying (ModeBase::StatusCode::kSuccess );
331313 return ;
332314 }
333315
334- // 4. Policy check
316+ // Check if the mode transition is possible
335317 if (IsTransitionBlocked (currentMode, newMode))
336318 {
337319 ChipLogProgress (AppServer, " OvenManager: Blocked transition %u -> %u" , currentMode, newMode);
@@ -340,7 +322,7 @@ void OvenManager::ProcessOvenModeChange(chip::EndpointId endpointId, uint8_t new
340322 return ;
341323 }
342324
343- // 5. Write new mode
325+ // Write new mode
344326 Status writeStatus = OvenMode::Attributes::CurrentMode::Set (endpointId, newMode);
345327 if (writeStatus != Status::Success)
346328 {
0 commit comments