Skip to content

Commit

Permalink
Use enum class for GeneralCommissioning::RegulatoryLocationType (#13374)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored and pull[bot] committed Feb 28, 2022
1 parent f481713 commit cca1ef1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH
const Commands::SetRegulatoryConfig::DecodableType & commandData)
{
DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr();
CheckSuccess(server->SetRegulatoryConfig(commandData.location, commandData.countryCode, commandData.breadcrumb), Failure);

CheckSuccess(server->SetRegulatoryConfig(to_underlying(commandData.location), commandData.countryCode, commandData.breadcrumb),
Failure);

Commands::SetRegulatoryConfigResponse::Type response;
response.errorCode = GeneralCommissioningError::kOk;
Expand Down
1 change: 0 additions & 1 deletion src/app/zap-templates/templates/app/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ function isWeaklyTypedEnum(label)
"PHYRateType",
"RadioFaultType",
"RoutingRole",
"RegulatoryLocationType",
"SaturationMoveMode",
"SaturationStepMode",
"SecurityType",
Expand Down
2 changes: 1 addition & 1 deletion src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio
// TODO(cecille): Worthwhile to keep this around as part of the class?
// TODO(cecille): Where is the country config actually set?
ChipLogProgress(Controller, "Setting Regulatory Config");
uint8_t regulatoryLocation = EMBER_ZCL_REGULATORY_LOCATION_TYPE_OUTDOOR;
uint8_t regulatoryLocation = to_underlying(app::Clusters::GeneralCommissioning::RegulatoryLocationType::kOutdoor);
#if CONFIG_DEVICE_LAYER
CHIP_ERROR status = DeviceLayer::ConfigurationMgr().GetRegulatoryLocation(regulatoryLocation);
#else
Expand Down
4 changes: 2 additions & 2 deletions src/include/platform/ConfigurationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <cstdint>

#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <lib/support/Span.h>
#include <platform/CHIPDeviceBuildConfig.h>
#include <platform/PersistedStorage.h>
Expand Down Expand Up @@ -191,7 +191,7 @@ extern void SetConfigurationMgr(ConfigurationManager * configurationManager);

inline CHIP_ERROR ConfigurationManager::GetLocationCapability(uint8_t & location)
{
location = EMBER_ZCL_REGULATORY_LOCATION_TYPE_INDOOR;
location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor);
return CHIP_NO_ERROR;
}

Expand Down
6 changes: 3 additions & 3 deletions src/platform/Linux/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <platform/internal/CHIPDeviceLayerInternal.h>

#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <ifaddrs.h>
#include <lib/core/CHIPVendorIdentifiers.hpp>
#include <lib/support/CodeUtils.h>
Expand Down Expand Up @@ -94,14 +94,14 @@ CHIP_ERROR ConfigurationManagerImpl::Init()

if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_RegulatoryLocation))
{
uint32_t location = EMBER_ZCL_REGULATORY_LOCATION_TYPE_INDOOR;
uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor);
err = WriteConfigValue(PosixConfig::kConfigKey_RegulatoryLocation, location);
SuccessOrExit(err);
}

if (!PosixConfig::ConfigValueExists(PosixConfig::kConfigKey_LocationCapability))
{
uint32_t location = EMBER_ZCL_REGULATORY_LOCATION_TYPE_INDOOR;
uint32_t location = to_underlying(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType::kIndoor);
err = WriteConfigValue(PosixConfig::kConfigKey_LocationCapability, location);
SuccessOrExit(err);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions zzz_generated/app-common/app-common/zap-generated/enums.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cca1ef1

Please sign in to comment.