Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App] Removing af-enums.h #32110

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ jobs:
--known-failure app/reporting/tests/MockReportScheduler.h \
--known-failure app/server/AppDelegate.h \
--known-failure app/TestEventTriggerDelegate.h \
--known-failure app/util/af-enums.h \
--known-failure app/util/af.h \
--known-failure app/util/af-types.h \
--known-failure app/util/attribute-metadata.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <protocols/interaction_model/StatusCode.h>

namespace chip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <protocols/interaction_model/StatusCode.h>

namespace chip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <protocols/interaction_model/StatusCode.h>

namespace chip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.h>
#include <app/util/af-enums.h>

using namespace chip;

Expand Down
2 changes: 1 addition & 1 deletion examples/chef/common/chef-rvc-operational-state-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <protocols/interaction_model/StatusCode.h>

namespace chip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#import <Matter/Matter.h>

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <protocols/interaction_model/StatusCode.h>

namespace chip {
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/af-enums.h>

#include <app/util/attribute-storage.h>
#include <lib/support/CodeUtils.h>
#include <lock/AppConfig.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <app/clusters/microwave-oven-control-server/microwave-oven-control-server.h>
#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <app/util/config.h>
#include <cstring>
#include <protocols/interaction_model/StatusCode.h>
Expand Down
1 change: 0 additions & 1 deletion examples/ota-requestor-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

#include "DeviceCallbacks.h"
#include "app/util/af-enums.h"
#include "app/util/af.h"
#include "esp_heap_caps_init.h"
#include "esp_log.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/operational-state-server/operational-state-server.h>
#include <app/util/af-enums.h>

#include <protocols/interaction_model/StatusCode.h>

namespace chip {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ CHIP_ERROR BooleanStateConfigAttrAccess::ReadCurrentSensitivityLevel(const Concr
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
uint8_t supportedSensLevel;
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == SupportedSensitivityLevels::Get(aPath.mEndpointId, &supportedSensLevel),
VerifyOrReturnError(Status::Success == SupportedSensitivityLevels::Get(aPath.mEndpointId, &supportedSensLevel),
CHIP_IM_GLOBAL_STATUS(Failure));
VerifyOrReturnError(supportedSensLevel >= kMinSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(Failure));
VerifyOrReturnError(supportedSensLevel <= kMaxSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(Failure));
Expand Down Expand Up @@ -168,13 +168,13 @@ static bool emitAlarmsStateChangedEvent(EndpointId ep)

BooleanStateConfiguration::Events::AlarmsStateChanged::Type event;
BitMask<BooleanStateConfiguration::AlarmModeBitmap> active;
VerifyOrReturnValue(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &active), false);
VerifyOrReturnValue(Status::Success == AlarmsActive::Get(ep, &active), false);
event.alarmsActive = active;

if (HasFeature(ep, BooleanStateConfiguration::Feature::kAlarmSuppress))
{
BitMask<BooleanStateConfiguration::AlarmModeBitmap> suppressed;
VerifyOrReturnValue(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &suppressed), false);
VerifyOrReturnValue(Status::Success == AlarmsSuppressed::Get(ep, &suppressed), false);
event.alarmsSuppressed.SetValue(suppressed);
}

Expand Down Expand Up @@ -214,7 +214,7 @@ static CHIP_ERROR emitSensorFaultEvent(EndpointId ep, BitMask<BooleanStateConfig
static CHIP_ERROR StoreCurrentSensitivityLevel(EndpointId ep, uint8_t level)
{
uint8_t supportedSensLevel;
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == SupportedSensitivityLevels::Get(ep, &supportedSensLevel),
VerifyOrReturnError(Status::Success == SupportedSensitivityLevels::Get(ep, &supportedSensLevel),
CHIP_IM_GLOBAL_STATUS(Failure));
VerifyOrReturnError(supportedSensLevel >= kMinSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(ConstraintError));
VerifyOrReturnError(supportedSensLevel <= kMaxSupportedSensitivityLevels, CHIP_IM_GLOBAL_STATUS(ConstraintError));
Expand Down Expand Up @@ -254,11 +254,10 @@ CHIP_ERROR SetAlarmsActive(EndpointId ep, BitMask<BooleanStateConfiguration::Ala
CHIP_IM_GLOBAL_STATUS(Failure));

BitMask<BooleanStateConfiguration::AlarmModeBitmap> alarmsEnabled;
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Get(ep, &alarmsEnabled),
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
VerifyOrReturnError(Status::Success == AlarmsEnabled::Get(ep, &alarmsEnabled), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
VerifyOrReturnError(alarmsEnabled.HasAll(alarms), CHIP_IM_GLOBAL_STATUS(Failure));

VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarms), CHIP_IM_GLOBAL_STATUS(Failure));
VerifyOrReturnError(Status::Success == AlarmsActive::Set(ep, alarms), CHIP_IM_GLOBAL_STATUS(Failure));
emitAlarmsStateChangedEvent(ep);

return CHIP_NO_ERROR;
Expand All @@ -271,12 +270,11 @@ CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep)
CHIP_IM_GLOBAL_STATUS(Failure));

BitMask<BooleanStateConfiguration::AlarmModeBitmap> alarmsEnabled;
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Get(ep, &alarmsEnabled),
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
VerifyOrReturnError(Status::Success == AlarmsEnabled::Get(ep, &alarmsEnabled), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));

if (alarmsEnabled.HasAny())
{
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsEnabled), CHIP_IM_GLOBAL_STATUS(Failure));
VerifyOrReturnError(Status::Success == AlarmsActive::Set(ep, alarmsEnabled), CHIP_IM_GLOBAL_STATUS(Failure));
emitAlarmsStateChangedEvent(ep);
}

Expand All @@ -288,23 +286,21 @@ CHIP_ERROR ClearAllAlarms(EndpointId ep)
BitMask<BooleanStateConfiguration::AlarmModeBitmap> alarmsActive, alarmsSuppressed;
bool emitEvent = false;

VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive),
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed),
VerifyOrReturnError(Status::Success == AlarmsActive::Get(ep, &alarmsActive), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
VerifyOrReturnError(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed),
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));

if (alarmsActive.HasAny())
{
alarmsActive.ClearAll();
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsActive),
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
VerifyOrReturnError(Status::Success == AlarmsActive::Set(ep, alarmsActive), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
emitEvent = true;
}

if (alarmsSuppressed.HasAny())
{
alarmsSuppressed.ClearAll();
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed),
VerifyOrReturnError(Status::Success == AlarmsSuppressed::Set(ep, alarmsSuppressed),
CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
emitEvent = true;
}
Expand All @@ -329,10 +325,10 @@ CHIP_ERROR SuppressAlarms(EndpointId ep, BitMask<BooleanStateConfiguration::Alar

BitMask<BooleanStateConfiguration::AlarmModeBitmap> alarmsActive, alarmsSuppressed, alarmsSupported;

VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSupported::Get(ep, &alarmsSupported), attribute_error);
VerifyOrReturnError(Status::Success == AlarmsSupported::Get(ep, &alarmsSupported), attribute_error);
VerifyOrReturnError(alarmsSupported.HasAll(alarm), CHIP_IM_GLOBAL_STATUS(ConstraintError));

VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), attribute_error);
VerifyOrReturnError(Status::Success == AlarmsActive::Get(ep, &alarmsActive), attribute_error);
VerifyOrReturnError(alarmsActive.HasAll(alarm), CHIP_IM_GLOBAL_STATUS(InvalidInState));

Delegate * delegate = GetDelegate(ep);
Expand All @@ -341,9 +337,9 @@ CHIP_ERROR SuppressAlarms(EndpointId ep, BitMask<BooleanStateConfiguration::Alar
delegate->HandleSuppressAlarm(alarm);
}

VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), attribute_error);
VerifyOrReturnError(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed), attribute_error);
alarmsSuppressed.Set(alarm);
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), attribute_error);
VerifyOrReturnError(Status::Success == AlarmsSuppressed::Set(ep, alarmsSuppressed), attribute_error);

emitAlarmsStateChangedEvent(ep);

Expand Down Expand Up @@ -409,29 +405,29 @@ bool emberAfBooleanStateConfigurationClusterEnableDisableAlarmCallback(
uint8_t rawAlarm = static_cast<uint8_t>(~alarms.Raw() & 0x03); // 0x03 is the current max bitmap
alarmsToDisable = BitMask<BooleanStateConfiguration::AlarmModeBitmap>(rawAlarm);

VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSupported::Get(ep, &alarmsSupported), status.Emplace(Status::Failure));
VerifyOrExit(Status::Success == AlarmsSupported::Get(ep, &alarmsSupported), status.Emplace(Status::Failure));
VerifyOrExit(alarmsSupported.HasAll(alarms), status.Emplace(Status::ConstraintError));

VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsEnabled::Set(ep, alarms), status.Emplace(Status::Failure));
VerifyOrExit(Status::Success == AlarmsEnabled::Set(ep, alarms), status.Emplace(Status::Failure));

if (!isDelegateNull(delegate))
{
delegate->HandleEnableDisableAlarms(alarms);
}

VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Get(ep, &alarmsActive), status.Emplace(Status::Failure));
VerifyOrExit(Status::Success == AlarmsActive::Get(ep, &alarmsActive), status.Emplace(Status::Failure));
if (alarmsActive.HasAny(alarmsToDisable))
{
alarmsActive.Clear(alarmsToDisable);
VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsActive::Set(ep, alarmsActive), status.Emplace(Status::Failure));
VerifyOrExit(Status::Success == AlarmsActive::Set(ep, alarmsActive), status.Emplace(Status::Failure));
emit = true;
}

VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Get(ep, &alarmsSuppressed), status.Emplace(Status::Failure));
VerifyOrExit(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed), status.Emplace(Status::Failure));
if (alarmsSuppressed.HasAny(alarmsToDisable))
{
alarmsSuppressed.Clear(alarmsToDisable);
VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == AlarmsSuppressed::Set(ep, alarmsSuppressed), status.Emplace(Status::Failure));
VerifyOrExit(Status::Success == AlarmsSuppressed::Set(ep, alarmsSuppressed), status.Emplace(Status::Failure));
emit = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <app-common/zap-generated/cluster-objects.h>
#include <app/util/basic-types.h>
#include <lib/core/DataModelTypes.h>
#include <protocols/interaction_model/StatusCode.h>

namespace chip {
namespace app {
Expand All @@ -46,7 +47,7 @@ CHIP_ERROR EmitSensorFault(EndpointId ep, chip::BitMask<BooleanStateConfiguratio
inline bool HasFeature(EndpointId ep, Feature feature)
{
uint32_t map;
bool success = (Attributes::FeatureMap::Get(ep, &map) == EMBER_ZCL_STATUS_SUCCESS);
bool success = (Attributes::FeatureMap::Get(ep, &map) == Protocols::InteractionModel::Status::Success);
return success ? (map & to_underlying(feature)) : false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/EventLogging.h>
#include <app/util/af-enums.h>

#include <app/util/basic-types.h>
#include <lib/core/CHIPError.h>
#include <lib/support/logging/CHIPLogging.h>
Expand All @@ -33,13 +33,15 @@ using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::BridgedDeviceBasicInformation;

using chip::Protocols::InteractionModel::Status;

namespace {

void ReachableChanged(EndpointId endpointId)
{
MATTER_TRACE_INSTANT("ReachableChanged", "BridgeBasicInfo");
bool reachable = false;
if (EMBER_ZCL_STATUS_SUCCESS != Attributes::Reachable::Get(endpointId, &reachable))
if (Status::Success != Attributes::Reachable::Get(endpointId, &reachable))
{
ChipLogError(Zcl, "ReachabledChanged: Failed to get Reachable value");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Status DishwasherAlarmServer::GetLatchValue(EndpointId endpoint, BitMask<AlarmMa
if (!HasResetFeature(endpoint))
{
ChipLogProgress(Zcl, "Dishwasher Alarm feature: Unsupport Latch attribute");
return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE;
return Status::UnsupportedAttribute;
}

Status status = Attributes::Latch::Get(endpoint, latch);
Expand Down Expand Up @@ -160,10 +160,10 @@ Status DishwasherAlarmServer::SetSupportedValue(EndpointId endpoint, const BitMa
Status DishwasherAlarmServer::SetMaskValue(EndpointId endpoint, const BitMask<AlarmMap> mask)
{
BitMask<AlarmMap> supported;
if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(mask))
if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(mask))
{
ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Mask is not supported");
return EMBER_ZCL_STATUS_FAILURE;
return Status::Failure;
}

Status status = Status::Success;
Expand Down Expand Up @@ -194,14 +194,14 @@ Status DishwasherAlarmServer::SetLatchValue(EndpointId endpoint, const BitMask<A
if (!HasResetFeature(endpoint))
{
ChipLogProgress(Zcl, "Dishwasher Alarm feature: Unsupport Latch attribute");
return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE;
return Status::UnsupportedAttribute;
}

BitMask<AlarmMap> supported;
if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(latch))
if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(latch))
{
ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Latch is not supported");
return EMBER_ZCL_STATUS_FAILURE;
return Status::Failure;
}

Status status = Attributes::Latch::Set(endpoint, latch);
Expand All @@ -220,17 +220,17 @@ Status DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const BitMask<A
BitMask<AlarmMap> finalNewState;
finalNewState.Set(newState);

if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(finalNewState))
if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(finalNewState))
{
ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Alarm is not supported");
return EMBER_ZCL_STATUS_FAILURE;
return Status::Failure;
}

BitMask<AlarmMap> mask;
if (GetMaskValue(endpoint, &mask) || !mask.HasAll(finalNewState))
if (Status::Success != GetMaskValue(endpoint, &mask) || !mask.HasAll(finalNewState))
{
ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Alarm is suppressed");
return EMBER_ZCL_STATUS_FAILURE;
return Status::Failure;
}

Status status = Status::Success;
Expand Down Expand Up @@ -271,16 +271,16 @@ Status DishwasherAlarmServer::SetStateValue(EndpointId endpoint, const BitMask<A
Status DishwasherAlarmServer::ResetLatchedAlarms(EndpointId endpoint, const BitMask<AlarmMap> alarms)
{
BitMask<AlarmMap> supported;
if (GetSupportedValue(endpoint, &supported) || !supported.HasAll(alarms))
if (Status::Success != GetSupportedValue(endpoint, &supported) || !supported.HasAll(alarms))
{
ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: Alarm is not supported");
return EMBER_ZCL_STATUS_FAILURE;
return Status::Failure;
}

BitMask<AlarmMap> state;
if (GetStateValue(endpoint, &state) != Status::Success)
{
return EMBER_ZCL_STATUS_FAILURE;
return Status::Failure;
}

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

// A server that is unable to reset alarms SHALL respond with a status code of FAILURE
Expand Down
Loading
Loading