mirror of
https://github.com/espressif/openthread.git
synced 2026-07-19 18:44:06 +00:00
[domain] add domain name (#4815)
This commit is contained in:
+22
-1
@@ -141,6 +141,9 @@ const struct Command Interpreter::sCommands[] = {
|
||||
#if OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
|
||||
{"dns", &Interpreter::ProcessDns},
|
||||
#endif
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
{"domainname", &Interpreter::ProcessDomainName},
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
{"eidcache", &Interpreter::ProcessEidCache},
|
||||
#endif
|
||||
@@ -579,6 +582,24 @@ exit:
|
||||
}
|
||||
#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
|
||||
void Interpreter::ProcessDomainName(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
if (aArgsLength == 0)
|
||||
{
|
||||
const char *domainName = otThreadGetDomainName(mInstance);
|
||||
mServer->OutputFormat("%s\r\n", static_cast<const char *>(domainName));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = otThreadSetDomainName(mInstance, aArgs[0]));
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
|
||||
void Interpreter::ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[])
|
||||
@@ -2061,7 +2082,7 @@ void Interpreter::ProcessNetworkName(uint8_t aArgsLength, char *aArgs[])
|
||||
if (aArgsLength == 0)
|
||||
{
|
||||
const char *networkName = otThreadGetNetworkName(mInstance);
|
||||
mServer->OutputFormat("%.*s\r\n", OT_NETWORK_NAME_MAX_SIZE, static_cast<const char *>(networkName));
|
||||
mServer->OutputFormat("%s\r\n", static_cast<const char *>(networkName));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user