Diag API cleanup.

This commit is contained in:
Jonathan Hui
2017-03-02 10:24:55 -08:00
parent e919576978
commit a6dac9270c
9 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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)
-1
View File
@@ -47,7 +47,6 @@ PRETTY_SUBDIRS = \
$(NULL)
include_HEADERS = \
openthread-diag.h \
openthread-icmp6.h \
$(NULL)
+1
View File
@@ -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
View File
@@ -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
+5 -5
View File
@@ -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();
}
+2 -2
View File
@@ -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,
+4 -4
View File
@@ -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");
}