Skip to content

Commit

Permalink
Update src/app/util/ emberafstatus (#32054)
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs authored Feb 12, 2024
1 parent 7cc357e commit 3b3d37b
Show file tree
Hide file tree
Showing 37 changed files with 141 additions and 187 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ jobs:
--known-failure app/util/ember-compatibility-functions.cpp \
--known-failure app/util/endpoint-config-api.h \
--known-failure app/util/endpoint-config-defines.h \
--known-failure app/util/error-mapping.h \
--known-failure app/util/generic-callbacks.h \
--known-failure app/util/generic-callback-stubs.cpp \
--known-failure app/util/im-client-callbacks.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

#include <air-purifier-manager.h>
#include <app/util/error-mapping.h>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -147,7 +146,7 @@ Status AirPurifierManager::HandleStep(FanControl::StepDirectionEnum aDirection,
}
}

return ToInteractionModelStatus(FanControl::Attributes::SpeedSetting::Set(mEndpointId, newSpeedSetting));
return FanControl::Attributes::SpeedSetting::Set(mEndpointId, newSpeedSetting);
}

void AirPurifierManager::HandleFanControlAttributeChange(AttributeId attributeId, uint8_t type, uint16_t size, uint8_t * value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/AttributeAccessInterface.h>
#include <app/clusters/fan-control-server/fan-control-server.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

Expand Down Expand Up @@ -147,7 +146,7 @@ Status FanControlManager::HandleStep(StepDirectionEnum aDirection, bool aWrap, b
}
}

return ToInteractionModelStatus(SpeedSetting::Set(mEndpoint, newSpeedSetting));
return SpeedSetting::Set(mEndpoint, newSpeedSetting);
}

CHIP_ERROR FanControlManager::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
Expand Down
3 changes: 1 addition & 2 deletions examples/chef/common/chef-fan-control-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/AttributeAccessInterface.h>
#include <app/clusters/fan-control-server/fan-control-server.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

Expand Down Expand Up @@ -115,7 +114,7 @@ Status ChefFanControlManager::HandleStep(StepDirectionEnum aDirection, bool aWra
});
}

return ToInteractionModelStatus(SpeedSetting::Set(mEndpoint, newSpeedSetting));
return SpeedSetting::Set(mEndpoint, newSpeedSetting);
}

CHIP_ERROR ChefFanControlManager::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
Expand Down
1 change: 0 additions & 1 deletion examples/darwin-framework-tool/commands/common/MTRError.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#import <app/MessageDef/StatusIB.h>
#import <app/util/af-enums.h>
#import <app/util/error-mapping.h>
#import <inet/InetError.h>
#import <lib/support/TypeTraits.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <app/EventLogging.h>
#include <app/InteractionModelEngine.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>
#include <lib/support/BitFlags.h>

using namespace chip;
Expand Down Expand Up @@ -355,7 +354,7 @@ static Status ResetHandler(const app::ConcreteCommandPath & commandPath, const B
if (!DishwasherAlarmServer::Instance().HasResetFeature(endpoint))
{
ChipLogProgress(Zcl, "Dishwasher Alarm feature: Unsupport Reset Command");
return app::ToInteractionModelStatus(EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND);
return EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND;
}

// A server that is unable to reset alarms SHALL respond with a status code of FAILURE
Expand Down
3 changes: 1 addition & 2 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <app/server/Server.h>
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>
#include <cinttypes>

#include <app/CommandHandler.h>
Expand Down Expand Up @@ -3418,7 +3417,7 @@ void DoorLockServer::sendClusterResponse(chip::app::CommandHandler * commandObj,
}
else
{
commandObj->AddStatus(commandPath, ToInteractionModelStatus(status));
commandObj->AddStatus(commandPath, status);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/fan-control-server/fan-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <app/ConcreteCommandPath.h>
#include <app/clusters/fan-control-server/fan-control-server.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

Expand Down
4 changes: 1 addition & 3 deletions src/app/clusters/identify-server/identify-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <app/util/af.h>
#include <app/util/common.h>
#include <app/util/error-mapping.h>
#include <array>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down Expand Up @@ -201,8 +200,7 @@ bool emberAfIdentifyClusterIdentifyCallback(CommandHandler * commandObj, const C
auto & identifyTime = commandData.identifyTime;

// cmd Identify
commandObj->AddStatus(commandPath,
ToInteractionModelStatus(Attributes::IdentifyTime::Set(commandPath.mEndpointId, identifyTime)));
commandObj->AddStatus(commandPath, Attributes::IdentifyTime::Set(commandPath.mEndpointId, identifyTime));
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <app/ConcreteAttributePath.h>
#include <app/ConcreteCommandPath.h>
#include <app/server/Server.h>
#include <app/util/error-mapping.h>
#include <lib/core/CHIPEncoding.h>

using namespace chip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <app/ConcreteAttributePath.h>
#include <app/ConcreteCommandPath.h>
#include <app/server/Server.h>
#include <app/util/error-mapping.h>
#include <lib/core/CHIPEncoding.h>

using namespace chip;
Expand Down
11 changes: 5 additions & 6 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <app/ConcreteCommandPath.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <app/util/error-mapping.h>
#include <app/util/util.h>

#include <app/reporting/reporting.h>
Expand Down Expand Up @@ -808,7 +807,7 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogProgress(Zcl, "ERR: reading current level %x", status);
return app::ToInteractionModelStatus(status);
return status;
}

if (currentLevel.IsNull())
Expand Down Expand Up @@ -873,7 +872,7 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogProgress(Zcl, "ERR: reading on/off transition time %x", status);
return app::ToInteractionModelStatus(status);
return status;
}

// Transition time comes in (or is stored, in the case of On/Off Transition
Expand Down Expand Up @@ -963,7 +962,7 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom
// Cancel any currently active command before fiddling with the state.
cancelEndpointTimerCallback(endpoint);

status = app::ToInteractionModelStatus(Attributes::CurrentLevel::Get(endpoint, currentLevel));
status = Attributes::CurrentLevel::Get(endpoint, currentLevel);
if (status != Status::Success)
{
ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status));
Expand Down Expand Up @@ -1022,7 +1021,7 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom
if (rate.IsNull())
{
app::DataModel::Nullable<uint8_t> defaultMoveRate;
status = app::ToInteractionModelStatus(Attributes::DefaultMoveRate::Get(endpoint, defaultMoveRate));
status = Attributes::DefaultMoveRate::Get(endpoint, defaultMoveRate);
if (status != Status::Success || defaultMoveRate.IsNull())
{
ChipLogProgress(Zcl, "ERR: reading default move rate %x", to_underlying(status));
Expand Down Expand Up @@ -1093,7 +1092,7 @@ static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCom
// Cancel any currently active command before fiddling with the state.
cancelEndpointTimerCallback(endpoint);

status = app::ToInteractionModelStatus(Attributes::CurrentLevel::Get(endpoint, currentLevel));
status = Attributes::CurrentLevel::Get(endpoint, currentLevel);
if (status != Status::Success)
{
ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/reporting/reporting.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>

using namespace chip;
using namespace chip::app;
Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/mode-select-server/mode-select-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
#include <app/util/config.h>
#include <app/util/error-mapping.h>
#include <app/util/odd-sized-integers.h>
#include <app/util/util.h>
#include <lib/support/CodeUtils.h>
Expand Down
9 changes: 4 additions & 5 deletions src/app/clusters/on-off-server/on-off-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/reporting/reporting.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <app/util/error-mapping.h>
#include <app/util/util.h>
#include <tracing/macros.h>

Expand Down Expand Up @@ -573,7 +572,7 @@ bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::Concre
MATTER_TRACE_SCOPE("OffCommand", "OnOff");
EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Off::Id, false);

commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status));
commandObj->AddStatus(commandPath, status);
return true;
}

Expand All @@ -582,7 +581,7 @@ bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::Concret
MATTER_TRACE_SCOPE("OnCommand", "OnOff");
EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::On::Id, false);

commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status));
commandObj->AddStatus(commandPath, status);
return true;
}

Expand All @@ -591,7 +590,7 @@ bool OnOffServer::toggleCommand(app::CommandHandler * commandObj, const app::Con
MATTER_TRACE_SCOPE("ToggleCommand", "OnOff");
EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Toggle::Id, false);

commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status));
commandObj->AddStatus(commandPath, status);
return true;
}

Expand Down Expand Up @@ -643,7 +642,7 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a
}
}

status = app::ToInteractionModelStatus(setOnOffValue(endpoint, Commands::Off::Id, false));
status = setOnOffValue(endpoint, Commands::Off::Id, false);
}
else
{
Expand Down
1 change: 0 additions & 1 deletion src/app/clusters/ota-provider/ota-provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/ConcreteCommandPath.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <app/util/error-mapping.h>
#include <platform/CHIPDeviceConfig.h>
#include <protocols/interaction_model/Constants.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <app/EventLogging.h>
#include <app/InteractionModelEngine.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>

using namespace chip;
using namespace chip::app;
Expand Down
12 changes: 4 additions & 8 deletions src/app/clusters/scenes-server/scenes-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <app/reporting/reporting.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>
#include <credentials/GroupDataProvider.h>
#include <lib/support/CommonIterator.h>
#include <lib/support/Span.h>
Expand Down Expand Up @@ -84,7 +83,7 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res
template <typename ResponseType>
CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, ResponseType & resp, EmberAfStatus status)
{
return AddResponseOnError(ctx, resp, StatusIB(ToInteractionModelStatus(status)).ToChipError());
return AddResponseOnError(ctx, resp, StatusIB(status).ToChipError());
}

template <typename ResponseType>
Expand Down Expand Up @@ -536,8 +535,7 @@ CHIP_ERROR StoreSceneParse(const FabricIndex & fabricIdx, const EndpointId & end
ScenesServer::Instance().MakeSceneInvalid(endpointID, fabricIdx);

uint16_t endpointTableSize = 0;
ReturnErrorOnFailure(
StatusIB(ToInteractionModelStatus(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize))).ToChipError());
ReturnErrorOnFailure(StatusIB(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize)).ToChipError());

// Get Scene Table Instance
SceneTable * sceneTable = scenes::GetSceneTableImpl(endpointID, endpointTableSize);
Expand Down Expand Up @@ -567,8 +565,7 @@ CHIP_ERROR StoreSceneParse(const FabricIndex & fabricIdx, const EndpointId & end
else
{
uint32_t featureMap = 0;
ReturnErrorOnFailure(
StatusIB(ToInteractionModelStatus(Attributes::FeatureMap::Get(endpointID, &featureMap))).ToChipError());
ReturnErrorOnFailure(StatusIB(Attributes::FeatureMap::Get(endpointID, &featureMap)).ToChipError());
// Check if we still support scenes name in case an OTA changed that, if we don't, set name to empty
if (!(featureMap & to_underlying(Feature::kSceneNames)))
{
Expand Down Expand Up @@ -597,8 +594,7 @@ CHIP_ERROR RecallSceneParse(const FabricIndex & fabricIdx, const EndpointId & en
ScenesServer::Instance().MakeSceneInvalidForAllFabrics(endpointID);

uint16_t endpointTableSize = 0;
ReturnErrorOnFailure(
StatusIB(ToInteractionModelStatus(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize))).ToChipError());
ReturnErrorOnFailure(StatusIB(Attributes::SceneTableSize::Get(endpointID, &endpointTableSize)).ToChipError());

// Get Scene Table Instance
SceneTable * sceneTable = scenes::GetSceneTableImpl(endpointID, endpointTableSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <app/InteractionModelEngine.h>
#include <app/clusters/temperature-control-server/supported-temperature-levels-manager.h>
#include <app/util/attribute-storage.h>
#include <app/util/error-mapping.h>

using namespace chip;
using namespace chip::app;
Expand Down Expand Up @@ -134,14 +133,14 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler
emberAfStatus = MinTemperature::Get(endpoint, &minTemperature);
if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS)
{
status = app::ToInteractionModelStatus(emberAfStatus);
status = emberAfStatus;
goto exit;
}

emberAfStatus = MaxTemperature::Get(endpoint, &maxTemperature);
if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS)
{
status = app::ToInteractionModelStatus(emberAfStatus);
status = emberAfStatus;
goto exit;
}

Expand All @@ -156,7 +155,7 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler
emberAfStatus = Step::Get(endpoint, &step);
if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS)
{
status = app::ToInteractionModelStatus(emberAfStatus);
status = emberAfStatus;
goto exit;
}

Expand Down
7 changes: 3 additions & 4 deletions src/app/clusters/thermostat-server/thermostat-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <app/CommandHandler.h>
#include <app/ConcreteAttributePath.h>
#include <app/ConcreteCommandPath.h>
#include <app/util/error-mapping.h>
#include <lib/core/CHIPEncoding.h>

using namespace chip;
Expand Down Expand Up @@ -101,7 +100,7 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
EmberAfStatus status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
StatusIB statusIB(ToInteractionModelStatus(status));
StatusIB statusIB(status);
return statusIB.ToChipError();
}
valueRemoteSensing.Clear(RemoteSensingBitmap::kLocalTemperature);
Expand Down Expand Up @@ -156,7 +155,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath,
}

EmberAfStatus status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing);
StatusIB statusIB(ToInteractionModelStatus(status));
StatusIB statusIB(status);
return statusIB.ToChipError();
}
break;
Expand Down Expand Up @@ -925,7 +924,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co
break;
}

commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status));
commandObj->AddStatus(commandPath, status);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
#include <app/util/config.h>
#include <app/util/error-mapping.h>
#include <lib/support/TypeTraits.h>
#include <string.h>

Expand Down
Loading

0 comments on commit 3b3d37b

Please sign in to comment.