Skip to content

Commit 5ab6a75

Browse files
committed
Address review comments and modify the file structures accordingly
1 parent ec92429 commit 5ab6a75

17 files changed

+66
-134
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
#pragma once
2020

21-
#include <AppSupportedTemperatureLevelsDelegate.h>
2221
#include <app-common/zap-generated/cluster-objects.h>
23-
#include <app/clusters/on-off-server/on-off-server.h>
24-
#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h>
2522
#include <lib/core/CHIPError.h>
2623
#include <lib/core/DataModelTypes.h>
2724

@@ -33,7 +30,7 @@ namespace CookSurface {
3330
class CookSurfaceEndpoint
3431
{
3532
public:
36-
CookSurfaceEndpoint(EndpointId endpointId) : mEndpoint(endpointId) {}
33+
CookSurfaceEndpoint(EndpointId endpointId) {}
3734

3835
/**
3936
* @brief Initialize the CookSurface endpoint.
@@ -43,11 +40,7 @@ class CookSurfaceEndpoint
4340
/**
4441
* @brief Handle the "off" command for the CookSurface.
4542
*/
46-
void offCommand();
47-
48-
private:
49-
EndpointId mEndpoint = kInvalidEndpointId;
50-
TemperatureControlledCabinet::AppSupportedTemperatureLevelsDelegate mTemperatureControlDelegate;
43+
void HandleOffCommand();
5144
};
5245

5346
} // namespace CookSurface

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,20 @@ namespace CookTop {
2929
class CookTopEndpoint
3030
{
3131
public:
32-
CookTopEndpoint(EndpointId endpointId) : mEndpoint(endpointId) {}
32+
CookTopEndpoint(EndpointId endpointId) {}
3333

3434
/**
3535
* @brief Initialize the cooktop endpoint.
3636
*
37-
* This function sets up the cooktop endpoint, preparing it for operation.
38-
*
3937
* @return CHIP_ERROR indicating success or failure of the initialization.
4038
*/
4139
CHIP_ERROR Init();
4240

4341
/**
4442
* @brief Handle the "off" command for the cooktop.
4543
*/
46-
void offCommand();
44+
void HandleOffCommand();
4745

48-
private:
49-
EndpointId mEndpoint = kInvalidEndpointId;
5046
};
5147

5248
} // namespace CookTop

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,15 @@ namespace Oven {
3333
class OvenEndpoint
3434
{
3535
public:
36-
OvenEndpoint(EndpointId endpointId) : mEndpoint(endpointId) {}
36+
OvenEndpoint(EndpointId endpointId) {}
3737

3838
/**
3939
* @brief Initialize the oven endpoint.
4040
*
41-
* This function sets up the oven endpoint, preparing it for operation.
42-
*
4341
* @return CHIP_ERROR indicating success or failure of the initialization.
4442
*/
4543
CHIP_ERROR Init();
4644

47-
private:
48-
EndpointId mEndpoint = kInvalidEndpointId;
4945
};
5046

5147
} // namespace Oven

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#pragma once
2020

21-
#include <app-common/zap-generated/cluster-objects.h> // provides detail::Structs::ModeTagStruct::Type and ModeOptionStruct::Type
21+
#include <app-common/zap-generated/cluster-objects.h>
2222
#include <app/clusters/mode-base-server/mode-base-server.h>
2323
#include <app/data-model/List.h>
2424
#include <lib/core/CHIPError.h>
@@ -30,7 +30,6 @@ namespace app {
3030
namespace Clusters {
3131
namespace TemperatureControlledCabinet {
3232

33-
/// This is an application level delegate to handle Oven commands according to the specific business logic.
3433
class OvenModeDelegate : public ModeBase::Delegate
3534
{
3635
public:

examples/oven-app/oven-app-common/oven-app.matter

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,10 +2360,10 @@ endpoint 2 {
23602360
}
23612361

23622362
server cluster TemperatureControl {
2363-
ram attribute temperatureSetpoint;
2364-
ram attribute minTemperature;
2365-
ram attribute maxTemperature;
2366-
ram attribute step;
2363+
ram attribute temperatureSetpoint default = 0;
2364+
ram attribute minTemperature default = 0;
2365+
ram attribute maxTemperature default = 10000;
2366+
ram attribute step default = 50;
23672367
callback attribute generatedCommandList;
23682368
callback attribute acceptedCommandList;
23692369
callback attribute attributeList;

examples/oven-app/oven-app-common/oven-app.zap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3979,10 +3979,10 @@
39793979
"side": "server",
39803980
"type": "bitmap32",
39813981
"included": 1,
3982-
"storageOption": "RAM",
3982+
"storageOption": "External",
39833983
"singleton": 0,
39843984
"bounded": 0,
3985-
"defaultValue": "0",
3985+
"defaultValue": null,
39863986
"reportable": 1,
39873987
"minInterval": 1,
39883988
"maxInterval": 65534,
@@ -3995,10 +3995,10 @@
39953995
"side": "server",
39963996
"type": "int16u",
39973997
"included": 1,
3998-
"storageOption": "RAM",
3998+
"storageOption": "External",
39993999
"singleton": 0,
40004000
"bounded": 0,
4001-
"defaultValue": "1",
4001+
"defaultValue": null,
40024002
"reportable": 1,
40034003
"minInterval": 1,
40044004
"maxInterval": 65534,
@@ -4682,7 +4682,7 @@
46824682
"storageOption": "RAM",
46834683
"singleton": 0,
46844684
"bounded": 0,
4685-
"defaultValue": "",
4685+
"defaultValue": "0",
46864686
"reportable": 1,
46874687
"minInterval": 1,
46884688
"maxInterval": 65534,
@@ -4698,7 +4698,7 @@
46984698
"storageOption": "RAM",
46994699
"singleton": 0,
47004700
"bounded": 0,
4701-
"defaultValue": "",
4701+
"defaultValue": "0",
47024702
"reportable": 1,
47034703
"minInterval": 1,
47044704
"maxInterval": 65534,
@@ -4714,7 +4714,7 @@
47144714
"storageOption": "RAM",
47154715
"singleton": 0,
47164716
"bounded": 0,
4717-
"defaultValue": "",
4717+
"defaultValue": "10000",
47184718
"reportable": 1,
47194719
"minInterval": 1,
47204720
"maxInterval": 65534,
@@ -4730,7 +4730,7 @@
47304730
"storageOption": "RAM",
47314731
"singleton": 0,
47324732
"bounded": 0,
4733-
"defaultValue": "",
4733+
"defaultValue": "50",
47344734
"reportable": 1,
47354735
"minInterval": 1,
47364736
"maxInterval": 65534,

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,20 @@
1717
*/
1818

1919
#include "CookSurfaceEndpoint.h"
20-
#include <app-common/zap-generated/cluster-objects.h>
21-
#include <app/clusters/on-off-server/on-off-server.h>
22-
#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h>
2320
#include <lib/core/CHIPError.h>
24-
#include <lib/core/DataModelTypes.h>
2521

2622
using namespace chip;
2723
using namespace chip::app::Clusters::CookSurface;
28-
using namespace chip::app::DataModel;
29-
using namespace chip::app::Clusters;
3024

3125
CHIP_ERROR CookSurfaceEndpoint::Init()
3226
{
33-
ChipLogProgress(AppServer, "CookSurfaceEndpoint::Init() called for endpoint %d", mEndpoint);
34-
35-
// Temperature Control Delegate set
36-
TemperatureControl::SetInstance(&mTemperatureControlDelegate);
37-
ChipLogProgress(AppServer, "Temperature control delegate set for CookSurfaceEndpoint");
38-
27+
ChipLogProgress(AppServer, "CookSurfaceEndpoint::Init()");
28+
// TODO: Add Endpoint initialization logic
3929
return CHIP_NO_ERROR;
4030
}
4131

42-
void CookSurfaceEndpoint::offCommand()
32+
void CookSurfaceEndpoint::HandleOffCommand()
4333
{
34+
// TODO: Implement the logic to handle the "off" command
4435
return;
4536
}

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,19 @@
1717
*/
1818

1919
#include "CookTopEndpoint.h"
20-
#include <app-common/zap-generated/cluster-objects.h>
2120
#include <lib/core/CHIPError.h>
22-
#include <lib/core/DataModelTypes.h>
2321

2422
using namespace chip;
2523
using namespace chip::app::Clusters::CookTop;
26-
using namespace chip::app::DataModel;
27-
using namespace ::chip::app::Clusters;
28-
using namespace ::chip::app::Clusters::OnOff;
2924

3025
CHIP_ERROR CookTopEndpoint::Init()
3126
{
32-
// Initialization logic
27+
// TODO: Add CookTop Endpoint Initialization logic
3328
return CHIP_NO_ERROR;
3429
}
3530

36-
void CookTopEndpoint::offCommand()
31+
void CookTopEndpoint::HandleOffCommand()
3732
{
38-
// Handle off command
33+
// TODO: Implement the logic to handle the "off" command
3934
return;
4035
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ using namespace chip::app::Clusters::Oven;
2424

2525
CHIP_ERROR OvenEndpoint::Init()
2626
{
27-
// Initialization logic
27+
// TODO: Add Initialization logic (if needed)
2828
return CHIP_NO_ERROR;
2929
}

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,16 @@
1919
#include "TemperatureControlledCabinetEndpoint.h"
2020
#include "OvenModeDelegate.h"
2121
#include <app-common/zap-generated/attributes/Accessors.h>
22-
#include <app-common/zap-generated/cluster-enums.h>
23-
#include <app-common/zap-generated/cluster-objects.h>
2422
#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h>
25-
#include <protocols/interaction_model/StatusCode.h>
2623

2724
using namespace chip;
2825
using namespace chip::app::Clusters::TemperatureControlledCabinet;
29-
using namespace chip::app::DataModel;
30-
using namespace chip::app::Clusters;
31-
32-
using Protocols::InteractionModel::Status;
3326

3427
CHIP_ERROR TemperatureControlledCabinetEndpoint::Init()
3528
{
3629
// Initialize the Oven Mode instance and delegate
3730
ReturnErrorOnFailure(mOvenModeInstance.Init());
3831
ReturnErrorOnFailure(mOvenModeDelegate.Init());
3932

40-
// Set the TemperatureControl cluster min and max temperature values
41-
// Temperature values are in hundredths of degrees Celsius (0°C = 0, 100°C = 10000)
42-
using namespace chip::app::Clusters::TemperatureControl::Attributes;
43-
44-
auto status = MinTemperature::Set(mEndpointId, 0); // 0°C
45-
if (status != chip::Protocols::InteractionModel::Status::Success)
46-
{
47-
ChipLogError(AppServer, "Failed to set MinTemperature: %d", static_cast<int>(status));
48-
return CHIP_ERROR_INTERNAL;
49-
}
50-
51-
status = MaxTemperature::Set(mEndpointId, 10000); // 100°C
52-
if (status != chip::Protocols::InteractionModel::Status::Success)
53-
{
54-
ChipLogError(AppServer, "Failed to set MaxTemperature: %d", static_cast<int>(status));
55-
return CHIP_ERROR_INTERNAL;
56-
}
57-
58-
// Set temperature step to 5°C (500 in hundredths of degrees)
59-
status = Step::Set(mEndpointId, 500); // 5°C step
60-
if (status != chip::Protocols::InteractionModel::Status::Success)
61-
{
62-
ChipLogError(AppServer, "Failed to set temperature Step: %d", static_cast<int>(status));
63-
return CHIP_ERROR_INTERNAL;
64-
}
65-
66-
ChipLogProgress(AppServer,
67-
"TemperatureControlledCabinetEndpoint initialized with MinTemperature=0°C, MaxTemperature=100°C, Step=5°C");
68-
6933
return CHIP_NO_ERROR;
7034
}

0 commit comments

Comments
 (0)