From 51cc7ddade541112b5b2713257a6f8f12329c29d Mon Sep 17 00:00:00 2001 From: Karsten Sperling Date: Fri, 15 Sep 2023 17:53:16 +1200 Subject: [PATCH 1/2] Make constexpr constants in headers inline constexpr This makes the linker deduplicate these constants, instead of emitting one definition per compilation unit. E.g. chip::System::Clock::kZero currently exists >10 times in the chip-tool binary. --- .../commands/clusters/ComplexArgument.h | 4 +- .../commands/clusters/WriteAttributeCommand.h | 6 +- .../chip-tool/commands/common/CHIPCommand.h | 8 +- .../commands/common/CustomStringPrefix.h | 16 +-- .../commands/common/CHIPCommandBridge.h | 6 +- .../commands/tests/TestCommandBridge.h | 6 +- .../placeholder/linux/include/TestCommand.h | 6 +- .../telink/common/include/AppTaskCommon.h | 10 +- examples/shell/shell_common/include/Globals.h | 6 +- examples/tv-casting-app/linux/CastingUtils.h | 2 +- .../tv-casting-common/include/CastingServer.h | 4 +- .../include/PersistenceManager.h | 2 +- .../include/TargetEndpointInfo.h | 2 +- .../include/TargetVideoPlayerInfo.h | 2 +- src/app/EventLoggingTypes.h | 2 +- src/app/EventManagement.h | 6 +- src/app/InteractionModelRevision.h | 2 +- src/app/ReadHandler.h | 2 +- src/app/app-platform/ContentAppPlatform.h | 6 +- .../operational-state-cluster-objects.h | 8 +- src/app/clusters/scenes-server/SceneTable.h | 6 +- src/app/data-model/Encode.h | 4 +- src/app/data-model/Nullable.h | 2 +- src/app/icd/IcdMonitoringTable.h | 2 +- src/app/server/Server.h | 6 +- src/app/tests/integration/common.h | 24 ++-- .../interaction_model/InteractionModel.h | 2 +- src/app/util/mock/Constants.h | 8 +- src/app/util/privilege-storage.h | 10 +- src/ble/BleLayer.h | 16 +-- src/ble/BtpEngine.h | 8 +- src/controller/CHIPDeviceController.h | 2 +- .../CHIPDeviceControllerSystemState.h | 2 +- src/controller/CommissioneeDeviceProxy.h | 2 +- src/controller/CommissioningDelegate.h | 4 +- .../OperationalCredentialsDelegate.h | 4 +- .../DeviceAttestationConstructor.h | 4 +- src/crypto/CHIPCryptoPAL.h | 112 +++++++++--------- .../platform/CommissionableDataProvider.h | 8 +- src/include/platform/DiagnosticDataProvider.h | 14 +-- src/include/platform/NetworkCommissioning.h | 2 +- src/include/platform/PersistedStorage.h | 2 +- .../platform/internal/DeviceNetworkInfo.h | 6 +- .../AddressResolve_DefaultImpl.h | 2 +- src/lib/core/DataModelTypes.h | 20 ++-- src/lib/core/GroupId.h | 20 ++-- src/lib/core/InPlace.h | 4 +- src/lib/core/NodeId.h | 28 ++--- src/lib/core/OTAImageHeader.h | 2 +- src/lib/core/Optional.h | 2 +- src/lib/core/PasscodeId.h | 2 +- src/lib/dnssd/Constants.h | 38 +++--- src/lib/dnssd/Resolver.h | 6 +- src/lib/dnssd/ServiceNaming.h | 14 +-- src/lib/dnssd/minimal_mdns/core/Constants.h | 4 +- .../minimal_mdns/tests/CheckOnlyServer.h | 2 +- src/lib/support/CommonPersistentData.h | 4 +- src/lib/support/PrivateHeap.h | 2 +- src/lib/support/ThreadOperationalDataset.h | 16 +-- src/messaging/ReliableMessageProtocolConfig.h | 2 +- src/messaging/tests/echo/common.h | 6 +- src/platform/ASR/NetworkCommissioningDriver.h | 10 +- .../Ameba/NetworkCommissioningDriver.h | 6 +- .../Beken/NetworkCommissioningDriver.h | 6 +- .../ESP32/NetworkCommissioningDriver.h | 6 +- .../PSOC6/NetworkCommissioningDriver.h | 10 +- .../android/DiagnosticDataProviderImpl.h | 6 +- .../BL602/NetworkCommissioningDriver.h | 12 +- .../BL702/NetworkCommissioningDriver.h | 6 +- .../mbed/NetworkCommissioningDriver.h | 8 +- .../mt793x/NetworkCommissioningWiFiDriver.h | 8 +- src/platform/nrfconnect/wifi/NrfWiFiDriver.h | 6 +- .../nxp/k32w/common/OTATlvProcessor.h | 6 +- src/platform/openiotsdk/KVPsaPsStore.h | 2 +- .../silabs/NetworkCommissioningWiFiDriver.h | 6 +- src/platform/silabs/SilabsConfig.h | 10 +- .../silabs/efr32/Efr32OpaqueKeypair.h | 8 +- src/protocols/bdx/BdxMessages.h | 4 +- src/protocols/bdx/BdxUri.h | 2 +- src/protocols/echo/Echo.h | 2 +- src/protocols/interaction_model/Constants.h | 4 +- .../secure_channel/CASEDestinationId.h | 4 +- src/protocols/secure_channel/Constants.h | 16 +-- src/protocols/secure_channel/PASESession.h | 6 +- .../secure_channel/RendezvousParameters.h | 2 +- .../user_directed_commissioning/UDCClients.h | 2 +- .../UserDirectedCommissioning.h | 4 +- src/setup_payload/AdditionalDataPayload.h | 4 +- src/setup_payload/SetupPayload.h | 16 +-- src/setup_payload/tests/TestHelpers.h | 10 +- src/system/SocketEvents.h | 2 +- src/system/SystemClock.h | 2 +- src/transport/SecureSessionTable.h | 4 +- src/transport/SessionManager.h | 2 +- src/transport/TraceMessage.h | 6 +- 95 files changed, 369 insertions(+), 369 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ComplexArgument.h b/examples/chip-tool/commands/clusters/ComplexArgument.h index 7705ba50369a59..fa19553d0cab62 100644 --- a/examples/chip-tool/commands/clusters/ComplexArgument.h +++ b/examples/chip-tool/commands/clusters/ComplexArgument.h @@ -45,8 +45,8 @@ #include "JsonParser.h" -constexpr uint8_t kMaxLabelLength = UINT8_MAX; -constexpr const char kNullString[] = "null"; +inline constexpr uint8_t kMaxLabelLength = UINT8_MAX; +inline constexpr const char kNullString[] = "null"; class ComplexArgumentParser { diff --git a/examples/chip-tool/commands/clusters/WriteAttributeCommand.h b/examples/chip-tool/commands/clusters/WriteAttributeCommand.h index 46a0b3dc4b37dd..76dc64ef6201db 100644 --- a/examples/chip-tool/commands/clusters/WriteAttributeCommand.h +++ b/examples/chip-tool/commands/clusters/WriteAttributeCommand.h @@ -23,9 +23,9 @@ #include "DataModelLogger.h" #include "ModelCommand.h" -constexpr const char * kWriteCommandKey = "write"; -constexpr const char * kWriteByIdCommandKey = "write-by-id"; -constexpr const char * kForceWriteCommandKey = "force-write"; +inline constexpr const char * kWriteCommandKey = "write"; +inline constexpr const char * kWriteByIdCommandKey = "write-by-id"; +inline constexpr const char * kForceWriteCommandKey = "force-write"; enum class WriteCommandType { diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 9d7c3c1a741ea6..36732793653504 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -34,9 +34,9 @@ #pragma once -constexpr const char kIdentityAlpha[] = "alpha"; -constexpr const char kIdentityBeta[] = "beta"; -constexpr const char kIdentityGamma[] = "gamma"; +inline constexpr const char kIdentityAlpha[] = "alpha"; +inline constexpr const char kIdentityBeta[] = "beta"; +inline constexpr const char kIdentityGamma[] = "gamma"; // The null fabric commissioner is a commissioner that isn't on a fabric. // This is a legal configuration in which the commissioner delegates // operational communication and invocation of the commssioning complete @@ -46,7 +46,7 @@ constexpr const char kIdentityGamma[] = "gamma"; // commissioner portion of such an architecture. The null-fabric-commissioner // can carry a commissioning flow up until the point of operational channel // (CASE) communcation. -constexpr const char kIdentityNull[] = "null-fabric-commissioner"; +inline constexpr const char kIdentityNull[] = "null-fabric-commissioner"; class CHIPCommand : public Command { diff --git a/examples/chip-tool/commands/common/CustomStringPrefix.h b/examples/chip-tool/commands/common/CustomStringPrefix.h index 235e190fd8f924..63196f78dbe3da 100644 --- a/examples/chip-tool/commands/common/CustomStringPrefix.h +++ b/examples/chip-tool/commands/common/CustomStringPrefix.h @@ -22,17 +22,17 @@ #include -static constexpr char kJsonStringPrefix[] = "json:"; -constexpr size_t kJsonStringPrefixLen = ArraySize(kJsonStringPrefix) - 1; // Don't count the null +static constexpr char kJsonStringPrefix[] = "json:"; +inline constexpr size_t kJsonStringPrefixLen = ArraySize(kJsonStringPrefix) - 1; // Don't count the null -static constexpr char kBase64StringPrefix[] = "base64:"; -constexpr size_t kBase64StringPrefixLen = ArraySize(kBase64StringPrefix) - 1; // Don't count the null +static constexpr char kBase64StringPrefix[] = "base64:"; +inline constexpr size_t kBase64StringPrefixLen = ArraySize(kBase64StringPrefix) - 1; // Don't count the null -static constexpr char kHexStringPrefix[] = "hex:"; -constexpr size_t kHexStringPrefixLen = ArraySize(kHexStringPrefix) - 1; // Don't count the null +static constexpr char kHexStringPrefix[] = "hex:"; +inline constexpr size_t kHexStringPrefixLen = ArraySize(kHexStringPrefix) - 1; // Don't count the null -static constexpr char kStrStringPrefix[] = "str:"; -constexpr size_t kStrStringPrefixLen = ArraySize(kStrStringPrefix) - 1; // Don't count the null +static constexpr char kStrStringPrefix[] = "str:"; +inline constexpr size_t kStrStringPrefixLen = ArraySize(kStrStringPrefix) - 1; // Don't count the null inline bool IsJsonString(const char * str) { diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h index 3a3a6d8d64efdd..f2a305678d75b4 100644 --- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h +++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h @@ -28,9 +28,9 @@ #pragma once -constexpr const char kIdentityAlpha[] = "alpha"; -constexpr const char kIdentityBeta[] = "beta"; -constexpr const char kIdentityGamma[] = "gamma"; +inline constexpr const char kIdentityAlpha[] = "alpha"; +inline constexpr const char kIdentityBeta[] = "beta"; +inline constexpr const char kIdentityGamma[] = "gamma"; class CHIPCommandBridge : public Command { public: diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index b3d08ecf051774..7d8b2c85c64fc2 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -41,7 +41,7 @@ const char basePath[] = "./src/app/tests/suites/commands/delay/scripts/"; const char * getScriptsFolder() { return basePath; } } // namespace -constexpr const char * kDefaultKey = "default"; +inline constexpr const char * kDefaultKey = "default"; @interface TestDeviceControllerDelegate : NSObject @property TestCommandBridge * commandBridge; @@ -58,7 +58,7 @@ constexpr const char * kDefaultKey = "default"; NS_ASSUME_NONNULL_END -constexpr uint16_t kTimeoutInSeconds = 90; +inline constexpr uint16_t kTimeoutInSeconds = 90; class TestCommandBridge : public CHIPCommandBridge, public ValueChecker, @@ -111,7 +111,7 @@ class TestCommandBridge : public CHIPCommandBridge, CHIP_ERROR WaitForMs( const char * _Nullable identity, const chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type & value) { - dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(value.ms * NSEC_PER_MSEC)); + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t) (value.ms * NSEC_PER_MSEC)); dispatch_after(delayTime, mCallbackQueue, ^(void) { NextTest(); }); diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 7bd4d3b6e8497b..e078345f430643 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -35,9 +35,9 @@ #include #include -constexpr const char kIdentityAlpha[] = ""; -constexpr const char kIdentityBeta[] = ""; -constexpr const char kIdentityGamma[] = ""; +inline constexpr const char kIdentityAlpha[] = ""; +inline constexpr const char kIdentityBeta[] = ""; +inline constexpr const char kIdentityGamma[] = ""; class TestCommand : public TestRunner, public PICSChecker, diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 74f1f879056ba5..09a8e898cd6a8d 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -53,11 +53,11 @@ using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; namespace { -constexpr EndpointId kExampleEndpointId = 1; -constexpr uint8_t kDefaultMinLevel = 0; -constexpr uint8_t kDefaultMaxLevel = 254; -constexpr uint8_t kButtonPushEvent = 1; -constexpr uint8_t kButtonReleaseEvent = 0; +inline constexpr EndpointId kExampleEndpointId = 1; +inline constexpr uint8_t kDefaultMinLevel = 0; +inline constexpr uint8_t kDefaultMaxLevel = 254; +inline constexpr uint8_t kButtonPushEvent = 1; +inline constexpr uint8_t kButtonReleaseEvent = 0; } // namespace class AppTaskCommon diff --git a/examples/shell/shell_common/include/Globals.h b/examples/shell/shell_common/include/Globals.h index fd2726c3e1f6ef..d91620ca0ad171 100644 --- a/examples/shell/shell_common/include/Globals.h +++ b/examples/shell/shell_common/include/Globals.h @@ -28,10 +28,10 @@ #include #if INET_CONFIG_ENABLE_TCP_ENDPOINT -constexpr size_t kMaxTcpActiveConnectionCount = 4; -constexpr size_t kMaxTcpPendingPackets = 4; +inline constexpr size_t kMaxTcpActiveConnectionCount = 4; +inline constexpr size_t kMaxTcpPendingPackets = 4; #endif -constexpr chip::System::Clock::Timeout kResponseTimeOut = chip::System::Clock::Seconds16(1); +inline constexpr chip::System::Clock::Timeout kResponseTimeOut = chip::System::Clock::Seconds16(1); extern chip::FabricTable gFabricTable; extern chip::secure_channel::MessageCounterManager gMessageCounterManager; diff --git a/examples/tv-casting-app/linux/CastingUtils.h b/examples/tv-casting-app/linux/CastingUtils.h index 13d9818662e3af..d87a8318948c76 100644 --- a/examples/tv-casting-app/linux/CastingUtils.h +++ b/examples/tv-casting-app/linux/CastingUtils.h @@ -26,7 +26,7 @@ #include "TargetEndpointInfo.h" #include "TargetVideoPlayerInfo.h" -constexpr uint32_t kCommissionerDiscoveryTimeoutInMs = 5 * 1000; +inline constexpr uint32_t kCommissionerDiscoveryTimeoutInMs = 5 * 1000; CHIP_ERROR ProcessClusterCommand(int argc, char ** argv); diff --git a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h index fd427afc712639..bf85e98f0d83c2 100644 --- a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h +++ b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h @@ -40,7 +40,7 @@ #include #include -constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = chip::System::Clock::Seconds16(3 * 60); +inline constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = chip::System::Clock::Seconds16(3 * 60); /** * @brief Represents a TV Casting server that can get the casting app commissioned @@ -50,7 +50,7 @@ constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = chip::Sys class CastingServer : public AppDelegate { public: - CastingServer(CastingServer & other) = delete; + CastingServer(CastingServer & other) = delete; void operator=(const CastingServer &) = delete; static CastingServer * GetInstance(); diff --git a/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h b/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h index f0774c3d0a2c23..2e4b7c90167458 100644 --- a/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h +++ b/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h @@ -21,7 +21,7 @@ #include "TargetEndpointInfo.h" #include "TargetVideoPlayerInfo.h" -constexpr size_t kMaxCachedVideoPlayers = 32; +inline constexpr size_t kMaxCachedVideoPlayers = 32; class PersistenceManager : public chip::FabricTable::Delegate { diff --git a/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h b/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h index 31cfde0d02b3f6..f93251e327f7a0 100644 --- a/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h +++ b/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h @@ -20,7 +20,7 @@ #include -constexpr size_t kMaxNumberOfClustersPerEndpoint = 10; +inline constexpr size_t kMaxNumberOfClustersPerEndpoint = 10; class TargetEndpointInfo { diff --git a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h index bbc086ae64a52d..d027a19edfb512 100644 --- a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h +++ b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h @@ -25,7 +25,7 @@ #include -constexpr size_t kMaxNumberOfEndpoints = 5; +inline constexpr size_t kMaxNumberOfEndpoints = 5; class TargetVideoPlayerInfo; class VideoPlayerConnectionContext diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 351774256d2a45..35fd37a25045ca 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -26,7 +26,7 @@ #include #include -constexpr size_t kNumPriorityLevel = 3; +inline constexpr size_t kNumPriorityLevel = 3; namespace chip { namespace app { diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 2286328214a0c5..228c26cca94a68 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -70,9 +70,9 @@ namespace chip { namespace app { -constexpr const uint32_t kEventManagementProfile = 0x1; -constexpr const uint32_t kFabricIndexTag = 0x1; -constexpr size_t kMaxEventSizeReserve = 512; +inline constexpr const uint32_t kEventManagementProfile = 0x1; +inline constexpr const uint32_t kFabricIndexTag = 0x1; +inline constexpr size_t kMaxEventSizeReserve = 512; constexpr uint16_t kRequiredEventField = (1 << to_underlying(EventDataIB::Tag::kPriority)) | (1 << to_underlying(EventDataIB::Tag::kPath)); diff --git a/src/app/InteractionModelRevision.h b/src/app/InteractionModelRevision.h index 9cc9fc66de0796..529ac0f839c80e 100644 --- a/src/app/InteractionModelRevision.h +++ b/src/app/InteractionModelRevision.h @@ -32,4 +32,4 @@ #define CHIP_DEVICE_INTERACTION_MODEL_REVISION 11 #endif -constexpr uint8_t kInteractionModelRevisionTag = 0xFF; +inline constexpr uint8_t kInteractionModelRevisionTag = 0xFF; diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index ecdc0c1c0696c1..4c9ad469c782eb 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -52,7 +52,7 @@ #include // https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/61a9d19e6af12fdfb0872bcff26d19de6c680a1a/src/Ch02_Architecture.adoc#1122-subscribe-interaction-limits -constexpr uint16_t kSubscriptionMaxIntervalPublisherLimit = 3600; // seconds (60 minutes) +inline constexpr uint16_t kSubscriptionMaxIntervalPublisherLimit = 3600; // seconds (60 minutes) namespace chip { namespace app { diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 8ab9efab8250c6..593ec0706a5a15 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -49,9 +49,9 @@ EmberAfStatus AppPlatformExternalAttributeReadCallback(EndpointId endpoint, Clus EmberAfStatus AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); -constexpr EndpointId kTargetBindingClusterEndpointId = 0; -constexpr EndpointId kLocalVideoPlayerEndpointId = 1; -constexpr EndpointId kLocalSpeakerEndpointId = 2; +inline constexpr EndpointId kTargetBindingClusterEndpointId = 0; +inline constexpr EndpointId kLocalVideoPlayerEndpointId = 1; +inline constexpr EndpointId kLocalSpeakerEndpointId = 2; class DLL_EXPORT ContentAppFactory { diff --git a/src/app/clusters/operational-state-server/operational-state-cluster-objects.h b/src/app/clusters/operational-state-server/operational-state-cluster-objects.h index 8fdd68cbd3851c..1910e00d20effb 100644 --- a/src/app/clusters/operational-state-server/operational-state-cluster-objects.h +++ b/src/app/clusters/operational-state-server/operational-state-cluster-objects.h @@ -27,10 +27,10 @@ namespace app { namespace Clusters { namespace OperationalState { -constexpr size_t kOperationalStateLabelMaxSize = 64u; -constexpr size_t kOperationalErrorLabelMaxSize = 64u; -constexpr size_t kOperationalErrorDetailsMaxSize = 64u; -constexpr size_t kOperationalPhaseNameMaxSize = 64u; +inline constexpr size_t kOperationalStateLabelMaxSize = 64u; +inline constexpr size_t kOperationalErrorLabelMaxSize = 64u; +inline constexpr size_t kOperationalErrorDetailsMaxSize = 64u; +inline constexpr size_t kOperationalPhaseNameMaxSize = 64u; /** * A class which represents the operational state of an Operational State cluster derivation instance. diff --git a/src/app/clusters/scenes-server/SceneTable.h b/src/app/clusters/scenes-server/SceneTable.h index b76ade0a15c665..e7fb2328d9ed98 100644 --- a/src/app/clusters/scenes-server/SceneTable.h +++ b/src/app/clusters/scenes-server/SceneTable.h @@ -33,9 +33,9 @@ typedef uint16_t SceneIndex; typedef uint32_t TransitionTimeMs; typedef uint32_t SceneTransitionTime; -constexpr GroupId kGlobalGroupSceneId = 0x0000; -constexpr SceneIndex kUndefinedSceneIndex = 0xffff; -constexpr SceneId kUndefinedSceneId = 0xff; +inline constexpr GroupId kGlobalGroupSceneId = 0x0000; +inline constexpr SceneIndex kUndefinedSceneIndex = 0xffff; +inline constexpr SceneId kUndefinedSceneId = 0xff; static constexpr size_t kIteratorsMax = CHIP_CONFIG_MAX_SCENES_CONCURRENT_ITERATORS; static constexpr size_t kSceneNameMaxLength = CHIP_CONFIG_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH; diff --git a/src/app/data-model/Encode.h b/src/app/data-model/Encode.h index 84a32cf745983c..7cb8298e47ac72 100644 --- a/src/app/data-model/Encode.h +++ b/src/app/data-model/Encode.h @@ -37,10 +37,10 @@ template using VoidType = void; template -constexpr bool HasUnknownValue = false; +inline constexpr bool HasUnknownValue = false; template -constexpr bool HasUnknownValue> = true; +inline constexpr bool HasUnknownValue> = true; } // namespace detail /* diff --git a/src/app/data-model/Nullable.h b/src/app/data-model/Nullable.h index ad6bdaf9e2c172..dec7fc5eb9ef55 100644 --- a/src/app/data-model/Nullable.h +++ b/src/app/data-model/Nullable.h @@ -30,7 +30,7 @@ namespace DataModel { /** * NullNullable is an alias for NullOptional, for better readability. */ -constexpr auto NullNullable = NullOptional; +inline constexpr auto NullNullable = NullOptional; /* * Dedicated type for nullable things, to differentiate them from optional diff --git a/src/app/icd/IcdMonitoringTable.h b/src/app/icd/IcdMonitoringTable.h index 0bfb311207c0d5..86186aec594d07 100644 --- a/src/app/icd/IcdMonitoringTable.h +++ b/src/app/icd/IcdMonitoringTable.h @@ -25,7 +25,7 @@ namespace chip { -constexpr size_t kIcdMonitoringBufferSize = 40; +inline constexpr size_t kIcdMonitoringBufferSize = 40; struct IcdMonitoringEntry : public PersistentData { diff --git a/src/app/server/Server.h b/src/app/server/Server.h index e2bcbe83d363a8..7c77c9122b0f33 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -74,7 +74,7 @@ namespace chip { -constexpr size_t kMaxBlePendingPackets = 1; +inline constexpr size_t kMaxBlePendingPackets = 1; // // NOTE: Please do not alter the order of template specialization here as the logic @@ -96,7 +96,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -178,7 +178,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** diff --git a/src/app/tests/integration/common.h b/src/app/tests/integration/common.h index 4766b9d6160500..5d232476981a17 100644 --- a/src/app/tests/integration/common.h +++ b/src/app/tests/integration/common.h @@ -43,18 +43,18 @@ extern chip::SessionHolder gSession; extern chip::TestPersistentStorageDelegate gStorage; extern chip::Crypto::DefaultSessionKeystore gSessionKeystore; -constexpr chip::NodeId kTestNodeId = 0x1ULL; -constexpr chip::NodeId kTestNodeId1 = 0x2ULL; -constexpr chip::ClusterId kTestClusterId = 6; -constexpr chip::CommandId kTestCommandId = 40; -constexpr chip::EndpointId kTestEndpointId = 1; -constexpr chip::GroupId kTestGroupId = 0; -constexpr chip::FieldId kTestFieldId1 = 1; -constexpr chip::FieldId kTestFieldId2 = 2; -constexpr uint8_t kTestFieldValue1 = 1; -constexpr uint8_t kTestFieldValue2 = 2; -constexpr chip::EventId kTestChangeEvent1 = 1; -constexpr chip::EventId kTestChangeEvent2 = 2; +inline constexpr chip::NodeId kTestNodeId = 0x1ULL; +inline constexpr chip::NodeId kTestNodeId1 = 0x2ULL; +inline constexpr chip::ClusterId kTestClusterId = 6; +inline constexpr chip::CommandId kTestCommandId = 40; +inline constexpr chip::EndpointId kTestEndpointId = 1; +inline constexpr chip::GroupId kTestGroupId = 0; +inline constexpr chip::FieldId kTestFieldId1 = 1; +inline constexpr chip::FieldId kTestFieldId2 = 2; +inline constexpr uint8_t kTestFieldValue1 = 1; +inline constexpr uint8_t kTestFieldValue2 = 2; +inline constexpr chip::EventId kTestChangeEvent1 = 1; +inline constexpr chip::EventId kTestChangeEvent2 = 2; void InitializeChip(void); void ShutdownChip(void); void TLVPrettyPrinter(const char * aFormat, ...); diff --git a/src/app/tests/suites/commands/interaction_model/InteractionModel.h b/src/app/tests/suites/commands/interaction_model/InteractionModel.h index c52ff744fac791..da3c3378a45d90 100644 --- a/src/app/tests/suites/commands/interaction_model/InteractionModel.h +++ b/src/app/tests/suites/commands/interaction_model/InteractionModel.h @@ -28,7 +28,7 @@ #include #include -constexpr uint8_t kMaxAllowedPaths = 64; +inline constexpr uint8_t kMaxAllowedPaths = 64; namespace chip { namespace test_utils { diff --git a/src/app/util/mock/Constants.h b/src/app/util/mock/Constants.h index a9017a58fba2da..803dff5b7f8f12 100644 --- a/src/app/util/mock/Constants.h +++ b/src/app/util/mock/Constants.h @@ -30,10 +30,10 @@ namespace chip { namespace Test { -constexpr EndpointId kMockEndpoint1 = 0xFFFE; -constexpr EndpointId kMockEndpoint2 = 0xFFFD; -constexpr EndpointId kMockEndpoint3 = 0xFFFC; -constexpr EndpointId kMockEndpointMin = 0xFFF1; +inline constexpr EndpointId kMockEndpoint1 = 0xFFFE; +inline constexpr EndpointId kMockEndpoint2 = 0xFFFD; +inline constexpr EndpointId kMockEndpoint3 = 0xFFFC; +inline constexpr EndpointId kMockEndpointMin = 0xFFF1; constexpr AttributeId MockAttributeId(const uint16_t & id) { diff --git a/src/app/util/privilege-storage.h b/src/app/util/privilege-storage.h index 5253769e019ea3..02d55488fd0780 100644 --- a/src/app/util/privilege-storage.h +++ b/src/app/util/privilege-storage.h @@ -18,11 +18,11 @@ #include -constexpr int kMatterAccessPrivilegeView = 0; -constexpr int kMatterAccessPrivilegeOperate = 1; -constexpr int kMatterAccessPrivilegeManage = 2; -constexpr int kMatterAccessPrivilegeAdminister = 3; -constexpr int kMatterAccessPrivilegeMaxValue = kMatterAccessPrivilegeAdminister; +inline constexpr int kMatterAccessPrivilegeView = 0; +inline constexpr int kMatterAccessPrivilegeOperate = 1; +inline constexpr int kMatterAccessPrivilegeManage = 2; +inline constexpr int kMatterAccessPrivilegeAdminister = 3; +inline constexpr int kMatterAccessPrivilegeMaxValue = kMatterAccessPrivilegeAdminister; int MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute); int MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute); diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h index 1f9dec2860a696..5ded6c82cc2b46 100644 --- a/src/ble/BleLayer.h +++ b/src/ble/BleLayer.h @@ -92,17 +92,17 @@ typedef enum kBleTransportProtocolVersion_V4 = 4 // BTP as defined by CHIP v1.0 } BleTransportProtocolVersion; -constexpr size_t kCapabilitiesRequestMagicnumLength = 2; -constexpr size_t kCapabilitiesRequestL2capMtuLength = 2; -constexpr size_t kCapabilitiesRequestSupportedVersionsLength = 4; -constexpr size_t kCapabilitiesRequestWindowSizeLength = 1; +inline constexpr size_t kCapabilitiesRequestMagicnumLength = 2; +inline constexpr size_t kCapabilitiesRequestL2capMtuLength = 2; +inline constexpr size_t kCapabilitiesRequestSupportedVersionsLength = 4; +inline constexpr size_t kCapabilitiesRequestWindowSizeLength = 1; constexpr size_t kCapabilitiesRequestLength = (kCapabilitiesRequestMagicnumLength + kCapabilitiesRequestL2capMtuLength + kCapabilitiesRequestSupportedVersionsLength + kCapabilitiesRequestWindowSizeLength); -constexpr size_t kCapabilitiesResponseMagicnumLength = 2; -constexpr size_t kCapabilitiesResponseL2capMtuLength = 2; -constexpr size_t kCapabilitiesResponseSelectedProtocolVersionLength = 1; -constexpr size_t kCapabilitiesResponseWindowSizeLength = 1; +inline constexpr size_t kCapabilitiesResponseMagicnumLength = 2; +inline constexpr size_t kCapabilitiesResponseL2capMtuLength = 2; +inline constexpr size_t kCapabilitiesResponseSelectedProtocolVersionLength = 1; +inline constexpr size_t kCapabilitiesResponseWindowSizeLength = 1; constexpr size_t kCapabilitiesResponseLength(kCapabilitiesResponseMagicnumLength + kCapabilitiesResponseL2capMtuLength + kCapabilitiesResponseSelectedProtocolVersionLength + kCapabilitiesResponseWindowSizeLength); diff --git a/src/ble/BtpEngine.h b/src/ble/BtpEngine.h index 4d32cf7342da94..7ec59e35a60c62 100644 --- a/src/ble/BtpEngine.h +++ b/src/ble/BtpEngine.h @@ -43,10 +43,10 @@ namespace chip { namespace Ble { -constexpr size_t kTransferProtocolHeaderFlagsSize = 1; // Size in bytes of enocded BTP fragment header flag bits -constexpr size_t kTransferProtocolSequenceNumSize = 1; // Size in bytes of encoded BTP sequence number -constexpr size_t kTransferProtocolAckSize = 1; // Size in bytes of encoded BTP fragment acknowledgement number -constexpr size_t kTransferProtocolMsgLenSize = 2; // Size in byte of encoded BTP total fragmented message length +inline constexpr size_t kTransferProtocolHeaderFlagsSize = 1; // Size in bytes of enocded BTP fragment header flag bits +inline constexpr size_t kTransferProtocolSequenceNumSize = 1; // Size in bytes of encoded BTP sequence number +inline constexpr size_t kTransferProtocolAckSize = 1; // Size in bytes of encoded BTP fragment acknowledgement number +inline constexpr size_t kTransferProtocolMsgLenSize = 2; // Size in byte of encoded BTP total fragmented message length constexpr size_t kTransferProtocolMaxHeaderSize = kTransferProtocolHeaderFlagsSize + kTransferProtocolAckSize + kTransferProtocolSequenceNumSize + kTransferProtocolMsgLenSize; diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index b328ef68d9a47c..6d61ee8fb636d7 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -81,7 +81,7 @@ namespace Controller { using namespace chip::Protocols::UserDirectedCommissioning; -constexpr uint16_t kNumMaxActiveDevices = CHIP_CONFIG_CONTROLLER_MAX_ACTIVE_DEVICES; +inline constexpr uint16_t kNumMaxActiveDevices = CHIP_CONFIG_CONTROLLER_MAX_ACTIVE_DEVICES; // Raw functions for cluster callbacks void OnBasicFailure(void * context, CHIP_ERROR err); diff --git a/src/controller/CHIPDeviceControllerSystemState.h b/src/controller/CHIPDeviceControllerSystemState.h index 6692fc6ecbc308..5c1731651cd2a1 100644 --- a/src/controller/CHIPDeviceControllerSystemState.h +++ b/src/controller/CHIPDeviceControllerSystemState.h @@ -54,7 +54,7 @@ namespace chip { -constexpr size_t kMaxDeviceTransportBlePendingPackets = 1; +inline constexpr size_t kMaxDeviceTransportBlePendingPackets = 1; using DeviceTransportMgr = TransportMgr networkCommissioningStatus; }; -constexpr uint16_t kDefaultFailsafeTimeout = 60; +inline constexpr uint16_t kDefaultFailsafeTimeout = 60; // Per spec, all commands that are sent with the failsafe armed need at least // a 30s timeout. -constexpr System::Clock::Timeout kMinimumCommissioningStepTimeout = System::Clock::Seconds16(30); +inline constexpr System::Clock::Timeout kMinimumCommissioningStepTimeout = System::Clock::Seconds16(30); class CommissioningParameters { diff --git a/src/controller/OperationalCredentialsDelegate.h b/src/controller/OperationalCredentialsDelegate.h index 5d51f820bf7ef7..1a7a8c45b64696 100644 --- a/src/controller/OperationalCredentialsDelegate.h +++ b/src/controller/OperationalCredentialsDelegate.h @@ -33,8 +33,8 @@ typedef void (*OnNOCChainGeneration)(void * context, CHIP_ERROR status, const By const ByteSpan & rcac, Optional ipk, Optional adminSubject); -constexpr uint32_t kMaxCHIPDERCertLength = 600; -constexpr size_t kCSRNonceLength = 32; +inline constexpr uint32_t kMaxCHIPDERCertLength = 600; +inline constexpr size_t kCSRNonceLength = 32; /// Callbacks for CHIP operational credentials generation class DLL_EXPORT OperationalCredentialsDelegate diff --git a/src/credentials/DeviceAttestationConstructor.h b/src/credentials/DeviceAttestationConstructor.h index b8404ef57577cc..7880199a6bb94d 100644 --- a/src/credentials/DeviceAttestationConstructor.h +++ b/src/credentials/DeviceAttestationConstructor.h @@ -24,10 +24,10 @@ namespace chip { namespace Credentials { // As per specifications section 11.22.5.1. Constant RESP_MAX -constexpr size_t kMaxRspLen = 900; +inline constexpr size_t kMaxRspLen = 900; // CSRNonce and AttestationNonce need to be this size -constexpr size_t kExpectedAttestationNonceSize = 32; +inline constexpr size_t kExpectedAttestationNonceSize = 32; /** * @brief Take the attestation elements buffer and return each component separately. diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index 9e276b9eea4359..6f6bc6edf1984c 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -42,78 +42,78 @@ namespace chip { namespace Crypto { -constexpr size_t kMax_x509_Certificate_Length = 600; - -constexpr size_t kP256_FE_Length = 32; -constexpr size_t kP256_ECDSA_Signature_Length_Raw = (2 * kP256_FE_Length); -constexpr size_t kP256_Point_Length = (2 * kP256_FE_Length + 1); -constexpr size_t kSHA256_Hash_Length = 32; -constexpr size_t kSHA1_Hash_Length = 20; -constexpr size_t kSubjectKeyIdentifierLength = kSHA1_Hash_Length; -constexpr size_t kAuthorityKeyIdentifierLength = kSHA1_Hash_Length; -constexpr size_t kMaxCertificateSerialNumberLength = 20; -constexpr size_t kMaxCertificateDistinguishedNameLength = 200; -constexpr size_t kMaxCRLDistributionPointURLLength = 100; - -constexpr const char * kValidCDPURIHttpPrefix = "http://"; -constexpr const char * kValidCDPURIHttpsPrefix = "https://"; - -constexpr size_t CHIP_CRYPTO_GROUP_SIZE_BYTES = kP256_FE_Length; -constexpr size_t CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES = kP256_Point_Length; - -constexpr size_t CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES = 16; -constexpr size_t CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES = 16; - -constexpr size_t kMax_ECDH_Secret_Length = kP256_FE_Length; -constexpr size_t kMax_ECDSA_Signature_Length = kP256_ECDSA_Signature_Length_Raw; -constexpr size_t kMAX_FE_Length = kP256_FE_Length; -constexpr size_t kMAX_Point_Length = kP256_Point_Length; -constexpr size_t kMAX_Hash_Length = kSHA256_Hash_Length; +inline constexpr size_t kMax_x509_Certificate_Length = 600; + +inline constexpr size_t kP256_FE_Length = 32; +inline constexpr size_t kP256_ECDSA_Signature_Length_Raw = (2 * kP256_FE_Length); +inline constexpr size_t kP256_Point_Length = (2 * kP256_FE_Length + 1); +inline constexpr size_t kSHA256_Hash_Length = 32; +inline constexpr size_t kSHA1_Hash_Length = 20; +inline constexpr size_t kSubjectKeyIdentifierLength = kSHA1_Hash_Length; +inline constexpr size_t kAuthorityKeyIdentifierLength = kSHA1_Hash_Length; +inline constexpr size_t kMaxCertificateSerialNumberLength = 20; +inline constexpr size_t kMaxCertificateDistinguishedNameLength = 200; +inline constexpr size_t kMaxCRLDistributionPointURLLength = 100; + +inline constexpr const char * kValidCDPURIHttpPrefix = "http://"; +inline constexpr const char * kValidCDPURIHttpsPrefix = "https://"; + +inline constexpr size_t CHIP_CRYPTO_GROUP_SIZE_BYTES = kP256_FE_Length; +inline constexpr size_t CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES = kP256_Point_Length; + +inline constexpr size_t CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES = 16; +inline constexpr size_t CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES = 16; + +inline constexpr size_t kMax_ECDH_Secret_Length = kP256_FE_Length; +inline constexpr size_t kMax_ECDSA_Signature_Length = kP256_ECDSA_Signature_Length_Raw; +inline constexpr size_t kMAX_FE_Length = kP256_FE_Length; +inline constexpr size_t kMAX_Point_Length = kP256_Point_Length; +inline constexpr size_t kMAX_Hash_Length = kSHA256_Hash_Length; // Minimum required CSR length buffer length is relatively small since it's a single // P256 key and no metadata/extensions are expected to be honored by the CA. -constexpr size_t kMIN_CSR_Buffer_Size = 255; +inline constexpr size_t kMIN_CSR_Buffer_Size = 255; [[deprecated("This constant is no longer used by common code and should be replaced by kMIN_CSR_Buffer_Size. Checks that a CSR is " "<= kMAX_CSR_Buffer_size must be updated. This remains to keep valid buffers working from previous public API " "usage.")]] constexpr size_t kMAX_CSR_Buffer_Size = 255; -constexpr size_t CHIP_CRYPTO_HASH_LEN_BYTES = kSHA256_Hash_Length; +inline constexpr size_t CHIP_CRYPTO_HASH_LEN_BYTES = kSHA256_Hash_Length; -constexpr size_t kSpake2p_Min_PBKDF_Salt_Length = 16; -constexpr size_t kSpake2p_Max_PBKDF_Salt_Length = 32; -constexpr uint32_t kSpake2p_Min_PBKDF_Iterations = 1000; -constexpr uint32_t kSpake2p_Max_PBKDF_Iterations = 100000; +inline constexpr size_t kSpake2p_Min_PBKDF_Salt_Length = 16; +inline constexpr size_t kSpake2p_Max_PBKDF_Salt_Length = 32; +inline constexpr uint32_t kSpake2p_Min_PBKDF_Iterations = 1000; +inline constexpr uint32_t kSpake2p_Max_PBKDF_Iterations = 100000; -constexpr size_t kP256_PrivateKey_Length = CHIP_CRYPTO_GROUP_SIZE_BYTES; -constexpr size_t kP256_PublicKey_Length = CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES; +inline constexpr size_t kP256_PrivateKey_Length = CHIP_CRYPTO_GROUP_SIZE_BYTES; +inline constexpr size_t kP256_PublicKey_Length = CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES; -constexpr size_t kAES_CCM128_Key_Length = 128u / 8u; -constexpr size_t kAES_CCM128_Block_Length = kAES_CCM128_Key_Length; -constexpr size_t kAES_CCM128_Nonce_Length = 13; -constexpr size_t kAES_CCM128_Tag_Length = 16; +inline constexpr size_t kAES_CCM128_Key_Length = 128u / 8u; +inline constexpr size_t kAES_CCM128_Block_Length = kAES_CCM128_Key_Length; +inline constexpr size_t kAES_CCM128_Nonce_Length = 13; +inline constexpr size_t kAES_CCM128_Tag_Length = 16; -constexpr size_t CHIP_CRYPTO_AEAD_NONCE_LENGTH_BYTES = kAES_CCM128_Nonce_Length; +inline constexpr size_t CHIP_CRYPTO_AEAD_NONCE_LENGTH_BYTES = kAES_CCM128_Nonce_Length; /* These sizes are hardcoded here to remove header dependency on underlying crypto library * in a public interface file. The validity of these sizes is verified by static_assert in * the implementation files. */ -constexpr size_t kMAX_Spake2p_Context_Size = 1024; -constexpr size_t kMAX_P256Keypair_Context_Size = 512; +inline constexpr size_t kMAX_Spake2p_Context_Size = 1024; +inline constexpr size_t kMAX_P256Keypair_Context_Size = 512; -constexpr size_t kEmitDerIntegerWithoutTagOverhead = 1; // 1 sign stuffer -constexpr size_t kEmitDerIntegerOverhead = 3; // Tag + Length byte + 1 sign stuffer +inline constexpr size_t kEmitDerIntegerWithoutTagOverhead = 1; // 1 sign stuffer +inline constexpr size_t kEmitDerIntegerOverhead = 3; // Tag + Length byte + 1 sign stuffer -constexpr size_t kMAX_Hash_SHA256_Context_Size = CHIP_CONFIG_SHA256_CONTEXT_SIZE; +inline constexpr size_t kMAX_Hash_SHA256_Context_Size = CHIP_CONFIG_SHA256_CONTEXT_SIZE; -constexpr size_t kSpake2p_WS_Length = kP256_FE_Length + 8; -constexpr size_t kSpake2p_VerifierSerialized_Length = kP256_FE_Length + kP256_Point_Length; +inline constexpr size_t kSpake2p_WS_Length = kP256_FE_Length + 8; +inline constexpr size_t kSpake2p_VerifierSerialized_Length = kP256_FE_Length + kP256_Point_Length; -constexpr char kVIDPrefixForCNEncoding[] = "Mvid:"; -constexpr char kPIDPrefixForCNEncoding[] = "Mpid:"; -constexpr size_t kVIDandPIDHexLength = sizeof(uint16_t) * 2; -constexpr size_t kMax_CommonNameAttr_Length = 64; +inline constexpr char kVIDPrefixForCNEncoding[] = "Mvid:"; +inline constexpr char kPIDPrefixForCNEncoding[] = "Mpid:"; +inline constexpr size_t kVIDandPIDHexLength = sizeof(uint16_t) * 2; +inline constexpr size_t kMax_CommonNameAttr_Length = 64; /* * Overhead to encode a raw ECDSA signature in X9.62 format in ASN.1 DER @@ -131,14 +131,14 @@ constexpr size_t kMax_CommonNameAttr_Length = 64; * * There is 1 sequence of 2 integers. Overhead is SEQ_OVERHEAD + (2 * INT_OVERHEAD) = 3 + (2 * 3) = 9. */ -constexpr size_t kMax_ECDSA_X9Dot62_Asn1_Overhead = 9; -constexpr size_t kMax_ECDSA_Signature_Length_Der = kMax_ECDSA_Signature_Length + kMax_ECDSA_X9Dot62_Asn1_Overhead; +inline constexpr size_t kMax_ECDSA_X9Dot62_Asn1_Overhead = 9; +inline constexpr size_t kMax_ECDSA_Signature_Length_Der = kMax_ECDSA_Signature_Length + kMax_ECDSA_X9Dot62_Asn1_Overhead; static_assert(kMax_ECDH_Secret_Length >= kP256_FE_Length, "ECDH shared secret is too short for crypto suite"); static_assert(kMax_ECDSA_Signature_Length >= kP256_ECDSA_Signature_Length_Raw, "ECDSA signature buffer length is too short for crypto suite"); -constexpr size_t kCompressedFabricIdentifierSize = 8; +inline constexpr size_t kCompressedFabricIdentifierSize = 8; /** * Spake2+ parameters for P256 @@ -580,8 +580,8 @@ class Aes128KeyHandle Aes128KeyHandle(const Aes128KeyHandle &) = delete; Aes128KeyHandle(Aes128KeyHandle &&) = delete; - void operator=(const Aes128KeyHandle &) = delete; - void operator=(Aes128KeyHandle &&) = delete; + void operator=(const Aes128KeyHandle &) = delete; + void operator=(Aes128KeyHandle &&) = delete; /** * @brief Get internal context cast to the desired key representation diff --git a/src/include/platform/CommissionableDataProvider.h b/src/include/platform/CommissionableDataProvider.h index 6a51023f1aef03..d3f3b23726a670 100644 --- a/src/include/platform/CommissionableDataProvider.h +++ b/src/include/platform/CommissionableDataProvider.h @@ -22,10 +22,10 @@ namespace chip { // The largest value of the 12-bit Payload discriminator -constexpr uint16_t kMaxDiscriminatorValue = 0xFFF; +inline constexpr uint16_t kMaxDiscriminatorValue = 0xFFF; -constexpr uint32_t kMinSetupPasscode = 1; -constexpr uint32_t kMaxSetupPasscode = 0x5F5E0FE; +inline constexpr uint32_t kMinSetupPasscode = 1; +inline constexpr uint32_t kMaxSetupPasscode = 0x5F5E0FE; namespace DeviceLayer { @@ -36,7 +36,7 @@ class CommissionableDataProvider virtual ~CommissionableDataProvider() = default; // Not copyable - CommissionableDataProvider(const CommissionableDataProvider &) = delete; + CommissionableDataProvider(const CommissionableDataProvider &) = delete; CommissionableDataProvider & operator=(const CommissionableDataProvider &) = delete; /** diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index 04820d3488debb..02599fea9c96b6 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -36,12 +36,12 @@ namespace DeviceLayer { static constexpr size_t kMaxThreadNameLength = 8; // 48-bit IEEE MAC Address or a 64-bit IEEE MAC Address (e.g. EUI-64). -constexpr size_t kMaxHardwareAddrSize = 8; +inline constexpr size_t kMaxHardwareAddrSize = 8; -constexpr size_t kMaxIPv4AddrSize = 4; -constexpr size_t kMaxIPv6AddrSize = 16; -constexpr size_t kMaxIPv4AddrCount = 4; -constexpr size_t kMaxIPv6AddrCount = 8; +inline constexpr size_t kMaxIPv4AddrSize = 4; +inline constexpr size_t kMaxIPv6AddrSize = 16; +inline constexpr size_t kMaxIPv4AddrCount = 4; +inline constexpr size_t kMaxIPv6AddrCount = 8; using BootReasonType = app::Clusters::GeneralDiagnostics::BootReasonEnum; @@ -186,8 +186,8 @@ class DiagnosticDataProvider WiFiDiagnosticsDelegate * mWiFiDiagnosticsDelegate = nullptr; // No copy, move or assignment. - DiagnosticDataProvider(const DiagnosticDataProvider &) = delete; - DiagnosticDataProvider(const DiagnosticDataProvider &&) = delete; + DiagnosticDataProvider(const DiagnosticDataProvider &) = delete; + DiagnosticDataProvider(const DiagnosticDataProvider &&) = delete; DiagnosticDataProvider & operator=(const DiagnosticDataProvider &) = delete; }; diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h index 7a9cbc3c6db8c0..8ae56f3cd80d0b 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -47,7 +47,7 @@ namespace DeviceLayer { */ namespace NetworkCommissioning { -constexpr size_t kMaxNetworkIDLen = 32; +inline constexpr size_t kMaxNetworkIDLen = 32; // TODO: This is exactly the same as the one in GroupDataProvider, this could be moved to src/lib/support template diff --git a/src/include/platform/PersistedStorage.h b/src/include/platform/PersistedStorage.h index 91a8eae88981e8..f6bebd2e32050c 100644 --- a/src/include/platform/PersistedStorage.h +++ b/src/include/platform/PersistedStorage.h @@ -57,7 +57,7 @@ struct EmptyKey } // namespace internal -constexpr Key kEmptyKey = internal::EmptyKey::value; +inline constexpr Key kEmptyKey = internal::EmptyKey::value; /** * @brief diff --git a/src/include/platform/internal/DeviceNetworkInfo.h b/src/include/platform/internal/DeviceNetworkInfo.h index 7e218914066e76..62c8d72a75858d 100644 --- a/src/include/platform/internal/DeviceNetworkInfo.h +++ b/src/include/platform/internal/DeviceNetworkInfo.h @@ -30,9 +30,9 @@ namespace Internal { * Constants for common network metadata entries */ // ---- WiFi-specific Limits ---- -constexpr size_t kMaxWiFiSSIDLength = 32; -constexpr size_t kMaxWiFiKeyLength = 64; -constexpr size_t kWiFiBSSIDLength = 6; +inline constexpr size_t kMaxWiFiSSIDLength = 32; +inline constexpr size_t kMaxWiFiKeyLength = 64; +inline constexpr size_t kWiFiBSSIDLength = 6; /** * Ids for well-known network provision types. diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.h b/src/lib/address_resolve/AddressResolve_DefaultImpl.h index ac6d7dd8d1f4d0..5445b6d1b89995 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.h +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.h @@ -26,7 +26,7 @@ namespace chip { namespace AddressResolve { namespace Impl { -constexpr uint8_t kNodeLookupResultsLen = CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS; +inline constexpr uint8_t kNodeLookupResultsLen = CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS; enum class NodeLookupResult { diff --git a/src/lib/core/DataModelTypes.h b/src/lib/core/DataModelTypes.h index 5ae16fa51f6544..dfbc5ef16ad400 100644 --- a/src/lib/core/DataModelTypes.h +++ b/src/lib/core/DataModelTypes.h @@ -49,21 +49,21 @@ typedef uint8_t InteractionModelRevision; typedef uint32_t SubscriptionId; typedef uint8_t SceneId; -constexpr CompressedFabricId kUndefinedCompressedFabricId = 0ULL; -constexpr FabricId kUndefinedFabricId = 0ULL; +inline constexpr CompressedFabricId kUndefinedCompressedFabricId = 0ULL; +inline constexpr FabricId kUndefinedFabricId = 0ULL; -constexpr FabricIndex kUndefinedFabricIndex = 0; -constexpr FabricIndex kMinValidFabricIndex = 1; -constexpr FabricIndex kMaxValidFabricIndex = UINT8_MAX - 1; +inline constexpr FabricIndex kUndefinedFabricIndex = 0; +inline constexpr FabricIndex kMinValidFabricIndex = 1; +inline constexpr FabricIndex kMaxValidFabricIndex = UINT8_MAX - 1; -constexpr EndpointId kInvalidEndpointId = 0xFFFF; -constexpr EndpointId kRootEndpointId = 0; -constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. -constexpr KeysetId kInvalidKeysetId = 0xFFFF; +inline constexpr EndpointId kInvalidEndpointId = 0xFFFF; +inline constexpr EndpointId kRootEndpointId = 0; +inline constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. +inline constexpr KeysetId kInvalidKeysetId = 0xFFFF; // Invalid IC identifier is provisional. Value will most likely change when identifying token is defined // https://github.com/project-chip/connectedhomeip/issues/24251 -constexpr uint64_t kInvalidIcId = 0; +inline constexpr uint64_t kInvalidIcId = 0; // These are MEIs, 0xFFFF is not a valid manufacturer code, // thus 0xFFFF'FFFF is not a valid MEI. diff --git a/src/lib/core/GroupId.h b/src/lib/core/GroupId.h index c1168b1cd71f3a..598a02d6a512a8 100644 --- a/src/lib/core/GroupId.h +++ b/src/lib/core/GroupId.h @@ -23,20 +23,20 @@ namespace chip { using GroupId = uint16_t; -constexpr GroupId kUndefinedGroupId = 0; +inline constexpr GroupId kUndefinedGroupId = 0; -constexpr GroupId kMinUniversalGroupId = 0xFF00; -constexpr GroupId kMaxUniversalGroupId = 0xFFFF; +inline constexpr GroupId kMinUniversalGroupId = 0xFF00; +inline constexpr GroupId kMaxUniversalGroupId = 0xFFFF; -constexpr GroupId kMinApplicationGroupId = 0x0001; -constexpr GroupId kMaxApplicationGroupId = 0xFEFF; +inline constexpr GroupId kMinApplicationGroupId = 0x0001; +inline constexpr GroupId kMaxApplicationGroupId = 0xFEFF; -constexpr GroupId kAllNodes = 0xFFFF; -constexpr GroupId kAllNonSleepy = 0xFFFE; -constexpr GroupId kAllProxies = 0xFFFD; +inline constexpr GroupId kAllNodes = 0xFFFF; +inline constexpr GroupId kAllNonSleepy = 0xFFFE; +inline constexpr GroupId kAllProxies = 0xFFFD; -constexpr GroupId kMinUniversalGroupIdReserved = 0xFF00; -constexpr GroupId kMaxUniversalGroupIdReserved = 0xFFFC; +inline constexpr GroupId kMinUniversalGroupIdReserved = 0xFF00; +inline constexpr GroupId kMaxUniversalGroupIdReserved = 0xFFFC; constexpr bool IsOperationalGroupId(GroupId aGroupId) { diff --git a/src/lib/core/InPlace.h b/src/lib/core/InPlace.h index 6ac2cb0c9b2c62..14ce5773101412 100644 --- a/src/lib/core/InPlace.h +++ b/src/lib/core/InPlace.h @@ -31,7 +31,7 @@ struct InPlaceType { explicit InPlaceType() = default; }; -constexpr InPlaceType InPlace{}; +inline constexpr InPlaceType InPlace{}; template struct InPlaceTemplateType @@ -39,6 +39,6 @@ struct InPlaceTemplateType explicit InPlaceTemplateType() = default; }; template -constexpr InPlaceTemplateType InPlaceTemplate{}; +inline constexpr InPlaceTemplateType InPlaceTemplate{}; } // namespace chip diff --git a/src/lib/core/NodeId.h b/src/lib/core/NodeId.h index a16868ccb900ba..7b518f09f0cc28 100644 --- a/src/lib/core/NodeId.h +++ b/src/lib/core/NodeId.h @@ -28,35 +28,35 @@ namespace chip { // methods. using NodeId = uint64_t; -constexpr NodeId kUndefinedNodeId = 0ULL; +inline constexpr NodeId kUndefinedNodeId = 0ULL; // The range of possible NodeId values has some pieces carved out for special // uses. -constexpr NodeId kMinGroupNodeId = 0xFFFF'FFFF'FFFF'0000ULL; +inline constexpr NodeId kMinGroupNodeId = 0xFFFF'FFFF'FFFF'0000ULL; // The max group id is complicated, depending on how we want to count the // various special group ids. Let's not define it for now, until we have use // cases. -constexpr NodeId kMaskGroupId = 0x0000'0000'0000'FFFFULL; +inline constexpr NodeId kMaskGroupId = 0x0000'0000'0000'FFFFULL; -constexpr NodeId kMinTemporaryLocalId = 0xFFFF'FFFE'0000'0000ULL; +inline constexpr NodeId kMinTemporaryLocalId = 0xFFFF'FFFE'0000'0000ULL; // We use the largest available temporary local id to represent // kPlaceholderNodeId, so the range is narrowed compared to the spec. -constexpr NodeId kMaxTemporaryLocalId = 0xFFFF'FFFE'FFFF'FFFEULL; -constexpr NodeId kPlaceholderNodeId = 0xFFFF'FFFE'FFFF'FFFFULL; +inline constexpr NodeId kMaxTemporaryLocalId = 0xFFFF'FFFE'FFFF'FFFEULL; +inline constexpr NodeId kPlaceholderNodeId = 0xFFFF'FFFE'FFFF'FFFFULL; -constexpr NodeId kMinCASEAuthTag = 0xFFFF'FFFD'0000'0000ULL; -constexpr NodeId kMaxCASEAuthTag = 0xFFFF'FFFD'FFFF'FFFFULL; -constexpr NodeId kMaskCASEAuthTag = 0x0000'0000'FFFF'FFFFULL; +inline constexpr NodeId kMinCASEAuthTag = 0xFFFF'FFFD'0000'0000ULL; +inline constexpr NodeId kMaxCASEAuthTag = 0xFFFF'FFFD'FFFF'FFFFULL; +inline constexpr NodeId kMaskCASEAuthTag = 0x0000'0000'FFFF'FFFFULL; -constexpr NodeId kMinPAKEKeyId = 0xFFFF'FFFB'0000'0000ULL; -constexpr NodeId kMaxPAKEKeyId = 0xFFFF'FFFB'FFFF'FFFFULL; -constexpr NodeId kMaskPAKEKeyId = 0x0000'0000'0000'FFFFULL; -constexpr NodeId kMaskUnusedPAKEKeyId = 0x0000'0000'FFFF'0000ULL; +inline constexpr NodeId kMinPAKEKeyId = 0xFFFF'FFFB'0000'0000ULL; +inline constexpr NodeId kMaxPAKEKeyId = 0xFFFF'FFFB'FFFF'FFFFULL; +inline constexpr NodeId kMaskPAKEKeyId = 0x0000'0000'0000'FFFFULL; +inline constexpr NodeId kMaskUnusedPAKEKeyId = 0x0000'0000'FFFF'0000ULL; // There are more reserved ranges here, not assigned to anything yet, going down // all the way to 0xFFFF'FFF0'0000'0000ULL -constexpr NodeId kMaxOperationalNodeId = 0xFFFF'FFEF'FFFF'FFFFULL; +inline constexpr NodeId kMaxOperationalNodeId = 0xFFFF'FFEF'FFFF'FFFFULL; constexpr bool IsOperationalNodeId(NodeId aNodeId) { diff --git a/src/lib/core/OTAImageHeader.h b/src/lib/core/OTAImageHeader.h index 4d3eea420432c6..f9fa8868530fd8 100644 --- a/src/lib/core/OTAImageHeader.h +++ b/src/lib/core/OTAImageHeader.h @@ -26,7 +26,7 @@ namespace chip { /// File signature (aka magic number) of a valid Matter OTA image -constexpr uint32_t kOTAImageFileIdentifier = 0x1BEEF11E; +inline constexpr uint32_t kOTAImageFileIdentifier = 0x1BEEF11E; enum class OTAImageDigestType : uint8_t { diff --git a/src/lib/core/Optional.h b/src/lib/core/Optional.h index 4edae30093c038..3b673e36fa7071 100644 --- a/src/lib/core/Optional.h +++ b/src/lib/core/Optional.h @@ -35,7 +35,7 @@ struct NullOptionalType { explicit NullOptionalType() = default; }; -constexpr NullOptionalType NullOptional{}; +inline constexpr NullOptionalType NullOptional{}; /** * Pairs an object with a boolean value to determine if the object value diff --git a/src/lib/core/PasscodeId.h b/src/lib/core/PasscodeId.h index f49aa19ea26b0e..e1322978f249e0 100644 --- a/src/lib/core/PasscodeId.h +++ b/src/lib/core/PasscodeId.h @@ -25,6 +25,6 @@ namespace chip { // methods. using PasscodeId = uint16_t; -constexpr PasscodeId kDefaultCommissioningPasscodeId = 0; +inline constexpr PasscodeId kDefaultCommissioningPasscodeId = 0; } // namespace chip diff --git a/src/lib/dnssd/Constants.h b/src/lib/dnssd/Constants.h index d1805058b1e8ba..f34bdfa3da52b8 100644 --- a/src/lib/dnssd/Constants.h +++ b/src/lib/dnssd/Constants.h @@ -29,18 +29,18 @@ namespace Dnssd { * Matter DNS host settings */ -constexpr size_t kHostNameMaxLength = 16; // MAC or 802.15.4 Extended Address in hex +inline constexpr size_t kHostNameMaxLength = 16; // MAC or 802.15.4 Extended Address in hex /* * Matter DNS service subtypes */ -constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S
-constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L -constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V -constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T -constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _CM -constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits> +inline constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S
+inline constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L +inline constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V +inline constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T +inline constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _CM +inline constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits> /* * Matter operational node service settings @@ -50,10 +50,10 @@ namespace Operational { #define SUBTYPES (std::initializer_list{ kSubTypeCompressedFabricIdMaxLength }) -constexpr size_t kInstanceNameMaxLength = 33; // - in hex (16 + 1 + 16) -constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); -constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); -constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); +inline constexpr size_t kInstanceNameMaxLength = 33; // - in hex (16 + 1 + 16) +inline constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); +inline constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); +inline constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); #undef SUBTYPES @@ -69,10 +69,10 @@ namespace Commission { (std::initializer_list{ kSubTypeShortDiscriminatorMaxLength, kSubTypeLongDiscriminatorMaxLength, \ kSubTypeVendorIdMaxLength, kSubTypeDeviceTypeMaxLength, kSubTypeCommissioningModeMaxLength }) -constexpr size_t kInstanceNameMaxLength = 16; // 64-bit random number in hex -constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); -constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); -constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); +inline constexpr size_t kInstanceNameMaxLength = 16; // 64-bit random number in hex +inline constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); +inline constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); +inline constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); #undef SUBTYPES @@ -84,10 +84,10 @@ constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); namespace Common { -constexpr size_t kInstanceNameMaxLength = std::max(Operational::kInstanceNameMaxLength, Commission::kInstanceNameMaxLength); -constexpr size_t kSubTypeMaxNumber = std::max(Operational::kSubTypeMaxNumber, Commission::kSubTypeMaxNumber); -constexpr size_t kSubTypeMaxLength = std::max(Operational::kSubTypeMaxLength, Commission::kSubTypeMaxLength); -constexpr size_t kSubTypeTotalLength = std::max(Operational::kSubTypeTotalLength, Commission::kSubTypeTotalLength); +inline constexpr size_t kInstanceNameMaxLength = std::max(Operational::kInstanceNameMaxLength, Commission::kInstanceNameMaxLength); +inline constexpr size_t kSubTypeMaxNumber = std::max(Operational::kSubTypeMaxNumber, Commission::kSubTypeMaxNumber); +inline constexpr size_t kSubTypeMaxLength = std::max(Operational::kSubTypeMaxLength, Commission::kSubTypeMaxLength); +inline constexpr size_t kSubTypeTotalLength = std::max(Operational::kSubTypeTotalLength, Commission::kSubTypeTotalLength); } // namespace Common diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index a9039352c64b36..81c8e975480347 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -139,9 +139,9 @@ struct OperationalNodeData void Reset() { peerId = PeerId(); } }; -constexpr size_t kMaxDeviceNameLen = 32; -constexpr size_t kMaxRotatingIdLen = 50; -constexpr size_t kMaxPairingInstructionLen = 128; +inline constexpr size_t kMaxDeviceNameLen = 32; +inline constexpr size_t kMaxRotatingIdLen = 50; +inline constexpr size_t kMaxPairingInstructionLen = 128; /// Data that is specific to commisionable/commissioning node discovery struct CommissionNodeData diff --git a/src/lib/dnssd/ServiceNaming.h b/src/lib/dnssd/ServiceNaming.h index 10e5abba465774..5f4c2e6c2ea948 100644 --- a/src/lib/dnssd/ServiceNaming.h +++ b/src/lib/dnssd/ServiceNaming.h @@ -28,13 +28,13 @@ namespace chip { namespace Dnssd { -constexpr char kSubtypeServiceNamePart[] = "_sub"; -constexpr char kCommissionableServiceName[] = "_matterc"; -constexpr char kOperationalServiceName[] = "_matter"; -constexpr char kCommissionerServiceName[] = "_matterd"; -constexpr char kOperationalProtocol[] = "_tcp"; -constexpr char kCommissionProtocol[] = "_udp"; -constexpr char kLocalDomain[] = "local"; +inline constexpr char kSubtypeServiceNamePart[] = "_sub"; +inline constexpr char kCommissionableServiceName[] = "_matterc"; +inline constexpr char kOperationalServiceName[] = "_matter"; +inline constexpr char kCommissionerServiceName[] = "_matterd"; +inline constexpr char kOperationalProtocol[] = "_tcp"; +inline constexpr char kCommissionProtocol[] = "_udp"; +inline constexpr char kLocalDomain[] = "local"; // each includes space for a null terminator, which becomes a . when the names are appended. constexpr size_t kMaxCommissionableServiceNameSize = diff --git a/src/lib/dnssd/minimal_mdns/core/Constants.h b/src/lib/dnssd/minimal_mdns/core/Constants.h index 30f2d4b0ddd0b9..bf2a309143cd7c 100644 --- a/src/lib/dnssd/minimal_mdns/core/Constants.h +++ b/src/lib/dnssd/minimal_mdns/core/Constants.h @@ -44,10 +44,10 @@ enum class QType : uint16_t }; /// Flag encoded in QCLASS requesting unicast answers -constexpr uint16_t kQClassUnicastAnswerFlag = 0x8000; +inline constexpr uint16_t kQClassUnicastAnswerFlag = 0x8000; // Flag used to indicate receiver should flush cache rather than appending. Used for Response RR's. // See https://datatracker.ietf.org/doc/html/rfc6762#section-10.2. -constexpr uint16_t kQClassResponseFlushBit = 0x8000; +inline constexpr uint16_t kQClassResponseFlushBit = 0x8000; enum class QClass : uint16_t { diff --git a/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h b/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h index e82dc5ee6c3492..f7b34f10591e9d 100644 --- a/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h +++ b/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h @@ -38,7 +38,7 @@ namespace mdns { namespace Minimal { namespace test { -constexpr QNamePart kIgnoreQNameParts[] = { "IGNORE", "THIS" }; +inline constexpr QNamePart kIgnoreQNameParts[] = { "IGNORE", "THIS" }; namespace { bool StringMatches(const BytesRange & br, const char * str) { diff --git a/src/lib/support/CommonPersistentData.h b/src/lib/support/CommonPersistentData.h index df0acff14616e4..64056a69dbe290 100644 --- a/src/lib/support/CommonPersistentData.h +++ b/src/lib/support/CommonPersistentData.h @@ -27,7 +27,7 @@ namespace chip { namespace CommonPersistentData { -constexpr uint8_t kdefaultUndefinedEntry = 0; +inline constexpr uint8_t kdefaultUndefinedEntry = 0; /// @brief Generic class to implement storage of a list persistently /// @tparam EntryType : Type of entry depends on the stored data @@ -74,7 +74,7 @@ struct StoredDataList : public PersistentData } }; -constexpr size_t kPersistentFabricBufferMax = 32; +inline constexpr size_t kPersistentFabricBufferMax = 32; struct FabricList : StoredDataList { // Subclasses need to define UpdateKey to be whatever fabric list key they diff --git a/src/lib/support/PrivateHeap.h b/src/lib/support/PrivateHeap.h index 864497a845a226..33334265d5e080 100644 --- a/src/lib/support/PrivateHeap.h +++ b/src/lib/support/PrivateHeap.h @@ -67,6 +67,6 @@ struct PrivateHeapBlockHeader } // namespace internal -constexpr size_t kPrivateHeapAllocationAlignment = std::alignment_of::value; +inline constexpr size_t kPrivateHeapAllocationAlignment = std::alignment_of::value; #endif // ifdef __cplusplus diff --git a/src/lib/support/ThreadOperationalDataset.h b/src/lib/support/ThreadOperationalDataset.h index 9fbfd1b1b3c547..e4de3ddaa8d2c5 100644 --- a/src/lib/support/ThreadOperationalDataset.h +++ b/src/lib/support/ThreadOperationalDataset.h @@ -29,16 +29,16 @@ namespace Thread { class ThreadTLV; -constexpr size_t kChannel_NotSpecified = UINT8_MAX; -constexpr size_t kPANId_NotSpecified = UINT16_MAX; +inline constexpr size_t kChannel_NotSpecified = UINT8_MAX; +inline constexpr size_t kPANId_NotSpecified = UINT16_MAX; -constexpr size_t kSizeOperationalDataset = 254; +inline constexpr size_t kSizeOperationalDataset = 254; -constexpr size_t kSizeNetworkName = 16; -constexpr size_t kSizeExtendedPanId = 8; -constexpr size_t kSizeMasterKey = 16; -constexpr size_t kSizeMeshLocalPrefix = 8; -constexpr size_t kSizePSKc = 16; +inline constexpr size_t kSizeNetworkName = 16; +inline constexpr size_t kSizeExtendedPanId = 8; +inline constexpr size_t kSizeMasterKey = 16; +inline constexpr size_t kSizeMeshLocalPrefix = 8; +inline constexpr size_t kSizePSKc = 16; /** * This class provides methods to manipulate Thread operational dataset. diff --git a/src/messaging/ReliableMessageProtocolConfig.h b/src/messaging/ReliableMessageProtocolConfig.h index 6a570ba25f93e7..bd0e421933a3a1 100644 --- a/src/messaging/ReliableMessageProtocolConfig.h +++ b/src/messaging/ReliableMessageProtocolConfig.h @@ -167,7 +167,7 @@ namespace chip { #endif #endif // CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST -constexpr System::Clock::Milliseconds32 kDefaultActiveTime = System::Clock::Milliseconds16(4000); +inline constexpr System::Clock::Milliseconds32 kDefaultActiveTime = System::Clock::Milliseconds16(4000); /** * @brief diff --git a/src/messaging/tests/echo/common.h b/src/messaging/tests/echo/common.h index 03d2431d3b7a8a..8158884c5c4321 100644 --- a/src/messaging/tests/echo/common.h +++ b/src/messaging/tests/echo/common.h @@ -31,9 +31,9 @@ #include #include -constexpr size_t kMaxTcpActiveConnectionCount = 4; -constexpr size_t kMaxTcpPendingPackets = 4; -constexpr size_t kNetworkSleepTimeMsecs = (100 * 1000); +inline constexpr size_t kMaxTcpActiveConnectionCount = 4; +inline constexpr size_t kMaxTcpPendingPackets = 4; +inline constexpr size_t kNetworkSleepTimeMsecs = (100 * 1000); extern chip::FabricTable gFabricTable; extern chip::SessionManager gSessionManager; diff --git a/src/platform/ASR/NetworkCommissioningDriver.h b/src/platform/ASR/NetworkCommissioningDriver.h index 954f0c886be2d5..5a028042d88d1a 100644 --- a/src/platform/ASR/NetworkCommissioningDriver.h +++ b/src/platform/ASR/NetworkCommissioningDriver.h @@ -33,10 +33,10 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -constexpr uint8_t kWiFiMaxNetworks = 15; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kWiFiMaxNetworks = 15; } // namespace class ASRScanResponseIterator : public Iterator @@ -56,7 +56,7 @@ class ASRScanResponseIterator : public Iterator // copy the available information into WiFiScanResponse struct, which will be copied to the result to be sent item.security.SetRaw(mpScanResults->ap_list[mIternum].security); item.ssidLen = static_cast(strnlen(reinterpret_cast(mpScanResults->ap_list[mIternum].ssid), - chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); + chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); item.channel = mpScanResults->ap_list[mIternum].channel; item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; item.rssi = mpScanResults->ap_list[mIternum].ap_power; diff --git a/src/platform/Ameba/NetworkCommissioningDriver.h b/src/platform/Ameba/NetworkCommissioningDriver.h index 3942b89627741f..0525ac4910f5ec 100644 --- a/src/platform/Ameba/NetworkCommissioningDriver.h +++ b/src/platform/Ameba/NetworkCommissioningDriver.h @@ -25,9 +25,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class AmebaScanResponseIterator : public Iterator diff --git a/src/platform/Beken/NetworkCommissioningDriver.h b/src/platform/Beken/NetworkCommissioningDriver.h index 5f83d0d928e39d..860a165601c20b 100644 --- a/src/platform/Beken/NetworkCommissioningDriver.h +++ b/src/platform/Beken/NetworkCommissioningDriver.h @@ -26,9 +26,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class BKScanResponseIterator : public Iterator diff --git a/src/platform/ESP32/NetworkCommissioningDriver.h b/src/platform/ESP32/NetworkCommissioningDriver.h index 7a261654d4f71e..5a2ca8f44d61c1 100644 --- a/src/platform/ESP32/NetworkCommissioningDriver.h +++ b/src/platform/ESP32/NetworkCommissioningDriver.h @@ -26,9 +26,9 @@ namespace chip { namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 30; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 30; } // namespace BitFlags ConvertSecurityType(wifi_auth_mode_t authMode); diff --git a/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h b/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h index d7f5683d516356..a0df82a0ed36d4 100644 --- a/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h +++ b/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h @@ -26,10 +26,10 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -constexpr uint8_t kWiFiMaxNetworks = 15; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kWiFiMaxNetworks = 15; } // namespace class P6ScanResponseIterator : public Iterator @@ -51,7 +51,7 @@ class P6ScanResponseIterator : public Iterator item.wiFiBand = (mpScanResults[mIternum].band == CY_WCM_WIFI_BAND_2_4GHZ) ? chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4 : chip::DeviceLayer::NetworkCommissioning::WiFiBand::k5g; - item.rssi = mpScanResults[mIternum].signal_strength; + item.rssi = mpScanResults[mIternum].signal_strength; memcpy(item.ssid, mpScanResults[mIternum].SSID, item.ssidLen); memcpy(item.bssid, mpScanResults[mIternum].BSSID, 6); diff --git a/src/platform/android/DiagnosticDataProviderImpl.h b/src/platform/android/DiagnosticDataProviderImpl.h index 26903d5d3ad3a4..7086b6c1a5a651 100644 --- a/src/platform/android/DiagnosticDataProviderImpl.h +++ b/src/platform/android/DiagnosticDataProviderImpl.h @@ -26,9 +26,9 @@ #include namespace { -constexpr int offPremiseServicesReachableUnknown = 0; -constexpr int offPremiseServicesReachableYes = 1; -constexpr int offPremiseServicesReachableNo = 2; +inline constexpr int offPremiseServicesReachableUnknown = 0; +inline constexpr int offPremiseServicesReachableYes = 1; +inline constexpr int offPremiseServicesReachableNo = 2; } // namespace namespace chip { diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h index 83416a534988ac..3e4b56b01df84a 100644 --- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h +++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h @@ -24,9 +24,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class BLScanResponseIterator : public Iterator @@ -42,9 +42,9 @@ class BLScanResponseIterator : public Iterator } item.security.SetRaw(mpScanResults[mIternum].auth); - item.ssidLen = mpScanResults[mIternum].ssid_len < chip::DeviceLayer::Internal::kMaxWiFiSSIDLength - ? mpScanResults[mIternum].ssid_len - : chip::DeviceLayer::Internal::kMaxWiFiSSIDLength; + item.ssidLen = mpScanResults[mIternum].ssid_len < chip::DeviceLayer::Internal::kMaxWiFiSSIDLength + ? mpScanResults[mIternum].ssid_len + : chip::DeviceLayer::Internal::kMaxWiFiSSIDLength; item.channel = mpScanResults[mIternum].channel; item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; item.rssi = mpScanResults[mIternum].rssi; diff --git a/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h index caa071ddd467b2..19262ce4db4e6f 100644 --- a/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h +++ b/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h @@ -24,9 +24,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class BLScanResponseIterator : public Iterator diff --git a/src/platform/mbed/NetworkCommissioningDriver.h b/src/platform/mbed/NetworkCommissioningDriver.h index 017f69218267a1..33496f0ed9af47 100644 --- a/src/platform/mbed/NetworkCommissioningDriver.h +++ b/src/platform/mbed/NetworkCommissioningDriver.h @@ -29,9 +29,9 @@ namespace NetworkCommissioning { #include namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class MbedScanResponseIterator : public Iterator @@ -49,7 +49,7 @@ class MbedScanResponseIterator : public Iterator item.security.SetRaw(mScanResults[mIternum].get_security()); static_assert(chip::DeviceLayer::Internal::kMaxWiFiSSIDLength <= UINT8_MAX, "Our length won't fit in ssidLen"); item.ssidLen = static_cast(strnlen(reinterpret_cast(mScanResults[mIternum].get_ssid()), - chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); + chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); item.channel = mScanResults[mIternum].get_channel(); item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; item.rssi = mScanResults[mIternum].get_rssi(); diff --git a/src/platform/mt793x/NetworkCommissioningWiFiDriver.h b/src/platform/mt793x/NetworkCommissioningWiFiDriver.h index ac810727d92808..85822801c4212a 100644 --- a/src/platform/mt793x/NetworkCommissioningWiFiDriver.h +++ b/src/platform/mt793x/NetworkCommissioningWiFiDriver.h @@ -25,10 +25,10 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -constexpr uint8_t kMaxWiFiScanAPs = 30; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiScanAPs = 30; } // namespace template diff --git a/src/platform/nrfconnect/wifi/NrfWiFiDriver.h b/src/platform/nrfconnect/wifi/NrfWiFiDriver.h index 7b57607b306822..d1fc765a72ac26 100644 --- a/src/platform/nrfconnect/wifi/NrfWiFiDriver.h +++ b/src/platform/nrfconnect/wifi/NrfWiFiDriver.h @@ -25,9 +25,9 @@ namespace chip { namespace DeviceLayer { namespace NetworkCommissioning { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 35; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 35; class NrfWiFiScanResponseIterator : public Iterator { diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.h b/src/platform/nxp/k32w/common/OTATlvProcessor.h index 400e23e8f9a4e1..534da067148da8 100644 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.h +++ b/src/platform/nxp/k32w/common/OTATlvProcessor.h @@ -42,10 +42,10 @@ namespace chip { #define CHIP_OTA_PROCESSOR_START_IMAGE CHIP_ERROR_TLV_PROCESSOR(0x0D) // Descriptor constants -constexpr size_t kVersionStringSize = 64; -constexpr size_t kBuildDateSize = 64; +inline constexpr size_t kVersionStringSize = 64; +inline constexpr size_t kBuildDateSize = 64; -constexpr uint16_t requestedOtaMaxBlockSize = 1024; +inline constexpr uint16_t requestedOtaMaxBlockSize = 1024; /** * Used alongside RegisterDescriptorCallback to register diff --git a/src/platform/openiotsdk/KVPsaPsStore.h b/src/platform/openiotsdk/KVPsaPsStore.h index 7e68bdbd32491b..acd3f695765650 100644 --- a/src/platform/openiotsdk/KVPsaPsStore.h +++ b/src/platform/openiotsdk/KVPsaPsStore.h @@ -44,7 +44,7 @@ using namespace chip::Platform::PersistedStorage; // '01' = Matter region // '02' = the sub region group base offset (Factory, Config, Counter or KVS) // '14' = the id offset inside the group. -constexpr Key kMatterPsaPaKeyRegion = 0x010000U; +inline constexpr Key kMatterPsaPaKeyRegion = 0x010000U; constexpr inline Key GetPsaPaKey(Key group, uint8_t id) { return kMatterPsaPaKeyRegion | (group) << 8 | id; diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.h b/src/platform/silabs/NetworkCommissioningWiFiDriver.h index fd73568a6ba98b..55148e3700091d 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.h +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.h @@ -25,9 +25,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace template diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h index 391d6a71682e28..d5742c7c077d9d 100644 --- a/src/platform/silabs/SilabsConfig.h +++ b/src/platform/silabs/SilabsConfig.h @@ -62,11 +62,11 @@ namespace Internal { // '08' = Matter nvm3 region // '72' = the sub region group base offset (Factory, Config, Counter or KVS) // '01' = the id offset inside the group. -constexpr uint32_t kUserNvm3KeyDomainLoLimit = 0x000000U; // User Domain NVM3 Key Range lower limit -constexpr uint32_t kUserNvm3KeyDomainHiLimit = 0x00FFFFU; // User Domain NVM3 Key Range Maximum limit -constexpr uint32_t kMatterNvm3KeyDomain = 0x080000U; -constexpr uint32_t kMatterNvm3KeyLoLimit = 0x087200U; // Do not modify without Silabs GSDK team approval -constexpr uint32_t kMatterNvm3KeyHiLimit = 0x087FFFU; // Do not modify without Silabs GSDK team approval +inline constexpr uint32_t kUserNvm3KeyDomainLoLimit = 0x000000U; // User Domain NVM3 Key Range lower limit +inline constexpr uint32_t kUserNvm3KeyDomainHiLimit = 0x00FFFFU; // User Domain NVM3 Key Range Maximum limit +inline constexpr uint32_t kMatterNvm3KeyDomain = 0x080000U; +inline constexpr uint32_t kMatterNvm3KeyLoLimit = 0x087200U; // Do not modify without Silabs GSDK team approval +inline constexpr uint32_t kMatterNvm3KeyHiLimit = 0x087FFFU; // Do not modify without Silabs GSDK team approval constexpr inline uint32_t SilabsConfigKey(uint8_t keyBaseOffset, uint8_t id) { return kMatterNvm3KeyDomain | static_cast(keyBaseOffset) << 8 | id; diff --git a/src/platform/silabs/efr32/Efr32OpaqueKeypair.h b/src/platform/silabs/efr32/Efr32OpaqueKeypair.h index 91dd43d04c312c..9b17d42b590fbe 100644 --- a/src/platform/silabs/efr32/Efr32OpaqueKeypair.h +++ b/src/platform/silabs/efr32/Efr32OpaqueKeypair.h @@ -25,10 +25,10 @@ namespace DeviceLayer { namespace Internal { typedef uint16_t EFR32OpaqueKeyId; -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdUnknown = 0xFFFFU; // Do not modify, will impact existing deployments -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdVolatile = 0xFFFEU; // Do not modify, will impact existing deployments -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMin = 0x0U; // Do not modify, will impact existing deployments -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMax = 0x1FFU; // Do not decrease, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdUnknown = 0xFFFFU; // Do not modify, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdVolatile = 0xFFFEU; // Do not modify, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMin = 0x0U; // Do not modify, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMax = 0x1FFU; // Do not decrease, will impact existing deployments enum class EFR32OpaqueKeyUsages : uint8_t { diff --git a/src/protocols/bdx/BdxMessages.h b/src/protocols/bdx/BdxMessages.h index 72e1ad2969ab5d..753520eab455d6 100644 --- a/src/protocols/bdx/BdxMessages.h +++ b/src/protocols/bdx/BdxMessages.h @@ -33,9 +33,9 @@ namespace chip { namespace bdx { -constexpr uint16_t kMaxFileDesignatorLen = 0xFF; +inline constexpr uint16_t kMaxFileDesignatorLen = 0xFF; -constexpr const char * kProtocolName = "BDX"; +inline constexpr const char * kProtocolName = "BDX"; enum class MessageType : uint8_t { diff --git a/src/protocols/bdx/BdxUri.h b/src/protocols/bdx/BdxUri.h index 776ccffe0973b0..8e072892f6fbcd 100644 --- a/src/protocols/bdx/BdxUri.h +++ b/src/protocols/bdx/BdxUri.h @@ -22,7 +22,7 @@ namespace chip { namespace bdx { -constexpr const char kScheme[] = "bdx://"; +inline constexpr const char kScheme[] = "bdx://"; /** * Parses the URI into NodeId and File Designator diff --git a/src/protocols/echo/Echo.h b/src/protocols/echo/Echo.h index 510bad30c24ca9..08690e2ae45abc 100644 --- a/src/protocols/echo/Echo.h +++ b/src/protocols/echo/Echo.h @@ -38,7 +38,7 @@ namespace chip { namespace Protocols { namespace Echo { -constexpr const char * kProtocolName = "Echo"; +inline constexpr const char * kProtocolName = "Echo"; /** * Echo Protocol Message Types diff --git a/src/protocols/interaction_model/Constants.h b/src/protocols/interaction_model/Constants.h index 77839513fa66d1..d5b33e3f23ff2b 100644 --- a/src/protocols/interaction_model/Constants.h +++ b/src/protocols/interaction_model/Constants.h @@ -45,12 +45,12 @@ namespace chip { namespace Protocols { namespace InteractionModel { -constexpr const char * kProtocolName = "IM"; +inline constexpr const char * kProtocolName = "IM"; /** * Version of the Interaction Model used by the node. */ -constexpr uint16_t kVersion = 0; +inline constexpr uint16_t kVersion = 0; /** * Interaction Model Protocol Message Types diff --git a/src/protocols/secure_channel/CASEDestinationId.h b/src/protocols/secure_channel/CASEDestinationId.h index 1be4a7cf88fe22..104d44a76d0715 100644 --- a/src/protocols/secure_channel/CASEDestinationId.h +++ b/src/protocols/secure_channel/CASEDestinationId.h @@ -28,8 +28,8 @@ namespace chip { -constexpr uint16_t kSigmaParamRandomNumberSize = 32; -constexpr uint16_t kIPKSize = Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES; +inline constexpr uint16_t kSigmaParamRandomNumberSize = 32; +inline constexpr uint16_t kIPKSize = Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES; CHIP_ERROR GenerateCaseDestinationId(const ByteSpan & ipk, const ByteSpan & initiatorRandom, const ByteSpan & rootPubKey, FabricId fabricId, NodeId nodeId, MutableByteSpan & outDestinationId); diff --git a/src/protocols/secure_channel/Constants.h b/src/protocols/secure_channel/Constants.h index 2e0b104599e1dc..57465a4e3414a6 100644 --- a/src/protocols/secure_channel/Constants.h +++ b/src/protocols/secure_channel/Constants.h @@ -43,7 +43,7 @@ namespace chip { namespace Protocols { namespace SecureChannel { -constexpr const char * kProtocolName = "SecureChannel"; +inline constexpr const char * kProtocolName = "SecureChannel"; /** * SecureChannel Protocol Message Types @@ -74,15 +74,15 @@ enum class MsgType : uint8_t }; // Placeholder value for the ProtocolCode field when the GeneralCode is Success or Continue. -constexpr uint16_t kProtocolCodeSuccess = 0x0000; -constexpr uint16_t kProtocolCodeNoSharedRoot = 0x0001; -constexpr uint16_t kProtocolCodeInvalidParam = 0x0002; -constexpr uint16_t kProtocolCodeCloseSession = 0x0003; -constexpr uint16_t kProtocolCodeBusy = 0x0004; -constexpr uint16_t kProtocolCodeSessionNotFound = 0x0005; +inline constexpr uint16_t kProtocolCodeSuccess = 0x0000; +inline constexpr uint16_t kProtocolCodeNoSharedRoot = 0x0001; +inline constexpr uint16_t kProtocolCodeInvalidParam = 0x0002; +inline constexpr uint16_t kProtocolCodeCloseSession = 0x0003; +inline constexpr uint16_t kProtocolCodeBusy = 0x0004; +inline constexpr uint16_t kProtocolCodeSessionNotFound = 0x0005; // Placeholder value for the ProtocolCode field when there is no additional protocol-specific code to provide more information. -constexpr uint16_t kProtocolCodeGeneralFailure = 0xFFFF; +inline constexpr uint16_t kProtocolCodeGeneralFailure = 0xFFFF; /** * Status Report - General Status Codes used to convey protocol-agnostic status info. diff --git a/src/protocols/secure_channel/PASESession.h b/src/protocols/secure_channel/PASESession.h index 39508d8342d7b8..02d8fa7d6636f8 100644 --- a/src/protocols/secure_channel/PASESession.h +++ b/src/protocols/secure_channel/PASESession.h @@ -44,7 +44,7 @@ namespace chip { extern const char * kSpake2pI2RSessionInfo; extern const char * kSpake2pR2ISessionInfo; -constexpr uint16_t kPBKDFParamRandomNumberSize = 32; +inline constexpr uint16_t kPBKDFParamRandomNumberSize = 32; using namespace Crypto; @@ -239,7 +239,7 @@ class DLL_EXPORT PASESession : public Messaging::UnsolicitedMessageHandler, }; // The following constants are node IDs that test devices and test controllers use. -constexpr chip::NodeId kTestControllerNodeId = 112233; -constexpr chip::NodeId kTestDeviceNodeId = 12344321; +inline constexpr chip::NodeId kTestControllerNodeId = 112233; +inline constexpr chip::NodeId kTestDeviceNodeId = 12344321; } // namespace chip diff --git a/src/protocols/secure_channel/RendezvousParameters.h b/src/protocols/secure_channel/RendezvousParameters.h index e563166f8acff0..a82628a483b2e9 100644 --- a/src/protocols/secure_channel/RendezvousParameters.h +++ b/src/protocols/secure_channel/RendezvousParameters.h @@ -33,7 +33,7 @@ namespace chip { const uint16_t kMaxRendezvousDiscriminatorValue = 0xFFF; // The largest supported value for sleepy idle interval and sleepy active interval -constexpr uint32_t kMaxSleepyInterval = 3600000; +inline constexpr uint32_t kMaxSleepyInterval = 3600000; class RendezvousParameters { diff --git a/src/protocols/user_directed_commissioning/UDCClients.h b/src/protocols/user_directed_commissioning/UDCClients.h index 47833bce421274..2edcdf3df2e74c 100644 --- a/src/protocols/user_directed_commissioning/UDCClients.h +++ b/src/protocols/user_directed_commissioning/UDCClients.h @@ -26,7 +26,7 @@ namespace Protocols { namespace UserDirectedCommissioning { // UDC client state times out after 1 hour. This may need to be tweaked. -constexpr const System::Clock::Timestamp kUDCClientTimeout = System::Clock::Milliseconds64(60 * 60 * 1000); +inline constexpr const System::Clock::Timestamp kUDCClientTimeout = System::Clock::Milliseconds64(60 * 60 * 1000); /** * Handles a set of UDC Client Processing States. diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h index e21c933455e594..8e22014e36aaf6 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h @@ -41,10 +41,10 @@ namespace chip { namespace Protocols { namespace UserDirectedCommissioning { -constexpr const char * kProtocolName = "UserDirectedCommissioning"; +inline constexpr const char * kProtocolName = "UserDirectedCommissioning"; // Cache contains 16 clients. This may need to be tweaked. -constexpr uint8_t kMaxUDCClients = 16; +inline constexpr uint8_t kMaxUDCClients = 16; /** * User Directed Commissioning Protocol Message Types diff --git a/src/setup_payload/AdditionalDataPayload.h b/src/setup_payload/AdditionalDataPayload.h index ede62352fadd45..78ba0137100aba 100644 --- a/src/setup_payload/AdditionalDataPayload.h +++ b/src/setup_payload/AdditionalDataPayload.h @@ -40,8 +40,8 @@ namespace chip { namespace SetupPayloadData { -constexpr uint8_t kRotatingDeviceIdLength = 18; -constexpr uint8_t kRotatingDeviceIdTag = 0x00; +inline constexpr uint8_t kRotatingDeviceIdLength = 18; +inline constexpr uint8_t kRotatingDeviceIdTag = 0x00; struct AdditionalDataPayload { diff --git a/src/setup_payload/SetupPayload.h b/src/setup_payload/SetupPayload.h index 4892e9ea0d2a23..0bb21698341279 100644 --- a/src/setup_payload/SetupPayload.h +++ b/src/setup_payload/SetupPayload.h @@ -68,14 +68,14 @@ const int kManualSetupVendorIdCharLength = 5; const int kManualSetupProductIdCharLength = 5; // Spec 5.1.4.2 CHIP-Common Reserved Tags -constexpr uint8_t kSerialNumberTag = 0x00; -constexpr uint8_t kPBKDFIterationsTag = 0x01; -constexpr uint8_t kBPKFSaltTag = 0x02; -constexpr uint8_t kNumberOFDevicesTag = 0x03; -constexpr uint8_t kCommissioningTimeoutTag = 0x04; - -constexpr uint32_t kSetupPINCodeMaximumValue = 99999998; -constexpr uint32_t kSetupPINCodeUndefinedValue = 0; +inline constexpr uint8_t kSerialNumberTag = 0x00; +inline constexpr uint8_t kPBKDFIterationsTag = 0x01; +inline constexpr uint8_t kBPKFSaltTag = 0x02; +inline constexpr uint8_t kNumberOFDevicesTag = 0x03; +inline constexpr uint8_t kCommissioningTimeoutTag = 0x04; + +inline constexpr uint32_t kSetupPINCodeMaximumValue = 99999998; +inline constexpr uint32_t kSetupPINCodeUndefinedValue = 0; // clang-format off const int kTotalPayloadDataSizeInBits = diff --git a/src/setup_payload/tests/TestHelpers.h b/src/setup_payload/tests/TestHelpers.h index dedd9040ae205e..8e83b512df26d1 100644 --- a/src/setup_payload/tests/TestHelpers.h +++ b/src/setup_payload/tests/TestHelpers.h @@ -30,16 +30,16 @@ namespace chip { const uint16_t kSmallBufferSizeInBytes = 1; const uint16_t kDefaultBufferSizeInBytes = 512; -const uint8_t kOptionalDefaultStringTag = 0x82; // Vendor "test" tag -constexpr char kOptionalDefaultStringValue[] = "myData"; +const uint8_t kOptionalDefaultStringTag = 0x82; // Vendor "test" tag +inline constexpr char kOptionalDefaultStringValue[] = "myData"; const uint8_t kOptionalDefaultIntTag = 0x83; // Vendor "test" tag const uint32_t kOptionalDefaultIntValue = 12; -constexpr char kSerialNumberDefaultStringValue[] = "123456789"; -const uint32_t kSerialNumberDefaultUInt32Value = 123456789; +inline constexpr char kSerialNumberDefaultStringValue[] = "123456789"; +const uint32_t kSerialNumberDefaultUInt32Value = 123456789; -constexpr const char * kDefaultPayloadQRCode = "MT:M5L90MP500K64J00000"; +inline constexpr const char * kDefaultPayloadQRCode = "MT:M5L90MP500K64J00000"; inline SetupPayload GetDefaultPayload() { diff --git a/src/system/SocketEvents.h b/src/system/SocketEvents.h index 508bbdcf759483..390fe78f597884 100644 --- a/src/system/SocketEvents.h +++ b/src/system/SocketEvents.h @@ -34,7 +34,7 @@ using SocketEvents = BitFlags; using SocketWatchToken = intptr_t; using SocketWatchCallback = void (*)(SocketEvents events, intptr_t data); -constexpr int kInvalidFd = -1; +inline constexpr int kInvalidFd = -1; } // namespace System } // namespace chip diff --git a/src/system/SystemClock.h b/src/system/SystemClock.h index 566e23d9738bc7..77196f995bbc89 100644 --- a/src/system/SystemClock.h +++ b/src/system/SystemClock.h @@ -68,7 +68,7 @@ using Seconds64 = std::chrono::duration; using Seconds32 = std::chrono::duration; using Seconds16 = std::chrono::duration; -constexpr Seconds16 kZero{ 0 }; +inline constexpr Seconds16 kZero{ 0 }; namespace Literals { diff --git a/src/transport/SecureSessionTable.h b/src/transport/SecureSessionTable.h index c84fc94ea3a5d8..aff58c4e5fe0b0 100644 --- a/src/transport/SecureSessionTable.h +++ b/src/transport/SecureSessionTable.h @@ -26,8 +26,8 @@ namespace chip { namespace Transport { -constexpr uint16_t kMaxSessionID = UINT16_MAX; -constexpr uint16_t kUnsecuredSessionId = 0; +inline constexpr uint16_t kMaxSessionID = UINT16_MAX; +inline constexpr uint16_t kUnsecuredSessionId = 0; /** * Handles a set of sessions. diff --git a/src/transport/SessionManager.h b/src/transport/SessionManager.h index e383c39d27a29c..5f2e6f7603cad0 100644 --- a/src/transport/SessionManager.h +++ b/src/transport/SessionManager.h @@ -528,7 +528,7 @@ namespace MessagePacketBuffer { /** * Maximum size of a message footer, in bytes. */ -constexpr uint16_t kMaxFooterSize = kMaxTagLen; +inline constexpr uint16_t kMaxFooterSize = kMaxTagLen; /** * Allocates a packet buffer with space for message headers and footers. diff --git a/src/transport/TraceMessage.h b/src/transport/TraceMessage.h index bf6cbaef99c861..d2be9478c53408 100644 --- a/src/transport/TraceMessage.h +++ b/src/transport/TraceMessage.h @@ -75,9 +75,9 @@ namespace chip { namespace trace { -constexpr const char * kTraceMessageEvent = "SecureMsg"; -constexpr const char * kTraceMessageSentDataFormat = "SecMsgSent"; -constexpr const char * kTraceMessageReceivedDataFormat = "SecMsgReceived"; +inline constexpr const char * kTraceMessageEvent = "SecureMsg"; +inline constexpr const char * kTraceMessageSentDataFormat = "SecMsgSent"; +inline constexpr const char * kTraceMessageReceivedDataFormat = "SecMsgReceived"; struct TraceSecureMessageSentData { From b2ce8c7c73379e0e1ea8ac5b33c0d75e75c28faa Mon Sep 17 00:00:00 2001 From: Karsten Sperling Date: Fri, 15 Sep 2023 17:57:02 +1200 Subject: [PATCH 2/2] Restyle --- .../commands/tests/TestCommandBridge.h | 2 +- .../tv-casting-common/include/CastingServer.h | 2 +- src/app/server/Server.h | 4 ++-- src/crypto/CHIPCryptoPAL.h | 4 ++-- src/include/platform/CommissionableDataProvider.h | 2 +- src/include/platform/DiagnosticDataProvider.h | 4 ++-- src/platform/ASR/NetworkCommissioningDriver.h | 2 +- src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h | 2 +- src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h | 6 +++--- src/platform/mbed/NetworkCommissioningDriver.h | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index 7d8b2c85c64fc2..abcc56dffbaf9d 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -111,7 +111,7 @@ class TestCommandBridge : public CHIPCommandBridge, CHIP_ERROR WaitForMs( const char * _Nullable identity, const chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type & value) { - dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t) (value.ms * NSEC_PER_MSEC)); + dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(value.ms * NSEC_PER_MSEC)); dispatch_after(delayTime, mCallbackQueue, ^(void) { NextTest(); }); diff --git a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h index bf85e98f0d83c2..f6078dd1a855f1 100644 --- a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h +++ b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h @@ -50,7 +50,7 @@ inline constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = ch class CastingServer : public AppDelegate { public: - CastingServer(CastingServer & other) = delete; + CastingServer(CastingServer & other) = delete; void operator=(const CastingServer &) = delete; static CastingServer * GetInstance(); diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 7c77c9122b0f33..2d9a78c58737b1 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -96,7 +96,7 @@ struct ServerInitParams ServerInitParams() = default; // Not copyable - ServerInitParams(const ServerInitParams &) = delete; + ServerInitParams(const ServerInitParams &) = delete; ServerInitParams & operator=(const ServerInitParams &) = delete; // Application delegate to handle some commissioning lifecycle events @@ -178,7 +178,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams CommonCaseDeviceServerInitParams() = default; // Not copyable - CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; + CommonCaseDeviceServerInitParams(const CommonCaseDeviceServerInitParams &) = delete; CommonCaseDeviceServerInitParams & operator=(const CommonCaseDeviceServerInitParams &) = delete; /** diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index 6f6bc6edf1984c..5b661f189f2964 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -580,8 +580,8 @@ class Aes128KeyHandle Aes128KeyHandle(const Aes128KeyHandle &) = delete; Aes128KeyHandle(Aes128KeyHandle &&) = delete; - void operator=(const Aes128KeyHandle &) = delete; - void operator=(Aes128KeyHandle &&) = delete; + void operator=(const Aes128KeyHandle &) = delete; + void operator=(Aes128KeyHandle &&) = delete; /** * @brief Get internal context cast to the desired key representation diff --git a/src/include/platform/CommissionableDataProvider.h b/src/include/platform/CommissionableDataProvider.h index d3f3b23726a670..95fa3faf5d99d4 100644 --- a/src/include/platform/CommissionableDataProvider.h +++ b/src/include/platform/CommissionableDataProvider.h @@ -36,7 +36,7 @@ class CommissionableDataProvider virtual ~CommissionableDataProvider() = default; // Not copyable - CommissionableDataProvider(const CommissionableDataProvider &) = delete; + CommissionableDataProvider(const CommissionableDataProvider &) = delete; CommissionableDataProvider & operator=(const CommissionableDataProvider &) = delete; /** diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index 02599fea9c96b6..12eacf0a6d2b60 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -186,8 +186,8 @@ class DiagnosticDataProvider WiFiDiagnosticsDelegate * mWiFiDiagnosticsDelegate = nullptr; // No copy, move or assignment. - DiagnosticDataProvider(const DiagnosticDataProvider &) = delete; - DiagnosticDataProvider(const DiagnosticDataProvider &&) = delete; + DiagnosticDataProvider(const DiagnosticDataProvider &) = delete; + DiagnosticDataProvider(const DiagnosticDataProvider &&) = delete; DiagnosticDataProvider & operator=(const DiagnosticDataProvider &) = delete; }; diff --git a/src/platform/ASR/NetworkCommissioningDriver.h b/src/platform/ASR/NetworkCommissioningDriver.h index 5a028042d88d1a..7fc9e0c10b49ad 100644 --- a/src/platform/ASR/NetworkCommissioningDriver.h +++ b/src/platform/ASR/NetworkCommissioningDriver.h @@ -56,7 +56,7 @@ class ASRScanResponseIterator : public Iterator // copy the available information into WiFiScanResponse struct, which will be copied to the result to be sent item.security.SetRaw(mpScanResults->ap_list[mIternum].security); item.ssidLen = static_cast(strnlen(reinterpret_cast(mpScanResults->ap_list[mIternum].ssid), - chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); + chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); item.channel = mpScanResults->ap_list[mIternum].channel; item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; item.rssi = mpScanResults->ap_list[mIternum].ap_power; diff --git a/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h b/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h index a0df82a0ed36d4..3bd1a02f99a91f 100644 --- a/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h +++ b/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h @@ -51,7 +51,7 @@ class P6ScanResponseIterator : public Iterator item.wiFiBand = (mpScanResults[mIternum].band == CY_WCM_WIFI_BAND_2_4GHZ) ? chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4 : chip::DeviceLayer::NetworkCommissioning::WiFiBand::k5g; - item.rssi = mpScanResults[mIternum].signal_strength; + item.rssi = mpScanResults[mIternum].signal_strength; memcpy(item.ssid, mpScanResults[mIternum].SSID, item.ssidLen); memcpy(item.bssid, mpScanResults[mIternum].BSSID, 6); diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h index 3e4b56b01df84a..a86a661d25520a 100644 --- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h +++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h @@ -42,9 +42,9 @@ class BLScanResponseIterator : public Iterator } item.security.SetRaw(mpScanResults[mIternum].auth); - item.ssidLen = mpScanResults[mIternum].ssid_len < chip::DeviceLayer::Internal::kMaxWiFiSSIDLength - ? mpScanResults[mIternum].ssid_len - : chip::DeviceLayer::Internal::kMaxWiFiSSIDLength; + item.ssidLen = mpScanResults[mIternum].ssid_len < chip::DeviceLayer::Internal::kMaxWiFiSSIDLength + ? mpScanResults[mIternum].ssid_len + : chip::DeviceLayer::Internal::kMaxWiFiSSIDLength; item.channel = mpScanResults[mIternum].channel; item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; item.rssi = mpScanResults[mIternum].rssi; diff --git a/src/platform/mbed/NetworkCommissioningDriver.h b/src/platform/mbed/NetworkCommissioningDriver.h index 33496f0ed9af47..9e61d4640ac4f5 100644 --- a/src/platform/mbed/NetworkCommissioningDriver.h +++ b/src/platform/mbed/NetworkCommissioningDriver.h @@ -49,7 +49,7 @@ class MbedScanResponseIterator : public Iterator item.security.SetRaw(mScanResults[mIternum].get_security()); static_assert(chip::DeviceLayer::Internal::kMaxWiFiSSIDLength <= UINT8_MAX, "Our length won't fit in ssidLen"); item.ssidLen = static_cast(strnlen(reinterpret_cast(mScanResults[mIternum].get_ssid()), - chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); + chip::DeviceLayer::Internal::kMaxWiFiSSIDLength)); item.channel = mScanResults[mIternum].get_channel(); item.wiFiBand = chip::DeviceLayer::NetworkCommissioning::WiFiBand::k2g4; item.rssi = mScanResults[mIternum].get_rssi();