mirror of
https://github.com/espressif/openthread.git
synced 2026-08-24 03:09:52 +00:00
Diag API cleanup.
This commit is contained in:
@@ -34,10 +34,10 @@
|
||||
|
||||
#include "openthread/openthread.h"
|
||||
#include "openthread/cli.h"
|
||||
#include "openthread/diag.h"
|
||||
#include "openthread/platform/platform.h"
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread-diag.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef OPENTHREAD_MULTIPLE_INSTANCE
|
||||
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
|
||||
otCliUartInit(sInstance);
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
diagInit(sInstance);
|
||||
otDiagInit(sInstance);
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
#endif
|
||||
|
||||
#include "openthread/openthread.h"
|
||||
#include "openthread/diag.h"
|
||||
#include "openthread/ncp.h"
|
||||
#include "openthread/platform/platform.h"
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread-diag.h>
|
||||
#include <common/debug.hpp>
|
||||
|
||||
#ifdef OPENTHREAD_MULTIPLE_INSTANCE
|
||||
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
|
||||
otNcpInit(sInstance);
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
diagInit(sInstance);
|
||||
otDiagInit(sInstance);
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
|
||||
@@ -47,7 +47,6 @@ PRETTY_SUBDIRS = \
|
||||
$(NULL)
|
||||
|
||||
include_HEADERS = \
|
||||
openthread-diag.h \
|
||||
openthread-icmp6.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ openthread_headers = \
|
||||
commissioner.h \
|
||||
crypto.h \
|
||||
dataset.h \
|
||||
diag.h \
|
||||
dhcp6_client.h \
|
||||
dhcp6_server.h \
|
||||
instance.h \
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void diagInit(otInstance *aInstance);
|
||||
void otDiagInit(otInstance *aInstance);
|
||||
|
||||
char *diagProcessCmd(int argc, char *argv[]);
|
||||
char *otDiagProcessCmd(int argc, char *argv[]);
|
||||
|
||||
char *diagProcessCmdLine(char *string);
|
||||
char *otDiagProcessCmdLine(char *string);
|
||||
|
||||
bool isDiagEnabled(void);
|
||||
bool otDiagIsEnabled(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
+3
-3
@@ -51,7 +51,7 @@
|
||||
|
||||
#ifndef OTDLL
|
||||
#include <openthread-instance.h>
|
||||
#include <openthread-diag.h>
|
||||
#include "openthread/diag.h"
|
||||
#include <openthread-icmp6.h>
|
||||
|
||||
#include <common/new.hpp>
|
||||
@@ -2719,7 +2719,7 @@ exit:
|
||||
void Interpreter::ProcessDiag(int argc, char *argv[])
|
||||
{
|
||||
// all diagnostics related features are processed within diagnostics module
|
||||
sServer->OutputFormat("%s\r\n", diagProcessCmd(argc, argv));
|
||||
sServer->OutputFormat("%s\r\n", otDiagProcessCmd(argc, argv));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2754,7 +2754,7 @@ void Interpreter::ProcessLine(char *aBuf, uint16_t aBufLength, Server &aServer)
|
||||
cmd = aBuf;
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
VerifyOrExit((!isDiagEnabled() || (strcmp(cmd, "diag") == 0)),
|
||||
VerifyOrExit((!otDiagIsEnabled() || (strcmp(cmd, "diag") == 0)),
|
||||
sServer->OutputFormat("under diagnostics mode, execute 'diag stop' before running any other commands.\r\n"));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <openthread-diag.h>
|
||||
#include "openthread/diag.h"
|
||||
#include <diag_process.hpp>
|
||||
|
||||
using namespace Thread::Diagnostics;
|
||||
@@ -44,17 +44,17 @@ using namespace Thread::Diagnostics;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void diagInit(otInstance *aInstance)
|
||||
void otDiagInit(otInstance *aInstance)
|
||||
{
|
||||
Diag::Init(aInstance);
|
||||
}
|
||||
|
||||
char *diagProcessCmd(int argc, char *argv[])
|
||||
char *otDiagProcessCmd(int argc, char *argv[])
|
||||
{
|
||||
return Diag::ProcessCmd(argc, argv);
|
||||
}
|
||||
|
||||
char *diagProcessCmdLine(char *string)
|
||||
char *otDiagProcessCmdLine(char *string)
|
||||
{
|
||||
char *argv[8];
|
||||
int argc = 0;
|
||||
@@ -79,7 +79,7 @@ char *diagProcessCmdLine(char *string)
|
||||
return Diag::ProcessCmd(argc, argv);
|
||||
}
|
||||
|
||||
bool isDiagEnabled()
|
||||
bool otDiagIsEnabled()
|
||||
{
|
||||
return Diag::isEnabled();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "openthread/openthread.h"
|
||||
#include "openthread/ncp.h"
|
||||
#include "openthread/diag.h"
|
||||
|
||||
#if OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
#include "openthread/jam_detection.h"
|
||||
@@ -52,7 +53,6 @@
|
||||
#include <common/debug.hpp>
|
||||
#include <ncp/ncp_base.hpp>
|
||||
#include <net/ip6.hpp>
|
||||
#include <openthread-diag.h>
|
||||
#include <openthread-icmp6.h>
|
||||
#include <openthread-instance.h>
|
||||
#include <stdarg.h>
|
||||
@@ -5455,7 +5455,7 @@ ThreadError NcpBase::SetPropertyHandler_NEST_STREAM_MFG(uint8_t header, spinel_p
|
||||
if ((parsedLength > 0) && (string != NULL))
|
||||
{
|
||||
// all diagnostics related features are processed within diagnostics module
|
||||
output = diagProcessCmdLine(string);
|
||||
output = otDiagProcessCmdLine(string);
|
||||
|
||||
errorCode = SendPropertyUpdate(
|
||||
header,
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
#include "test_util.h"
|
||||
#include <string.h>
|
||||
#include <openthread-diag.h>
|
||||
|
||||
#include "openthread/diag.h"
|
||||
#include "openthread/platform/platform.h"
|
||||
#include "openthread/platform/radio.h"
|
||||
|
||||
@@ -149,10 +149,10 @@ void TestDiag()
|
||||
PlatformInit(argc, argv);
|
||||
|
||||
// initialize diagnostics module
|
||||
diagInit(NULL);
|
||||
otDiagInit(NULL);
|
||||
|
||||
// test diagnostics commands
|
||||
VerifyOrQuit(!isDiagEnabled(), "diagnostics mode shoud be disabled as default\n");
|
||||
VerifyOrQuit(!otDiagIsEnabled(), "diagnostics mode shoud be disabled as default\n");
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
||||
{
|
||||
@@ -161,7 +161,7 @@ void TestDiag()
|
||||
|
||||
memcpy(string, tests[i].command, strlen(tests[i].command) + 1);
|
||||
|
||||
output = diagProcessCmdLine(string);
|
||||
output = otDiagProcessCmdLine(string);
|
||||
VerifyOrQuit(memcmp(output, tests[i].output, strlen(tests[i].output)) == 0,
|
||||
"Test Diagnostics module failed\r\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user