|
19 | 19 | #include "TemperatureControlledCabinetEndpoint.h" |
20 | 20 | #include "OvenModeDelegate.h" |
21 | 21 | #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> |
24 | 22 | #include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h> |
25 | | -#include <protocols/interaction_model/StatusCode.h> |
26 | 23 |
|
27 | 24 | using namespace chip; |
28 | 25 | using namespace chip::app::Clusters::TemperatureControlledCabinet; |
29 | | -using namespace chip::app::DataModel; |
30 | | -using namespace chip::app::Clusters; |
31 | | - |
32 | | -using Protocols::InteractionModel::Status; |
33 | 26 |
|
34 | 27 | CHIP_ERROR TemperatureControlledCabinetEndpoint::Init() |
35 | 28 | { |
36 | 29 | // Initialize the Oven Mode instance and delegate |
37 | 30 | ReturnErrorOnFailure(mOvenModeInstance.Init()); |
38 | 31 | ReturnErrorOnFailure(mOvenModeDelegate.Init()); |
39 | 32 |
|
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 | | - |
69 | 33 | return CHIP_NO_ERROR; |
70 | 34 | } |
0 commit comments