diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 8e31c4ec720ce6..763bb15c47f5be 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -181,7 +181,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen() && commandObj->GetSubjectDescriptor().authMode == Access::AuthMode::kCase) { - response.errorCode = CommissioningError::kBusyWithOtherAdmin; + response.errorCode = CommissioningErrorEnum::kBusyWithOtherAdmin; commandObj->AddResponse(commandPath, response); } else if (commandData.expiryLengthSeconds == 0) @@ -190,7 +190,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * failSafeContext.ForceFailSafeTimerExpiry(); // Don't set the breadcrumb, since expiring the failsafe should // reset it anyway. - response.errorCode = CommissioningError::kOk; + response.errorCode = CommissioningErrorEnum::kOk; commandObj->AddResponse(commandPath, response); } else @@ -199,13 +199,13 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * failSafeContext.ArmFailSafe(accessingFabricIndex, System::Clock::Seconds16(commandData.expiryLengthSeconds)), Failure); Breadcrumb::Set(commandPath.mEndpointId, commandData.breadcrumb); - response.errorCode = CommissioningError::kOk; + response.errorCode = CommissioningErrorEnum::kOk; commandObj->AddResponse(commandPath, response); } } else { - response.errorCode = CommissioningError::kBusyWithOtherAdmin; + response.errorCode = CommissioningErrorEnum::kBusyWithOtherAdmin; commandObj->AddResponse(commandPath, response); } @@ -227,7 +227,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback( Commands::CommissioningCompleteResponse::Type response; if (!failSafe.IsFailSafeArmed()) { - response.errorCode = CommissioningError::kNoFailSafe; + response.errorCode = CommissioningErrorEnum::kNoFailSafe; } else { @@ -238,7 +238,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback( handle->AsSecureSession()->GetSecureSessionType() != SecureSession::Type::kCASE || !failSafe.MatchesFabricIndex(commandObj->GetAccessingFabricIndex())) { - response.errorCode = CommissioningError::kInvalidAuthentication; + response.errorCode = CommissioningErrorEnum::kInvalidAuthentication; ChipLogError(FailSafe, "GeneralCommissioning: Got commissioning complete in invalid security context"); } else @@ -270,7 +270,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback( Failure); Breadcrumb::Set(commandPath.mEndpointId, 0); - response.errorCode = CommissioningError::kOk; + response.errorCode = CommissioningErrorEnum::kOk; } } @@ -287,9 +287,9 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr(); Commands::SetRegulatoryConfigResponse::Type response; - if (commandData.newRegulatoryConfig > RegulatoryLocationType::kIndoorOutdoor) + if (commandData.newRegulatoryConfig > RegulatoryLocationTypeEnum::kIndoorOutdoor) { - response.errorCode = CommissioningError::kValueOutsideRange; + response.errorCode = CommissioningErrorEnum::kValueOutsideRange; response.debugText = commandData.countryCode; } else @@ -301,16 +301,16 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH // If the LocationCapability attribute is not Indoor/Outdoor and the NewRegulatoryConfig value received does not match // either the Indoor or Outdoor fixed value in LocationCapability. - if ((locationCapability != to_underlying(RegulatoryLocationType::kIndoorOutdoor)) && (location != locationCapability)) + if ((locationCapability != to_underlying(RegulatoryLocationTypeEnum::kIndoorOutdoor)) && (location != locationCapability)) { - response.errorCode = CommissioningError::kValueOutsideRange; + response.errorCode = CommissioningErrorEnum::kValueOutsideRange; response.debugText = commandData.countryCode; } else { CheckSuccess(server->SetRegulatoryConfig(location, commandData.countryCode), Failure); Breadcrumb::Set(commandPath.mEndpointId, commandData.breadcrumb); - response.errorCode = CommissioningError::kOk; + response.errorCode = CommissioningErrorEnum::kOk; } } diff --git a/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml index cde1addf326305..390da4c31d2bd1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml @@ -16,7 +16,7 @@ limitations under the License. --> - + @@ -24,7 +24,7 @@ limitations under the License. - + @@ -47,8 +47,8 @@ limitations under the License. BasicCommissioningInfo - RegulatoryConfig - LocationCapability + RegulatoryConfig + LocationCapability SupportsConcurrentConnection @@ -59,19 +59,19 @@ limitations under the License. Success/failure response for ArmFailSafe command - + Set the regulatory configuration to be used during commissioning - + Success/failure response for SetRegulatoryConfig command - + @@ -80,7 +80,7 @@ limitations under the License. Indicates to client whether CommissioningComplete command succeeded - + diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index f9cc5a282d8737..5b27cc358429ce 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -2070,7 +2070,7 @@ void DeviceCommissioner::OnArmFailSafe(void * context, CHIP_ERROR err = CHIP_NO_ERROR; ChipLogProgress(Controller, "Received ArmFailSafe response errorCode=%u", to_underlying(data.errorCode)); - if (data.errorCode != GeneralCommissioning::CommissioningError::kOk) + if (data.errorCode != GeneralCommissioning::CommissioningErrorEnum::kOk) { err = CHIP_ERROR_INTERNAL; report.Set(data.errorCode); @@ -2087,7 +2087,7 @@ void DeviceCommissioner::OnSetRegulatoryConfigResponse( CHIP_ERROR err = CHIP_NO_ERROR; ChipLogProgress(Controller, "Received SetRegulatoryConfig response errorCode=%u", to_underlying(data.errorCode)); - if (data.errorCode != GeneralCommissioning::CommissioningError::kOk) + if (data.errorCode != GeneralCommissioning::CommissioningErrorEnum::kOk) { err = CHIP_ERROR_INTERNAL; report.Set(data.errorCode); @@ -2181,7 +2181,7 @@ void DeviceCommissioner::OnCommissioningCompleteResponse( CHIP_ERROR err = CHIP_NO_ERROR; ChipLogProgress(Controller, "Received CommissioningComplete response, errorCode=%u", to_underlying(data.errorCode)); - if (data.errorCode != GeneralCommissioning::CommissioningError::kOk) + if (data.errorCode != GeneralCommissioning::CommissioningErrorEnum::kOk) { err = CHIP_ERROR_INTERNAL; report.Set(data.errorCode); @@ -2309,10 +2309,10 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio // TODO(cecille): Where is the country config actually set? ChipLogProgress(Controller, "Setting Regulatory Config"); auto capability = - params.GetLocationCapability().ValueOr(app::Clusters::GeneralCommissioning::RegulatoryLocationType::kOutdoor); - app::Clusters::GeneralCommissioning::RegulatoryLocationType regulatoryConfig; + params.GetLocationCapability().ValueOr(app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kOutdoor); + app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum regulatoryConfig; // Value is only switchable on the devices with indoor/outdoor capability - if (capability == app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor) + if (capability == app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoorOutdoor) { // If the device supports indoor and outdoor configs, use the setting from the commissioner, otherwise fall back to // the current device setting then to outdoor (most restrictive) @@ -2330,7 +2330,7 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio } else { - regulatoryConfig = app::Clusters::GeneralCommissioning::RegulatoryLocationType::kOutdoor; + regulatoryConfig = app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kOutdoor; ChipLogProgress(Controller, "No overrride or device regulatory config supplied, setting to outdoor"); } } diff --git a/src/controller/CommissioningDelegate.h b/src/controller/CommissioningDelegate.h index d34f8fff234526..3499a8ea9bc22a 100644 --- a/src/controller/CommissioningDelegate.h +++ b/src/controller/CommissioningDelegate.h @@ -85,7 +85,7 @@ struct CompletionStatus CHIP_ERROR err; Optional failedStage; Optional attestationResult; - Optional commissioningError; + Optional commissioningError; Optional networkCommissioningStatus; }; @@ -125,7 +125,7 @@ class CommissioningParameters // (from GetLocationCapability - see below). If the regulatory location is not supplied, this will fall back to the location in // GetDefaultRegulatoryLocation and then to Outdoor (most restrictive). // This value should be set before calling PerformCommissioningStep for the kConfigRegulatory step. - const Optional GetDeviceRegulatoryLocation() const + const Optional GetDeviceRegulatoryLocation() const { return mDeviceRegulatoryLocation; } @@ -228,7 +228,7 @@ class CommissioningParameters // Default regulatory location set by the node, as read from the GeneralCommissioning cluster. In the AutoCommissioner, this is // automatically set from report from the kReadCommissioningInfo stage. // This should be set before calling PerformCommissioningStep for the kConfigRegulatory step. - const Optional GetDefaultRegulatoryLocation() const + const Optional GetDefaultRegulatoryLocation() const { return mDefaultRegulatoryLocation; } @@ -236,7 +236,7 @@ class CommissioningParameters // Location capabilities of the node, as read from the GeneralCommissioning cluster. In the AutoCommissioner, this is // automatically set from report from the kReadCommissioningInfo stage. // This should be set before calling PerformCommissioningStep for the kConfigRegulatory step. - const Optional GetLocationCapability() const + const Optional GetLocationCapability() const { return mLocationCapability; } @@ -257,7 +257,7 @@ class CommissioningParameters return *this; } - CommissioningParameters & SetDeviceRegulatoryLocation(app::Clusters::GeneralCommissioning::RegulatoryLocationType location) + CommissioningParameters & SetDeviceRegulatoryLocation(app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum location) { mDeviceRegulatoryLocation.SetValue(location); return *this; @@ -368,12 +368,12 @@ class CommissioningParameters mRemoteProductId = MakeOptional(id); return *this; } - CommissioningParameters & SetDefaultRegulatoryLocation(app::Clusters::GeneralCommissioning::RegulatoryLocationType location) + CommissioningParameters & SetDefaultRegulatoryLocation(app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum location) { mDefaultRegulatoryLocation = MakeOptional(location); return *this; } - CommissioningParameters & SetLocationCapability(app::Clusters::GeneralCommissioning::RegulatoryLocationType capability) + CommissioningParameters & SetLocationCapability(app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum capability) { mLocationCapability = MakeOptional(capability); return *this; @@ -451,7 +451,7 @@ class CommissioningParameters // Items that can be set by the commissioner Optional mFailsafeTimerSeconds; Optional mCASEFailsafeTimerSeconds; - Optional mDeviceRegulatoryLocation; + Optional mDeviceRegulatoryLocation; Optional mCSRNonce; Optional mAttestationNonce; Optional mWiFiCreds; @@ -471,8 +471,8 @@ class CommissioningParameters Optional mRemoteNodeId; Optional mRemoteVendorId; Optional mRemoteProductId; - Optional mDefaultRegulatoryLocation; - Optional mLocationCapability; + Optional mDefaultRegulatoryLocation; + Optional mLocationCapability; CompletionStatus completionStatus; Credentials::DeviceAttestationDelegate * mDeviceAttestationDelegate = nullptr; // Delegate to handle device attestation failures during commissioning @@ -542,10 +542,10 @@ struct GeneralCommissioningInfo { uint64_t breadcrumb = 0; uint16_t recommendedFailsafe = 0; - app::Clusters::GeneralCommissioning::RegulatoryLocationType currentRegulatoryLocation = - app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor; - app::Clusters::GeneralCommissioning::RegulatoryLocationType locationCapability = - app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor; + app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum currentRegulatoryLocation = + app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoorOutdoor; + app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum locationCapability = + app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoorOutdoor; ; }; @@ -565,8 +565,8 @@ struct AttestationErrorInfo struct CommissioningErrorInfo { - CommissioningErrorInfo(app::Clusters::GeneralCommissioning::CommissioningError result) : commissioningError(result) {} - app::Clusters::GeneralCommissioning::CommissioningError commissioningError; + CommissioningErrorInfo(app::Clusters::GeneralCommissioning::CommissioningErrorEnum result) : commissioningError(result) {} + app::Clusters::GeneralCommissioning::CommissioningErrorEnum commissioningError; }; struct NetworkCommissioningStatusInfo diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 33919c12e7a70c..8b4c8c1b204665 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -3098,8 +3098,16 @@ - WiredCurrentTypeEnum - WiredFaultEnum GeneralCommissioning: - - CommissioningError - - RegulatoryLocationType + # CommissioningErrorEnum was originally just named + # CommissioningError, but we generate the same API + # for both of those names, so the name can just change + # here. + - CommissioningErrorEnum + # RegulatoryLocationTypeEnum was originally just named + # RegulatoryLocationType, but we generate the same API + # for both of those names, so the name can just change + # here. + - RegulatoryLocationTypeEnum NetworkCommissioning: - NetworkCommissioningStatus - WiFiBand @@ -3414,13 +3422,21 @@ - OverVoltage - UnderVoltage GeneralCommissioning: - CommissioningError: + # CommissioningErrorEnum was originally just named + # CommissioningError, but we generate the same API + # for both of those names, so the name can just change + # here. + CommissioningErrorEnum: - Ok - ValueOutsideRange - InvalidAuthentication - NoFailSafe - BusyWithOtherAdmin - RegulatoryLocationType: + # RegulatoryLocationTypeEnum was originally just named + # RegulatoryLocationType, but we generate the same API + # for both of those names, so the name can just change + # here. + RegulatoryLocationTypeEnum: - Indoor - Outdoor - IndoorOutdoor @@ -5646,7 +5662,11 @@ - ValueB - ValueC GeneralCommissioning: - CommissioningError: + # CommissioningErrorEnum was originally just named + # CommissioningError, but we generate the same API + # for both of those names, so the name can just change + # here. + CommissioningErrorEnum: - OK AccessControl: AccessControlEntryPrivilegeEnum: @@ -6211,7 +6231,11 @@ - DoorLockProgrammingEventCode enum values: GeneralCommissioning: - CommissioningError: + # CommissioningErrorEnum was originally just named + # CommissioningError, but we generate the same API + # for both of those names, so the name can just change + # here. + CommissioningErrorEnum: - Ok PowerSource: BatChargeLevelEnum: @@ -6569,7 +6593,11 @@ UserTypeEnum: DlUserType enum values: GeneralCommissioning: - CommissioningError: + # CommissioningErrorEnum was originally just named + # CommissioningError, but we generate the same API + # for both of those names, so the name can just change + # here. + CommissioningErrorEnum: OK: Ok PowerSource: BatChargeLevelEnum: diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index 8da89c2223d6ff..a7decf94224786 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -202,7 +202,7 @@ void SetConfigurationMgr(ConfigurationManager * configurationManager); inline CHIP_ERROR ConfigurationManager::GetLocationCapability(uint8_t & location) { - location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); return CHIP_NO_ERROR; } diff --git a/src/platform/Darwin/ConfigurationManagerImpl.cpp b/src/platform/Darwin/ConfigurationManagerImpl.cpp index a24e9b84e07c27..45957a5c37ee32 100644 --- a/src/platform/Darwin/ConfigurationManagerImpl.cpp +++ b/src/platform/Darwin/ConfigurationManagerImpl.cpp @@ -191,13 +191,13 @@ CHIP_ERROR ConfigurationManagerImpl::Init() if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_RegulatoryLocation)) { - uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); ReturnErrorOnFailure(WriteConfigValue(PosixConfig::kConfigKey_RegulatoryLocation, location)); } if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_LocationCapability)) { - uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); ReturnErrorOnFailure(WriteConfigValue(PosixConfig::kConfigKey_LocationCapability, location)); } diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 8cec8f46f9f92f..889ccb8abdb776 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -231,7 +231,7 @@ CHIP_ERROR ConfigurationManagerImpl::GetLocationCapability(uint8_t & location) return err; #else - location = static_cast(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + location = static_cast(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); return CHIP_NO_ERROR; #endif } diff --git a/src/platform/Linux/ConfigurationManagerImpl.cpp b/src/platform/Linux/ConfigurationManagerImpl.cpp index 44e77e4e290ebe..f5d163487f12f9 100644 --- a/src/platform/Linux/ConfigurationManagerImpl.cpp +++ b/src/platform/Linux/ConfigurationManagerImpl.cpp @@ -106,14 +106,14 @@ CHIP_ERROR ConfigurationManagerImpl::Init() if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_RegulatoryLocation)) { - uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); err = WriteConfigValue(PosixConfig::kConfigKey_RegulatoryLocation, location); SuccessOrExit(err); } if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_LocationCapability)) { - uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor); + uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoorOutdoor); err = WriteConfigValue(PosixConfig::kConfigKey_LocationCapability, location); SuccessOrExit(err); } diff --git a/src/platform/webos/ConfigurationManagerImpl.cpp b/src/platform/webos/ConfigurationManagerImpl.cpp index a7815277a215fd..6958e4adeff9dd 100644 --- a/src/platform/webos/ConfigurationManagerImpl.cpp +++ b/src/platform/webos/ConfigurationManagerImpl.cpp @@ -106,14 +106,14 @@ CHIP_ERROR ConfigurationManagerImpl::Init() if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_RegulatoryLocation)) { - uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); err = WriteConfigValue(PosixConfig::kConfigKey_RegulatoryLocation, location); SuccessOrExit(err); } if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_LocationCapability)) { - uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); err = WriteConfigValue(PosixConfig::kConfigKey_LocationCapability, location); SuccessOrExit(err); }