mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 00:27:47 +00:00
[network-name] consolidate default network name definition (#9036)
This commit is contained in:
@@ -83,7 +83,7 @@ Error Dataset::Info::GenerateRandom(Instance &aInstance)
|
||||
SuccessOrExit(error = Random::Crypto::FillBuffer(mExtendedPanId.m8, sizeof(mExtendedPanId.m8)));
|
||||
SuccessOrExit(error = AsCoreType(&mMeshLocalPrefix).GenerateRandomUla());
|
||||
|
||||
snprintf(mNetworkName.m8, sizeof(mNetworkName), "OpenThread-%04x", mPanId);
|
||||
snprintf(mNetworkName.m8, sizeof(mNetworkName), "%s-%04x", NetworkName::kNetworkNameInit, mPanId);
|
||||
|
||||
mComponents.mIsActiveTimestampPresent = true;
|
||||
mComponents.mIsNetworkKeyPresent = true;
|
||||
|
||||
@@ -40,12 +40,6 @@
|
||||
namespace ot {
|
||||
namespace MeshCoP {
|
||||
|
||||
const char NetworkNameManager::sNetworkNameInit[] = "OpenThread";
|
||||
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
const char NetworkNameManager::sDomainNameInit[] = "DefaultDomain";
|
||||
#endif
|
||||
|
||||
uint8_t NameData::CopyTo(char *aBuffer, uint8_t aMaxSize) const
|
||||
{
|
||||
MutableData<kWithUint8Length> destData;
|
||||
@@ -114,10 +108,10 @@ bool NetworkName::operator==(const NetworkName &aOther) const { return GetAsData
|
||||
NetworkNameManager::NetworkNameManager(Instance &aInstance)
|
||||
: InstanceLocator(aInstance)
|
||||
{
|
||||
IgnoreError(SetNetworkName(sNetworkNameInit));
|
||||
IgnoreError(SetNetworkName(NetworkName::kNetworkNameInit));
|
||||
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
IgnoreError(SetDomainName(sDomainNameInit));
|
||||
IgnoreError(SetDomainName(NetworkName::kDomainNameInit));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,9 @@ public:
|
||||
class NetworkName : public otNetworkName, public Unequatable<NetworkName>
|
||||
{
|
||||
public:
|
||||
static constexpr const char *kNetworkNameInit = "OpenThread";
|
||||
static constexpr const char *kDomainNameInit = "DefaultDomain";
|
||||
|
||||
/**
|
||||
* This constant specified the maximum number of chars in Network Name (excludes null char).
|
||||
*
|
||||
@@ -262,9 +265,6 @@ public:
|
||||
private:
|
||||
Error SignalNetworkNameChange(Error aError);
|
||||
|
||||
static const char sNetworkNameInit[];
|
||||
static const char sDomainNameInit[];
|
||||
|
||||
NetworkName mNetworkName;
|
||||
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
|
||||
Reference in New Issue
Block a user