Skip to content

Commit

Permalink
Replace ChipErrorFromStatusCode with CHIP_ERROR_IM_GLOBAL_STATUS_VALUE (
Browse files Browse the repository at this point in the history
  • Loading branch information
nivi-apple authored Aug 6, 2024
1 parent 653a55f commit e2ce403
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions examples/thermostat/linux/thermostat-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ ThermostatManager ThermostatManager::sThermostatMgr;

namespace {

CHIP_ERROR ChipErrorFromStatusCode(Status status)
{
StatusIB statusIB(status);
return statusIB.ToChipError();
}

template <typename DecodableAttributeType>
static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value);

Expand Down Expand Up @@ -332,7 +326,7 @@ CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode)
}

ChipLogError(AppServer, "Setting system mode: %u (%s)", systemModeValue, SystemModeString(systemMode));
return ChipErrorFromStatusCode(SystemMode::Set(kThermostatEndpoint, systemMode));
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(SystemMode::Set(kThermostatEndpoint, systemMode));
}

CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMode)
Expand All @@ -345,22 +339,22 @@ CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMo
}

ChipLogError(AppServer, "Setting running mode: %u (%s)", runningModeValue, RunningModeString(runningMode));
return ChipErrorFromStatusCode(ThermostatRunningMode::Set(kThermostatEndpoint, runningMode));
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(ThermostatRunningMode::Set(kThermostatEndpoint, runningMode));
}

CHIP_ERROR ThermostatManager::SetCurrentTemperature(int16_t temperature)
{
return ChipErrorFromStatusCode(LocalTemperature::Set(kThermostatEndpoint, temperature));
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(LocalTemperature::Set(kThermostatEndpoint, temperature));
}

CHIP_ERROR ThermostatManager::SetCurrentHeatingSetPoint(int16_t heatingSetpoint)
{
return ChipErrorFromStatusCode(OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint));
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint));
}

CHIP_ERROR ThermostatManager::SetCurrentCoolingSetPoint(int16_t coolingSetpoint)
{
return ChipErrorFromStatusCode(OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint));
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint));
}

void ThermostatManager::EvalThermostatState()
Expand Down

0 comments on commit e2ce403

Please sign in to comment.