From ddf373cd0b3c62c6a2ac56cc2e4154a2df254a42 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:52:36 -0500 Subject: [PATCH] [IM] Remove EmberAfStatus from src/app/clusters (#32055) * Remove EmberAfStatus from src/app/clusters * fix ci * fix specs compliance * remove using Status from headers * fix comments * Remove using Status from headers * fix comments * fix ci * fix door lock --- src/app/app-platform/ContentApp.cpp | 12 +- src/app/app-platform/ContentApp.h | 6 +- src/app/app-platform/ContentAppPlatform.cpp | 28 ++-- src/app/app-platform/ContentAppPlatform.h | 14 +- .../account-login-server.cpp | 1 + .../application-launcher-server.cpp | 4 +- .../audio-output-server.cpp | 4 +- .../barrier-control-server.cpp | 34 ++--- .../basic-information/basic-information.cpp | 8 +- .../color-control-server.cpp | 36 ++--- .../device-energy-management-server.h | 31 +++-- .../dishwasher-alarm-server.cpp | 88 ++++++------ .../dishwasher-alarm-server.h | 20 +-- .../door-lock-server/door-lock-server.cpp | 66 ++++----- .../door-lock-server/door-lock-server.h | 26 ++-- .../electrical-power-measurement-server.h | 3 +- .../energy-evse-server/energy-evse-server.h | 15 +- .../fan-control-server/fan-control-server.cpp | 95 ++++++------- .../clusters/groups-server/groups-server.cpp | 38 +++--- .../icd-management-server.cpp | 2 + .../icd-management-server.h | 16 +-- .../laundry-dryer-controls-server.cpp | 10 +- .../laundry-dryer-controls-server.h | 6 +- .../laundry-washer-controls-server.cpp | 17 ++- .../laundry-washer-controls-server.h | 10 +- .../clusters/level-control/level-control.cpp | 79 ++++++----- .../localization-configuration-server.cpp | 12 +- .../media-input-server/media-input-server.cpp | 4 +- .../mode-select-server/mode-select-server.cpp | 14 +- .../clusters/on-off-server/on-off-server.cpp | 59 ++++---- .../clusters/on-off-server/on-off-server.h | 8 +- .../ota-requestor/DefaultOTARequestor.h | 4 +- .../ota-requestor/ota-requestor-server.cpp | 21 +-- .../ota-requestor/ota-requestor-server.h | 15 +- .../refrigerator-alarm-server.cpp | 62 ++++----- .../refrigerator-alarm-server.h | 23 ++-- .../resource-monitoring-server.h | 14 +- .../clusters/scenes-server/scenes-server.cpp | 15 +- .../smoke-co-alarm-server.cpp | 14 +- .../smoke-co-alarm-server.h | 5 +- .../temperature-control-server.cpp | 28 ++-- .../thermostat-server/thermostat-server.cpp | 129 +++++++++--------- .../time-format-localization-server.cpp | 12 +- .../time-synchronization-server.cpp | 18 +-- .../window-covering-server.cpp | 4 +- src/app/server/Server.h | 2 +- src/app/util/af-enums.h | 92 ++++++------- src/app/util/af-types.h | 6 +- src/app/util/af.h | 12 +- src/app/util/attribute-storage.h | 12 +- src/app/util/attribute-table.h | 12 +- src/app/util/generic-callback-stubs.cpp | 9 +- src/app/util/generic-callbacks.h | 16 +-- .../CHIP/ServerEndpoint/MTRIMDispatch.mm | 4 +- 54 files changed, 665 insertions(+), 630 deletions(-) diff --git a/src/app/app-platform/ContentApp.cpp b/src/app/app-platform/ContentApp.cpp index 571561454162ac..3bc16e9555ced5 100644 --- a/src/app/app-platform/ContentApp.cpp +++ b/src/app/app-platform/ContentApp.cpp @@ -29,35 +29,37 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED using namespace chip; using namespace chip::AppPlatform; +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace AppPlatform { #define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) #define ZCL_APPLICATION_BASIC_CLUSTER_REVISION (1u) -EmberAfStatus ContentApp::HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, - uint16_t maxReadLength) +Status ContentApp::HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength) { ChipLogProgress(DeviceLayer, "Read Attribute for endpoint " ChipLogFormatMEI " cluster " ChipLogFormatMEI " attribute " ChipLogFormatMEI, ChipLogValueMEI(mEndpointId), ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } -EmberAfStatus ContentApp::HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer) +Status ContentApp::HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer) { ChipLogProgress(DeviceLayer, "Read Attribute for endpoint " ChipLogFormatMEI " cluster " ChipLogFormatMEI " attribute " ChipLogFormatMEI, ChipLogValueMEI(mEndpointId), ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } } // namespace AppPlatform diff --git a/src/app/app-platform/ContentApp.h b/src/app/app-platform/ContentApp.h index 6fed23cf7d64da..d3b7d1fb2b2187 100644 --- a/src/app/app-platform/ContentApp.h +++ b/src/app/app-platform/ContentApp.h @@ -33,6 +33,7 @@ #include #include #include +#include namespace chip { namespace AppPlatform { @@ -65,8 +66,9 @@ class DLL_EXPORT ContentApp virtual MediaPlaybackDelegate * GetMediaPlaybackDelegate() = 0; virtual TargetNavigatorDelegate * GetTargetNavigatorDelegate() = 0; - EmberAfStatus HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength); - EmberAfStatus HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer); + Protocols::InteractionModel::Status HandleReadAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer, + uint16_t maxReadLength); + Protocols::InteractionModel::Status HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer); protected: EndpointId mEndpointId = 0; diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index bb4638c45d95ba..abcaa981843037 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED @@ -41,19 +42,20 @@ using namespace chip::app::Clusters; using namespace chip::Access; using ApplicationStatusEnum = app::Clusters::ApplicationBasic::ApplicationStatusEnum; using GetSetupPINResponseType = app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Type; +using chip::Protocols::InteractionModel::Status; // Device Version for dynamic endpoints: #define DEVICE_VERSION_DEFAULT 1 -EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength) +Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, + uint16_t maxReadLength) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); ChipLogDetail(DeviceLayer, "emberAfExternalAttributeReadCallback endpoint %d ", endpointIndex); - EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; + Status ret = Status::Failure; ContentApp * app = ContentAppPlatform::GetInstance().GetContentApp(endpoint); if (app != nullptr) @@ -68,14 +70,14 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI return ret; } -EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) +Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); ChipLogDetail(DeviceLayer, "emberAfExternalAttributeWriteCallback endpoint %d ", endpointIndex); - EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; + Status ret = Status::Failure; ContentApp * app = ContentAppPlatform::GetInstance().GetContentApp(endpoint); if (app != nullptr) @@ -93,18 +95,18 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster namespace chip { namespace AppPlatform { -EmberAfStatus __attribute__((weak)) AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, - uint8_t * buffer, uint16_t maxReadLength) +Status __attribute__((weak)) AppPlatformExternalAttributeReadCallback(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)) AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { - return (EMBER_ZCL_STATUS_FAILURE); + return (Status::Failure); } EndpointId ContentAppPlatform::AddContentApp(ContentApp * app, EmberAfEndpointType * ep, diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 3dd0b138d2e9d1..16a47c26a3b991 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -27,6 +27,7 @@ #include #include #include +#include #include using chip::app::Clusters::ApplicationBasic::CatalogVendorApp; @@ -40,14 +41,15 @@ namespace AppPlatform { // The AppPlatform overrides emberAfExternalAttributeReadCallback to handle external attribute reads for ContentApps. // This callback can be used to handle external attribute reads for attributes belonging to static endpoints. -EmberAfStatus AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength); +Protocols::InteractionModel::Status AppPlatformExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); // The AppPlatform overrides emberAfExternalAttributeWriteCallback to handle external attribute writes for ContentApps. // This callback can be used to handle external attribute writes for attributes belonging to static endpoints. -EmberAfStatus AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); +Protocols::InteractionModel::Status AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); inline constexpr EndpointId kTargetBindingClusterEndpointId = 0; inline constexpr EndpointId kLocalVideoPlayerEndpointId = 1; @@ -157,7 +159,7 @@ class DLL_EXPORT ContentAppPlatform // loads given app and calls HandleGetSetupPasscode. Sets passcode to 0 if it cannot be obtained. // return true if a matching app was found (and it granted this client access), even if a passcode was not obtained bool HasTargetContentApp(uint16_t vendorId, uint16_t productId, CharSpan rotatingId, - chip::Protocols::UserDirectedCommissioning::TargetAppInfo & info, uint32_t & passcode); + Protocols::UserDirectedCommissioning::TargetAppInfo & info, uint32_t & passcode); /** * @brief diff --git a/src/app/clusters/account-login-server/account-login-server.cpp b/src/app/clusters/account-login-server/account-login-server.cpp index aa939ae810bb10..684558eec0f0bc 100644 --- a/src/app/clusters/account-login-server/account-login-server.cpp +++ b/src/app/clusters/account-login-server/account-login-server.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED #include diff --git a/src/app/clusters/application-launcher-server/application-launcher-server.cpp b/src/app/clusters/application-launcher-server/application-launcher-server.cpp index aa72d8ad499620..18a30bb1190659 100644 --- a/src/app/clusters/application-launcher-server/application-launcher-server.cpp +++ b/src/app/clusters/application-launcher-server/application-launcher-server.cpp @@ -116,8 +116,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } diff --git a/src/app/clusters/audio-output-server/audio-output-server.cpp b/src/app/clusters/audio-output-server/audio-output-server.cpp index f47fc528456a78..297d1ea9d8d8b3 100644 --- a/src/app/clusters/audio-output-server/audio-output-server.cpp +++ b/src/app/clusters/audio-output-server/audio-output-server.cpp @@ -92,8 +92,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } diff --git a/src/app/clusters/barrier-control-server/barrier-control-server.cpp b/src/app/clusters/barrier-control-server/barrier-control-server.cpp index e4e72eeb2ae930..99bd0621ba793d 100644 --- a/src/app/clusters/barrier-control-server/barrier-control-server.cpp +++ b/src/app/clusters/barrier-control-server/barrier-control-server.cpp @@ -102,29 +102,29 @@ static void cancelEndpointTimerCallback(EndpointId endpoint) uint8_t emAfPluginBarrierControlServerGetBarrierPosition(EndpointId endpoint) { uint8_t position; - EmberAfStatus status = Attributes::BarrierPosition::Get(endpoint, &position); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierPosition::Get(endpoint, &position); + assert(status == Status::Success); return position; } void emAfPluginBarrierControlServerSetBarrierPosition(EndpointId endpoint, uint8_t position) { - EmberAfStatus status = Attributes::BarrierPosition::Set(endpoint, position); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierPosition::Set(endpoint, position); + assert(status == Status::Success); } bool emAfPluginBarrierControlServerIsPartialBarrierSupported(EndpointId endpoint) { uint8_t bitmap; - EmberAfStatus status = Attributes::BarrierCapabilities::Get(endpoint, &bitmap); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierCapabilities::Get(endpoint, &bitmap); + assert(status == Status::Success); return (bitmap & to_underlying(BarrierControlCapabilities::kPartialBarrier)) != 0; } static uint16_t getOpenOrClosePeriod(EndpointId endpoint, bool open) { - uint16_t period = 0; - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + uint16_t period = 0; + Status status = Status::Success; #if defined(ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_OPEN_PERIOD_ATTRIBUTE) if (open) { @@ -137,21 +137,21 @@ static uint16_t getOpenOrClosePeriod(EndpointId endpoint, bool open) status = Attributes::BarrierClosePeriod::Get(endpoint, &period); } #endif - assert(status == EMBER_ZCL_STATUS_SUCCESS); + assert(status == Status::Success); return period; } static void setMovingState(EndpointId endpoint, uint8_t newState) { - EmberAfStatus status = Attributes::BarrierMovingState::Set(endpoint, newState); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierMovingState::Set(endpoint, newState); + assert(status == Status::Success); } uint16_t emAfPluginBarrierControlServerGetSafetyStatus(EndpointId endpoint) { uint16_t safetyStatus; - EmberAfStatus status = Attributes::BarrierSafetyStatus::Get(endpoint, &safetyStatus); - assert(status == EMBER_ZCL_STATUS_SUCCESS); + Status status = Attributes::BarrierSafetyStatus::Get(endpoint, &safetyStatus); + assert(status == Status::Success); return safetyStatus; } @@ -163,8 +163,8 @@ static bool isRemoteLockoutOn(EndpointId endpoint) void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool open, bool command) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - uint16_t events = 0; + Status status = Status::Success; + uint16_t events = 0; #if defined(ZCL_USING_BARRIER_CONTROL_CLUSTER_BARRIER_OPEN_EVENTS_ATTRIBUTE) if (open && !command) @@ -190,7 +190,7 @@ void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool ope status = Attributes::BarrierCommandCloseEvents::Get(endpoint, &events); } #endif - assert(status == EMBER_ZCL_STATUS_SUCCESS); + assert(status == Status::Success); // Section 7.1.2.1.5-8 says that this events counter SHALL NOT roll over. // The maximum 16-bit unsigned integer in Zigbee is 0xFFFE, so we have this @@ -225,7 +225,7 @@ void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool ope status = Attributes::BarrierCommandCloseEvents::Set(endpoint, events); } #endif - assert(status == EMBER_ZCL_STATUS_SUCCESS); + assert(status == Status::Success); } // ----------------------------------------------------------------------------- diff --git a/src/app/clusters/basic-information/basic-information.cpp b/src/app/clusters/basic-information/basic-information.cpp index f241bb2cf5a008..641dc59a853dd6 100644 --- a/src/app/clusters/basic-information/basic-information.cpp +++ b/src/app/clusters/basic-information/basic-information.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,7 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::BasicInformation; using namespace chip::app::Clusters::BasicInformation::Attributes; using namespace chip::DeviceLayer; +using chip::Protocols::InteractionModel::Status; namespace { @@ -463,9 +465,9 @@ namespace Clusters { namespace BasicInformation { bool IsLocalConfigDisabled() { - bool disabled = false; - EmberAfStatus status = LocalConfigDisabled::Get(0, &disabled); - return status == EMBER_ZCL_STATUS_SUCCESS && disabled; + bool disabled = false; + Status status = LocalConfigDisabled::Get(0, &disabled); + return status == Status::Success && disabled; } } // namespace BasicInformation } // namespace Clusters diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 941f9d5a5f5842..3e883cf5165e3a 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -109,14 +109,14 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kXy)) { uint16_t xValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::CurrentX::Get(endpoint, &xValue)) + if (Status::Success != Attributes::CurrentX::Get(endpoint, &xValue)) { xValue = 0x616B; // Default X value according to spec } AddAttributeValuePair(pairs, Attributes::CurrentX::Id, xValue, attributeCount); uint16_t yValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::CurrentY::Get(endpoint, &yValue)) + if (Status::Success != Attributes::CurrentY::Get(endpoint, &yValue)) { yValue = 0x607D; // Default Y value according to spec } @@ -133,7 +133,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kHueAndSaturation)) { uint8_t saturationValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::CurrentSaturation::Get(endpoint, &saturationValue)) + if (Status::Success != Attributes::CurrentSaturation::Get(endpoint, &saturationValue)) { saturationValue = 0x00; } @@ -143,21 +143,21 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop)) { uint8_t loopActiveValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorLoopActive::Get(endpoint, &loopActiveValue)) + if (Status::Success != Attributes::ColorLoopActive::Get(endpoint, &loopActiveValue)) { loopActiveValue = 0x00; } AddAttributeValuePair(pairs, Attributes::ColorLoopActive::Id, loopActiveValue, attributeCount); uint8_t loopDirectionValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorLoopDirection::Get(endpoint, &loopDirectionValue)) + if (Status::Success != Attributes::ColorLoopDirection::Get(endpoint, &loopDirectionValue)) { loopDirectionValue = 0x00; } AddAttributeValuePair(pairs, Attributes::ColorLoopDirection::Id, loopDirectionValue, attributeCount); uint16_t loopTimeValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorLoopTime::Get(endpoint, &loopTimeValue)) + if (Status::Success != Attributes::ColorLoopTime::Get(endpoint, &loopTimeValue)) { loopTimeValue = 0x0019; // Default loop time value according to spec } @@ -167,7 +167,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorTemperature)) { uint16_t temperatureValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::ColorTemperatureMireds::Get(endpoint, &temperatureValue)) + if (Status::Success != Attributes::ColorTemperatureMireds::Get(endpoint, &temperatureValue)) { temperatureValue = 0x00FA; // Default temperature value according to spec } @@ -175,7 +175,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } uint8_t modeValue; - if (EMBER_ZCL_STATUS_SUCCESS != Attributes::EnhancedColorMode::Get(endpoint, &modeValue)) + if (Status::Success != Attributes::EnhancedColorMode::Get(endpoint, &modeValue)) { modeValue = ColorControl::EnhancedColorMode::kCurrentXAndCurrentY; // Default mode value according to spec } @@ -446,7 +446,7 @@ bool ColorControlServer::HasFeature(chip::EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } @@ -2509,11 +2509,11 @@ Status ColorControlServer::moveToColorTemp(EndpointId aEndpoint, uint16_t colorT uint16_t ColorControlServer::getTemperatureCoupleToLevelMin(EndpointId endpoint) { uint16_t colorTemperatureCoupleToLevelMin; - EmberAfStatus status; + Status status; status = Attributes::CoupleColorTempToLevelMinMireds::Get(endpoint, &colorTemperatureCoupleToLevelMin); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { // Not less than the physical min. Attributes::ColorTempPhysicalMinMireds::Get(endpoint, &colorTemperatureCoupleToLevelMin); @@ -2552,14 +2552,14 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint) // Initialize startUpColorTempMireds to "maintain previous value" value null app::DataModel::Nullable startUpColorTemp; - EmberAfStatus status = Attributes::StartUpColorTemperatureMireds::Get(endpoint, startUpColorTemp); + Status status = Attributes::StartUpColorTemperatureMireds::Get(endpoint, startUpColorTemp); - if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpColorTemp.IsNull()) + if (status == Status::Success && !startUpColorTemp.IsNull()) { uint16_t updatedColorTemp = MAX_TEMPERATURE_VALUE; status = Attributes::ColorTemperatureMireds::Get(endpoint, &updatedColorTemp); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE; Attributes::ColorTempPhysicalMinMireds::Get(endpoint, &tempPhysicalMin); @@ -2576,7 +2576,7 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint) updatedColorTemp = startUpColorTemp.Value(); status = Attributes::ColorTemperatureMireds::Set(endpoint, updatedColorTemp); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { // Set ColorMode attributes to reflect ColorTemperature. uint8_t updateColorMode = ColorControl::EnhancedColorMode::kColorTemperature; @@ -2607,7 +2607,7 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint) // Check whether our color temperature has actually changed. If not, do // nothing, and wait for it to change. uint16_t currentColorTemp; - if (Attributes::ColorTemperatureMireds::Get(endpoint, ¤tColorTemp) != EMBER_ZCL_STATUS_SUCCESS) + if (Attributes::ColorTemperatureMireds::Get(endpoint, ¤tColorTemp) != Status::Success) { // Why can't we read our attribute? return; @@ -2906,9 +2906,9 @@ void ColorControlServer::levelControlColorTempChangeCommand(EndpointId endpoint) if (colorMode == ColorControl::EnhancedColorMode::kColorTemperature) { app::DataModel::Nullable currentLevel; - EmberAfStatus status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); + Status status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS || currentLevel.IsNull()) + if (status != Status::Success || currentLevel.IsNull()) { currentLevel.SetNonNull((uint8_t) 0x7F); } diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index 3620379d4ed8e2..7aeb06da661cd1 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -35,8 +36,6 @@ namespace DeviceEnergyManagement { using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; -using chip::Protocols::InteractionModel::Status; - class Delegate { public: @@ -52,7 +51,8 @@ class Delegate * @param duration The duration that the ESA SHALL maintain the requested power for. * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. */ - virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration, AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status PowerAdjustRequest(const int64_t power, const uint32_t duration, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate SHALL make the ESA end the active power adjustment session & return to normal (or idle) power levels. @@ -60,7 +60,7 @@ class Delegate * * @return It should report SUCCESS if successful and FAILURE otherwise. */ - virtual Status CancelPowerAdjustRequest() = 0; + virtual Protocols::InteractionModel::Status CancelPowerAdjustRequest() = 0; /** * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastId. @@ -76,7 +76,8 @@ class Delegate * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate * IM_Status. */ - virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime, AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status StartTimeAdjustRequest(const uint32_t requestedStartTime, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for PauseRequest command @@ -91,7 +92,7 @@ class Delegate * @param duration Duration that the ESA SHALL be paused for. * @return Success if the ESA is paused, otherwise returns other IM_Status. */ - virtual Status PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for ResumeRequest command @@ -102,7 +103,7 @@ class Delegate * * @return Success if the ESA is resumed, otherwise returns other IM_Status. */ - virtual Status ResumeRequest() = 0; + virtual Protocols::InteractionModel::Status ResumeRequest() = 0; /** * @brief Delegate handler for ModifyForecastRequest @@ -118,9 +119,10 @@ class Delegate * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command * SHALL be rejected returning other IM_Status. */ - virtual Status ModifyForecastRequest(const uint32_t forecastId, - const DataModel::DecodableList & slotAdjustments, - AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status + ModifyForecastRequest(const uint32_t forecastId, + const DataModel::DecodableList & slotAdjustments, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for RequestConstraintBasedForecast @@ -133,8 +135,9 @@ class Delegate * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. */ - virtual Status RequestConstraintBasedForecast(const DataModel::DecodableList & constraints, - AdjustmentCauseEnum cause) = 0; + virtual Protocols::InteractionModel::Status + RequestConstraintBasedForecast(const DataModel::DecodableList & constraints, + AdjustmentCauseEnum cause) = 0; /** * @brief Delegate handler for CancelRequest @@ -153,7 +156,7 @@ class Delegate * * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. */ - virtual Status CancelRequest() = 0; + virtual Protocols::InteractionModel::Status CancelRequest() = 0; // ------------------------------------------------------------------ // Get attribute methods @@ -210,7 +213,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface void InvokeCommand(HandlerContext & handlerContext) override; CHIP_ERROR EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) override; - Status CheckOptOutAllowsRequest(AdjustmentCauseEnum adjustmentCause); + Protocols::InteractionModel::Status CheckOptOutAllowsRequest(AdjustmentCauseEnum adjustmentCause); void HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData); void HandleCancelPowerAdjustRequest(HandlerContext & ctx, const Commands::CancelPowerAdjustRequest::DecodableType & commandData); 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 73a626e73e4f34..dbf3ee3116b317 100644 --- a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp +++ b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp @@ -76,18 +76,18 @@ DishwasherAlarmServer & DishwasherAlarmServer::Instance() return instance; } -EmberAfStatus DishwasherAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) +Status DishwasherAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) { - EmberAfStatus status = Attributes::Mask::Get(endpoint, mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Mask::Get(endpoint, mask); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading mask, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading mask, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::GetLatchValue(EndpointId endpoint, BitMask * latch) +Status DishwasherAlarmServer::GetLatchValue(EndpointId endpoint, BitMask * latch) { if (!HasResetFeature(endpoint)) { @@ -95,48 +95,48 @@ EmberAfStatus DishwasherAlarmServer::GetLatchValue(EndpointId endpoint, BitMask< return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; } - EmberAfStatus status = Attributes::Latch::Get(endpoint, latch); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Latch::Get(endpoint, latch); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading latch, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading latch, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) +Status DishwasherAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) { - EmberAfStatus status = Attributes::State::Get(endpoint, state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::State::Get(endpoint, state); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: get state, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: get state, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) +Status DishwasherAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) { - EmberAfStatus status = Attributes::Supported::Get(endpoint, supported); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Supported::Get(endpoint, supported); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading supported, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading supported, err:0x%x", to_underlying(status)); } return status; } -EmberAfStatus DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) +Status DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; ; - if ((status = Attributes::Supported::Set(endpoint, supported)) != EMBER_ZCL_STATUS_SUCCESS) + if ((status = Attributes::Supported::Set(endpoint, supported)) != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing supported, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing supported, err:0x%x", to_underlying(status)); return status; } // Whenever there is change in Supported attribute, Latch should change accordingly (if possible). BitMask latch; - if (GetLatchValue(endpoint, &latch) == EMBER_ZCL_STATUS_SUCCESS && !supported.HasAll(latch)) + if (GetLatchValue(endpoint, &latch) == Status::Success && !supported.HasAll(latch)) { latch = latch & supported; status = SetLatchValue(endpoint, latch); @@ -144,7 +144,7 @@ EmberAfStatus DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, cons // Whenever there is change in Supported attribute, Mask, State should change accordingly. BitMask mask; - if ((status = GetMaskValue(endpoint, &mask)) != EMBER_ZCL_STATUS_SUCCESS) + if ((status = GetMaskValue(endpoint, &mask)) != Status::Success) { return status; } @@ -157,7 +157,7 @@ EmberAfStatus DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, cons return status; } -EmberAfStatus DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) +Status DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) { BitMask supported; if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(mask)) @@ -166,17 +166,17 @@ EmberAfStatus DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const Bit return EMBER_ZCL_STATUS_FAILURE; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - if ((status = Attributes::Mask::Set(endpoint, mask)) != EMBER_ZCL_STATUS_SUCCESS) + Status status = Status::Success; + if ((status = Attributes::Mask::Set(endpoint, mask)) != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing mask, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing mask, err:0x%x", to_underlying(status)); return status; } // Whenever there is change in Mask, State should change accordingly. BitMask state; status = GetStateValue(endpoint, &state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -189,7 +189,7 @@ EmberAfStatus DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const Bit return status; } -EmberAfStatus DishwasherAlarmServer::SetLatchValue(EndpointId endpoint, const BitMask latch) +Status DishwasherAlarmServer::SetLatchValue(EndpointId endpoint, const BitMask latch) { if (!HasResetFeature(endpoint)) { @@ -204,17 +204,17 @@ EmberAfStatus DishwasherAlarmServer::SetLatchValue(EndpointId endpoint, const Bi return EMBER_ZCL_STATUS_FAILURE; } - EmberAfStatus status = Attributes::Latch::Set(endpoint, latch); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Latch::Set(endpoint, latch); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing latch, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing latch, err:0x%x", to_underlying(status)); return status; } return status; } -EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const BitMask newState, bool ignoreLatchState) +Status DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const BitMask newState, bool ignoreLatchState) { BitMask supported; BitMask finalNewState; @@ -233,17 +233,17 @@ EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const Bi return EMBER_ZCL_STATUS_FAILURE; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; BitMask currentState; status = Attributes::State::Get(endpoint, ¤tState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading state, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: reading state, err:0x%x", to_underlying(status)); return status; } BitMask latch; - if (!ignoreLatchState && (GetLatchValue(endpoint, &latch) == EMBER_ZCL_STATUS_SUCCESS)) + if (!ignoreLatchState && (GetLatchValue(endpoint, &latch) == Status::Success)) { // Restore bits that have their Latch bit set. auto bitsToKeep = latch & currentState; @@ -252,9 +252,9 @@ EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const Bi // Store the new value of the State attribute. status = Attributes::State::Set(endpoint, finalNewState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing state, err:0x%x", status); + ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing state, err:0x%x", to_underlying(status)); return status; } @@ -268,7 +268,7 @@ EmberAfStatus DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const Bi return status; } -EmberAfStatus DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms) +Status DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms) { BitMask supported; if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(alarms)) @@ -278,7 +278,7 @@ EmberAfStatus DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, con } BitMask state; - if (GetStateValue(endpoint, &state) != EMBER_ZCL_STATUS_SUCCESS) + if (GetStateValue(endpoint, &state) != Status::Success) { return EMBER_ZCL_STATUS_FAILURE; } @@ -290,7 +290,7 @@ EmberAfStatus DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, con bool DishwasherAlarmServer::HasResetFeature(EndpointId endpoint) { uint32_t featureMap = 0; - if (Attributes::FeatureMap::Get(endpoint, &featureMap) != EMBER_ZCL_STATUS_SUCCESS) + if (Attributes::FeatureMap::Get(endpoint, &featureMap) != Status::Success) { return false; } @@ -319,7 +319,7 @@ static Status ModifyEnabledHandler(const app::ConcreteCommandPath & commandPath, EndpointId endpoint = commandPath.mEndpointId; BitMask supported; - if (DishwasherAlarmServer::Instance().GetSupportedValue(endpoint, &supported) != EMBER_ZCL_STATUS_SUCCESS) + if (DishwasherAlarmServer::Instance().GetSupportedValue(endpoint, &supported) != Status::Success) { return Status::Failure; } @@ -340,7 +340,7 @@ static Status ModifyEnabledHandler(const app::ConcreteCommandPath & commandPath, return Status::Failure; } // The cluster will do this update if delegate.ModifyEnabledAlarmsCallback() returns true. - if (DishwasherAlarmServer::Instance().SetMaskValue(endpoint, mask) != EMBER_ZCL_STATUS_SUCCESS) + if (DishwasherAlarmServer::Instance().SetMaskValue(endpoint, mask) != Status::Success) { return Status::Failure; } @@ -366,7 +366,7 @@ static Status ResetHandler(const app::ConcreteCommandPath & commandPath, const B } // The cluster will do this update if delegate.ResetAlarmsCallback() returns true. - if (DishwasherAlarmServer::Instance().ResetLatchedAlarms(endpoint, alarms) != EMBER_ZCL_STATUS_SUCCESS) + if (DishwasherAlarmServer::Instance().ResetLatchedAlarms(endpoint, alarms) != Status::Success) { ChipLogProgress(Zcl, "reset alarms fail"); return Status::Failure; diff --git a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h index d03662f29333fd..5aff983ca6e84f 100644 --- a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h +++ b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -35,16 +36,16 @@ class DishwasherAlarmServer public: static DishwasherAlarmServer & Instance(); - EmberAfStatus GetMaskValue(EndpointId endpoint, BitMask * mask); - EmberAfStatus GetStateValue(EndpointId endpoint, BitMask * state); - EmberAfStatus GetLatchValue(EndpointId endpoint, BitMask * latch); - EmberAfStatus GetSupportedValue(EndpointId endpoint, BitMask * suppported); + Protocols::InteractionModel::Status GetMaskValue(EndpointId endpoint, BitMask * mask); + Protocols::InteractionModel::Status GetStateValue(EndpointId endpoint, BitMask * state); + Protocols::InteractionModel::Status GetLatchValue(EndpointId endpoint, BitMask * latch); + Protocols::InteractionModel::Status GetSupportedValue(EndpointId endpoint, BitMask * suppported); // Whenever there is change on Mask we should change State accordingly. - EmberAfStatus SetMaskValue(EndpointId endpoint, const BitMask mask); - EmberAfStatus SetLatchValue(EndpointId endpoint, const BitMask latch); + Protocols::InteractionModel::Status SetMaskValue(EndpointId endpoint, const BitMask mask); + Protocols::InteractionModel::Status SetLatchValue(EndpointId endpoint, const BitMask latch); // A change in supported value will result in a corresponding change in mask and state. - EmberAfStatus SetSupportedValue(EndpointId endpoint, const BitMask supported); + Protocols::InteractionModel::Status SetSupportedValue(EndpointId endpoint, const BitMask supported); /** * @brief Set the value of the State attribute @@ -60,7 +61,8 @@ class DishwasherAlarmServer * honoring the Mask and Supported attributes. * The default value for the ignoreLatchState parameter is false. */ - EmberAfStatus SetStateValue(EndpointId endpoint, const BitMask newState, bool ignoreLatchState = false); + Protocols::InteractionModel::Status SetStateValue(EndpointId endpoint, const BitMask newState, + bool ignoreLatchState = false); /** * @brief Reset the value of latched alarms in the State attribute. @@ -69,7 +71,7 @@ class DishwasherAlarmServer * @param[in] alarms Each bit set to a 1 in this parameter corresponds to a bit in the * State attribute will SHALL be reset to false. */ - EmberAfStatus ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms); + Protocols::InteractionModel::Status ResetLatchedAlarms(EndpointId endpoint, const BitMask alarms); // check whether the Alarm featureMap has enabled Reset feature. bool HasResetFeature(EndpointId endpoint); 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 8f1037ac3fba17..7f1a99131d4b90 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -466,7 +466,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb return; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; switch (operationType) { case DataOperationTypeEnum::kAdd: @@ -481,7 +481,7 @@ void DoorLockServer::setUserCommandHandler(chip::app::CommandHandler * commandOb default: // appclusters, 5.2.4.34: SetUser command allow only kAdd/kModify, we should respond with INVALID_COMMAND if we got kClear // or anything else - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = Status::InvalidCommand; ChipLogProgress(Zcl, "[SetUser] Invalid operation type [endpointId=%d,operationType=%u]", commandPath.mEndpointId, to_underlying(operationType)); break; @@ -1873,25 +1873,26 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred return false; } -EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, - uint16_t userIndex, const Nullable & userName, - const Nullable & userUniqueId, const Nullable & userStatus, - const Nullable & userType, - const Nullable & credentialRule, - const Nullable & credential) +Status DoorLockServer::createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, + uint16_t userIndex, const Nullable & userName, + const Nullable & userUniqueId, const Nullable & userStatus, + const Nullable & userType, const Nullable & credentialRule, + const Nullable & credential) { EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { ChipLogError(Zcl, "[createUser] Unable to get the user from app [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } // appclusters, 5.2.4.34: to modify user its status should be set to Available. If it is we should return OCCUPIED. if (UserStatusEnum::kAvailable != user.userStatus) { ChipLogProgress(Zcl, "[createUser] Unable to overwrite existing user [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return static_cast(DlStatus::kOccupied); + // TODO FixMe https://github.com/project-chip/connectedhomeip/issues/32100 + return static_cast(DlStatus::kOccupied); + ; } const auto & newUserName = !userName.IsNull() ? userName.Value() : ""_span; @@ -1917,7 +1918,7 @@ EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::Fabr endpointId, creatorFabricIdx, userIndex, static_cast(newUserName.size()), newUserName.data(), newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), to_underlying(newCredentialRule), static_cast(newTotalCredentials)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } ChipLogProgress(Zcl, @@ -1934,25 +1935,24 @@ EmberAfStatus DoorLockServer::createUser(chip::EndpointId endpointId, chip::Fabr return EMBER_ZCL_STATUS_SUCCESS; } -EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, - chip::NodeId sourceNodeId, uint16_t userIndex, const Nullable & userName, - const Nullable & userUniqueId, const Nullable & userStatus, - const Nullable & userType, - const Nullable & credentialRule) +Status DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, + uint16_t userIndex, const Nullable & userName, + const Nullable & userUniqueId, const Nullable & userStatus, + const Nullable & userType, const Nullable & credentialRule) { // We should get the user by that index first EmberAfPluginDoorLockUserInfo user; if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) { ChipLogError(Zcl, "[modifyUser] Unable to get the user from app [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } // appclusters, 5.2.4.34: to modify user its status should NOT be set to Available. If it is we should return INVALID_COMMAND. if (UserStatusEnum::kAvailable == user.userStatus) { ChipLogProgress(Zcl, "[modifyUser] Unable to modify non-existing user [endpointId=%d,userIndex=%d]", endpointId, userIndex); - return EMBER_ZCL_STATUS_INVALID_COMMAND; + return Status::InvalidCommand; } // appclusters, 5.2.4.34: UserName SHALL be null if modifying a user record that was not created by the accessing fabric @@ -1962,7 +1962,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr "[modifyUser] Unable to modify name of user created by different fabric " "[endpointId=%d,userIndex=%d,creatorIdx=%d,modifierIdx=%d]", endpointId, userIndex, user.createdBy, modifierFabricIndex); - return EMBER_ZCL_STATUS_INVALID_COMMAND; + return Status::InvalidCommand; } // appclusters, 5.2.4.34: UserUniqueID SHALL be null if modifying the user record that was not created by the accessing fabric. @@ -1972,7 +1972,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr "[modifyUser] Unable to modify UUID of user created by different fabric " "[endpointId=%d,userIndex=%d,creatorIdx=%d,modifierIdx=%d]", endpointId, userIndex, user.createdBy, modifierFabricIndex); - return EMBER_ZCL_STATUS_INVALID_COMMAND; + return Status::InvalidCommand; } const auto & newUserName = !userName.IsNull() ? userName.Value() : user.userName; @@ -1991,7 +1991,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr ",userType=%u,credentialRule=%u]", endpointId, modifierFabricIndex, userIndex, static_cast(newUserName.size()), newUserName.data(), newUserUniqueId, to_underlying(newUserStatus), to_underlying(newUserType), to_underlying(newCredentialRule)); - return EMBER_ZCL_STATUS_FAILURE; + return Status::Failure; } ChipLogProgress(Zcl, @@ -2004,7 +2004,7 @@ EmberAfStatus DoorLockServer::modifyUser(chip::EndpointId endpointId, chip::Fabr sendRemoteLockUserChange(endpointId, LockDataTypeEnum::kUserIndex, DataOperationTypeEnum::kModify, sourceNodeId, modifierFabricIndex, userIndex, userIndex); - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } Status DoorLockServer::clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, chip::NodeId sourceNodeId, @@ -3406,7 +3406,7 @@ bool DoorLockServer::RemoteOperationEnabled(chip::EndpointId endpointId) const } void DoorLockServer::sendClusterResponse(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - EmberAfStatus status) + Status status) { VerifyOrDie(nullptr != commandObj); @@ -3627,10 +3627,10 @@ void DoorLockServer::SendEvent(chip::EndpointId endpointId, T & event) template bool DoorLockServer::GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value) const + Status (*getFn)(chip::EndpointId endpointId, T * value), T & value) const { - EmberAfStatus status = getFn(endpointId, &value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); + Status status = getFn(endpointId, &value); + bool success = (Status::Success == status); if (!success) { @@ -3642,10 +3642,10 @@ bool DoorLockServer::GetAttribute(chip::EndpointId endpointId, chip::AttributeId template bool DoorLockServer::SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value) + Status (*setFn)(chip::EndpointId endpointId, T value), T value) { - EmberAfStatus status = setFn(endpointId, value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); + Status status = setFn(endpointId, value); + bool success = (Status::Success == status); if (!success) { @@ -3951,11 +3951,11 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command return; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; if (!emberAfPluginDoorLockSetAliroReaderConfig(endpointID, signingKey, verificationKey, groupIdentifier, groupResolvingKey)) { ChipLogProgress(Zcl, "[SetAliroReaderConfig] Unable to set aliro reader config [endpointId=%d]", endpointID); - status = EMBER_ZCL_STATUS_FAILURE; + status = Status::Failure; } sendClusterResponse(commandObj, commandPath, status); } @@ -3973,11 +3973,11 @@ void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * comma return; } - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; if (!emberAfPluginDoorLockClearAliroReaderConfig(endpointID)) { ChipLogProgress(Zcl, "[SetAliroReaderConfig] Unable to set aliro reader config [endpointId=%d]", endpointID); - status = EMBER_ZCL_STATUS_FAILURE; + status = Status::Failure; } sendClusterResponse(commandObj, commandPath, status); } diff --git a/src/app/clusters/door-lock-server/door-lock-server.h b/src/app/clusters/door-lock-server/door-lock-server.h index 9b1a7f6fd27791..dd11ebdbd7db3f 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -307,15 +307,17 @@ class DoorLockServer : public chip::app::AttributeAccessInterface bool findUserIndexByCredential(chip::EndpointId endpointId, CredentialTypeEnum credentialType, chip::ByteSpan credentialData, uint16_t & userIndex, uint16_t & credentialIndex, EmberAfPluginDoorLockUserInfo & userInfo); - EmberAfStatus createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, - uint16_t userIndex, const Nullable & userName, const Nullable & userUniqueId, - const Nullable & userStatus, const Nullable & userType, - const Nullable & credentialRule, - const Nullable & credential = Nullable()); - EmberAfStatus modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, - uint16_t userIndex, const Nullable & userName, const Nullable & userUniqueId, - const Nullable & userStatus, const Nullable & userType, - const Nullable & credentialRule); + chip::Protocols::InteractionModel::Status + createUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, uint16_t userIndex, + const Nullable & userName, const Nullable & userUniqueId, + const Nullable & userStatus, const Nullable & userType, + const Nullable & credentialRule, + const Nullable & credential = Nullable()); + chip::Protocols::InteractionModel::Status + modifyUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, uint16_t userIndex, + const Nullable & userName, const Nullable & userUniqueId, + const Nullable & userStatus, const Nullable & userType, + const Nullable & credentialRule); chip::Protocols::InteractionModel::Status clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, chip::NodeId sourceNodeId, uint16_t userIndex, bool sendUserChangeEvent); chip::Protocols::InteractionModel::Status clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, @@ -477,7 +479,7 @@ class DoorLockServer : public chip::app::AttributeAccessInterface bool engageLockout(chip::EndpointId endpointId); static void sendClusterResponse(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - EmberAfStatus status); + chip::Protocols::InteractionModel::Status status); /** * @brief Common handler for LockDoor, UnlockDoor, UnlockWithTimeout commands @@ -544,7 +546,7 @@ class DoorLockServer : public chip::app::AttributeAccessInterface */ template bool GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; + chip::Protocols::InteractionModel::Status (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; /** * @brief Set generic attribute value @@ -559,7 +561,7 @@ class DoorLockServer : public chip::app::AttributeAccessInterface */ template bool SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value); + chip::Protocols::InteractionModel::Status (*setFn)(chip::EndpointId endpointId, T value), T value); // AttributeAccessInterface's Read API CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath & aPath, chip::app::AttributeValueEncoder & aEncoder) override; diff --git a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h index 0b5d45f1dc447b..28af3fa0abb343 100644 --- a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h +++ b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h @@ -22,6 +22,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -31,8 +32,6 @@ namespace ElectricalPowerMeasurement { using namespace chip::app::Clusters::ElectricalPowerMeasurement::Attributes; using namespace chip::app::Clusters::ElectricalPowerMeasurement::Structs; -using chip::Protocols::InteractionModel::Status; - class Delegate { public: diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index dfead37517d4e8..2ff46f339ff6ad 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -38,7 +39,6 @@ constexpr int64_t kMinimumChargeCurrent = 0; constexpr int64_t kMaximumChargeCurrent = 80000; constexpr uint32_t kMaxRandomizationDelayWindow = 86400; -using chip::Protocols::InteractionModel::Status; /** @brief * Defines methods for implementing application-specific logic for the EVSE Management Cluster. */ @@ -55,30 +55,31 @@ class Delegate * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status Disable() = 0; + virtual Protocols::InteractionModel::Status Disable() = 0; /** * @brief Delegate should implement a handler to enable EVSE Charging. * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status EnableCharging(const DataModel::Nullable & enableChargeTime, const int64_t & minimumChargeCurrent, - const int64_t & maximumChargeCurrent) = 0; + virtual Protocols::InteractionModel::Status EnableCharging(const DataModel::Nullable & enableChargeTime, + const int64_t & minimumChargeCurrent, + const int64_t & maximumChargeCurrent) = 0; /** * @brief Delegate should implement a handler to enable EVSE Discharging. * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status EnableDischarging(const DataModel::Nullable & enableDischargeTime, - const int64_t & maximumDischargeCurrent) = 0; + virtual Protocols::InteractionModel::Status EnableDischarging(const DataModel::Nullable & enableDischargeTime, + const int64_t & maximumDischargeCurrent) = 0; /** * @brief Delegate should implement a handler to enable EVSE Diagnostics. * It should report Status::Success if successful and may * return other Status codes if it fails */ - virtual Status StartDiagnostics() = 0; + virtual Protocols::InteractionModel::Status StartDiagnostics() = 0; // ------------------------------------------------------------------ // Get attribute methods 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 8bca0d1e86c129..b297acdd1e80cf 100644 --- a/src/app/clusters/fan-control-server/fan-control-server.cpp +++ b/src/app/clusters/fan-control-server/fan-control-server.cpp @@ -34,6 +34,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -41,6 +42,8 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::FanControl; using namespace chip::app::Clusters::FanControl::Attributes; +using Protocols::InteractionModel::Status; + namespace { constexpr size_t kFanControlDelegateTableSize = @@ -85,11 +88,11 @@ namespace { // Indicates if the write operation is from the cluster server itself bool gWriteFromClusterLogic = false; -EmberAfStatus SetFanModeToOff(EndpointId endpointId) +Status SetFanModeToOff(EndpointId endpointId) { FanModeEnum currentFanMode; - EmberAfStatus status = FanMode::Get(endpointId, ¤tFanMode); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + Status status = FanMode::Get(endpointId, ¤tFanMode); + VerifyOrReturnError(Status::Success == status, status); if (currentFanMode != FanModeEnum::kOff) { @@ -103,7 +106,7 @@ bool HasFeature(EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } @@ -163,8 +166,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute else if (*value == to_underlying(FanModeEnum::kSmart)) { FanModeSequenceEnum fanModeSequence; - EmberAfStatus status = FanModeSequence::Get(attributePath.mEndpointId, &fanModeSequence); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::Failure); + Status status = FanModeSequence::Get(attributePath.mEndpointId, &fanModeSequence); + VerifyOrReturnError(Status::Success == status, Status::Failure); if (SupportsAuto(attributePath.mEndpointId) && ((fanModeSequence == FanModeSequenceEnum::kOffLowHighAuto) || @@ -204,8 +207,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute else { uint8_t speedMax; - EmberAfStatus status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::ConstraintError); + Status status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); + VerifyOrReturnError(Status::Success == status, Status::ConstraintError); if (*value <= speedMax) { @@ -247,8 +250,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute if (SupportsRocking(attributePath.mEndpointId)) { BitMask rockSupport; - EmberAfStatus status = RockSupport::Get(attributePath.mEndpointId, &rockSupport); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::ConstraintError); + Status status = RockSupport::Get(attributePath.mEndpointId, &rockSupport); + VerifyOrReturnError(Status::Success == status, Status::ConstraintError); auto rawRockSupport = rockSupport.Raw(); if ((*value & rawRockSupport) == *value) { @@ -269,8 +272,8 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute if (SupportsWind(attributePath.mEndpointId)) { BitMask windSupport; - EmberAfStatus status = WindSupport::Get(attributePath.mEndpointId, &windSupport); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::ConstraintError); + Status status = WindSupport::Get(attributePath.mEndpointId, &windSupport); + VerifyOrReturnError(Status::Success == status, Status::ConstraintError); auto rawWindSupport = windSupport.Raw(); if ((*value & rawWindSupport) == *value) { @@ -312,30 +315,30 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt { case FanMode::Id: { FanModeEnum mode; - EmberAfStatus status = FanMode::Get(attributePath.mEndpointId, &mode); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status); + Status status = FanMode::Get(attributePath.mEndpointId, &mode); + VerifyOrReturn(Status::Success == status); // Setting the FanMode value to Off SHALL set the values of PercentSetting, PercentCurrent, // SpeedSetting, SpeedCurrent attributes to 0 (zero). if (mode == FanModeEnum::kOff) { status = PercentSetting::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", to_underlying(status))); status = PercentCurrent::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write PercentCurrent with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write PercentCurrent with error: 0x%02x", to_underlying(status))); if (SupportsMultiSpeed(attributePath.mEndpointId)) { status = SpeedSetting::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", to_underlying(status))); status = SpeedCurrent::Set(attributePath.mEndpointId, 0); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write SpeedCurrent with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write SpeedCurrent with error: 0x%02x", to_underlying(status))); } } @@ -345,30 +348,30 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt { gWriteFromClusterLogic = true; status = PercentSetting::SetNull(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write PercentSetting with error: 0x%02x", to_underlying(status))); if (SupportsMultiSpeed(attributePath.mEndpointId)) { gWriteFromClusterLogic = true; status = SpeedSetting::SetNull(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write SpeedSetting with error: 0x%02x", to_underlying(status))); } } break; } case PercentSetting::Id: { DataModel::Nullable percentSetting; - EmberAfStatus status = PercentSetting::Get(attributePath.mEndpointId, percentSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status && !percentSetting.IsNull()); + Status status = PercentSetting::Get(attributePath.mEndpointId, percentSetting); + VerifyOrReturn(Status::Success == status && !percentSetting.IsNull()); // If PercentSetting is set to 0, the server SHALL set the FanMode attribute value to Off. if (percentSetting.Value() == 0) { status = SetFanModeToOff(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", to_underlying(status))); } if (SupportsMultiSpeed(attributePath.mEndpointId)) @@ -377,13 +380,13 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt // speed = ceil( SpeedMax * (percent * 0.01) ) uint8_t speedMax; status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", to_underlying(status))); DataModel::Nullable currentSpeedSetting; status = SpeedSetting::Get(attributePath.mEndpointId, currentSpeedSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get SpeedSetting with error: 0x%02x", to_underlying(status))); uint16_t percent = percentSetting.Value(); // Plus 99 then integer divide by 100 instead of multiplying 0.01 to avoid floating point precision error @@ -392,8 +395,8 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt if (currentSpeedSetting.IsNull() || speedSetting != currentSpeedSetting.Value()) { status = SpeedSetting::Set(attributePath.mEndpointId, speedSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set SpeedSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set SpeedSetting with error: 0x%02x", to_underlying(status))); } } break; @@ -402,28 +405,28 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt if (SupportsMultiSpeed(attributePath.mEndpointId)) { DataModel::Nullable speedSetting; - EmberAfStatus status = SpeedSetting::Get(attributePath.mEndpointId, speedSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status && !speedSetting.IsNull()); + Status status = SpeedSetting::Get(attributePath.mEndpointId, speedSetting); + VerifyOrReturn(Status::Success == status && !speedSetting.IsNull()); // If SpeedSetting is set to 0, the server SHALL set the FanMode attribute value to Off. if (speedSetting.Value() == 0) { status = SetFanModeToOff(attributePath.mEndpointId); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set FanMode to off with error: 0x%02x", to_underlying(status))); } // Adjust PercentSetting from a speed value change for SpeedSetting // percent = floor( speed/SpeedMax * 100 ) uint8_t speedMax; status = SpeedMax::Get(attributePath.mEndpointId, &speedMax); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get SpeedMax with error: 0x%02x", to_underlying(status))); DataModel::Nullable currentPercentSetting; status = PercentSetting::Get(attributePath.mEndpointId, currentPercentSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to get PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to get PercentSetting with error: 0x%02x", to_underlying(status))); float speed = speedSetting.Value(); Percent percentSetting = static_cast(speed / speedMax * 100); @@ -431,8 +434,8 @@ void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAt if (currentPercentSetting.IsNull() || percentSetting != currentPercentSetting.Value()) { status = PercentSetting::Set(attributePath.mEndpointId, percentSetting); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to set PercentSetting with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to set PercentSetting with error: 0x%02x", to_underlying(status))); } } break; diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index d591c3f3d6e331..04e26a004b3aed 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -102,40 +102,40 @@ static Status GroupAdd(FabricIndex fabricIndex, EndpointId endpointId, GroupId g return Status::ResourceExhausted; } -static EmberAfStatus GroupRemove(FabricIndex fabricIndex, EndpointId endpointId, GroupId groupId) +static Status GroupRemove(FabricIndex fabricIndex, EndpointId endpointId, GroupId groupId) { - VerifyOrReturnError(IsValidGroupId(groupId), EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - VerifyOrReturnError(GroupExists(fabricIndex, endpointId, groupId), EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrReturnError(IsValidGroupId(groupId), Status::ConstraintError); + VerifyOrReturnError(GroupExists(fabricIndex, endpointId, groupId), Status::NotFound); GroupDataProvider * provider = GetGroupDataProvider(); - VerifyOrReturnError(nullptr != provider, EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrReturnError(nullptr != provider, Status::NotFound); CHIP_ERROR err = provider->RemoveEndpoint(fabricIndex, groupId, endpointId); if (CHIP_NO_ERROR == err) { MatterReportingAttributeChangeCallback(kRootEndpointId, GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id); - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } ChipLogDetail(Zcl, "ERR: Failed to remove mapping (end:%d, group:0x%x), err:%" CHIP_ERROR_FORMAT, endpointId, groupId, err.Format()); - return EMBER_ZCL_STATUS_NOT_FOUND; + return Status::NotFound; } void emberAfGroupsClusterServerInitCallback(EndpointId endpointId) { // According to spec, highest bit (Group Names) MUST match feature bit 0 (Group Names) - EmberAfStatus status = Attributes::NameSupport::Set(endpointId, NameSupportBitmap::kGroupNames); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::NameSupport::Set(endpointId, NameSupportBitmap::kGroupNames); + if (status != Status::Success) { - ChipLogDetail(Zcl, "ERR: writing NameSupport %x", status); + ChipLogDetail(Zcl, "ERR: writing NameSupport %x", to_underlying(status)); } status = Attributes::FeatureMap::Set(endpointId, static_cast(Feature::kGroupNames)); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogDetail(Zcl, "ERR: writing group feature map %x", status); + ChipLogDetail(Zcl, "ERR: writing group feature map %x", to_underlying(status)); } } @@ -161,21 +161,21 @@ bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, con GroupDataProvider * provider = GetGroupDataProvider(); GroupDataProvider::GroupInfo info; Groups::Commands::ViewGroupResponse::Type response; - CHIP_ERROR err = CHIP_NO_ERROR; - EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND; + CHIP_ERROR err = CHIP_NO_ERROR; + Status status = Status::NotFound; - VerifyOrExit(IsValidGroupId(groupId), status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - VerifyOrExit(nullptr != provider, status = EMBER_ZCL_STATUS_FAILURE); - VerifyOrExit(provider->HasEndpoint(fabricIndex, groupId, commandPath.mEndpointId), status = EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrExit(IsValidGroupId(groupId), status = Status::ConstraintError); + VerifyOrExit(nullptr != provider, status = Status::Failure); + VerifyOrExit(provider->HasEndpoint(fabricIndex, groupId, commandPath.mEndpointId), status = Status::NotFound); err = provider->GetGroupInfo(fabricIndex, groupId, info); - VerifyOrExit(CHIP_NO_ERROR == err, status = EMBER_ZCL_STATUS_NOT_FOUND); + VerifyOrExit(CHIP_NO_ERROR == err, status = Status::NotFound); response.groupName = CharSpan(info.name, strnlen(info.name, GroupDataProvider::GroupInfo::kGroupNameMax)); - status = EMBER_ZCL_STATUS_SUCCESS; + status = Status::Success; exit: response.groupID = groupId; - response.status = status; + response.status = to_underlying(status); commandObj->AddResponse(commandPath, response); return true; } diff --git a/src/app/clusters/icd-management-server/icd-management-server.cpp b/src/app/clusters/icd-management-server/icd-management-server.cpp index 90953e3b814dd2..cac9e2dce3146e 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.cpp +++ b/src/app/clusters/icd-management-server/icd-management-server.cpp @@ -36,6 +36,8 @@ using namespace chip::app::Clusters::IcdManagement; using namespace Protocols; using namespace chip::Access; +using chip::Protocols::InteractionModel::Status; + namespace { /** diff --git a/src/app/clusters/icd-management-server/icd-management-server.h b/src/app/clusters/icd-management-server/icd-management-server.h index 308d50859d2d4b..0763f4863d1f0b 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.h +++ b/src/app/clusters/icd-management-server/icd-management-server.h @@ -29,8 +29,6 @@ #include #include -using chip::Protocols::InteractionModel::Status; - class ICDManagementServer { public: @@ -46,14 +44,16 @@ class ICDManagementServer * ICDConfigurationData If function fails, icdCounter will be unchanged * @return Status */ - Status RegisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::IcdManagement::Commands::RegisterClient::DecodableType & commandData, - uint32_t & icdCounter); + chip::Protocols::InteractionModel::Status + RegisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::IcdManagement::Commands::RegisterClient::DecodableType & commandData, + uint32_t & icdCounter); - Status UnregisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::DecodableType & commandData); + chip::Protocols::InteractionModel::Status + UnregisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::DecodableType & commandData); - Status StayActiveRequest(chip::FabricIndex fabricIndex); + chip::Protocols::InteractionModel::Status StayActiveRequest(chip::FabricIndex fabricIndex); private: /** 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 c3107015ca6f0c..7a3d47f823c409 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 @@ -82,12 +82,12 @@ LaundryDryerControlsServer & LaundryDryerControlsServer::Instance() return sInstance; } -EmberAfStatus LaundryDryerControlsServer::SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel) +Status LaundryDryerControlsServer::SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel) { DataModel::Nullable selectedDrynessLevel; - EmberAfStatus res = SelectedDrynessLevel::Get(endpointId, selectedDrynessLevel); + Status res = SelectedDrynessLevel::Get(endpointId, selectedDrynessLevel); - if ((res == EMBER_ZCL_STATUS_SUCCESS) && (selectedDrynessLevel != newSelectedDrynessLevel)) + if ((res == Status::Success) && (selectedDrynessLevel != newSelectedDrynessLevel)) { res = SelectedDrynessLevel::Set(endpointId, newSelectedDrynessLevel); } @@ -95,8 +95,8 @@ EmberAfStatus LaundryDryerControlsServer::SetSelectedDrynessLevel(EndpointId end return res; } -EmberAfStatus LaundryDryerControlsServer::GetSelectedDrynessLevel(EndpointId endpointId, - DataModel::Nullable & selectedDrynessLevel) +Status LaundryDryerControlsServer::GetSelectedDrynessLevel(EndpointId endpointId, + DataModel::Nullable & selectedDrynessLevel) { return SelectedDrynessLevel::Get(endpointId, selectedDrynessLevel); } diff --git a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h index 454c029e21fc52..5a7123c0ee78e0 100644 --- a/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h +++ b/src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -46,8 +47,9 @@ class LaundryDryerControlsServer : public AttributeAccessInterface /** * API to set/get the SelectedDrynessLevel attribute */ - EmberAfStatus SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel); - EmberAfStatus GetSelectedDrynessLevel(EndpointId endpointId, DataModel::Nullable & selectedDrynessLevel); + Protocols::InteractionModel::Status SetSelectedDrynessLevel(EndpointId endpointId, DrynessLevelEnum newSelectedDrynessLevel); + Protocols::InteractionModel::Status GetSelectedDrynessLevel(EndpointId endpointId, + DataModel::Nullable & selectedDrynessLevel); private: CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; 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 cc8d7100e07367..4e58236e9b2cad 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 @@ -81,11 +81,11 @@ LaundryWasherControlsServer & LaundryWasherControlsServer::Instance() return sInstance; } -EmberAfStatus LaundryWasherControlsServer::SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent) +Status LaundryWasherControlsServer::SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent) { DataModel::Nullable spinSpeedCurrentNow; - EmberAfStatus res = SpinSpeedCurrent::Get(endpointId, spinSpeedCurrentNow); - if ((res == EMBER_ZCL_STATUS_SUCCESS) && (spinSpeedCurrentNow != spinSpeedCurrent)) + Status res = SpinSpeedCurrent::Get(endpointId, spinSpeedCurrentNow); + if ((res == Status::Success) && (spinSpeedCurrentNow != spinSpeedCurrent)) { res = SpinSpeedCurrent::Set(endpointId, spinSpeedCurrent); } @@ -93,18 +93,17 @@ EmberAfStatus LaundryWasherControlsServer::SetSpinSpeedCurrent(EndpointId endpoi return res; } -EmberAfStatus LaundryWasherControlsServer::GetSpinSpeedCurrent(EndpointId endpointId, - DataModel::Nullable & spinSpeedCurrent) +Status LaundryWasherControlsServer::GetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable & spinSpeedCurrent) { return SpinSpeedCurrent::Get(endpointId, spinSpeedCurrent); } -EmberAfStatus LaundryWasherControlsServer::SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses) +Status LaundryWasherControlsServer::SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses) { NumberOfRinsesEnum numberOfRinses; - EmberAfStatus res = NumberOfRinses::Get(endpointId, &numberOfRinses); + Status res = NumberOfRinses::Get(endpointId, &numberOfRinses); - if ((res == EMBER_ZCL_STATUS_SUCCESS) && (numberOfRinses != newNumberOfRinses)) + if ((res == Status::Success) && (numberOfRinses != newNumberOfRinses)) { res = NumberOfRinses::Set(endpointId, newNumberOfRinses); } @@ -112,7 +111,7 @@ EmberAfStatus LaundryWasherControlsServer::SetNumberOfRinses(EndpointId endpoint return res; } -EmberAfStatus LaundryWasherControlsServer::GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses) +Status LaundryWasherControlsServer::GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses) { return NumberOfRinses::Get(endpointId, &numberOfRinses); } diff --git a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h index f01069135b3e7c..c19b6f88518bf8 100644 --- a/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h +++ b/src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h @@ -22,6 +22,8 @@ #include #include +#include + namespace chip { namespace app { namespace Clusters { @@ -48,14 +50,14 @@ class LaundryWasherControlsServer : public AttributeAccessInterface /** * API to set/get the SpinSpeedCurrent attribute */ - EmberAfStatus SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent); - EmberAfStatus GetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable & spinSpeedCurrent); + Protocols::InteractionModel::Status SetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable spinSpeedCurrent); + Protocols::InteractionModel::Status GetSpinSpeedCurrent(EndpointId endpointId, DataModel::Nullable & spinSpeedCurrent); /** * API to set/get the NumberOfRinses attribute */ - EmberAfStatus SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses); - EmberAfStatus GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses); + Protocols::InteractionModel::Status SetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum newNumberOfRinses); + Protocols::InteractionModel::Status GetNumberOfRinses(EndpointId endpointId, NumberOfRinsesEnum & numberOfRinses); private: CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index b1edc341cdd3cc..b04d32fe69c448 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -161,12 +161,12 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; app::DataModel::Nullable level; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == Attributes::CurrentLevel::Get(endpoint, level), CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Status::Success == Attributes::CurrentLevel::Get(endpoint, level), CHIP_ERROR_READ_FAILED); AttributeValuePair pairs[kLevelMaxScenableAttributes]; uint8_t maxLevel; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == Attributes::MaxLevel::Get(endpoint, &maxLevel), CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Status::Success == Attributes::MaxLevel::Get(endpoint, &maxLevel), CHIP_ERROR_READ_FAILED); pairs[0].attributeID = Attributes::CurrentLevel::Id; if (!level.IsNull()) @@ -181,8 +181,7 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)) { uint16_t frequency; - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == Attributes::CurrentFrequency::Get(endpoint, &frequency), - CHIP_ERROR_READ_FAILED); + VerifyOrReturnError(Status::Success == Attributes::CurrentFrequency::Get(endpoint, &frequency), CHIP_ERROR_READ_FAILED); pairs[attributeCount].attributeID = Attributes::CurrentFrequency::Id; pairs[attributeCount].attributeValue = frequency; attributeCount++; @@ -337,10 +336,10 @@ static EmberAfLevelControlState * getState(EndpointId endpoint) static void reallyUpdateCoupledColorTemp(EndpointId endpoint) { LevelControl::Attributes::Options::TypeInfo::Type options; - EmberAfStatus status = Attributes::Options::Get(endpoint, &options); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Options::Get(endpoint, &options); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", to_underlying(status)); return; } @@ -357,7 +356,7 @@ static void reallyUpdateCoupledColorTemp(EndpointId endpoint) void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) { EmberAfLevelControlState * state = getState(endpoint); - EmberAfStatus status; + Status status; app::DataModel::Nullable currentLevel; const auto callbackStartTimestamp = System::SystemClock().GetMonotonicTimestamp(); @@ -371,9 +370,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) // Read the attribute; print error message and return if it can't be read status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS || currentLevel.IsNull()) + if (status != Status::Success || currentLevel.IsNull()) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); writeRemainingTime(endpoint, 0); return; @@ -404,9 +403,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) ChipLogDetail(Zcl, "(diff %c1)", state->increasing ? '+' : '-'); status = Attributes::CurrentLevel::Set(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing current level %x", status); + ChipLogProgress(Zcl, "ERR: writing current level %x", to_underlying(status)); state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); writeRemainingTime(endpoint, 0); return; @@ -427,9 +426,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) { uint8_t storedLevel8u = (uint8_t) state->storedLevel; status = Attributes::CurrentLevel::Set(endpoint, storedLevel8u); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing current level %x", status); + ChipLogProgress(Zcl, "ERR: writing current level %x", to_underlying(status)); } else { @@ -469,10 +468,10 @@ static void writeRemainingTime(EndpointId endpoint, uint16_t remainingTimeMs) // This is done to ensure that the attribute, in tenths of a second, only // goes to zero when the remaining time in milliseconds is actually zero. uint16_t remainingTimeDs = static_cast((remainingTimeMs + 99) / 100); - EmberAfStatus status = LevelControl::Attributes::RemainingTime::Set(endpoint, remainingTimeDs); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = LevelControl::Attributes::RemainingTime::Set(endpoint, remainingTimeDs); + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing remaining time %x", status); + ChipLogProgress(Zcl, "ERR: writing remaining time %x", to_underlying(status)); } } #endif // IGNORE_LEVEL_CONTROL_CLUSTER_LEVEL_CONTROL_REMAINING_TIME @@ -515,19 +514,19 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, chip::O } LevelControl::Attributes::Options::TypeInfo::Type options; - EmberAfStatus status = Attributes::Options::Get(endpoint, &options); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Options::Get(endpoint, &options); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read Options attribute: 0x%X", to_underlying(status)); // If we can't read the attribute, then we should just assume that it has its // default value. } bool on; status = OnOff::Attributes::OnOff::Get(endpoint, &on); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Unable to read OnOff attribute: 0x%X", status); + ChipLogProgress(Zcl, "Unable to read OnOff attribute: 0x%X", to_underlying(status)); return true; } // The device is on - hence ExecuteIfOff does not matter @@ -803,10 +802,10 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 // Cancel any currently active command before fiddling with the state. cancelEndpointTimerCallback(endpoint); - EmberAfStatus status = Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::CurrentLevel::Get(endpoint, currentLevel); + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return status; } @@ -869,9 +868,9 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 { uint16_t onOffTransitionTime = 0; status = Attributes::OnOffTransitionTime::Get(endpoint, &onOffTransitionTime); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on/off transition time %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off transition time %x", to_underlying(status)); return status; } @@ -1243,7 +1242,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new app::DataModel::Nullable transitionTime; uint16_t currentOnOffTransitionTime; - EmberAfStatus status; + Status status; bool useOnLevel = false; EmberAfLevelControlState * state = getState(endpoint); @@ -1257,9 +1256,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new // "Temporarily store CurrentLevel." status = Attributes::CurrentLevel::Get(endpoint, temporaryCurrentLevelCache); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return; } @@ -1273,9 +1272,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new if (emberAfContainsAttribute(endpoint, LevelControl::Id, Attributes::OnLevel::Id)) { status = Attributes::OnLevel::Get(endpoint, resolvedLevel); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on level %x", status); + ChipLogProgress(Zcl, "ERR: reading on level %x", to_underlying(status)); return; } @@ -1302,9 +1301,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new if (emberAfContainsAttribute(endpoint, LevelControl::Id, Attributes::OnOffTransitionTime::Id)) { status = Attributes::OnOffTransitionTime::Get(endpoint, ¤tOnOffTransitionTime); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return; } transitionTime.SetNonNull(currentOnOffTransitionTime); @@ -1322,9 +1321,9 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new // If newValue is OnOff::Commands::On::Id... // "Set CurrentLevel to minimum level allowed for the device." status = Attributes::CurrentLevel::Set(endpoint, minimumLevelAllowedForTheDevice); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading current level %x", status); + ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); return; } @@ -1386,8 +1385,8 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) } app::DataModel::Nullable currentLevel; - EmberAfStatus status = Attributes::CurrentLevel::Get(endpoint, currentLevel); - if (status == EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::CurrentLevel::Get(endpoint, currentLevel); + if (status == Status::Success) { #ifndef IGNORE_LEVEL_CONTROL_CLUSTER_START_UP_CURRENT_LEVEL // StartUp behavior relies StartUpCurrentLevel attributes being Non Volatile. @@ -1408,7 +1407,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) app::DataModel::Nullable startUpCurrentLevel; status = Attributes::StartUpCurrentLevel::Get(endpoint, startUpCurrentLevel); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { if (!startUpCurrentLevel.IsNull()) { @@ -1480,7 +1479,7 @@ bool LevelControlHasFeature(EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } diff --git a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp index 144665b1c03b19..88283325c7c380 100644 --- a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp +++ b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -37,6 +38,8 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::LocalizationConfiguration; using namespace chip::app::Clusters::LocalizationConfiguration::Attributes; +using chip::Protocols::InteractionModel::Status; + namespace { class LocalizationConfigurationAttrAccess : public AttributeAccessInterface @@ -163,9 +166,10 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi { char outBuf[Attributes::ActiveLocale::TypeInfo::MaxLength()]; MutableCharSpan activeLocale(outBuf); - EmberAfStatus status = ActiveLocale::Get(endpoint, activeLocale); + Status status = ActiveLocale::Get(endpoint, activeLocale); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(Zcl, "Failed to read ActiveLocale with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to read ActiveLocale with error: 0x%02x", to_underlying(status))); DeviceLayer::DeviceInfoProvider * provider = DeviceLayer::GetDeviceInfoProvider(); @@ -208,8 +212,8 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi { // If initial value is not one of the allowed values, write the valid value it. status = ActiveLocale::Set(endpoint, validLocale); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write active locale with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write active locale with error: 0x%02x", to_underlying(status))); } } } diff --git a/src/app/clusters/media-input-server/media-input-server.cpp b/src/app/clusters/media-input-server/media-input-server.cpp index 02b114c648b2fd..3fe13985b1ff06 100644 --- a/src/app/clusters/media-input-server/media-input-server.cpp +++ b/src/app/clusters/media-input-server/media-input-server.cpp @@ -92,8 +92,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } 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 e2a25904bd770a..f8d99474b24c9c 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -136,8 +136,8 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) // attribute are listed below. DataModel::Nullable startUpMode; - EmberAfStatus status = Attributes::StartUpMode::Get(endpointId, startUpMode); - if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpMode.IsNull()) + Status status = Attributes::StartUpMode::Get(endpointId, startUpMode); + if (status == Status::Success && !startUpMode.IsNull()) { #ifdef MATTER_DM_PLUGIN_ON_OFF // OnMode with Power Up @@ -150,9 +150,9 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) { Attributes::OnMode::TypeInfo::Type onMode; bool onOffValueForStartUp = false; - if (Attributes::OnMode::Get(endpointId, onMode) == EMBER_ZCL_STATUS_SUCCESS && + if (Attributes::OnMode::Get(endpointId, onMode) == Status::Success && !emberAfIsKnownVolatileAttribute(endpointId, OnOff::Id, OnOff::Attributes::StartUpOnOff::Id) && - OnOffServer::Instance().getOnOffValueForStartUp(endpointId, onOffValueForStartUp) == EMBER_ZCL_STATUS_SUCCESS) + OnOffServer::Instance().getOnOffValueForStartUp(endpointId, onOffValueForStartUp) == Status::Success) { if (onOffValueForStartUp && !onMode.IsNull()) { @@ -182,12 +182,12 @@ void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) uint8_t currentMode = 0; status = Attributes::CurrentMode::Get(endpointId, ¤tMode); - if ((status == EMBER_ZCL_STATUS_SUCCESS) && (startUpMode.Value() != currentMode)) + if ((status == Status::Success) && (startUpMode.Value() != currentMode)) { status = Attributes::CurrentMode::Set(endpointId, startUpMode.Value()); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogError(Zcl, "ModeSelect: Error initializing CurrentMode, EmberAfStatus code 0x%02x", status); + ChipLogError(Zcl, "ModeSelect: Error initializing CurrentMode, Status code 0x%02x", to_underlying(status)); } else { 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 e5c7ae43fb188e..ac1c4a0c3bf3c6 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT @@ -151,10 +152,10 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl bool currentValue; // read current on/off value - EmberAfStatus status = Attributes::OnOff::Get(endpoint, ¤tValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::OnOff::Get(endpoint, ¤tValue); + if (status != Status::Success) { - ChipLogError(Zcl, "ERR: reading on/off %x", status); + ChipLogError(Zcl, "ERR: reading on/off %x", to_underlying(status)); return CHIP_ERROR_READ_FAILED; } @@ -311,18 +312,18 @@ bool OnOffServer::HasFeature(chip::EndpointId endpoint, Feature feature) { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } -EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue) +Status OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue) { // read current on/off value - EmberAfStatus status = Attributes::OnOff::Get(endpoint, currentOnOffValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::OnOff::Get(endpoint, currentOnOffValue); + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on/off %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off %x", to_underlying(status)); } ChipLogProgress(Zcl, "On/Off ep%d value: %d", endpoint, *currentOnOffValue); @@ -339,17 +340,17 @@ EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * curre * @param command Ver.: always * @param initiatedByLevelChange Ver.: always */ -EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange) +Status OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange) { MATTER_TRACE_SCOPE("setOnOffValue", "OnOff"); - EmberAfStatus status; + Status status; bool currentValue, newValue; // read current on/off value status = Attributes::OnOff::Get(endpoint, ¤tValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: reading on/off %x", status); + ChipLogProgress(Zcl, "ERR: reading on/off %x", to_underlying(status)); return status; } @@ -357,7 +358,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman if ((!currentValue && command == Commands::Off::Id) || (currentValue && command == Commands::On::Id)) { ChipLogProgress(Zcl, "Endpoint %x On/off already set to new value", endpoint); - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } // we either got a toggle, or an on when off, or an off when on, @@ -396,9 +397,9 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman // write the new on/off value status = Attributes::OnOff::Set(endpoint, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing on/off %x", status); + ChipLogProgress(Zcl, "ERR: writing on/off %x", to_underlying(status)); return status; } @@ -416,7 +417,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman emberAfContainsAttribute(endpoint, ModeSelect::Id, ModeSelect::Attributes::OnMode::Id)) { ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; - if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == EMBER_ZCL_STATUS_SUCCESS && !onMode.IsNull()) + if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == Status::Success && !onMode.IsNull()) { ChipLogProgress(Zcl, "Changing Current Mode to %x", onMode.Value()); status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); @@ -442,9 +443,9 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman { // write the new on/off value status = Attributes::OnOff::Set(endpoint, newValue); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "ERR: writing on/off %x", status); + ChipLogProgress(Zcl, "ERR: writing on/off %x", to_underlying(status)); return status; } @@ -466,7 +467,7 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, chip::Comman // The returned status is based solely on the On/Off cluster. Errors in the // Level Control and/or Scenes cluster are ignored. - return EMBER_ZCL_STATUS_SUCCESS; + return Status::Success; } void OnOffServer::initOnOffServer(chip::EndpointId endpoint) @@ -494,8 +495,8 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) // null Set the OnOff attribute to its previous value. bool onOffValueForStartUp = false; - EmberAfStatus status = getOnOffValueForStartUp(endpoint, onOffValueForStartUp); - if (status == EMBER_ZCL_STATUS_SUCCESS) + Status status = getOnOffValueForStartUp(endpoint, onOffValueForStartUp); + if (status == Status::Success) { status = setOnOffValue(endpoint, onOffValueForStartUp, true); } @@ -512,7 +513,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) emberAfContainsAttribute(endpoint, ModeSelect::Id, ModeSelect::Attributes::OnMode::Id)) { ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; - if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == EMBER_ZCL_STATUS_SUCCESS && !onMode.IsNull()) + if (ModeSelect::Attributes::OnMode::Get(endpoint, onMode) == Status::Success && !onMode.IsNull()) { ChipLogProgress(Zcl, "Changing Current Mode to %x", onMode.Value()); status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); @@ -532,16 +533,16 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) * @param endpoint Ver.: always * @param onOffValueForStartUp Ver.: always */ -EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp) +Status OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp) { app::DataModel::Nullable startUpOnOff; - EmberAfStatus status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff); - if (status == EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff); + if (status == Status::Success) { // Initialise updated value to 0 bool updatedOnOff = false; status = Attributes::OnOff::Get(endpoint, &updatedOnOff); - if (status == EMBER_ZCL_STATUS_SUCCESS) + if (status == Status::Success) { if (!startUpOnOff.IsNull()) { @@ -570,7 +571,7 @@ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bo bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { MATTER_TRACE_SCOPE("OffCommand", "OnOff"); - EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Off::Id, false); + Status status = setOnOffValue(commandPath.mEndpointId, Commands::Off::Id, false); commandObj->AddStatus(commandPath, status); return true; @@ -579,7 +580,7 @@ bool OnOffServer::offCommand(app::CommandHandler * commandObj, const app::Concre bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { MATTER_TRACE_SCOPE("OnCommand", "OnOff"); - EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::On::Id, false); + Status status = setOnOffValue(commandPath.mEndpointId, Commands::On::Id, false); commandObj->AddStatus(commandPath, status); return true; @@ -588,7 +589,7 @@ bool OnOffServer::onCommand(app::CommandHandler * commandObj, const app::Concret bool OnOffServer::toggleCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath) { MATTER_TRACE_SCOPE("ToggleCommand", "OnOff"); - EmberAfStatus status = setOnOffValue(commandPath.mEndpointId, Commands::Toggle::Id, false); + Status status = setOnOffValue(commandPath.mEndpointId, Commands::Toggle::Id, false); commandObj->AddStatus(commandPath, status); return true; diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index 26e62fb2ea1a73..2cb5b62958a6c7 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -24,6 +24,7 @@ #include #include #include +#include /********************************************************** * Defines and Macros @@ -61,9 +62,10 @@ class OnOffServer bool OnWithTimedOffCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::OnOff::Commands::OnWithTimedOff::DecodableType & commandData); void updateOnOffTimeCommand(chip::EndpointId endpoint); - EmberAfStatus getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue); - EmberAfStatus setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, bool initiatedByLevelChange); - EmberAfStatus getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp); + chip::Protocols::InteractionModel::Status getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue); + chip::Protocols::InteractionModel::Status setOnOffValue(chip::EndpointId endpoint, chip::CommandId command, + bool initiatedByLevelChange); + chip::Protocols::InteractionModel::Status getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp); bool HasFeature(chip::EndpointId endpoint, Feature feature); inline bool SupportsLightingApplications(chip::EndpointId endpointId) { return HasFeature(endpointId, Feature::kLighting); } diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestor.h b/src/app/clusters/ota-requestor/DefaultOTARequestor.h index e0e45c2709af2e..025dc66975d8b3 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestor.h +++ b/src/app/clusters/ota-requestor/DefaultOTARequestor.h @@ -136,7 +136,7 @@ class DefaultOTARequestor : public OTARequestorInterface, public BDXDownloader:: chip::Messaging::SendFlags sendFlags; if (!event.msgTypeData.HasMessageType(chip::bdx::MessageType::BlockAckEOF) && - !event.msgTypeData.HasMessageType(chip::Protocols::SecureChannel::MsgType::StatusReport)) + !event.msgTypeData.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport)) { sendFlags.Set(chip::Messaging::SendMessageFlags::kExpectResponse); } @@ -162,7 +162,7 @@ class DefaultOTARequestor : public OTARequestorInterface, public BDXDownloader:: mDownloader->OnMessageReceived(payloadHeader, std::move(payload)); // For a receiver using BDX Protocol, all received messages will require a response except for a StatusReport - if (!payloadHeader.HasMessageType(chip::Protocols::SecureChannel::MsgType::StatusReport)) + if (!payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport)) { ec->WillSendMessage(); } diff --git a/src/app/clusters/ota-requestor/ota-requestor-server.cpp b/src/app/clusters/ota-requestor/ota-requestor-server.cpp index b5611b7d57c70f..8f5d1326aaf70a 100644 --- a/src/app/clusters/ota-requestor/ota-requestor-server.cpp +++ b/src/app/clusters/ota-requestor/ota-requestor-server.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -147,54 +148,54 @@ CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::WriteDefaultOtaProviders(const // ----------------------------------------------------------------------------- // Global functions -EmberAfStatus OtaRequestorServerSetUpdateState(OTAUpdateStateEnum value) +Status OtaRequestorServerSetUpdateState(OTAUpdateStateEnum value) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; // Find all endpoints that have OtaSoftwareUpdateRequestor implemented for (auto endpoint : EnabledEndpointsWithServerCluster(OtaSoftwareUpdateRequestor::Id)) { OTAUpdateStateEnum currentValue; status = Attributes::UpdateState::Get(endpoint, ¤tValue); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); if (currentValue != value) { status = Attributes::UpdateState::Set(endpoint, value); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); } } return status; } -EmberAfStatus OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, OTAUpdateStateEnum & value) +Status OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, OTAUpdateStateEnum & value) { return Attributes::UpdateState::Get(endpointId, &value); } -EmberAfStatus OtaRequestorServerSetUpdateStateProgress(app::DataModel::Nullable value) +Status OtaRequestorServerSetUpdateStateProgress(app::DataModel::Nullable value) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; // Find all endpoints that have OtaSoftwareUpdateRequestor implemented for (auto endpoint : EnabledEndpointsWithServerCluster(OtaSoftwareUpdateRequestor::Id)) { app::DataModel::Nullable currentValue; status = Attributes::UpdateStateProgress::Get(endpoint, currentValue); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); if (currentValue != value) { status = Attributes::UpdateStateProgress::Set(endpoint, value); - VerifyOrDie(EMBER_ZCL_STATUS_SUCCESS == status); + VerifyOrDie(Status::Success == status); } } return status; } -EmberAfStatus OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, DataModel::Nullable & value) +Status OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, DataModel::Nullable & value) { return Attributes::UpdateStateProgress::Get(endpointId, value); } diff --git a/src/app/clusters/ota-requestor/ota-requestor-server.h b/src/app/clusters/ota-requestor/ota-requestor-server.h index 323cb7b49c241e..b8874aa00109f5 100644 --- a/src/app/clusters/ota-requestor/ota-requestor-server.h +++ b/src/app/clusters/ota-requestor/ota-requestor-server.h @@ -19,13 +19,16 @@ #pragma once #include +#include -EmberAfStatus OtaRequestorServerSetUpdateState(chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value); -EmberAfStatus OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, - chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum & value); -EmberAfStatus OtaRequestorServerSetUpdateStateProgress(chip::app::DataModel::Nullable value); -EmberAfStatus OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, - chip::app::DataModel::Nullable & value); +chip::Protocols::InteractionModel::Status +OtaRequestorServerSetUpdateState(chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value); +chip::Protocols::InteractionModel::Status +OtaRequestorServerGetUpdateState(chip::EndpointId endpointId, + chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum & value); +chip::Protocols::InteractionModel::Status OtaRequestorServerSetUpdateStateProgress(chip::app::DataModel::Nullable value); +chip::Protocols::InteractionModel::Status OtaRequestorServerGetUpdateStateProgress(chip::EndpointId endpointId, + chip::app::DataModel::Nullable & value); void OtaRequestorServerOnStateTransition(chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum previousState, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum newState, 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 a7fd3ed7d64c5f..620e113177c1c7 100644 --- a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp +++ b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.cpp @@ -40,12 +40,12 @@ RefrigeratorAlarmServer & RefrigeratorAlarmServer::Instance() return instance; } -EmberAfStatus RefrigeratorAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) +Status RefrigeratorAlarmServer::GetMaskValue(EndpointId endpoint, BitMask * mask) { - EmberAfStatus status = Attributes::Mask::Get(endpoint, mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Mask::Get(endpoint, mask); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading mask, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading mask, err:0x%x", to_underlying(status)); } else { @@ -55,12 +55,12 @@ EmberAfStatus RefrigeratorAlarmServer::GetMaskValue(EndpointId endpoint, BitMask return status; } -EmberAfStatus RefrigeratorAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) +Status RefrigeratorAlarmServer::GetStateValue(EndpointId endpoint, BitMask * state) { - EmberAfStatus status = Attributes::State::Get(endpoint, state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::State::Get(endpoint, state); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", to_underlying(status)); } else { @@ -70,12 +70,12 @@ EmberAfStatus RefrigeratorAlarmServer::GetStateValue(EndpointId endpoint, BitMas return status; } -EmberAfStatus RefrigeratorAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) +Status RefrigeratorAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask * supported) { - EmberAfStatus status = Attributes::Supported::Get(endpoint, supported); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Attributes::Supported::Get(endpoint, supported); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading supported, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading supported, err:0x%x", to_underlying(status)); } else { @@ -85,13 +85,13 @@ EmberAfStatus RefrigeratorAlarmServer::GetSupportedValue(EndpointId endpoint, Bi return status; } -EmberAfStatus RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) +Status RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask mask) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - status = Attributes::Mask::Set(endpoint, mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Status::Success; + status = Attributes::Mask::Set(endpoint, mask); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing mask, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing mask, err:0x%x", to_underlying(status)); return status; } @@ -100,7 +100,7 @@ EmberAfStatus RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const B // Whenever there is change in Mask, State should change accordingly. BitMask state; status = GetStateValue(endpoint, &state); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -113,22 +113,22 @@ EmberAfStatus RefrigeratorAlarmServer::SetMaskValue(EndpointId endpoint, const B return status; } -EmberAfStatus RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMask newState) +Status RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMask newState) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; BitMask currentState; status = Attributes::State::Get(endpoint, ¤tState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: reading state, err:0x%x", to_underlying(status)); return status; } status = Attributes::State::Set(endpoint, newState); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing state, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing state, err:0x%x", to_underlying(status)); return status; } @@ -143,7 +143,7 @@ EmberAfStatus RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMas BitMask mask; status = GetMaskValue(endpoint, &mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } @@ -152,13 +152,13 @@ EmberAfStatus RefrigeratorAlarmServer::SetStateValue(EndpointId endpoint, BitMas return status; } -EmberAfStatus RefrigeratorAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) +Status RefrigeratorAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMask supported) { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - status = Attributes::Supported::Set(endpoint, supported); - if (status != EMBER_ZCL_STATUS_SUCCESS) + Status status = Status::Success; + status = Attributes::Supported::Set(endpoint, supported); + if (status != Status::Success) { - ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing supported, err:0x%x", status); + ChipLogProgress(Zcl, "Refrigerator Alarm: ERR: writing supported, err:0x%x", to_underlying(status)); return status; } @@ -167,7 +167,7 @@ EmberAfStatus RefrigeratorAlarmServer::SetSupportedValue(EndpointId endpoint, co // Whenever there is change in Supported attribute, Mask, State should change accordingly. BitMask mask; status = GetMaskValue(endpoint, &mask); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != Status::Success) { return status; } diff --git a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h index 1ed6023a9dbeab..65df99d82bb2c0 100644 --- a/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h +++ b/src/app/clusters/refrigerator-alarm-server/refrigerator-alarm-server.h @@ -23,28 +23,31 @@ #include #include #include +#include class RefrigeratorAlarmServer { public: static RefrigeratorAlarmServer & Instance(); - EmberAfStatus GetMaskValue(chip::EndpointId endpoint, chip::BitMask * mask); - EmberAfStatus GetStateValue(chip::EndpointId endpoint, chip::BitMask * state); - EmberAfStatus GetSupportedValue(chip::EndpointId endpoint, - chip::BitMask * suppported); + chip::Protocols::InteractionModel::Status GetMaskValue(chip::EndpointId endpoint, + chip::BitMask * mask); + chip::Protocols::InteractionModel::Status + GetStateValue(chip::EndpointId endpoint, chip::BitMask * state); + chip::Protocols::InteractionModel::Status + GetSupportedValue(chip::EndpointId endpoint, chip::BitMask * suppported); // A change in mask value will result in a corresponding change in state. - EmberAfStatus SetMaskValue(chip::EndpointId endpoint, - const chip::BitMask mask); + chip::Protocols::InteractionModel::Status + SetMaskValue(chip::EndpointId endpoint, const chip::BitMask mask); // When State changes we are generating Notify event. - EmberAfStatus SetStateValue(chip::EndpointId endpoint, - chip::BitMask newState); + chip::Protocols::InteractionModel::Status + SetStateValue(chip::EndpointId endpoint, chip::BitMask newState); // A change in supported value will result in a corresponding change in mask and state. - EmberAfStatus SetSupportedValue(chip::EndpointId endpoint, - const chip::BitMask supported); + chip::Protocols::InteractionModel::Status + SetSupportedValue(chip::EndpointId endpoint, const chip::BitMask supported); private: static RefrigeratorAlarmServer instance; diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h index da17d36f0d2c3d..8cdc74f34c1b0d 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.h @@ -91,10 +91,10 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface bool HasFeature(ResourceMonitoring::Feature aFeature) const; // Attribute setters - chip::Protocols::InteractionModel::Status UpdateCondition(uint8_t aNewCondition); - chip::Protocols::InteractionModel::Status UpdateChangeIndication(ChangeIndicationEnum aNewChangeIndication); - chip::Protocols::InteractionModel::Status UpdateInPlaceIndicator(bool aNewInPlaceIndicator); - chip::Protocols::InteractionModel::Status UpdateLastChangedTime(DataModel::Nullable aNewLastChangedTime); + Protocols::InteractionModel::Status UpdateCondition(uint8_t aNewCondition); + Protocols::InteractionModel::Status UpdateChangeIndication(ChangeIndicationEnum aNewChangeIndication); + Protocols::InteractionModel::Status UpdateInPlaceIndicator(bool aNewInPlaceIndicator); + Protocols::InteractionModel::Status UpdateLastChangedTime(DataModel::Nullable aNewLastChangedTime); void SetReplacementProductListManagerInstance(ReplacementProductListManager * instance); @@ -196,7 +196,7 @@ class Delegate * @return Status::Success If the command was handled successfully. * @return All Other PreResetCondition() or PostResetCondition() failed, these are application specific. */ - virtual chip::Protocols::InteractionModel::Status OnResetCondition(); + virtual Protocols::InteractionModel::Status OnResetCondition(); /** * This method may be overwritten by the SDK User, if the SDK User wants to do something before the reset. @@ -206,7 +206,7 @@ class Delegate * @return Status::Success All good, the reset may proceed. * @return All Other The reset should not proceed. The reset command will fail. */ - virtual chip::Protocols::InteractionModel::Status PreResetCondition(); + virtual Protocols::InteractionModel::Status PreResetCondition(); /** * This method may be overwritten by the SDK User, if the SDK User wants to do something after the reset. @@ -217,7 +217,7 @@ class Delegate * @return All Other Something went wrong. The attributes will already be updated. But the reset command will report * the failure. */ - virtual chip::Protocols::InteractionModel::Status PostResetCondition(); + virtual Protocols::InteractionModel::Status PostResetCondition(); }; } // namespace ResourceMonitoring diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 330d7eb0bd4523..a62427dfffadda 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -41,6 +41,7 @@ using GroupDataProvider = chip::Credentials::GroupDataProvider; using SceneTable = chip::scenes::SceneTable; using AuthMode = chip::Access::AuthMode; using ScenesServer = chip::app::Clusters::ScenesManagement::ScenesServer; +using chip::Protocols::InteractionModel::Status; namespace chip { namespace app { @@ -74,14 +75,14 @@ CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, Res return err; } -/// @brief Generate and add a response to a command handler context depending on an EmberAfStatus +/// @brief Generate and add a response to a command handler context depending on an InteractionModel::Status /// @tparam ResponseType Type of response, depends on the command /// @param ctx Command Handler context where to add reponse /// @param resp Response to add in ctx /// @param status Status to verify -/// @return EmberAfStatus -> CHIP_ERROR +/// @return InteractionModel::Status -> CHIP_ERROR template -CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, ResponseType & resp, EmberAfStatus status) +CHIP_ERROR AddResponseOnError(CommandHandlerInterface::HandlerContext & ctx, ResponseType & resp, Status status) { return AddResponseOnError(ctx, resp, StatusIB(status).ToChipError()); } @@ -90,7 +91,7 @@ template CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) { Access::SubjectDescriptor descriptor = ctx.mCommandHandler.GetSubjectDescriptor(); - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + Status status = Status::Success; if (AuthMode::kCase == descriptor.authMode) { @@ -102,7 +103,7 @@ CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) } // LastConfiguredBy is optional, so we don't want to fail the command if it fails to update - VerifyOrReturnValue(!(EMBER_ZCL_STATUS_SUCCESS == status || EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status), CHIP_NO_ERROR); + VerifyOrReturnValue(!(Status::Success == status || Status::UnsupportedAttribute == status), CHIP_NO_ERROR); return AddResponseOnError(ctx, resp, status); } @@ -1108,8 +1109,8 @@ using namespace chip::app::Clusters::ScenesManagement; void emberAfScenesManagementClusterServerInitCallback(EndpointId endpoint) { - EmberAfStatus status = Attributes::LastConfiguredBy::SetNull(endpoint); - if (EMBER_ZCL_STATUS_SUCCESS != status) + Status status = Attributes::LastConfiguredBy::SetNull(endpoint); + if (Status::Success != status) { ChipLogDetail(Zcl, "ERR: setting LastConfiguredBy on Endpoint %hu Status: %x", endpoint, status); } diff --git a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp index 2d5ae5fe2a2480..5b3da157d515e2 100644 --- a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp +++ b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp @@ -467,11 +467,11 @@ void SmokeCoAlarmServer::SendEvent(EndpointId endpointId, T & event) template bool SmokeCoAlarmServer::GetAttribute(EndpointId endpointId, AttributeId attributeId, - EmberAfStatus (*getFn)(EndpointId endpointId, T * value), T & value) const + Status (*getFn)(EndpointId endpointId, T * value), T & value) const { - EmberAfStatus status = getFn(endpointId, &value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); - bool unsupportedStatus = (EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status); + Status status = getFn(endpointId, &value); + bool success = (Status::Success == status); + bool unsupportedStatus = (Status::UnsupportedAttribute == status); if (unsupportedStatus) { @@ -487,10 +487,10 @@ bool SmokeCoAlarmServer::GetAttribute(EndpointId endpointId, AttributeId attribu template bool SmokeCoAlarmServer::SetAttribute(EndpointId endpointId, AttributeId attributeId, - EmberAfStatus (*setFn)(EndpointId endpointId, T value), T value) + Status (*setFn)(EndpointId endpointId, T value), T value) { - EmberAfStatus status = setFn(endpointId, value); - bool success = (EMBER_ZCL_STATUS_SUCCESS == status); + Status status = setFn(endpointId, value); + bool success = (Status::Success == status); if (!success) { diff --git a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h index 37bd1f6bd11a83..42efc49ee8e092 100644 --- a/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h +++ b/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.h @@ -26,6 +26,7 @@ #include #include #include +#include /** * @brief Smoke CO Alarm Server Plugin class @@ -139,7 +140,7 @@ class SmokeCoAlarmServer */ template bool GetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; + chip::Protocols::InteractionModel::Status (*getFn)(chip::EndpointId endpointId, T * value), T & value) const; /** * @brief Set generic attribute value @@ -154,7 +155,7 @@ class SmokeCoAlarmServer */ template bool SetAttribute(chip::EndpointId endpointId, chip::AttributeId attributeId, - EmberAfStatus (*setFn)(chip::EndpointId endpointId, T value), T value); + chip::Protocols::InteractionModel::Status (*setFn)(chip::EndpointId endpointId, T value), T value); friend bool emberAfSmokeCoAlarmClusterSelfTestRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, 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 6217288bf7cfaa..9194c168fb236a 100644 --- a/src/app/clusters/temperature-control-server/temperature-control-server.cpp +++ b/src/app/clusters/temperature-control-server/temperature-control-server.cpp @@ -99,7 +99,7 @@ bool TemperatureControlHasFeature(EndpointId endpoint, TemperatureControl::Featu { bool success; uint32_t featureMap; - success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS); + success = (Attributes::FeatureMap::Get(endpoint, &featureMap) == Status::Success); return success ? ((featureMap & to_underlying(feature)) != 0) : false; } @@ -116,7 +116,6 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler auto & targetTemperatureLevel = commandData.targetTemperatureLevel; EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; - EmberAfStatus emberAfStatus = EMBER_ZCL_STATUS_SUCCESS; if (TemperatureControlHasFeature(endpoint, Feature::kTemperatureNumber) && TemperatureControlHasFeature(endpoint, Feature::kTemperatureLevel)) @@ -130,17 +129,15 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler { int16_t minTemperature = 0; int16_t maxTemperature = 0; - emberAfStatus = MinTemperature::Get(endpoint, &minTemperature); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = MinTemperature::Get(endpoint, &minTemperature); + if (status != Status::Success) { - status = emberAfStatus; goto exit; } - emberAfStatus = MaxTemperature::Get(endpoint, &maxTemperature); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = MaxTemperature::Get(endpoint, &maxTemperature); + if (status != Status::Success) { - status = emberAfStatus; goto exit; } @@ -151,11 +148,10 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler } if (TemperatureControlHasFeature(endpoint, TemperatureControl::Feature::kTemperatureStep)) { - int16_t step = 0; - emberAfStatus = Step::Get(endpoint, &step); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + int16_t step = 0; + status = Step::Get(endpoint, &step); + if (status != Status::Success) { - status = emberAfStatus; goto exit; } @@ -165,8 +161,8 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler goto exit; } } - emberAfStatus = TemperatureSetpoint::Set(endpoint, targetTemperature.Value()); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = TemperatureSetpoint::Set(endpoint, targetTemperature.Value()); + if (status != Status::Success) { /** * If the server is unable to execute the command at the time the command is received @@ -199,8 +195,8 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler if (targetTemperatureLevel.Value() < size) { - emberAfStatus = SelectedTemperatureLevel::Set(endpoint, targetTemperatureLevel.Value()); - if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) + status = SelectedTemperatureLevel::Set(endpoint, targetTemperatureLevel.Value()); + if (status != Status::Success) { /** * If the server is unable to execute the command at the time the command is received diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 780d244bc71519..c0e43593316816 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -82,7 +82,7 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A VerifyOrDie(aPath.mClusterId == Thermostat::Id); uint32_t ourFeatureMap; - bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == EMBER_ZCL_STATUS_SUCCESS) && + bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); switch (aPath.mAttributeId) @@ -97,8 +97,8 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A if (localTemperatureNotExposedSupported) { BitMask valueRemoteSensing; - EmberAfStatus status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); - if (status != EMBER_ZCL_STATUS_SUCCESS) + imcode status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); + if (status != imcode::Success) { StatusIB statusIB(status); return statusIB.ToChipError(); @@ -139,7 +139,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrDie(aPath.mClusterId == Thermostat::Id); uint32_t ourFeatureMap; - bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == EMBER_ZCL_STATUS_SUCCESS) && + bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); switch (aPath.mAttributeId) @@ -153,8 +153,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } - - EmberAfStatus status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing); + imcode status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing); StatusIB statusIB(status); return statusIB.ToChipError(); } @@ -226,7 +225,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr bool CoolSupported = false; bool OccupancySupported = false; - if (FeatureMap::Get(endpoint, &OurFeatureMap) != EMBER_ZCL_STATUS_SUCCESS) + if (FeatureMap::Get(endpoint, &OurFeatureMap) != imcode::Success) OurFeatureMap = FEATURE_MAP_DEFAULT; if (OurFeatureMap & 1 << 5) // Bit 5 is Auto Mode supported @@ -243,60 +242,60 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (AutoSupported) { - if (MinSetpointDeadBand::Get(endpoint, &DeadBand) != EMBER_ZCL_STATUS_SUCCESS) + if (MinSetpointDeadBand::Get(endpoint, &DeadBand) != imcode::Success) { DeadBand = kDefaultDeadBand; } DeadBandTemp = static_cast(DeadBand * 10); } - if (AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit) != imcode::Success) AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; - if (AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit) != imcode::Success) AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; - if (MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit) != imcode::Success) MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - if (MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit) != imcode::Success) MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; - if (AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit) != imcode::Success) AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; - if (AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit) != imcode::Success) AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; - if (MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit) != imcode::Success) MinHeatSetpointLimit = AbsMinHeatSetpointLimit; - if (MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit) != EMBER_ZCL_STATUS_SUCCESS) + if (MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit) != imcode::Success) MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; if (CoolSupported) - if (OccupiedCoolingSetpoint::Get(endpoint, &OccupiedCoolingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(endpoint, &OccupiedCoolingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Occupied Cooling Setpoint"); return imcode::Failure; } if (HeatSupported) - if (OccupiedHeatingSetpoint::Get(endpoint, &OccupiedHeatingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(endpoint, &OccupiedHeatingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Occupied Heating Setpoint"); return imcode::Failure; } if (CoolSupported && OccupancySupported) - if (UnoccupiedCoolingSetpoint::Get(endpoint, &UnoccupiedCoolingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (UnoccupiedCoolingSetpoint::Get(endpoint, &UnoccupiedCoolingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Unoccupied Cooling Setpoint"); return imcode::Failure; } if (HeatSupported && OccupancySupported) - if (UnoccupiedHeatingSetpoint::Get(endpoint, &UnoccupiedHeatingSetpoint) != EMBER_ZCL_STATUS_SUCCESS) + if (UnoccupiedHeatingSetpoint::Get(endpoint, &UnoccupiedHeatingSetpoint) != imcode::Success) { ChipLogError(Zcl, "Error: Can not read Unoccupied Heating Setpoint"); return imcode::Failure; @@ -434,8 +433,8 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr case SystemMode::Id: { ControlSequenceOfOperationEnum ControlSequenceOfOperation; - EmberAfStatus status = ControlSequenceOfOperation::Get(endpoint, &ControlSequenceOfOperation); - if (status != EMBER_ZCL_STATUS_SUCCESS) + imcode status = ControlSequenceOfOperation::Get(endpoint, &ControlSequenceOfOperation); + if (status != imcode::Success) { return imcode::InvalidValue; } @@ -566,7 +565,7 @@ int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoin // Note that the limits are initialized above per the spec limits // if they are not present Get() will not update the value so the defaults are used - EmberAfStatus status; + imcode status; // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 // behavior is not specified when Abs * values are not present and user values are present @@ -576,24 +575,24 @@ int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoin // if a attribute is not present then it's default shall be used. status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); } status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); } status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MinHeatSetpointLimit = AbsMinHeatSetpointLimit; } status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; } @@ -637,7 +636,7 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin // Note that the limits are initialized above per the spec limits // if they are not present Get() will not update the value so the defaults are used - EmberAfStatus status; + imcode status; // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 // behavior is not specified when Abs * values are not present and user values are present @@ -647,25 +646,25 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin // if a attribute is not present then it's default shall be used. status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); } status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); } status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MinCoolSetpointLimit = AbsMinCoolSetpointLimit; } status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (status != imcode::Success) { MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; } @@ -702,17 +701,17 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co EndpointId aEndpointId = commandPath.mEndpointId; int16_t HeatingSetpoint = kDefaultHeatingSetpoint, CoolingSetpoint = kDefaultCoolingSetpoint; // Set to defaults to be safe - EmberAfStatus status = EMBER_ZCL_STATUS_FAILURE; - EmberAfStatus WriteCoolingSetpointStatus = EMBER_ZCL_STATUS_FAILURE; - EmberAfStatus WriteHeatingSetpointStatus = EMBER_ZCL_STATUS_FAILURE; - int16_t DeadBandTemp = 0; - int8_t DeadBand = 0; + imcode status = imcode::Failure; + imcode WriteCoolingSetpointStatus = imcode::Failure; + imcode WriteHeatingSetpointStatus = imcode::Failure; + int16_t DeadBandTemp = 0; + int8_t DeadBand = 0; uint32_t OurFeatureMap; bool AutoSupported = false; bool HeatSupported = false; bool CoolSupported = false; - if (FeatureMap::Get(aEndpointId, &OurFeatureMap) != EMBER_ZCL_STATUS_SUCCESS) + if (FeatureMap::Get(aEndpointId, &OurFeatureMap) != imcode::Success) OurFeatureMap = FEATURE_MAP_DEFAULT; if (OurFeatureMap & 1 << 5) // Bit 5 is Auto Mode supported @@ -726,7 +725,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (AutoSupported) { - if (MinSetpointDeadBand::Get(aEndpointId, &DeadBand) != EMBER_ZCL_STATUS_SUCCESS) + if (MinSetpointDeadBand::Get(aEndpointId, &DeadBand) != imcode::Success) DeadBand = kDefaultDeadBand; DeadBandTemp = static_cast(DeadBand * 10); } @@ -737,13 +736,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (HeatSupported && CoolSupported) { int16_t DesiredCoolingSetpoint, CoolLimit, DesiredHeatingSetpoint, HeatLimit; - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - @@ -765,12 +764,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co } } WriteCoolingSetpointStatus = OccupiedCoolingSetpoint::Set(aEndpointId, DesiredCoolingSetpoint); - if (WriteCoolingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteCoolingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); } WriteHeatingSetpointStatus = OccupiedHeatingSetpoint::Set(aEndpointId, DesiredHeatingSetpoint); - if (WriteHeatingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteHeatingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); } @@ -782,12 +781,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (CoolSupported && !HeatSupported) { - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { CoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolingSetpoint = EnforceCoolingSetpointLimits(CoolingSetpoint, aEndpointId); WriteCoolingSetpointStatus = OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint); - if (WriteCoolingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteCoolingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); } @@ -796,34 +795,34 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (HeatSupported && !CoolSupported) { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { HeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatingSetpoint = EnforceHeatingSetpointLimits(HeatingSetpoint, aEndpointId); WriteHeatingSetpointStatus = OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint); - if (WriteHeatingSetpointStatus != EMBER_ZCL_STATUS_SUCCESS) + if (WriteHeatingSetpointStatus != imcode::Success) { ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); } } } - if ((!HeatSupported || WriteHeatingSetpointStatus == EMBER_ZCL_STATUS_SUCCESS) && - (!CoolSupported || WriteCoolingSetpointStatus == EMBER_ZCL_STATUS_SUCCESS)) - status = EMBER_ZCL_STATUS_SUCCESS; + if ((!HeatSupported || WriteHeatingSetpointStatus == imcode::Success) && + (!CoolSupported || WriteCoolingSetpointStatus == imcode::Success)) + status = imcode::Success; break; case SetpointRaiseLowerModeEnum::kCool: if (CoolSupported) { - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { CoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolingSetpoint = EnforceCoolingSetpointLimits(CoolingSetpoint, aEndpointId); if (AutoSupported) { // Need to check if we can move the cooling setpoint while maintaining the dead band - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { if (CoolingSetpoint - HeatingSetpoint < DeadBandTemp) { @@ -834,10 +833,10 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { // Desired cooling setpoint is enforcable // Set the new cooling and heating setpoints - if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == imcode::Success) { - if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) - status = EMBER_ZCL_STATUS_SUCCESS; + if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == imcode::Success) + status = imcode::Success; } else ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); @@ -845,7 +844,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co else { ChipLogError(Zcl, "Error: Could Not adjust heating setpoint to maintain dead band!"); - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; } } else @@ -863,20 +862,20 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co ChipLogError(Zcl, "Error: GetOccupiedCoolingSetpoint failed!"); } else - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; break; case SetpointRaiseLowerModeEnum::kHeat: if (HeatSupported) { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { HeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatingSetpoint = EnforceHeatingSetpointLimits(HeatingSetpoint, aEndpointId); if (AutoSupported) { // Need to check if we can move the cooling setpoint while maintaining the dead band - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) { if (CoolingSetpoint - HeatingSetpoint < DeadBandTemp) { @@ -887,10 +886,10 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { // Desired cooling setpoint is enforcable // Set the new cooling and heating setpoints - if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) + if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == imcode::Success) { - if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == EMBER_ZCL_STATUS_SUCCESS) - status = EMBER_ZCL_STATUS_SUCCESS; + if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == imcode::Success) + status = imcode::Success; } else ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); @@ -898,7 +897,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co else { ChipLogError(Zcl, "Error: Could Not adjust cooling setpoint to maintain dead band!"); - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; } } else @@ -916,11 +915,11 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co ChipLogError(Zcl, "Error: GetOccupiedHeatingSetpoint failed!"); } else - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; break; default: - status = EMBER_ZCL_STATUS_INVALID_COMMAND; + status = imcode::InvalidCommand; break; } diff --git a/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp b/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp index 8539566e75dece..08e90207760603 100644 --- a/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp +++ b/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp @@ -39,6 +39,8 @@ using namespace chip::app::Clusters::TimeFormatLocalization; using namespace chip::app::Clusters::TimeFormatLocalization::Attributes; using namespace chip::DeviceLayer; +using chip::Protocols::InteractionModel::Status; + namespace { class TimeFormatLocalizationAttrAccess : public AttributeAccessInterface @@ -202,18 +204,18 @@ void emberAfTimeFormatLocalizationClusterServerInitCallback(EndpointId endpoint) { CalendarTypeEnum calendarType; CalendarTypeEnum validType; - EmberAfStatus status = ActiveCalendarType::Get(endpoint, &calendarType); + Status status = ActiveCalendarType::Get(endpoint, &calendarType); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to read calendar type with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to read calendar type with error: 0x%02x", to_underlying(status))); // We could have an invalid calendar type value if an OTA update removed support for the value we were using. // If initial value is not one of the allowed values, pick one valid value and write it. if (!IsSupportedCalendarType(calendarType, validType)) { status = ActiveCalendarType::Set(endpoint, validType); - VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, - ChipLogError(Zcl, "Failed to write calendar type with error: 0x%02x", status)); + VerifyOrReturn(Status::Success == status, + ChipLogError(Zcl, "Failed to write calendar type with error: 0x%02x", to_underlying(status))); } } diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp index 8e919ef5bb7976..cc6c3f509c8937 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp @@ -380,9 +380,9 @@ void TimeSynchronizationServer::OnTimeSyncCompletionFn(TimeSourceEnum timeSource } return; } - mGranularity = granularity; - EmberAfStatus status = TimeSource::Set(kRootEndpointId, timeSource); - if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) + mGranularity = granularity; + Status status = TimeSource::Set(kRootEndpointId, timeSource); + if (!(status == Status::Success || status == Status::UnsupportedAttribute)) { ChipLogError(Zcl, "Writing TimeSource failed."); } @@ -394,8 +394,8 @@ void TimeSynchronizationServer::OnFallbackNTPCompletionFn(bool timeSyncSuccessfu { mGranularity = GranularityEnum::kMillisecondsGranularity; // Non-matter SNTP because we know it's external and there's only one source - EmberAfStatus status = TimeSource::Set(kRootEndpointId, TimeSourceEnum::kNonMatterSNTP); - if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) + Status status = TimeSource::Set(kRootEndpointId, TimeSourceEnum::kNonMatterSNTP); + if (!(status == Status::Success || status == Status::UnsupportedAttribute)) { ChipLogError(Zcl, "Writing TimeSource failed."); } @@ -777,9 +777,9 @@ CHIP_ERROR TimeSynchronizationServer::SetUTCTime(EndpointId ep, uint64_t utcTime return err; } GetDelegate()->UTCTimeAvailabilityChanged(utcTime); - mGranularity = granularity; - EmberAfStatus status = TimeSource::Set(ep, source); - if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) + mGranularity = granularity; + Status status = TimeSource::Set(ep, source); + if (!(status == Status::Success || status == Status::UnsupportedAttribute)) { ChipLogError(Zcl, "Writing TimeSource failed."); return CHIP_IM_GLOBAL_STATUS(Failure); @@ -1264,7 +1264,7 @@ bool emberAfTimeSynchronizationClusterSetDefaultNTPCallback( return true; } bool dnsResolve; - if (EMBER_ZCL_STATUS_SUCCESS != SupportsDNSResolve::Get(commandPath.mEndpointId, &dnsResolve)) + if (Status::Success != SupportsDNSResolve::Get(commandPath.mEndpointId, &dnsResolve)) { commandObj->AddStatus(commandPath, Status::Failure); 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 1b47b9c2e4d6a2..ba7d74c56583a5 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -118,8 +118,8 @@ bool HasFeature(chip::EndpointId endpoint, Feature feature) bool hasFeature = false; uint32_t featureMap = 0; - EmberAfStatus status = Attributes::FeatureMap::Get(endpoint, &featureMap); - if (EMBER_ZCL_STATUS_SUCCESS == status) + Status status = Attributes::FeatureMap::Get(endpoint, &featureMap); + if (Status::Success == status) { hasFeature = (featureMap & chip::to_underlying(feature)); } diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 5e51254e76753e..302471b8bebb89 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -609,7 +609,7 @@ class Server FabricTable mFabrics; secure_channel::MessageCounterManager mMessageCounterManager; #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT - chip::Protocols::UserDirectedCommissioning::UserDirectedCommissioningClient * gUDCClient = nullptr; + Protocols::UserDirectedCommissioning::UserDirectedCommissioningClient * gUDCClient = nullptr; // mUdcTransportMgr is for insecure communication (ex. user directed commissioning) // specifically, the commissioner declaration message (sent by commissioner to commissionee) UdcTransportMgr * mUdcTransportMgr = nullptr; diff --git a/src/app/util/af-enums.h b/src/app/util/af-enums.h index 411f042032a758..50bf0af1786b4e 100644 --- a/src/app/util/af-enums.h +++ b/src/app/util/af-enums.h @@ -23,50 +23,48 @@ #include #include -typedef chip::Protocols::InteractionModel::Status EmberAfStatus; - -#define EMBER_ZCL_STATUS_SUCCESS chip::Protocols::InteractionModel::Status::Success -#define EMBER_ZCL_STATUS_FAILURE chip::Protocols::InteractionModel::Status::Failure -#define EMBER_ZCL_STATUS_INVALID_SUBSCRIPTION chip::Protocols::InteractionModel::Status::InvalidSubscription -#define EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS chip::Protocols::InteractionModel::Status::UnsupportedAccess -#define EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT chip::Protocols::InteractionModel::Status::UnsupportedEndpoint -#define EMBER_ZCL_STATUS_MALFORMED_COMMAND chip::Protocols::InteractionModel::Status::InvalidAction -#define EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND chip::Protocols::InteractionModel::Status::UnsupportedCommand -#define EMBER_ZCL_STATUS_DEPRECATED82 chip::Protocols::InteractionModel::Status::Deprecated82 -#define EMBER_ZCL_STATUS_DEPRECATED83 chip::Protocols::InteractionModel::Status::Deprecated83 -#define EMBER_ZCL_STATUS_DEPRECATED84 chip::Protocols::InteractionModel::Status::Deprecated84 -#define EMBER_ZCL_STATUS_INVALID_COMMAND chip::Protocols::InteractionModel::Status::InvalidCommand -#define EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE chip::Protocols::InteractionModel::Status::UnsupportedAttribute -#define EMBER_ZCL_STATUS_CONSTRAINT_ERROR chip::Protocols::InteractionModel::Status::ConstraintError -#define EMBER_ZCL_STATUS_UNSUPPORTED_WRITE chip::Protocols::InteractionModel::Status::UnsupportedWrite -#define EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED chip::Protocols::InteractionModel::Status::ResourceExhausted -#define EMBER_ZCL_STATUS_NOT_FOUND chip::Protocols::InteractionModel::Status::NotFound -#define EMBER_ZCL_STATUS_UNREPORTABLE_ATTRIBUTE chip::Protocols::InteractionModel::Status::UnreportableAttribute -#define EMBER_ZCL_STATUS_INVALID_DATA_TYPE chip::Protocols::InteractionModel::Status::InvalidDataType -#define EMBER_ZCL_STATUS_DEPRECATED8E chip::Protocols::InteractionModel::Status::Deprecated8e -#define EMBER_ZCL_STATUS_UNSUPPORTED_READ chip::Protocols::InteractionModel::Status::UnsupportedRead -#define EMBER_ZCL_STATUS_DEPRECATED90 chip::Protocols::InteractionModel::Status::Deprecated90 -#define EMBER_ZCL_STATUS_DEPRECATED91 chip::Protocols::InteractionModel::Status::Deprecated91 -#define EMBER_ZCL_STATUS_DATA_VERSION_MISMATCH chip::Protocols::InteractionModel::Status::DataVersionMismatch -#define EMBER_ZCL_STATUS_DEPRECATED93 chip::Protocols::InteractionModel::Status::Deprecated93 -#define EMBER_ZCL_STATUS_TIMEOUT chip::Protocols::InteractionModel::Status::Timeout -#define EMBER_ZCL_STATUS_RESERVED95 chip::Protocols::InteractionModel::Status::Reserved95 -#define EMBER_ZCL_STATUS_RESERVED96 chip::Protocols::InteractionModel::Status::Reserved96 -#define EMBER_ZCL_STATUS_RESERVED97 chip::Protocols::InteractionModel::Status::Reserved97 -#define EMBER_ZCL_STATUS_RESERVED98 chip::Protocols::InteractionModel::Status::Reserved98 -#define EMBER_ZCL_STATUS_RESERVED99 chip::Protocols::InteractionModel::Status::Reserved99 -#define EMBER_ZCL_STATUS_RESERVED9A chip::Protocols::InteractionModel::Status::Reserved9a -#define EMBER_ZCL_STATUS_BUSY chip::Protocols::InteractionModel::Status::Busy -#define EMBER_ZCL_STATUS_DEPRECATEDC0 chip::Protocols::InteractionModel::Status::Deprecatedc0 -#define EMBER_ZCL_STATUS_DEPRECATEDC1 chip::Protocols::InteractionModel::Status::Deprecatedc1 -#define EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER chip::Protocols::InteractionModel::Status::UnsupportedCluster -#define EMBER_ZCL_STATUS_DEPRECATEDC4 chip::Protocols::InteractionModel::Status::Deprecatedc4 -#define EMBER_ZCL_STATUS_NO_UPSTREAM_SUBSCRIPTION chip::Protocols::InteractionModel::Status::NoUpstreamSubscription -#define EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION chip::Protocols::InteractionModel::Status::NeedsTimedInteraction -#define EMBER_ZCL_STATUS_UNSUPPORTED_EVENT chip::Protocols::InteractionModel::Status::UnsupportedEvent -#define EMBER_ZCL_STATUS_PATHS_EXHAUSTED chip::Protocols::InteractionModel::Status::PathsExhausted -#define EMBER_ZCL_STATUS_TIMED_REQUEST_MISMATCH chip::Protocols::InteractionModel::Status::TimedRequestMismatch -#define EMBER_ZCL_STATUS_FAILSAFE_REQUIRED chip::Protocols::InteractionModel::Status::FailsafeRequired -#define EMBER_ZCL_STATUS_INVALID_IN_STATE chip::Protocols::InteractionModel::Status::InvalidInState -#define EMBER_ZCL_STATUS_NO_COMMAND_RESPONSE chip::Protocols::InteractionModel::Status::NoCommandResponse -#define EMBER_ZCL_STATUS_WRITE_IGNORED chip::Protocols::InteractionModel::Status::WriteIgnored // NOT SPEC COMPLIANT FOR TEST ONLY +#define EMBER_ZCL_STATUS_SUCCESS Protocols::InteractionModel::Status::Success +#define EMBER_ZCL_STATUS_FAILURE Protocols::InteractionModel::Status::Failure +#define EMBER_ZCL_STATUS_INVALID_SUBSCRIPTION Protocols::InteractionModel::Status::InvalidSubscription +#define EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS Protocols::InteractionModel::Status::UnsupportedAccess +#define EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT Protocols::InteractionModel::Status::UnsupportedEndpoint +#define EMBER_ZCL_STATUS_MALFORMED_COMMAND Protocols::InteractionModel::Status::InvalidAction +#define EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND Protocols::InteractionModel::Status::UnsupportedCommand +#define EMBER_ZCL_STATUS_DEPRECATED82 Protocols::InteractionModel::Status::Deprecated82 +#define EMBER_ZCL_STATUS_DEPRECATED83 Protocols::InteractionModel::Status::Deprecated83 +#define EMBER_ZCL_STATUS_DEPRECATED84 Protocols::InteractionModel::Status::Deprecated84 +#define EMBER_ZCL_STATUS_INVALID_COMMAND Protocols::InteractionModel::Status::InvalidCommand +#define EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE Protocols::InteractionModel::Status::UnsupportedAttribute +#define EMBER_ZCL_STATUS_CONSTRAINT_ERROR Protocols::InteractionModel::Status::ConstraintError +#define EMBER_ZCL_STATUS_UNSUPPORTED_WRITE Protocols::InteractionModel::Status::UnsupportedWrite +#define EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED Protocols::InteractionModel::Status::ResourceExhausted +#define EMBER_ZCL_STATUS_NOT_FOUND Protocols::InteractionModel::Status::NotFound +#define EMBER_ZCL_STATUS_UNREPORTABLE_ATTRIBUTE Protocols::InteractionModel::Status::UnreportableAttribute +#define EMBER_ZCL_STATUS_INVALID_DATA_TYPE Protocols::InteractionModel::Status::InvalidDataType +#define EMBER_ZCL_STATUS_DEPRECATED8E Protocols::InteractionModel::Status::Deprecated8e +#define EMBER_ZCL_STATUS_UNSUPPORTED_READ Protocols::InteractionModel::Status::UnsupportedRead +#define EMBER_ZCL_STATUS_DEPRECATED90 Protocols::InteractionModel::Status::Deprecated90 +#define EMBER_ZCL_STATUS_DEPRECATED91 Protocols::InteractionModel::Status::Deprecated91 +#define EMBER_ZCL_STATUS_DATA_VERSION_MISMATCH Protocols::InteractionModel::Status::DataVersionMismatch +#define EMBER_ZCL_STATUS_DEPRECATED93 Protocols::InteractionModel::Status::Deprecated93 +#define EMBER_ZCL_STATUS_TIMEOUT Protocols::InteractionModel::Status::Timeout +#define EMBER_ZCL_STATUS_RESERVED95 Protocols::InteractionModel::Status::Reserved95 +#define EMBER_ZCL_STATUS_RESERVED96 Protocols::InteractionModel::Status::Reserved96 +#define EMBER_ZCL_STATUS_RESERVED97 Protocols::InteractionModel::Status::Reserved97 +#define EMBER_ZCL_STATUS_RESERVED98 Protocols::InteractionModel::Status::Reserved98 +#define EMBER_ZCL_STATUS_RESERVED99 Protocols::InteractionModel::Status::Reserved99 +#define EMBER_ZCL_STATUS_RESERVED9A Protocols::InteractionModel::Status::Reserved9a +#define EMBER_ZCL_STATUS_BUSY Protocols::InteractionModel::Status::Busy +#define EMBER_ZCL_STATUS_DEPRECATEDC0 Protocols::InteractionModel::Status::Deprecatedc0 +#define EMBER_ZCL_STATUS_DEPRECATEDC1 Protocols::InteractionModel::Status::Deprecatedc1 +#define EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER Protocols::InteractionModel::Status::UnsupportedCluster +#define EMBER_ZCL_STATUS_DEPRECATEDC4 Protocols::InteractionModel::Status::Deprecatedc4 +#define EMBER_ZCL_STATUS_NO_UPSTREAM_SUBSCRIPTION Protocols::InteractionModel::Status::NoUpstreamSubscription +#define EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION Protocols::InteractionModel::Status::NeedsTimedInteraction +#define EMBER_ZCL_STATUS_UNSUPPORTED_EVENT Protocols::InteractionModel::Status::UnsupportedEvent +#define EMBER_ZCL_STATUS_PATHS_EXHAUSTED Protocols::InteractionModel::Status::PathsExhausted +#define EMBER_ZCL_STATUS_TIMED_REQUEST_MISMATCH Protocols::InteractionModel::Status::TimedRequestMismatch +#define EMBER_ZCL_STATUS_FAILSAFE_REQUIRED Protocols::InteractionModel::Status::FailsafeRequired +#define EMBER_ZCL_STATUS_INVALID_IN_STATE Protocols::InteractionModel::Status::InvalidInState +#define EMBER_ZCL_STATUS_NO_COMMAND_RESPONSE Protocols::InteractionModel::Status::NoCommandResponse +#define EMBER_ZCL_STATUS_WRITE_IGNORED Protocols::InteractionModel::Status::WriteIgnored // NOT SPEC COMPLIANT FOR TEST ONLY diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index 66738e101394b8..f2526271717af8 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -43,8 +43,6 @@ #include #include -using chip::Protocols::InteractionModel::Status; - /** * @brief Type for the cluster mask */ @@ -293,8 +291,8 @@ typedef void (*EmberAfClusterAttributeChangedCallback)(const chip::app::Concrete * * This function is called before an attribute changes. */ -typedef Status (*EmberAfClusterPreAttributeChangedCallback)(const chip::app::ConcreteAttributePath & attributePath, - EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); +typedef chip::Protocols::InteractionModel::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 e53b613916ca76..f7f772a4f2f4d2 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -31,8 +31,6 @@ #include #include -using chip::Protocols::InteractionModel::Status; - /** @name Attribute Storage */ // @{ @@ -98,8 +96,9 @@ 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 ? */ -Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, - EmberAfAttributeType dataType); +chip::Protocols::InteractionModel::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. @@ -110,8 +109,9 @@ Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, * dataPtr may be NULL, signifying that we don't need the value, just the status * (i.e. whether the attribute can be read). */ -Status emberAfReadAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, - uint16_t readLength); +chip::Protocols::InteractionModel::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.h b/src/app/util/attribute-storage.h index e68735cde8f172..83a3aeacf8bf0f 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -30,8 +30,6 @@ #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) @@ -73,8 +71,9 @@ void emAfCallInits(void); // Initial configuration void emberAfEndpointConfigure(void); -Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata, - uint8_t * buffer, uint16_t readLength, bool write); +chip::Protocols::InteractionModel::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. // @@ -134,8 +133,9 @@ void emAfSaveAttributeToStorageIfNeeded(uint8_t * data, chip::EndpointId endpoin void emAfClusterAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); // Calls the attribute changed callback for a specific cluster. -Status emAfClusterPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, - EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); +chip::Protocols::InteractionModel::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.h b/src/app/util/attribute-table.h index 0969e8c18c9b87..7b86298209326f 100644 --- a/src/app/util/attribute-table.h +++ b/src/app/util/attribute-table.h @@ -21,16 +21,15 @@ #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. */ -Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, - uint8_t * dataPtr, EmberAfAttributeType dataType); +chip::Protocols::InteractionModel::Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, + chip::AttributeId attributeID, uint8_t * dataPtr, + EmberAfAttributeType dataType); /** * @brief write an attribute, performing all the checks. @@ -62,5 +61,6 @@ Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId clu * the attribute * - Status::Success: if the attribute was found and successfully written */ -Status emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * data, - EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType); +chip::Protocols::InteractionModel::Status emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, + chip::AttributeId attributeID, uint8_t * data, + EmberAfAttributeType dataType, bool overrideReadOnlyAndDataType); diff --git a/src/app/util/generic-callback-stubs.cpp b/src/app/util/generic-callback-stubs.cpp index 21d40858c4d13c..723c9f2a60df5b 100644 --- a/src/app/util/generic-callback-stubs.cpp +++ b/src/app/util/generic-callback-stubs.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace chip; @@ -34,18 +35,18 @@ bool __attribute__((weak)) emberAfAttributeWriteAccessCallback(EndpointId endpoi return true; } -Status __attribute__((weak)) +chip::Protocols::InteractionModel::Status __attribute__((weak)) emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) { - return Status::Failure; + return chip::Protocols::InteractionModel::Status::Failure; } -Status __attribute__((weak)) +chip::Protocols::InteractionModel::Status __attribute__((weak)) emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer) { - return Status::Failure; + return chip::Protocols::InteractionModel::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 51917e6f86012b..4a20138250322e 100644 --- a/src/app/util/generic-callbacks.h +++ b/src/app/util/generic-callbacks.h @@ -28,8 +28,6 @@ #include #include -using chip::Protocols::InteractionModel::Status; - /** @brief Cluster Init * * This function is called when a specific cluster is initialized. It gives the @@ -84,9 +82,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. */ -Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, - uint16_t maxReadLength); +chip::Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); /** @brief External Attribute Write * @@ -128,15 +126,17 @@ Status emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::Clu * other return value indicates the application was not able to write the * attribute. */ -Status emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); +chip::Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, + chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); /** @brief Pre Attribute Change * * This function is called by the application framework before it changes an * attribute value. The value passed into this callback is the value to which * the attribute is to be set by the framework. The application should return - * chip::Protocols::InteractionModel::Status::Success to permit the change or + * Protocols::InteractionModel::Status::Success to permit the change or * any other code to reject it. */ chip::Protocols::InteractionModel::Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm index a1f1f47a7dc26e..a96af0ad7e0fea 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm @@ -39,14 +39,14 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) // clusters dont use it. } -EmberAfStatus emAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, +Protocols::InteractionModel::Status emAfWriteAttributeExternal(EndpointId endpoint, ClusterId cluster, AttributeId attributeID, uint8_t * dataPtr, EmberAfAttributeType dataType) { assertChipStackLockedByCurrentThread(); // All of our attributes are handled via AttributeAccessInterface, so this // should be unreached. - return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; + return Protocols::InteractionModel::Status::UnsupportedAttribute; } namespace chip {