Update src/app/util/ emberafstatus (#32054)
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 613c3ae..6b99456 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -137,7 +137,6 @@
--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 \
diff --git a/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp b/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp
index 7ce8ac5..3b3065e 100644
--- a/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp
+++ b/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp
@@ -17,7 +17,6 @@
*/
#include <air-purifier-manager.h>
-#include <app/util/error-mapping.h>
using namespace chip;
using namespace chip::app;
@@ -147,7 +146,7 @@
}
}
- 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)
diff --git a/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp
index 5535326..9a9fccc 100644
--- a/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp
@@ -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>
@@ -147,7 +146,7 @@
}
}
- return ToInteractionModelStatus(SpeedSetting::Set(mEndpoint, newSpeedSetting));
+ return SpeedSetting::Set(mEndpoint, newSpeedSetting);
}
CHIP_ERROR FanControlManager::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
diff --git a/examples/chef/common/chef-fan-control-manager.cpp b/examples/chef/common/chef-fan-control-manager.cpp
index 56576fe..35d3579 100644
--- a/examples/chef/common/chef-fan-control-manager.cpp
+++ b/examples/chef/common/chef-fan-control-manager.cpp
@@ -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>
@@ -115,7 +114,7 @@
});
}
- return ToInteractionModelStatus(SpeedSetting::Set(mEndpoint, newSpeedSetting));
+ return SpeedSetting::Set(mEndpoint, newSpeedSetting);
}
CHIP_ERROR ChefFanControlManager::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
diff --git a/examples/darwin-framework-tool/commands/common/MTRError.mm b/examples/darwin-framework-tool/commands/common/MTRError.mm
index 770c947..d385983 100644
--- a/examples/darwin-framework-tool/commands/common/MTRError.mm
+++ b/examples/darwin-framework-tool/commands/common/MTRError.mm
@@ -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>
diff --git a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp
index aaed13b..73a626e 100644
--- a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp
+++ b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp
@@ -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;
@@ -355,7 +354,7 @@
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
diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp
index fe7bfa7..8f1037a 100644
--- a/src/app/clusters/door-lock-server/door-lock-server.cpp
+++ b/src/app/clusters/door-lock-server/door-lock-server.cpp
@@ -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>
@@ -3418,7 +3417,7 @@
}
else
{
- commandObj->AddStatus(commandPath, ToInteractionModelStatus(status));
+ commandObj->AddStatus(commandPath, status);
}
}
diff --git a/src/app/clusters/fan-control-server/fan-control-server.cpp b/src/app/clusters/fan-control-server/fan-control-server.cpp
index 4ed216b..8bca0d1 100644
--- a/src/app/clusters/fan-control-server/fan-control-server.cpp
+++ b/src/app/clusters/fan-control-server/fan-control-server.cpp
@@ -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>
diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp
index 55a0e15..c93d96d 100644
--- a/src/app/clusters/identify-server/identify-server.cpp
+++ b/src/app/clusters/identify-server/identify-server.cpp
@@ -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>
@@ -201,8 +200,7 @@
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;
}
diff --git a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp
index b672f95..c310701 100644
--- a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp
+++ b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.cpp
@@ -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;
diff --git a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp
index 7800f07..cc8d710 100644
--- a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp
+++ b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.cpp
@@ -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;
diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp
index 5f08cfd..b1edc34 100644
--- a/src/app/clusters/level-control/level-control.cpp
+++ b/src/app/clusters/level-control/level-control.cpp
@@ -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>
@@ -808,7 +807,7 @@
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogProgress(Zcl, "ERR: reading current level %x", status);
- return app::ToInteractionModelStatus(status);
+ return status;
}
if (currentLevel.IsNull())
@@ -873,7 +872,7 @@
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
@@ -963,7 +962,7 @@
// 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));
@@ -1022,7 +1021,7 @@
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));
@@ -1093,7 +1092,7 @@
// 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));
diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp
index f6c6304..ddaed23 100644
--- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp
+++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp
@@ -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;
diff --git a/src/app/clusters/mode-select-server/mode-select-server.cpp b/src/app/clusters/mode-select-server/mode-select-server.cpp
index 57cd6d7..e2a2590 100644
--- a/src/app/clusters/mode-select-server/mode-select-server.cpp
+++ b/src/app/clusters/mode-select-server/mode-select-server.cpp
@@ -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>
diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp
index 8d0f849..e5c7ae4 100644
--- a/src/app/clusters/on-off-server/on-off-server.cpp
+++ b/src/app/clusters/on-off-server/on-off-server.cpp
@@ -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>
@@ -573,7 +572,7 @@
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;
}
@@ -582,7 +581,7 @@
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;
}
@@ -591,7 +590,7 @@
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;
}
@@ -643,7 +642,7 @@
}
}
- status = app::ToInteractionModelStatus(setOnOffValue(endpoint, Commands::Off::Id, false));
+ status = setOnOffValue(endpoint, Commands::Off::Id, false);
}
else
{
diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp
index 46f5590..3da02b6 100644
--- a/src/app/clusters/ota-provider/ota-provider.cpp
+++ b/src/app/clusters/ota-provider/ota-provider.cpp
@@ -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>
diff --git a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp
index aefc65e..a7fd3ed 100644
--- a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp
+++ b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp
@@ -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;
diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp
index c595ee6..330d7eb 100644
--- a/src/app/clusters/scenes-server/scenes-server.cpp
+++ b/src/app/clusters/scenes-server/scenes-server.cpp
@@ -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>
@@ -84,7 +83,7 @@
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>
@@ -536,8 +535,7 @@
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);
@@ -567,8 +565,7 @@
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)))
{
@@ -597,8 +594,7 @@
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);
diff --git a/src/app/clusters/temperature-control-server/temperature-control-server.cpp b/src/app/clusters/temperature-control-server/temperature-control-server.cpp
index 8c72347..6217288 100644
--- a/src/app/clusters/temperature-control-server/temperature-control-server.cpp
+++ b/src/app/clusters/temperature-control-server/temperature-control-server.cpp
@@ -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;
@@ -134,14 +133,14 @@
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;
}
@@ -156,7 +155,7 @@
emberAfStatus = Step::Get(endpoint, &step);
if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS)
{
- status = app::ToInteractionModelStatus(emberAfStatus);
+ status = emberAfStatus;
goto exit;
}
diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp
index f5a5157..780d244 100644
--- a/src/app/clusters/thermostat-server/thermostat-server.cpp
+++ b/src/app/clusters/thermostat-server/thermostat-server.cpp
@@ -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;
@@ -101,7 +100,7 @@
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);
@@ -156,7 +155,7 @@
}
EmberAfStatus status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing);
- StatusIB statusIB(ToInteractionModelStatus(status));
+ StatusIB statusIB(status);
return statusIB.ToChipError();
}
break;
@@ -925,7 +924,7 @@
break;
}
- commandObj->AddStatus(commandPath, app::ToInteractionModelStatus(status));
+ commandObj->AddStatus(commandPath, status);
return true;
}
diff --git a/src/app/clusters/window-covering-server/window-covering-server.cpp b/src/app/clusters/window-covering-server/window-covering-server.cpp
index 79956d0..1b47b9c 100644
--- a/src/app/clusters/window-covering-server/window-covering-server.cpp
+++ b/src/app/clusters/window-covering-server/window-covering-server.cpp
@@ -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>
diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h
index e394a20..66738e1 100644
--- a/src/app/util/af-types.h
+++ b/src/app/util/af-types.h
@@ -41,6 +41,9 @@
#include <app-common/zap-generated/cluster-enums.h>
#include <app-common/zap-generated/cluster-objects.h>
+#include <protocols/interaction_model/StatusCode.h>
+
+using chip::Protocols::InteractionModel::Status;
/**
* @brief Type for the cluster mask
@@ -290,9 +293,8 @@
*
* This function is called before an attribute changes.
*/
-typedef EmberAfStatus (*EmberAfClusterPreAttributeChangedCallback)(const chip::app::ConcreteAttributePath & attributePath,
- EmberAfAttributeType attributeType, uint16_t size,
- uint8_t * value);
+typedef Status (*EmberAfClusterPreAttributeChangedCallback)(const chip::app::ConcreteAttributePath & attributePath,
+ EmberAfAttributeType attributeType, uint16_t size, uint8_t * value);
#define MAX_INT32U_VALUE (0xFFFFFFFFUL)
#define MAX_INT16U_VALUE (0xFFFF)
diff --git a/src/app/util/af.h b/src/app/util/af.h
index d18d699..e53b613 100644
--- a/src/app/util/af.h
+++ b/src/app/util/af.h
@@ -29,6 +29,9 @@
#include <lib/core/DataModelTypes.h>
#include <lib/support/Iterators.h>
#include <lib/support/SafeInt.h>
+#include <protocols/interaction_model/StatusCode.h>
+
+using chip::Protocols::InteractionModel::Status;
/** @name Attribute Storage */
// @{
@@ -95,8 +98,8 @@
* data type (as Accessors.h/cpp have this correct by default).
* TODO: this not checking seems off - what if this is run without Accessors.h ?
*/
-EmberAfStatus emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
- uint8_t * dataPtr, EmberAfAttributeType dataType);
+Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr,
+ EmberAfAttributeType dataType);
/**
* @brief Read the attribute value, performing all the checks.
@@ -107,8 +110,8 @@
* dataPtr may be NULL, signifying that we don't need the value, just the status
* (i.e. whether the attribute can be read).
*/
-EmberAfStatus emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
- uint8_t * dataPtr, uint16_t readLength);
+Status emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr,
+ uint16_t readLength);
/**
* @brief macro that returns size of attribute in bytes.
diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp
index 43f8684..d44c598 100644
--- a/src/app/util/attribute-storage.cpp
+++ b/src/app/util/attribute-storage.cpp
@@ -27,6 +27,9 @@
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/LockTracker.h>
+#include <protocols/interaction_model/StatusCode.h>
+
+using chip::Protocols::InteractionModel::Status;
// Attribute storage depends on knowing the current layout/setup of attributes
// and corresponding callbacks. Specifically:
@@ -372,20 +375,20 @@
}
// This function is used to call the per-cluster pre-attribute changed callback
-EmberAfStatus emAfClusterPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath,
- EmberAfAttributeType attributeType, uint16_t size, uint8_t * value)
+Status emAfClusterPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType,
+ uint16_t size, uint8_t * value)
{
const EmberAfCluster * cluster = emberAfFindServerCluster(attributePath.mEndpointId, attributePath.mClusterId);
if (cluster == nullptr)
{
if (!emberAfEndpointIsEnabled(attributePath.mEndpointId))
{
- return EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT;
+ return Status::UnsupportedEndpoint;
}
- return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER;
+ return Status::UnsupportedCluster;
}
- EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
+ Status status = Status::Success;
// Casting and calling a function pointer on the same line results in ignoring the return
// of the call on gcc-arm-none-eabi-9-2019-q4-major
EmberAfClusterPreAttributeChangedCallback f = (EmberAfClusterPreAttributeChangedCallback) (emberAfFindClusterFunction(
@@ -487,8 +490,8 @@
// If src == NULL, then this method will set memory to zeroes
// See documentation for emAfReadOrWriteAttribute for the semantics of
// readLength when reading and writing.
-static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, uint8_t * src, const EmberAfAttributeMetadata * am,
- bool write, uint16_t readLength)
+static Status typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, uint8_t * src, const EmberAfAttributeMetadata * am,
+ bool write, uint16_t readLength)
{
EmberAfAttributeType attributeType = am->attributeType;
// readLength == 0 for a read indicates that we should just trust that the
@@ -500,7 +503,7 @@
{
if (bufferSize < 1)
{
- return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED;
+ return Status::ResourceExhausted;
}
emberAfCopyString(dest, src, bufferSize - 1);
}
@@ -508,7 +511,7 @@
{
if (bufferSize < 2)
{
- return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED;
+ return Status::ResourceExhausted;
}
emberAfCopyLongString(dest, src, bufferSize - 2);
}
@@ -516,7 +519,7 @@
{
if (bufferSize < 2)
{
- return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED;
+ return Status::ResourceExhausted;
}
// Just copy the length.
@@ -526,7 +529,7 @@
{
if (!ignoreReadLength && readLength < am->size)
{
- return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED;
+ return Status::ResourceExhausted;
}
if (src == nullptr)
{
@@ -537,7 +540,7 @@
memmove(dest, src, am->size);
}
}
- return EMBER_ZCL_STATUS_SUCCESS;
+ return Status::Success;
}
/**
@@ -581,8 +584,8 @@
// type. For strings, the function will copy as many bytes as will fit in the
// attribute. This means the resulting string may be truncated. The length
// byte(s) in the resulting string will reflect any truncated.
-EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata,
- uint8_t * buffer, uint16_t readLength, bool write)
+Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata,
+ uint8_t * buffer, uint16_t readLength, bool write)
{
assertChipStackLockedByCurrentThread();
@@ -630,14 +633,14 @@
if (!emberAfAttributeWriteAccessCallback(attRecord->endpoint, attRecord->clusterId,
am->attributeId))
{
- return EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS;
+ return Status::UnsupportedAccess;
}
}
else
{
if (buffer == nullptr)
{
- return EMBER_ZCL_STATUS_SUCCESS;
+ return Status::Success;
}
src = attributeLocation;
@@ -645,7 +648,7 @@
if (!emberAfAttributeReadAccessCallback(attRecord->endpoint, attRecord->clusterId,
am->attributeId))
{
- return EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS;
+ return Status::UnsupportedAccess;
}
}
@@ -664,7 +667,7 @@
return typeSensitiveMemCopy(attRecord->clusterId, dst, src, am, write, readLength);
}
- return EMBER_ZCL_STATUS_FAILURE;
+ return Status::Failure;
}
}
else
@@ -678,7 +681,7 @@
}
// Attribute is not in the cluster.
- return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE;
+ return Status::UnsupportedAttribute;
}
// Not the cluster we are looking for
@@ -686,7 +689,7 @@
}
// Cluster is not in the endpoint.
- return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER;
+ return Status::UnsupportedCluster;
}
// Not the endpoint we are looking for
@@ -696,7 +699,7 @@
attributeOffsetIndex = static_cast<uint16_t>(attributeOffsetIndex + emAfEndpoints[ep].endpointType->endpointSize);
}
}
- return EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT; // Sorry, endpoint was not found.
+ return Status::UnsupportedEndpoint; // Sorry, endpoint was not found.
}
const EmberAfEndpointType * emberAfFindEndpointType(chip::EndpointId endpointId)
diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h
index abc0402..e68735c 100644
--- a/src/app/util/attribute-storage.h
+++ b/src/app/util/attribute-storage.h
@@ -28,6 +28,10 @@
#include <app/att-storage.h>
#include <zap-generated/endpoint_config.h>
+#include <protocols/interaction_model/StatusCode.h>
+
+using chip::Protocols::InteractionModel::Status;
+
// If we have fixed number of endpoints, then max is the same.
#ifdef FIXED_ENDPOINT_COUNT
#define MAX_ENDPOINT_COUNT (FIXED_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
@@ -69,8 +73,8 @@
// Initial configuration
void emberAfEndpointConfigure(void);
-EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata,
- uint8_t * buffer, uint16_t readLength, bool write);
+Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata,
+ uint8_t * buffer, uint16_t readLength, bool write);
// Check if a cluster is implemented or not. If yes, the cluster is returned.
//
@@ -130,8 +134,8 @@
void emAfClusterAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath);
// Calls the attribute changed callback for a specific cluster.
-EmberAfStatus emAfClusterPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath,
- EmberAfAttributeType attributeType, uint16_t size, uint8_t * value);
+Status emAfClusterPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath,
+ EmberAfAttributeType attributeType, uint16_t size, uint8_t * value);
// Note the difference in for server filtering.
// This method will return the cluster count for BOTH client and server
diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp
index 4c36d75..d169426 100644
--- a/src/app/util/attribute-table.cpp
+++ b/src/app/util/attribute-table.cpp
@@ -22,7 +22,6 @@
// for pulling in defines dealing with EITHER server or client
#include "app/util/common.h"
#include <app/util/config.h>
-#include <app/util/error-mapping.h>
#include <app/util/generic-callbacks.h>
#include <app/util/odd-sized-integers.h>
#include <lib/core/CHIPConfig.h>
@@ -30,16 +29,18 @@
#include <app/reporting/reporting.h>
#include <protocols/interaction_model/Constants.h>
+using chip::Protocols::InteractionModel::Status;
+
using namespace chip;
-EmberAfStatus emAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr,
- EmberAfAttributeType dataType)
+Status emAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr,
+ EmberAfAttributeType dataType)
{
return emAfWriteAttribute(endpoint, cluster, attributeID, dataPtr, dataType, false /* override read-only */);
}
-EmberAfStatus emberAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr,
- EmberAfAttributeType dataType)
+Status emberAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr,
+ EmberAfAttributeType dataType)
{
return emAfWriteAttribute(endpoint, cluster, attributeID, dataPtr, dataType, true /* override read-only */);
}
@@ -103,18 +104,18 @@
return false;
}
-EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * data,
- EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType)
+Status emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * data,
+ EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType)
{
const EmberAfAttributeMetadata * metadata = nullptr;
EmberAfAttributeSearchRecord record;
- record.endpoint = endpoint;
- record.clusterId = cluster;
- record.attributeId = attributeID;
- EmberAfStatus status = emAfReadOrWriteAttribute(&record, &metadata,
- nullptr, // buffer
- 0, // buffer size
- false); // write?
+ record.endpoint = endpoint;
+ record.clusterId = cluster;
+ record.attributeId = attributeID;
+ Status status = emAfReadOrWriteAttribute(&record, &metadata,
+ nullptr, // buffer
+ 0, // buffer size
+ false); // write?
// if we dont support that attribute
if (metadata == nullptr)
@@ -130,18 +131,18 @@
if (dataType != metadata->attributeType)
{
ChipLogProgress(Zcl, "%p invalid data type", "WRITE ERR: ");
- return EMBER_ZCL_STATUS_INVALID_DATA_TYPE;
+ return Status::InvalidDataType;
}
if (metadata->IsReadOnly())
{
ChipLogProgress(Zcl, "%p attr not writable", "WRITE ERR: ");
- return EMBER_ZCL_STATUS_UNSUPPORTED_WRITE;
+ return Status::UnsupportedWrite;
}
}
// if the value the attribute is being set to is out of range
- // return EMBER_ZCL_STATUS_CONSTRAINT_ERROR
+ // return Status::ConstraintError
if ((metadata->mask & ATTRIBUTE_MASK_MIN_MAX) != 0U)
{
EmberAfDefaultAttributeValue minv = metadata->defaultValue.ptrToMinMaxValue->minValue;
@@ -178,7 +179,7 @@
// null value is always in-range for a nullable attribute.
(!metadata->IsNullable() || !IsNullValue(data, dataLen, isAttributeSigned)))
{
- return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+ return Status::ConstraintError;
}
}
@@ -190,7 +191,7 @@
MatterPreAttributeChangeCallback(attributePath, dataType, emberAfAttributeSize(metadata), data);
if (imStatus != Protocols::InteractionModel::Status::Success)
{
- return app::ToEmberAfStatus(imStatus);
+ return imStatus;
}
// Pre-write attribute callback specific
@@ -198,12 +199,12 @@
status = emAfClusterPreAttributeChangedCallback(attributePath, dataType, emberAfAttributeSize(metadata), data);
// Ignore the following write operation and return success
- if (status == EMBER_ZCL_STATUS_WRITE_IGNORED)
+ if (status == Status::WriteIgnored)
{
- return EMBER_ZCL_STATUS_SUCCESS;
+ return Status::Success;
}
- if (status != EMBER_ZCL_STATUS_SUCCESS)
+ if (status != Status::Success)
{
return status;
}
@@ -215,7 +216,7 @@
0, // buffer size - unused
true); // write?
- if (status != EMBER_ZCL_STATUS_SUCCESS)
+ if (status != Status::Success)
{
return status;
}
@@ -234,15 +235,14 @@
// to the cluster that the attribute lives in.
emAfClusterAttributeChangedCallback(attributePath);
- return EMBER_ZCL_STATUS_SUCCESS;
+ return Status::Success;
}
-EmberAfStatus emberAfReadAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr,
- uint16_t readLength)
+Status emberAfReadAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, uint16_t readLength)
{
const EmberAfAttributeMetadata * metadata = nullptr;
EmberAfAttributeSearchRecord record;
- EmberAfStatus status;
+ Status status;
record.endpoint = endpoint;
record.clusterId = cluster;
record.attributeId = attributeID;
@@ -250,7 +250,7 @@
false); // write?
// failed, print debug info
- if (status == EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)
+ if (status == Status::ResourceExhausted)
{
ChipLogProgress(Zcl, "READ: attribute size too large for caller");
}
diff --git a/src/app/util/attribute-table.h b/src/app/util/attribute-table.h
index 1f08d80..0969e8c 100644
--- a/src/app/util/attribute-table.h
+++ b/src/app/util/attribute-table.h
@@ -19,14 +19,18 @@
#include <app/util/af.h>
+#include <protocols/interaction_model/StatusCode.h>
+
+using chip::Protocols::InteractionModel::Status;
+
/**
* Write an attribute for a request arriving from external sources.
*
* This will check attribute writeability and that
* the provided data type matches the expected data type.
*/
-EmberAfStatus emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
- uint8_t * dataPtr, EmberAfAttributeType dataType);
+Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID,
+ uint8_t * dataPtr, EmberAfAttributeType dataType);
/**
* @brief write an attribute, performing all the checks.
@@ -48,15 +52,15 @@
* testing or setting the initial value of the attribute on the device.
*
* this returns:
- * - EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT: if endpoint isn't supported by the device.
- * - EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER: if cluster isn't supported on the endpoint.
- * - EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE: if attribute isn't supported in the cluster.
- * - EMBER_ZCL_STATUS_INVALID_DATA_TYPE: if the data type passed in doesnt match the type
+ * - Status::UnsupportedEndpoint: if endpoint isn't supported by the device.
+ * - Status::UnsupportedCluster: if cluster isn't supported on the endpoint.
+ * - Status::UnsupportedAttribute: if attribute isn't supported in the cluster.
+ * - Status::InvalidDataType: if the data type passed in doesnt match the type
* stored in the attribute table
- * - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE: if the attribute isnt writable
- * - EMBER_ZCL_STATUS_CONSTRAINT_ERROR: if the value is set out of the allowable range for
+ * - Status::UnsupportedWrite: if the attribute isnt writable
+ * - Status::ConstraintError: if the value is set out of the allowable range for
* the attribute
- * - EMBER_ZCL_STATUS_SUCCESS: if the attribute was found and successfully written
+ * - Status::Success: if the attribute was found and successfully written
*/
-EmberAfStatus emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * data,
- EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType);
+Status emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * data,
+ EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType);
diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp
index 76daa77..d35be58 100644
--- a/src/app/util/ember-compatibility-functions.cpp
+++ b/src/app/util/ember-compatibility-functions.cpp
@@ -36,7 +36,6 @@
#include <app/util/attribute-storage.h>
#include <app/util/attribute-table.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/core/CHIPCore.h>
@@ -53,6 +52,8 @@
#include <limits>
+using chip::Protocols::InteractionModel::Status;
+
using namespace chip;
using namespace chip::app;
using namespace chip::Access;
@@ -619,13 +620,13 @@
ReturnErrorOnFailure(err);
EmberAfAttributeSearchRecord record;
- record.endpoint = aPath.mEndpointId;
- record.clusterId = aPath.mClusterId;
- record.attributeId = aPath.mAttributeId;
- EmberAfStatus emberStatus = emAfReadOrWriteAttribute(&record, &attributeMetadata, attributeData, sizeof(attributeData),
- /* write = */ false);
+ record.endpoint = aPath.mEndpointId;
+ record.clusterId = aPath.mClusterId;
+ record.attributeId = aPath.mAttributeId;
+ Status status = emAfReadOrWriteAttribute(&record, &attributeMetadata, attributeData, sizeof(attributeData),
+ /* write = */ false);
- if (emberStatus == EMBER_ZCL_STATUS_SUCCESS)
+ if (status == Status::Success)
{
EmberAfAttributeType attributeType = attributeMetadata->attributeType;
bool isNullable = attributeMetadata->IsNullable();
@@ -822,17 +823,16 @@
}
default:
ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast<int>(attributeType));
- emberStatus = EMBER_ZCL_STATUS_UNSUPPORTED_READ;
+ status = Status::UnsupportedRead;
}
}
- Protocols::InteractionModel::Status imStatus = ToInteractionModelStatus(emberStatus);
- if (imStatus == Protocols::InteractionModel::Status::Success)
+ if (status == Protocols::InteractionModel::Status::Success)
{
return SendSuccessStatus(attributeReport, attributeDataIBBuilder);
}
- return SendFailureStatus(aPath, aAttributeReports, imStatus, &backup);
+ return SendFailureStatus(aPath, aAttributeReports, status, &backup);
}
namespace {
@@ -1051,8 +1051,8 @@
return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::InvalidValue);
}
- auto status = ToInteractionModelStatus(emAfWriteAttributeExternal(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId,
- attributeData, attributeMetadata->attributeType));
+ auto status = emAfWriteAttributeExternal(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId, attributeData,
+ attributeMetadata->attributeType);
return apWriteHandler->AddStatus(aPath, status);
}
diff --git a/src/app/util/error-mapping.h b/src/app/util/error-mapping.h
deleted file mode 100644
index de47b27..0000000
--- a/src/app/util/error-mapping.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright (c) 2020 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <app/util/af-enums.h>
-#include <protocols/interaction_model/Constants.h>
-
-namespace chip {
-namespace app {
-
-inline EmberAfStatus ToEmberAfStatus(Protocols::InteractionModel::Status code)
-{
- return static_cast<EmberAfStatus>(code);
-}
-
-inline Protocols::InteractionModel::Status ToInteractionModelStatus(EmberAfStatus code)
-{
- return static_cast<Protocols::InteractionModel::Status>(code);
-}
-
-} // namespace app
-} // namespace chip
diff --git a/src/app/util/generic-callback-stubs.cpp b/src/app/util/generic-callback-stubs.cpp
index 11e705c..21d4085 100644
--- a/src/app/util/generic-callback-stubs.cpp
+++ b/src/app/util/generic-callback-stubs.cpp
@@ -34,18 +34,18 @@
return true;
}
-EmberAfStatus __attribute__((weak))
+Status __attribute__((weak))
emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer, uint16_t maxReadLength)
{
- return EMBER_ZCL_STATUS_FAILURE;
+ return Status::Failure;
}
-EmberAfStatus __attribute__((weak))
+Status __attribute__((weak))
emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata,
uint8_t * buffer)
{
- return EMBER_ZCL_STATUS_FAILURE;
+ return Status::Failure;
}
chip::Protocols::InteractionModel::Status __attribute__((weak))
diff --git a/src/app/util/generic-callbacks.h b/src/app/util/generic-callbacks.h
index 4f0fc66..51917e6 100644
--- a/src/app/util/generic-callbacks.h
+++ b/src/app/util/generic-callbacks.h
@@ -28,6 +28,8 @@
#include <lib/support/Span.h>
#include <protocols/interaction_model/Constants.h>
+using chip::Protocols::InteractionModel::Status;
+
/** @brief Cluster Init
*
* This function is called when a specific cluster is initialized. It gives the
@@ -82,9 +84,9 @@
* EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED. Any other return value indicates the
* application was not able to read the attribute.
*/
-EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
- const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
- uint16_t maxReadLength);
+Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
+ const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer,
+ uint16_t maxReadLength);
/** @brief External Attribute Write
*
@@ -126,8 +128,8 @@
* other return value indicates the application was not able to write the
* attribute.
*/
-EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
- const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer);
+Status emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
+ const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer);
/** @brief Pre Attribute Change
*
diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp
index 2593609..cdaac8f 100644
--- a/src/app/util/util.cpp
+++ b/src/app/util/util.cpp
@@ -24,6 +24,7 @@
#include <app/util/config.h>
#include <app/util/generic-callbacks.h>
#include <lib/core/CHIPConfig.h>
+#include <protocols/interaction_model/StatusCode.h>
// TODO: figure out a clear path for compile-time codegen
#include <app/PluginApplicationCallbacks.h>
@@ -34,6 +35,8 @@
using namespace chip;
+using chip::Protocols::InteractionModel::Status;
+
//------------------------------------------------------------------------------
// Forward Declarations
@@ -56,8 +59,8 @@
{
#ifdef ZCL_USING_IDENTIFY_CLUSTER_SERVER
uint16_t identifyTime;
- EmberAfStatus status = app::Clusters::Identify::Attributes::IdentifyTime::Get(endpoint, &identifyTime);
- return (status == EMBER_ZCL_STATUS_SUCCESS && 0 < identifyTime);
+ Status status = app::Clusters::Identify::Attributes::IdentifyTime::Get(endpoint, &identifyTime);
+ return (status == Status::Success && 0 < identifyTime);
#else
return false;
#endif
diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h
index f442190..c425b34 100644
--- a/src/controller/CHIPCluster.h
+++ b/src/controller/CHIPCluster.h
@@ -29,7 +29,6 @@
#include "app/ConcreteCommandPath.h"
#include <app/AppConfig.h>
#include <app/DeviceProxy.h>
-#include <app/util/error-mapping.h>
#include <controller/InvokeInteraction.h>
#include <controller/ReadInteraction.h>
#include <controller/WriteInteraction.h>
diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp
index 99cd69a..7cc2c86 100644
--- a/src/controller/CHIPDeviceController.cpp
+++ b/src/controller/CHIPDeviceController.cpp
@@ -42,7 +42,6 @@
#include <app/InteractionModelEngine.h>
#include <app/OperationalSessionSetup.h>
-#include <app/util/error-mapping.h>
#include <controller/CurrentFabricRemover.h>
#include <credentials/CHIPCert.h>
#include <credentials/DeviceAttestationCredsProvider.h>
diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp
index 26870b5..85c37b8 100644
--- a/src/controller/java/CHIPDeviceController-JNI.cpp
+++ b/src/controller/java/CHIPDeviceController-JNI.cpp
@@ -34,7 +34,6 @@
#include <app/InteractionModelEngine.h>
#include <app/ReadClient.h>
#include <app/WriteClient.h>
-#include <app/util/error-mapping.h>
#include <atomic>
#include <ble/BleUUID.h>
#include <controller/CHIPDeviceController.h>
diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm
index 41de3b4..0d41d92 100644
--- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm
+++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm
@@ -46,7 +46,6 @@
#include <app/ClusterStateCache.h>
#include <app/InteractionModelEngine.h>
#include <app/ReadClient.h>
-#include <app/util/error-mapping.h>
#include <controller/CommissioningWindowOpener.h>
#include <controller/ReadInteraction.h>
#include <controller/WriteInteraction.h>
diff --git a/src/darwin/Framework/CHIP/MTRError.mm b/src/darwin/Framework/CHIP/MTRError.mm
index 9f7c093..4050615 100644
--- a/src/darwin/Framework/CHIP/MTRError.mm
+++ b/src/darwin/Framework/CHIP/MTRError.mm
@@ -22,7 +22,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>