diff --git a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp index b38cc27407965a..67ee2c831c755a 100644 --- a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp +++ b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp @@ -98,36 +98,31 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( auto & failSafeContext = Server::GetInstance().GetFailSafeContext(); auto & commissionMgr = Server::GetInstance().GetCommissioningWindowManager(); - VerifyOrExit(fabricInfo != nullptr, status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); - VerifyOrExit(failSafeContext.IsFailSafeFullyDisarmed(), status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_BUSY)); - - VerifyOrExit(!commissionMgr.IsCommissioningWindowOpen(), status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_BUSY)); - VerifyOrExit(iterations >= kSpake2p_Min_PBKDF_Iterations, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); - VerifyOrExit(iterations <= kSpake2p_Max_PBKDF_Iterations, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); - VerifyOrExit(salt.size() >= kSpake2p_Min_PBKDF_Salt_Length, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); - VerifyOrExit(salt.size() <= kSpake2p_Max_PBKDF_Salt_Length, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); + VerifyOrExit(fabricInfo != nullptr, status.Emplace(StatusCode::kPAKEParameterError)); + VerifyOrExit(failSafeContext.IsFailSafeFullyDisarmed(), status.Emplace(StatusCode::kBusy)); + + VerifyOrExit(!commissionMgr.IsCommissioningWindowOpen(), status.Emplace(StatusCode::kBusy)); + VerifyOrExit(iterations >= kSpake2p_Min_PBKDF_Iterations, status.Emplace(StatusCode::kPAKEParameterError)); + VerifyOrExit(iterations <= kSpake2p_Max_PBKDF_Iterations, status.Emplace(StatusCode::kPAKEParameterError)); + VerifyOrExit(salt.size() >= kSpake2p_Min_PBKDF_Salt_Length, status.Emplace(StatusCode::kPAKEParameterError)); + VerifyOrExit(salt.size() <= kSpake2p_Max_PBKDF_Salt_Length, status.Emplace(StatusCode::kPAKEParameterError)); VerifyOrExit(commissioningTimeout <= commissionMgr.MaxCommissioningTimeout(), globalStatus = InteractionModel::Status::InvalidCommand); VerifyOrExit(commissioningTimeout >= commissionMgr.MinCommissioningTimeout(), globalStatus = InteractionModel::Status::InvalidCommand); VerifyOrExit(discriminator <= kMaxDiscriminatorValue, globalStatus = InteractionModel::Status::InvalidCommand); - VerifyOrExit(verifier.Deserialize(pakeVerifier) == CHIP_NO_ERROR, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); + VerifyOrExit(verifier.Deserialize(pakeVerifier) == CHIP_NO_ERROR, status.Emplace(StatusCode::kPAKEParameterError)); VerifyOrExit(commissionMgr.OpenEnhancedCommissioningWindow(commissioningTimeout, discriminator, verifier, iterations, salt, fabricIndex, fabricInfo->GetVendorId()) == CHIP_NO_ERROR, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); + status.Emplace(StatusCode::kPAKEParameterError)); ChipLogProgress(Zcl, "Commissioning window is now open"); exit: if (status.HasValue()) { - ChipLogError(Zcl, "Failed to open commissioning window. Cluster status %d", status.Value()); - commandObj->AddClusterSpecificFailure(commandPath, status.Value()); + ChipLogError(Zcl, "Failed to open commissioning window. Cluster status 0x%02x", to_underlying(status.Value())); + commandObj->AddClusterSpecificFailure(commandPath, to_underlying(status.Value())); } else { @@ -156,24 +151,24 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac auto & failSafeContext = Server::GetInstance().GetFailSafeContext(); auto & commissionMgr = Server::GetInstance().GetCommissioningWindowManager(); - VerifyOrExit(fabricInfo != nullptr, status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); + VerifyOrExit(fabricInfo != nullptr, status.Emplace(StatusCode::kPAKEParameterError)); - VerifyOrExit(!commissionMgr.IsCommissioningWindowOpen(), status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_BUSY)); - VerifyOrExit(failSafeContext.IsFailSafeFullyDisarmed(), status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_BUSY)); + VerifyOrExit(!commissionMgr.IsCommissioningWindowOpen(), status.Emplace(StatusCode::kBusy)); + VerifyOrExit(failSafeContext.IsFailSafeFullyDisarmed(), status.Emplace(StatusCode::kBusy)); VerifyOrExit(commissioningTimeout <= commissionMgr.MaxCommissioningTimeout(), globalStatus = InteractionModel::Status::InvalidCommand); VerifyOrExit(commissioningTimeout >= commissionMgr.MinCommissioningTimeout(), globalStatus = InteractionModel::Status::InvalidCommand); VerifyOrExit(commissionMgr.OpenBasicCommissioningWindowForAdministratorCommissioningCluster( commissioningTimeout, fabricIndex, fabricInfo->GetVendorId()) == CHIP_NO_ERROR, - status.Emplace(StatusCode::EMBER_ZCL_STATUS_CODE_PAKE_PARAMETER_ERROR)); + status.Emplace(StatusCode::kPAKEParameterError)); ChipLogProgress(Zcl, "Commissioning window is now open"); exit: if (status.HasValue()) { - ChipLogError(Zcl, "Failed to open commissioning window. Cluster status %d", status.Value()); - commandObj->AddClusterSpecificFailure(commandPath, status.Value()); + ChipLogError(Zcl, "Failed to open commissioning window. Cluster status 0x%02x", to_underlying(status.Value())); + commandObj->AddClusterSpecificFailure(commandPath, to_underlying(status.Value())); } else { @@ -198,7 +193,7 @@ bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback( if (!Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) { ChipLogError(Zcl, "Commissioning window is currently not open"); - commandObj->AddClusterSpecificFailure(commandPath, StatusCode::EMBER_ZCL_STATUS_CODE_WINDOW_NOT_OPEN); + commandObj->AddClusterSpecificFailure(commandPath, to_underlying(StatusCode::kWindowNotOpen)); } else { diff --git a/src/app/common/templates/weak-enum-list.yaml b/src/app/common/templates/weak-enum-list.yaml index 515e30bde00831..1dca3747b9a520 100644 --- a/src/app/common/templates/weak-enum-list.yaml +++ b/src/app/common/templates/weak-enum-list.yaml @@ -31,7 +31,6 @@ - SaturationMoveMode - SaturationStepMode - SecurityType -- StatusCode - StepMode - TemperatureDisplayMode - WiFiVersionType