diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 94798f22a..f69807110 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -277,14 +277,10 @@ protected: static Interpreter *sInterpreter; private: - enum - { - kIndentSize = 4, - kMaxArgs = 32, - kMaxAutoAddresses = 8, - kMaxLineLength = OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH, - kMaxUserCommandEntries = OPENTHREAD_CONFIG_CLI_MAX_USER_CMD_ENTRIES, - }; + static constexpr uint8_t kIndentSize = 4; + static constexpr uint16_t kMaxArgs = 32; + static constexpr uint16_t kMaxLineLength = OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH; + static constexpr uint16_t kMaxUserCommandEntries = OPENTHREAD_CONFIG_CLI_MAX_USER_CMD_ENTRIES; static constexpr uint32_t kNetworkDiagnosticTimeoutMsecs = 5000; static constexpr uint32_t kLocateTimeoutMsecs = 2500; diff --git a/src/cli/cli_coap.hpp b/src/cli/cli_coap.hpp index f3357fcc5..2b4184a51 100644 --- a/src/cli/cli_coap.hpp +++ b/src/cli/cli_coap.hpp @@ -78,11 +78,8 @@ public: otError Process(Arg aArgs[]); private: - enum - { - kMaxUriLength = 32, - kMaxBufferSize = 16 - }; + static constexpr uint16_t kMaxUriLength = 32; + static constexpr uint16_t kMaxBufferSize = 16; using Command = CommandEntry; diff --git a/src/cli/cli_coap_secure.hpp b/src/cli/cli_coap_secure.hpp index 2165642bd..dd26ebf6c 100644 --- a/src/cli/cli_coap_secure.hpp +++ b/src/cli/cli_coap_secure.hpp @@ -84,13 +84,10 @@ public: otError Process(Arg aArgs[]); private: - enum - { - kMaxUriLength = 32, - kMaxBufferSize = 16, - kPskMaxLength = 32, - kPskIdMaxLength = 32 - }; + static constexpr uint16_t kMaxUriLength = 32; + static constexpr uint16_t kMaxBufferSize = 16; + static constexpr uint8_t kPskMaxLength = 32; + static constexpr uint8_t kPskIdMaxLength = 32; using Command = CommandEntry; diff --git a/src/cli/cli_commissioner.hpp b/src/cli/cli_commissioner.hpp index 8969bd762..162c6da5b 100644 --- a/src/cli/cli_commissioner.hpp +++ b/src/cli/cli_commissioner.hpp @@ -81,10 +81,7 @@ public: otError Process(Arg aArgs[]); private: - enum - { - kDefaultJoinerTimeout = 120, ///< Default timeout for Joiners, in seconds. - }; + static constexpr uint32_t kDefaultJoinerTimeout = 120; ///< Default timeout for Joiners, in seconds. using Command = CommandEntry; diff --git a/src/cli/cli_srp_client.hpp b/src/cli/cli_srp_client.hpp index 5d96a1366..93e7fe35f 100644 --- a/src/cli/cli_srp_client.hpp +++ b/src/cli/cli_srp_client.hpp @@ -80,11 +80,8 @@ public: otError Process(Arg aArgs[]); private: - enum : uint8_t - { - kMaxHostAddresses = OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_HOST_ADDRESSES, - kIndentSize = 4, - }; + static constexpr uint8_t kIndentSize = 4; + static constexpr uint8_t kMaxHostAddresses = OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_HOST_ADDRESSES; using Command = CommandEntry; diff --git a/src/cli/cli_udp.cpp b/src/cli/cli_udp.cpp index 0ec70ccea..1651debb2 100644 --- a/src/cli/cli_udp.cpp +++ b/src/cli/cli_udp.cpp @@ -399,10 +399,7 @@ exit: otError UdpExample::PrepareHexStringPayload(otMessage &aMessage, const char *aHexString) { - enum : uint8_t - { - kBufferSize = 50, - }; + static constexpr uint16_t kBufferSize = 50; otError error; uint8_t buf[kBufferSize];