[cli] use static constexpr for constants instead of of enum (#9789)

This commit is contained in:
Abtin Keshavarzian
2024-01-22 23:08:29 -08:00
committed by GitHub
parent 84e0e77ce2
commit 7761b81d23
6 changed files with 14 additions and 33 deletions
+4 -8
View File
@@ -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;
+2 -5
View File
@@ -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<Coap>;
+4 -7
View File
@@ -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<CoapSecure>;
+1 -4
View File
@@ -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<Commissioner>;
+2 -5
View File
@@ -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<SrpClient>;
+1 -4
View File
@@ -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];