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"
@@ -110,21 +109,9 @@ void OvenManager::Init()
110109
111110void OvenManager::TempCtrlAttributeChangeHandler (EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size)
112111{
113- if (endpointId == kCookSurfaceEndpoint4 || endpointId == kCookSurfaceEndpoint5 )
112+ if (endpointId == kTemperatureControlledCabinetEndpoint2 )
114113 {
115- // Handle temperature control attribute changes for the cook surface endpoints
116- if (*value == 0 ) // low
117- {
118- // TODO: Adjust the temperature-setpoint value in TemperatureControl Cluster accordingly
119- }
120- else if (*value == 1 ) // medium
121- {
122- // TODO: Adjust the temperature-setpoint value in TemperatureControl Cluster accordingly
123- }
124- else if (*value == 2 ) // high
125- {
126- // TODO: Adjust the temperature-setpoint value in TemperatureControl Cluster accordingly
127- }
114+ // TODO: Update the LCD with the new Temperature Control attribute value
128115 }
129116 return ;
130117}
@@ -133,7 +120,6 @@ void OvenManager::OnOffAttributeChangeHandler(EndpointId endpointId, AttributeId
133120{
134121 if (endpointId == kCookTopEndpoint3 )
135122 {
136- // Handle LCD and LED Actions
137123 InitiateAction (AppEvent::kEventType_Oven , *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION, value);
138124
139125 // Update CookSurface states accordingly
@@ -174,27 +160,24 @@ bool OvenManager::InitiateAction(int32_t aActor, Action_t aAction, uint8_t * aVa
174160 State_t new_state;
175161
176162 // Initiate Turn On/Off Action only when the previous one is complete.
177- // if (((mState == kState_OffCompleted) || mOffEffectArmed) && aAction == ON_ACTION)
178163 if (mState == kState_OffCompleted && aAction == ON_ACTION)
179164 {
180165 action_initiated = true ;
181-
182- new_state = kState_OnInitiated ;
166+ new_state = kState_OnInitiated ;
183167 }
184168 else if (mState == kState_OnCompleted && aAction == OFF_ACTION)
185169 {
186170 action_initiated = true ;
187-
188- new_state = kState_OffInitiated ;
171+ new_state = kState_OffInitiated ;
189172 }
190173
191174 if (action_initiated && (aAction == ON_ACTION || aAction == OFF_ACTION))
192175 {
193176 mState = new_state;
194177
195178 AppEvent event;
196- event.Type = AppEvent::kEventType_Oven ; // Assuming a distinct action type exists; fallback to Timer if not.
197- event.OvenEvent .Context = this ; // Reuse Context field; adjust if a specific union member exists for action.
179+ event.Type = AppEvent::kEventType_Oven ;
180+ event.OvenEvent .Context = this ;
198181 event.Handler = ActuatorMovementHandler;
199182 AppTask::GetAppTask ().PostEvent (&event);
200183 }
@@ -211,17 +194,16 @@ void OvenManager::ActuatorMovementHandler(AppEvent * aEvent)
211194{
212195 Action_t actionCompleted = INVALID_ACTION;
213196
214- // Correct union member: event posted stored context in OvenEvent.Context, not TimerEvent.Context.
215197 OvenManager * oven = static_cast <OvenManager *>(aEvent->OvenEvent .Context );
216198
217199 if (oven->mState == kState_OffInitiated )
218200 {
219- oven->mState = kState_OffCompleted ;
201+ oven->mState = kState_OffCompleted ;
220202 actionCompleted = OFF_ACTION;
221203 }
222204 else if (oven->mState == kState_OnInitiated )
223205 {
224- oven->mState = kState_OnCompleted ;
206+ oven->mState = kState_OnCompleted ;
225207 actionCompleted = ON_ACTION;
226208 }
227209
@@ -270,15 +252,15 @@ void OvenManager::ProcessOvenModeChange(chip::EndpointId endpointId, uint8_t new
270252 using chip::Protocols::InteractionModel::Status;
271253 ChipLogProgress (AppServer, " OvenManager::ProcessOvenModeChange ep=%u newMode=%u" , endpointId, newMode);
272254
273- // 1. Verify newMode is among supported modes
255+ // Verify newMode is among supported modes
274256 bool supported = TemperatureControlledCabinet::OvenModeDelegate::IsSupportedMode (newMode);
275257 if (!supported)
276258 {
277259 response.status = to_underlying (ModeBase::StatusCode::kUnsupportedMode );
278260 return ;
279261 }
280262
281- // 2. Read current mode
263+ // Read Current Oven Mode
282264 uint8_t currentMode;
283265 Status attrStatus = OvenMode::Attributes::CurrentMode::Get (endpointId, ¤tMode);
284266 if (attrStatus != Status::Success)
@@ -289,14 +271,14 @@ void OvenManager::ProcessOvenModeChange(chip::EndpointId endpointId, uint8_t new
289271 return ;
290272 }
291273
292- // 3. No-op
274+ // No action needed if current mode is the same as new mode
293275 if (currentMode == newMode)
294276 {
295277 response.status = to_underlying (ModeBase::StatusCode::kSuccess );
296278 return ;
297279 }
298280
299- // 4. Policy check
281+ // Check if the mode transition is possible
300282 if (IsTransitionBlocked (currentMode, newMode))
301283 {
302284 ChipLogProgress (AppServer, " OvenManager: Blocked transition %u -> %u" , currentMode, newMode);
@@ -305,7 +287,7 @@ void OvenManager::ProcessOvenModeChange(chip::EndpointId endpointId, uint8_t new
305287 return ;
306288 }
307289
308- // 5. Write new mode
290+ // Write new mode
309291 Status writeStatus = OvenMode::Attributes::CurrentMode::Set (endpointId, newMode);
310292 if (writeStatus != Status::Success)
311293 {
0 commit comments