diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 613c3aeb6b4e47..6b99456496d22a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 \ 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 7ce8ac5f338fcc..3b3065e5e843de 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 -#include using namespace chip; using namespace chip::app; @@ -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) 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 553532622ddcac..9a9fcccd73f4f2 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 #include #include -#include #include #include @@ -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) diff --git a/examples/chef/common/chef-fan-control-manager.cpp b/examples/chef/common/chef-fan-control-manager.cpp index 56576febd693d4..35d3579adf3439 100644 --- a/examples/chef/common/chef-fan-control-manager.cpp +++ b/examples/chef/common/chef-fan-control-manager.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -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) diff --git a/examples/darwin-framework-tool/commands/common/MTRError.mm b/examples/darwin-framework-tool/commands/common/MTRError.mm index 770c947e05d94b..d385983ca2fc94 100644 --- a/examples/darwin-framework-tool/commands/common/MTRError.mm +++ b/examples/darwin-framework-tool/commands/common/MTRError.mm @@ -21,7 +21,6 @@ #import #import -#import #import #import 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 aaed13bbded7e4..73a626e73e4f34 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 #include #include -#include #include using namespace chip; @@ -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 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 fe7bfa76b5e8ef..8f1037ac3fba17 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 #include #include -#include #include #include @@ -3418,7 +3417,7 @@ void DoorLockServer::sendClusterResponse(chip::app::CommandHandler * commandObj, } 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 4ed216b9cad088..8bca0d1e86c129 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 #include #include -#include #include #include diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp index 55a0e15ee59c2f..c93d96d3016e7e 100644 --- a/src/app/clusters/identify-server/identify-server.cpp +++ b/src/app/clusters/identify-server/identify-server.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -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; } 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 b672f953a16d56..c3107015ca6f0c 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 #include #include -#include #include 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 7800f075d159b7..cc8d7100e07367 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 #include #include -#include #include using namespace chip; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 5f08cfd6fc1383..b1edc341cdd3cc 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -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()) @@ -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 @@ -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)); @@ -1022,7 +1021,7 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom if (rate.IsNull()) { app::DataModel::Nullable 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 @@ 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)); 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 f6c6304b610c73..ddaed23187481d 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 #include #include -#include 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 57cd6d71312012..e2a25904bd770a 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 #include #include -#include #include #include #include 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 8d0f849d923b3f..e5c7ae43fb188e 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 #include #include -#include #include #include @@ -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; } @@ -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; } @@ -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; } @@ -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 { diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp index 46f55905157a95..3da02b62cec9a8 100644 --- a/src/app/clusters/ota-provider/ota-provider.cpp +++ b/src/app/clusters/ota-provider/ota-provider.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include 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 aefc65ecd8a05a..a7fd3ed7d64c5f 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 #include #include -#include 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 c595ee6486779f..330d7eb0bd4523 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -84,7 +83,7 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res template 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 @@ -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); @@ -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))) { @@ -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); 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 8c72347818333e..6217288bf7cfaa 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 #include #include -#include using namespace chip; using namespace chip::app; @@ -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; } @@ -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; } diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index f5a5157a7e44e9..780d244bc71519 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include using namespace chip; @@ -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); @@ -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; @@ -925,7 +924,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co 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 79956d0c448894..1b47b9c2e4d6a2 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 #include #include -#include #include #include diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index e394a2098e4005..66738e101394b8 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -41,6 +41,9 @@ #include #include +#include + +using chip::Protocols::InteractionModel::Status; /** * @brief Type for the cluster mask @@ -290,9 +293,8 @@ typedef void (*EmberAfClusterAttributeChangedCallback)(const chip::app::Concrete * * 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 d18d69956b9746..e53b613916ca76 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -29,6 +29,9 @@ #include #include #include +#include + +using chip::Protocols::InteractionModel::Status; /** @name Attribute Storage */ // @{ @@ -95,8 +98,8 @@ bool emberAfContainsClient(chip::EndpointId endpoint, chip::ClusterId clusterId) * 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 @@ EmberAfStatus emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId c * 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 43f86843f187c2..d44c598a737b93 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -27,6 +27,9 @@ #include #include #include +#include + +using chip::Protocols::InteractionModel::Status; // Attribute storage depends on knowing the current layout/setup of attributes // and corresponding callbacks. Specifically: @@ -372,20 +375,20 @@ void emAfClusterAttributeChangedCallback(const app::ConcreteAttributePath & attr } // 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 @@ static uint8_t * singletonAttributeLocation(const EmberAfAttributeMetadata * am) // 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 @@ static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, u { if (bufferSize < 1) { - return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED; + return Status::ResourceExhausted; } emberAfCopyString(dest, src, bufferSize - 1); } @@ -508,7 +511,7 @@ static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, u { if (bufferSize < 2) { - return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED; + return Status::ResourceExhausted; } emberAfCopyLongString(dest, src, bufferSize - 2); } @@ -516,7 +519,7 @@ static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, u { if (bufferSize < 2) { - return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED; + return Status::ResourceExhausted; } // Just copy the length. @@ -526,7 +529,7 @@ static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, u { if (!ignoreReadLength && readLength < am->size) { - return EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED; + return Status::ResourceExhausted; } if (src == nullptr) { @@ -537,7 +540,7 @@ static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, u memmove(dest, src, am->size); } } - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } /** @@ -581,8 +584,8 @@ bool emAfMatchAttribute(const EmberAfCluster * cluster, const EmberAfAttributeMe // 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 @@ EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attR 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 @@ EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attR if (!emberAfAttributeReadAccessCallback(attRecord->endpoint, attRecord->clusterId, am->attributeId)) { - return EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS; + return Status::UnsupportedAccess; } } @@ -664,7 +667,7 @@ EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attR return typeSensitiveMemCopy(attRecord->clusterId, dst, src, am, write, readLength); } - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } } else @@ -678,7 +681,7 @@ EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attR } // 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 @@ EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attR } // 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 @@ EmberAfStatus emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attR attributeOffsetIndex = static_cast(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 abc04021fb0a9a..e68735cde8f172 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -28,6 +28,10 @@ #include #include +#include + +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 @@ void emAfCallInits(void); // 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 emAfSaveAttributeToStorageIfNeeded(uint8_t * data, chip::EndpointId endpoin 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 4c36d759c3a5ed..d16942646ba929 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 -#include #include #include #include @@ -30,16 +29,18 @@ #include #include +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 @@ static bool IsNullValue(const uint8_t * data, uint16_t dataLen, bool isAttribute 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 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu 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 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu // 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 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu 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 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu 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 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu 0, // buffer size - unused true); // write? - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -234,15 +235,14 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu // 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 @@ EmberAfStatus emberAfReadAttribute(EndpointId endpoint, ClusterId cluster, Attri 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 1f08d80dbd1353..0969e8c18c9b87 100644 --- a/src/app/util/attribute-table.h +++ b/src/app/util/attribute-table.h @@ -19,14 +19,18 @@ #include +#include + +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 @@ EmberAfStatus emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::Cluste * 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 76daa77ea13fa7..d35be58bffdd80 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -53,6 +52,8 @@ #include +using chip::Protocols::InteractionModel::Status; + using namespace chip; using namespace chip::app; using namespace chip::Access; @@ -619,13 +620,13 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b 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 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b } default: ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast(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 @@ CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, 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 de47b27f859d59..00000000000000 --- 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 -#include - -namespace chip { -namespace app { - -inline EmberAfStatus ToEmberAfStatus(Protocols::InteractionModel::Status code) -{ - return static_cast(code); -} - -inline Protocols::InteractionModel::Status ToInteractionModelStatus(EmberAfStatus code) -{ - return static_cast(code); -} - -} // namespace app -} // namespace chip diff --git a/src/app/util/generic-callback-stubs.cpp b/src/app/util/generic-callback-stubs.cpp index 11e705c7382b1c..21d40858c4d13c 100644 --- a/src/app/util/generic-callback-stubs.cpp +++ b/src/app/util/generic-callback-stubs.cpp @@ -34,18 +34,18 @@ bool __attribute__((weak)) emberAfAttributeWriteAccessCallback(EndpointId endpoi 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 4f0fc6661af92c..51917e6f86012b 100644 --- a/src/app/util/generic-callbacks.h +++ b/src/app/util/generic-callbacks.h @@ -28,6 +28,8 @@ #include #include +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 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste * 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 @@ EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, ch * 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 2593609d77af93..cdaac8f494a8c7 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -24,6 +24,7 @@ #include #include #include +#include // TODO: figure out a clear path for compile-time codegen #include @@ -34,6 +35,8 @@ using namespace chip; +using chip::Protocols::InteractionModel::Status; + //------------------------------------------------------------------------------ // Forward Declarations @@ -56,8 +59,8 @@ bool emberAfIsDeviceIdentifying(EndpointId endpoint) { #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 f442190c0fc200..c425b344c68962 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -29,7 +29,6 @@ #include "app/ConcreteCommandPath.h" #include #include -#include #include #include #include diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 99cd69a5284bc7..7cc2c86432f5f9 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -42,7 +42,6 @@ #include #include -#include #include #include #include diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 26870b5752caab..85c37b87ae6691 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index 41de3b4646f870..0d41d925d49507 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/src/darwin/Framework/CHIP/MTRError.mm b/src/darwin/Framework/CHIP/MTRError.mm index 9f7c0938b41c61..4050615f2c3adf 100644 --- a/src/darwin/Framework/CHIP/MTRError.mm +++ b/src/darwin/Framework/CHIP/MTRError.mm @@ -22,7 +22,6 @@ #import #import -#import #import #import