From d356ebcb0f7cba6928025b81b27c650617ebdbcd Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 22 May 2023 16:16:12 -0400 Subject: [PATCH] Align General Commissioning cluster XML to spec changes. Spec changes happened in https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/6179 and https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/6338 Fixes https://github.com/project-chip/connectedhomeip/issues/24997 --- .../general-commissioning-server.cpp | 24 +++++------ .../chip/general-commissioning-cluster.xml | 16 +++---- src/controller/CHIPDeviceController.cpp | 14 +++---- src/controller/CommissioningDelegate.h | 32 +++++++------- .../java/CHIPDeviceController-JNI.cpp | 8 ++-- .../devicecontroller/ControllerParams.java | 6 +-- .../commissioning_flow_blocks.py | 2 +- .../chip/utils/CommissioningBuildingBlocks.py | 8 ++-- .../python/test/test_scripts/base.py | 4 +- .../CHIP/templates/availability.yaml | 42 +++++++++++++++---- src/include/platform/ConfigurationManager.h | 2 +- .../Ameba/ConfigurationManagerImpl.cpp | 7 ++-- .../Darwin/ConfigurationManagerImpl.cpp | 4 +- .../ESP32/ConfigurationManagerImpl.cpp | 2 +- .../Linux/ConfigurationManagerImpl.cpp | 4 +- .../webos/ConfigurationManagerImpl.cpp | 4 +- src/python_testing/TC_CGEN_2_4.py | 16 +++---- 17 files changed, 112 insertions(+), 83 deletions(-) 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/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index d7bb27b126b3f3..8d4412b9370f67 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -428,11 +428,11 @@ JNI_METHOD(jlong, newDeviceController)(JNIEnv * env, jobject self, jobject contr using namespace app::Clusters::GeneralCommissioning; jint regulatoryLocationJint = chip::JniReferences::GetInstance().IntegerToPrimitive(regulatoryLocation); - VerifyOrExit(chip::CanCastTo(regulatoryLocationJint), err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(chip::CanCastTo(regulatoryLocationJint), err = CHIP_ERROR_INVALID_ARGUMENT); - RegulatoryLocationType regulatoryLocationType = static_cast(regulatoryLocationJint); - VerifyOrExit(regulatoryLocationType >= RegulatoryLocationType::kIndoor, err = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(regulatoryLocationType <= RegulatoryLocationType::kIndoorOutdoor, err = CHIP_ERROR_INVALID_ARGUMENT); + RegulatoryLocationType regulatoryLocationType = static_cast(regulatoryLocationJint); + VerifyOrExit(regulatoryLocationType >= RegulatoryLocationTypeEnum::kIndoor, err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(regulatoryLocationType <= RegulatoryLocationTypeEnum::kIndoorOutdoor, err = CHIP_ERROR_INVALID_ARGUMENT); chip::Controller::CommissioningParameters commissioningParams = wrapper->GetCommissioningParameters(); commissioningParams.SetDeviceRegulatoryLocation(regulatoryLocationType); diff --git a/src/controller/java/src/chip/devicecontroller/ControllerParams.java b/src/controller/java/src/chip/devicecontroller/ControllerParams.java index a746dd43ad6e17..c1d475040c4806 100644 --- a/src/controller/java/src/chip/devicecontroller/ControllerParams.java +++ b/src/controller/java/src/chip/devicecontroller/ControllerParams.java @@ -288,15 +288,15 @@ public Builder setCountryCode(final String countryCode) { *

Setting the regulatory location type will set the NewRegulatoryConfig when the * SetRegulatoryConfig command is sent by this ChipDeviceCommissioner. * - * @param regulatoryLocation an app::Clusters::GeneralCommissioning::RegulatoryLocationType enum + * @param regulatoryLocation an app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum enum * value * @return */ public Builder setRegulatoryLocation(int regulatoryLocation) { if ((regulatoryLocation < 0) || (regulatoryLocation > 2)) { throw new IllegalArgumentException( - "regulatoryLocation value must be between RegulatoryLocationType::kIndoor and " - + "RegulatoryLocationType::kIndoorOutdoor"); + "regulatoryLocation value must be between RegulatoryLocationTypeEnum::kIndoor and " + + "RegulatoryLocationTypeEnum::kIndoorOutdoor"); } this.regulatoryLocationType = Optional.of(regulatoryLocation); return this; diff --git a/src/controller/python/chip/commissioning/commissioning_flow_blocks.py b/src/controller/python/chip/commissioning/commissioning_flow_blocks.py index 986064af8b6e9e..6a5603bbc5d08c 100644 --- a/src/controller/python/chip/commissioning/commissioning_flow_blocks.py +++ b/src/controller/python/chip/commissioning/commissioning_flow_blocks.py @@ -233,7 +233,7 @@ async def network_commissioning(self, parameter: commissioning.Parameters, node_ async def send_regulatory_config(self, parameter: commissioning.Parameters, node_id: int): self._logger.info("Sending Regulatory Config") response = await self._devCtrl.SendCommand(node_id, commissioning.ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Commands.SetRegulatoryConfig( - newRegulatoryConfig=Clusters.GeneralCommissioning.Enums.RegulatoryLocationType( + newRegulatoryConfig=Clusters.GeneralCommissioning.Enums.RegulatoryLocationTypeEnum( parameter.regulatory_config.location_type), countryCode=parameter.regulatory_config.country_code )) diff --git a/src/controller/python/chip/utils/CommissioningBuildingBlocks.py b/src/controller/python/chip/utils/CommissioningBuildingBlocks.py index 773f05748f51bc..c85866003c7207 100644 --- a/src/controller/python/chip/utils/CommissioningBuildingBlocks.py +++ b/src/controller/python/chip/utils/CommissioningBuildingBlocks.py @@ -142,7 +142,7 @@ async def AddNOCForNewFabricFromExisting(commissionerDevCtrl, newFabricDevCtrl, ''' resp = await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(60)) - if resp.errorCode is not generalCommissioning.Enums.CommissioningError.kOk: + if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: return False csrForAddNOC = await commissionerDevCtrl.SendCommand(existingNodeId, 0, opCreds.Commands.CSRRequest(CSRNonce=os.urandom(32))) @@ -161,7 +161,7 @@ async def AddNOCForNewFabricFromExisting(commissionerDevCtrl, newFabricDevCtrl, return False resp = await newFabricDevCtrl.SendCommand(newNodeId, 0, generalCommissioning.Commands.CommissioningComplete()) - if resp.errorCode is not generalCommissioning.Enums.CommissioningError.kOk: + if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) return False @@ -189,7 +189,7 @@ async def UpdateNOC(devCtrl, existingNodeId, newNodeId): """ resp = await devCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(600)) - if resp.errorCode is not generalCommissioning.Enums.CommissioningError.kOk: + if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: return False csrForUpdateNOC = await devCtrl.SendCommand( existingNodeId, 0, opCreds.Commands.CSRRequest(CSRNonce=os.urandom(32), isForUpdateNOC=True)) @@ -208,7 +208,7 @@ async def UpdateNOC(devCtrl, existingNodeId, newNodeId): devCtrl.ExpireSessions(existingNodeId) resp = await devCtrl.SendCommand(newNodeId, 0, generalCommissioning.Commands.CommissioningComplete()) - if resp.errorCode is not generalCommissioning.Enums.CommissioningError.kOk: + if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: # Expiring the failsafe timer in an attempt to clean up. await devCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) return False diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index 65d774618f1f79..57a757401eeec5 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -351,7 +351,7 @@ def TestFailsafe(self, nodeid: int): "Failed to send arm failsafe command error is {} with im response{}".format(err, resp)) return False - if resp.errorCode is not Clusters.GeneralCommissioning.Enums.CommissioningError.kOk: + if resp.errorCode is not Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kOk: self.logger.error( "Incorrect response received from arm failsafe - wanted OK, received {}".format(resp)) return False @@ -431,7 +431,7 @@ def TestFailsafe(self, nodeid: int): self.logger.error( "Failed to send arm failsafe command error is {} with im response{}".format(err, resp)) return False - if resp.errorCode is Clusters.GeneralCommissioning.Enums.CommissioningError.kBusyWithOtherAdmin: + if resp.errorCode is Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kBusyWithOtherAdmin: return True return False 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/Ameba/ConfigurationManagerImpl.cpp b/src/platform/Ameba/ConfigurationManagerImpl.cpp index 9eb8e08d3867f4..16d7a8f45e75f7 100644 --- a/src/platform/Ameba/ConfigurationManagerImpl.cpp +++ b/src/platform/Ameba/ConfigurationManagerImpl.cpp @@ -82,15 +82,16 @@ CHIP_ERROR ConfigurationManagerImpl::Init() if (!AmebaConfig::ConfigValueExists(AmebaConfig::kConfigKey_RegulatoryLocation)) { - uint32_t regulatoryLocation = to_underlying(app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor); + uint32_t regulatoryLocation = to_underlying(app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoor); err = WriteConfigValue(AmebaConfig::kConfigKey_RegulatoryLocation, regulatoryLocation); SuccessOrExit(err); } if (!AmebaConfig::ConfigValueExists(AmebaConfig::kConfigKey_LocationCapability)) { - uint32_t locationCapability = to_underlying(app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoorOutdoor); - err = WriteConfigValue(AmebaConfig::kConfigKey_LocationCapability, locationCapability); + uint32_t locationCapability = + to_underlying(app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum::kIndoorOutdoor); + err = WriteConfigValue(AmebaConfig::kConfigKey_LocationCapability, locationCapability); SuccessOrExit(err); } 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); } diff --git a/src/python_testing/TC_CGEN_2_4.py b/src/python_testing/TC_CGEN_2_4.py index 7ef128a787dfe3..6c8e36b907bb00 100644 --- a/src/python_testing/TC_CGEN_2_4.py +++ b/src/python_testing/TC_CGEN_2_4.py @@ -102,18 +102,18 @@ async def test_TC_CGEN_2_4(self): logging.info('Step 18 - TH1 reads the location capability') attr = Clusters.GeneralCommissioning.Attributes.LocationCapability cap = await self.read_single_attribute(dev_ctrl=self.th1, node_id=self.dut_node_id, endpoint=0, attribute=attr) - if cap == Clusters.GeneralCommissioning.Enums.RegulatoryLocationType.kIndoor: - newloc = Clusters.GeneralCommissioning.Enums.RegulatoryLocationType.kOutdoor - elif cap == Clusters.GeneralCommissioning.Enums.RegulatoryLocationType.kOutdoor: - newloc = Clusters.GeneralCommissioning.Enums.RegulatoryLocationType.kIndoor + if cap == Clusters.GeneralCommissioning.Enums.RegulatoryLocationTypeEnum.kIndoor: + newloc = Clusters.GeneralCommissioning.Enums.RegulatoryLocationTypeEnum.kOutdoor + elif cap == Clusters.GeneralCommissioning.Enums.RegulatoryLocationTypeEnum.kOutdoor: + newloc = Clusters.GeneralCommissioning.Enums.RegulatoryLocationTypeEnum.kIndoor else: - newloc = Clusters.GeneralCommissioning.Enums.RegulatoryLocationType.extend_enum_if_value_doesnt_exist(3) + newloc = Clusters.GeneralCommissioning.Enums.RegulatoryLocationTypeEnum.extend_enum_if_value_doesnt_exist(3) logging.info('Step 19 Send SetRgulatoryConfig with incorrect location newloc = {}'.format(newloc)) cmd = Clusters.GeneralCommissioning.Commands.SetRegulatoryConfig( newRegulatoryConfig=newloc, countryCode="XX", breadcrumb=0) ret = await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd) - asserts.assert_true(ret.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningError.kValueOutsideRange) + asserts.assert_true(ret.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kValueOutsideRange) logging.info('Step 20 - TH2 sends CommissioningComplete') cmd = Clusters.GeneralCommissioning.Commands.CommissioningComplete() @@ -121,7 +121,7 @@ async def test_TC_CGEN_2_4(self): asserts.assert_true(isinstance(resp, Clusters.GeneralCommissioning.Commands.CommissioningCompleteResponse), 'Incorrect response type from command') asserts.assert_true( - resp.errorCode == Clusters.GeneralCommissioning.Enums.CommissioningError.kInvalidAuthentication, 'Incorrect error code') + resp.errorCode == Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kInvalidAuthentication, 'Incorrect error code') logging.info('Step 21 - TH1 sends an arm failsafe with timeout==0') cmd = Clusters.GeneralCommissioning.Commands.ArmFailSafe(expiryLengthSeconds=0, breadcrumb=0) @@ -133,7 +133,7 @@ async def test_TC_CGEN_2_4(self): resp = await self.th2.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd) asserts.assert_true(isinstance(resp, Clusters.GeneralCommissioning.Commands.CommissioningCompleteResponse), 'Incorrect response type from command') - asserts.assert_true(resp.errorCode == Clusters.GeneralCommissioning.Enums.CommissioningError.kNoFailSafe, + asserts.assert_true(resp.errorCode == Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kNoFailSafe, 'Incorrect error code') logging.info('Step 23 - TH2 reads fabric index')