17
17
*/
18
18
19
19
#include " thermostat-manager.h"
20
+ #include < protocols/interaction_model/StatusCode.h>
21
+
22
+ using chip::Protocols::InteractionModel::Status;
20
23
21
24
using namespace chip ;
22
25
using namespace chip ::app;
@@ -26,28 +29,28 @@ void ThermostatManager::Init()
26
29
{
27
30
BitMask<Thermostat::Feature> FeatureMap;
28
31
FeatureMap.Set (Thermostat::Feature::kHeating );
29
- EmberAfStatus status = Thermostat::Attributes::FeatureMap::Set (mEndpointId , FeatureMap.Raw ());
32
+ Status status = Thermostat::Attributes::FeatureMap::Set (mEndpointId , FeatureMap.Raw ());
30
33
31
34
status = Thermostat::Attributes::ControlSequenceOfOperation::Set (mEndpointId ,
32
35
Thermostat::ControlSequenceOfOperationEnum::kHeatingOnly );
33
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
36
+ VerifyOrReturn (Status::Success == status,
34
37
ChipLogError (NotSpecified, " Failed to set Thermostat ControlSequenceOfOperation attribute" ));
35
38
36
39
status = Thermostat::Attributes::AbsMinHeatSetpointLimit::Set (mEndpointId , 500 );
37
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
40
+ VerifyOrReturn (Status::Success == status,
38
41
ChipLogError (NotSpecified, " Failed to set Thermostat MinHeatSetpointLimit attribute" ));
39
42
40
43
status = Thermostat::Attributes::AbsMaxHeatSetpointLimit::Set (mEndpointId , 3000 );
41
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
44
+ VerifyOrReturn (Status::Success == status,
42
45
ChipLogError (NotSpecified, " Failed to set Thermostat MaxHeatSetpointLimit attribute" ));
43
46
}
44
47
45
48
void ThermostatManager::HeatingSetpointWriteCallback (int16_t newValue)
46
49
{
47
50
ChipLogDetail (NotSpecified, " ThermostatManager::HeatingSetpointWriteCallback: %d" , newValue);
48
51
Thermostat::SystemModeEnum systemMode;
49
- EmberAfStatus status = Thermostat::Attributes::SystemMode::Get (mEndpointId , &systemMode);
50
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError (NotSpecified, " Failed to get Thermostat SystemMode attribute" ));
52
+ Status status = Thermostat::Attributes::SystemMode::Get (mEndpointId , &systemMode);
53
+ VerifyOrReturn (Status::Success == status, ChipLogError (NotSpecified, " Failed to get Thermostat SystemMode attribute" ));
51
54
52
55
// A new setpoint has been set, so we shall infer that the we want to be in Heating mode
53
56
if (systemMode == Thermostat::SystemModeEnum::kOff )
@@ -58,7 +61,7 @@ void ThermostatManager::HeatingSetpointWriteCallback(int16_t newValue)
58
61
// Check the current temperature and turn on the heater if needed
59
62
DataModel::Nullable<int16_t > localTemperature;
60
63
status = Thermostat::Attributes::LocalTemperature::Get (mEndpointId , localTemperature);
61
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
64
+ VerifyOrReturn (Status::Success == status,
62
65
ChipLogError (NotSpecified, " Failed to get TemperatureMeasurement MeasuredValue attribute" ));
63
66
64
67
if (localTemperature.Value () < newValue)
@@ -81,14 +84,13 @@ void ThermostatManager::SystemModeWriteCallback(uint8_t newValue)
81
84
else if ((Thermostat::SystemModeEnum) newValue == Thermostat::SystemModeEnum::kHeat )
82
85
{
83
86
DataModel::Nullable<int16_t > localTemperature;
84
- EmberAfStatus status = Thermostat::Attributes::LocalTemperature::Get (mEndpointId , localTemperature);
85
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
87
+ Status status = Thermostat::Attributes::LocalTemperature::Get (mEndpointId , localTemperature);
88
+ VerifyOrReturn (Status::Success == status,
86
89
ChipLogError (NotSpecified, " Failed to get TemperatureMeasurement MeasuredValue attribute" ));
87
90
88
91
int16_t heatingSetpoint;
89
92
status = Thermostat::Attributes::OccupiedHeatingSetpoint::Get (mEndpointId , &heatingSetpoint);
90
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
91
- ChipLogError (NotSpecified, " Failed to get Thermostat HeatingSetpoint attribute" ));
93
+ VerifyOrReturn (Status::Success == status, ChipLogError (NotSpecified, " Failed to get Thermostat HeatingSetpoint attribute" ));
92
94
93
95
if (localTemperature.Value () < heatingSetpoint)
94
96
{
@@ -99,8 +101,8 @@ void ThermostatManager::SystemModeWriteCallback(uint8_t newValue)
99
101
100
102
void ThermostatManager::OnLocalTemperatureChangeCallback (int16_t temperature)
101
103
{
102
- EmberAfStatus status = Thermostat::Attributes::LocalTemperature::Set (mEndpointId , temperature);
103
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
104
+ Status status = Thermostat::Attributes::LocalTemperature::Set (mEndpointId , temperature);
105
+ VerifyOrReturn (Status::Success == status,
104
106
ChipLogError (NotSpecified, " Failed to set TemperatureMeasurement MeasuredValue attribute" ));
105
107
}
106
108
@@ -122,14 +124,13 @@ void ThermostatManager::SetHeating(bool isHeating)
122
124
runningState.Clear (Thermostat::RelayStateBitmap::kHeat );
123
125
}
124
126
125
- EmberAfStatus status = Thermostat::Attributes::ThermostatRunningState::Set (mEndpointId , runningState);
126
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status,
127
- ChipLogError (NotSpecified, " Failed to set Thermostat RunningState attribute" ));
127
+ Status status = Thermostat::Attributes::ThermostatRunningState::Set (mEndpointId , runningState);
128
+ VerifyOrReturn (Status::Success == status, ChipLogError (NotSpecified, " Failed to set Thermostat RunningState attribute" ));
128
129
}
129
130
130
131
void ThermostatManager::SetHeatMode (bool heat)
131
132
{
132
- EmberAfStatus status = Thermostat::Attributes::SystemMode::Set (
133
+ Status status = Thermostat::Attributes::SystemMode::Set (
133
134
mEndpointId , heat ? Thermostat::SystemModeEnum::kHeat : Thermostat::SystemModeEnum::kOff );
134
- VerifyOrReturn (EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError (NotSpecified, " Failed to set Thermostat SystemMode attribute" ));
135
+ VerifyOrReturn (Status::Success == status, ChipLogError (NotSpecified, " Failed to set Thermostat SystemMode attribute" ));
135
136
}
0 commit comments