@@ -57,21 +57,6 @@ void OvenManager::Init()
5757
5858 VerifyOrReturn (mCookTopEndpoint .Init () == CHIP_NO_ERROR, ChipLogError (AppServer, " CookTopEndpoint Init failed" ));
5959
60- // Initialize TemperatureControl cluster numeric temperature attributes for endpoint 2 (silent on failure)
61- {
62- Status tcStatus = TemperatureControl::Attributes::TemperatureSetpoint::Set (kTemperatureControlledCabinetEndpoint2 , 0 );
63- VerifyOrReturn (tcStatus == Status::Success, ChipLogError (AppServer, " Endpoint2 TemperatureSetpoint init failed" ));
64-
65- tcStatus = TemperatureControl::Attributes::MinTemperature::Set (kTemperatureControlledCabinetEndpoint2 , 0 );
66- VerifyOrReturn (tcStatus == Status::Success, ChipLogError (AppServer, " Endpoint2 MinTemperature init failed" ));
67-
68- tcStatus = TemperatureControl::Attributes::MaxTemperature::Set (kTemperatureControlledCabinetEndpoint2 , 30000 );
69- VerifyOrReturn (tcStatus == Status::Success, ChipLogError (AppServer, " Endpoint2 MaxTemperature init failed" ));
70-
71- tcStatus = TemperatureControl::Attributes::Step::Set (kTemperatureControlledCabinetEndpoint2 , 500 );
72- VerifyOrReturn (tcStatus == Status::Success, ChipLogError (AppServer, " Endpoint2 Step init failed" ));
73- }
74-
7560 // Register the shared TemperatureLevelsDelegate for all the cooksurface endpoints
7661 TemperatureControl::SetInstance (&mTemperatureControlDelegate );
7762
@@ -167,35 +152,42 @@ CHIP_ERROR OvenManager::SetTemperatureControlledCabinetInitialState(EndpointId t
167152
168153void OvenManager::TempCtrlAttributeChangeHandler (EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size)
169154{
170- if (endpointId == kTemperatureControlledCabinetEndpoint2 )
155+ switch (endpointId)
171156 {
157+ case kTemperatureControlledCabinetEndpoint :
172158 // TODO: Update the LCD with the new Temperature Control attribute value
159+ break ;
160+ default :
161+ break ;
173162 }
174- return ;
175163}
176164
177165void OvenManager::OnOffAttributeChangeHandler (EndpointId endpointId, AttributeId attributeId, uint8_t * value, uint16_t size)
178166{
179- if (endpointId == kCookTopEndpoint3 )
167+ switch (endpointId)
180168 {
169+ case kCookTopEndpoint3 :
181170 InitiateAction (AppEvent::kEventType_Oven , *value ? OvenManager::ON_ACTION : OvenManager::OFF_ACTION, value);
182-
183171 // Update CookSurface states accordingly
184- mCookSurfaceEndpoint4 .SetOnOffState (*value);
185- mCookSurfaceEndpoint5 .SetOnOffState (*value);
186- }
187- else if (endpointId == kCookSurfaceEndpoint4 || endpointId == kCookSurfaceEndpoint5 )
188- {
172+ mCookSurfaceEndpoint1 .SetOnOffState (*value);
173+ mCookSurfaceEndpoint2 .SetOnOffState (*value);
174+ break ;
175+ case kCookSurfaceEndpoint1 :
176+ case kCookSurfaceEndpoint2 :
189177 // Handle On/Off attribute changes for the cook surface endpoints
190- bool cookSurfaceEndpoint4State = mCookSurfaceEndpoint4 .GetOnOffState ();
191- bool cookSurfaceEndpoint5State = mCookSurfaceEndpoint5 .GetOnOffState ();
192- // Check if both cooksurfaces are off. If yes, turn off the cooktop (call cooktop.TurnOffCookTop)
193- if (cookSurfaceEndpoint4State == false && cookSurfaceEndpoint5State == false )
194178 {
195- mCookTopEndpoint3 .SetOnOffState (false );
179+ bool cookSurfaceEndpoint1State = mCookSurfaceEndpoint1 .GetOnOffState ();
180+ bool cookSurfaceEndpoint2State = mCookSurfaceEndpoint2 .GetOnOffState ();
181+ // Check if both cooksurfaces are off. If yes, turn off the cooktop (call cooktop.TurnOffCookTop)
182+ if (cookSurfaceEndpoint1State == false && cookSurfaceEndpoint2State == false )
183+ {
184+ mCookTopEndpoint3 .SetOnOffState (false );
185+ }
196186 }
187+ break ;
188+ default :
189+ break ;
197190 }
198- return ;
199191}
200192
201193void OvenManager::OvenModeAttributeChangeHandler (chip::EndpointId endpointId, chip::AttributeId attributeId, uint8_t * value,
0 commit comments