mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 09:27:47 +00:00
[code-style] make diag related file pretty
This commit is contained in:
committed by
Jonathan Hui
parent
c369d729b4
commit
00299f2e91
@@ -48,8 +48,8 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut
|
||||
{
|
||||
// Add more plarform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -64,22 +64,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <stdio.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -46,8 +45,8 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
}
|
||||
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -62,22 +61,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ static bool sDiagMode = false;
|
||||
|
||||
void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
|
||||
// Add more platform specific diagnostics features here.
|
||||
if (argc > 1)
|
||||
@@ -67,22 +67,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut
|
||||
{
|
||||
// Add more plarform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -69,22 +69,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
#ifndef PLATFORM_EFR32_H_
|
||||
#define PLATFORM_EFR32_H_
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread-core-config.h>
|
||||
#include "core_cm4.h"
|
||||
#include "em_device.h"
|
||||
#include "em_system.h"
|
||||
#include "core_cm4.h"
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/config.h>
|
||||
|
||||
// Global OpenThread instance structure
|
||||
extern otInstance *sInstance;
|
||||
@@ -96,4 +96,4 @@ void efr32MiscInit(void);
|
||||
*/
|
||||
void efr32RandomInit(void);
|
||||
|
||||
#endif // PLATFORM_EFR32_H_
|
||||
#endif // PLATFORM_EFR32_H_
|
||||
|
||||
@@ -46,8 +46,8 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut
|
||||
{
|
||||
// Add more plarform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -62,22 +62,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "fsl_device_registers.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "openthread/openthread.h"
|
||||
|
||||
#include "openthread/platform/alarm-milli.h"
|
||||
@@ -51,8 +51,8 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut
|
||||
{
|
||||
// Add more plarform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -67,22 +67,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut
|
||||
{
|
||||
// Add more plarform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -64,22 +64,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
// Spi-slave stubs
|
||||
|
||||
otError otPlatSpiSlaveEnable(otPlatSpiSlaveTransactionCompleteCallback aCompleteCallback,
|
||||
otPlatSpiSlaveTransactionProcessCallback aProcessCallback, void *aContext)
|
||||
otPlatSpiSlaveTransactionProcessCallback aProcessCallback,
|
||||
void * aContext)
|
||||
{
|
||||
(void)aCompleteCallback;
|
||||
(void)aProcessCallback;
|
||||
@@ -53,8 +54,11 @@ void otPlatSpiSlaveDisable(void)
|
||||
{
|
||||
}
|
||||
|
||||
otError otPlatSpiSlavePrepareTransaction(uint8_t *aOutputBuf, uint16_t aOutputBufLen, uint8_t *aInputBuf,
|
||||
uint16_t aInputBufLen, bool aRequestTransactionFlag)
|
||||
otError otPlatSpiSlavePrepareTransaction(uint8_t *aOutputBuf,
|
||||
uint16_t aOutputBufLen,
|
||||
uint8_t *aInputBuf,
|
||||
uint16_t aInputBufLen,
|
||||
bool aRequestTransactionFlag)
|
||||
{
|
||||
(void)aOutputBuf;
|
||||
(void)aOutputBufLen;
|
||||
|
||||
@@ -44,8 +44,8 @@ static bool sDiagMode = false;
|
||||
|
||||
void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen)
|
||||
{
|
||||
(void) argc;
|
||||
(void) aInstance;
|
||||
(void)argc;
|
||||
(void)aInstance;
|
||||
|
||||
// Add more plarform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
@@ -63,22 +63,22 @@ bool otPlatDiagModeGet()
|
||||
|
||||
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||
{
|
||||
(void) aChannel;
|
||||
(void)aChannel;
|
||||
}
|
||||
|
||||
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||
{
|
||||
(void) aTxPower;
|
||||
(void)aTxPower;
|
||||
}
|
||||
|
||||
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void) aFrame;
|
||||
(void) aError;
|
||||
(void)aInstance;
|
||||
(void)aFrame;
|
||||
(void)aError;
|
||||
}
|
||||
|
||||
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
(void) aInstance;
|
||||
(void)aInstance;
|
||||
}
|
||||
|
||||
+11
-15
@@ -61,7 +61,7 @@ extern "C" void otPlatAlarmMicroFired(otInstance *)
|
||||
{
|
||||
}
|
||||
|
||||
extern "C" void otPlatRadioTxDone(otInstance *, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
|
||||
extern "C" void otPlatRadioTxDone(otInstance *, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
|
||||
{
|
||||
(void)aFrame;
|
||||
(void)aAckFrame;
|
||||
@@ -76,7 +76,7 @@ extern "C" void otPlatRadioReceiveDone(otInstance *, otRadioFrame *aFrame, otErr
|
||||
|
||||
extern "C" void otPlatRadioTxStarted(otInstance *, otRadioFrame *aFrame)
|
||||
{
|
||||
(void) aFrame;
|
||||
(void)aFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ const char *MakePrintable(const char *aString)
|
||||
// two for encoding the current char (in case it needs a backslash)
|
||||
// and two for the ending `"` and null char.
|
||||
|
||||
char c = *aString++;
|
||||
char c = *aString++;
|
||||
bool addBackslash = true;
|
||||
|
||||
switch (c)
|
||||
@@ -140,7 +140,7 @@ const char *MakePrintable(const char *aString)
|
||||
}
|
||||
|
||||
*ptr++ = '\"';
|
||||
*ptr = 0;
|
||||
*ptr = 0;
|
||||
|
||||
return printableString;
|
||||
}
|
||||
@@ -153,8 +153,7 @@ void TestDiag(void)
|
||||
const char *mExpectedOutput;
|
||||
};
|
||||
|
||||
static const TestCommand tests[] =
|
||||
{
|
||||
static const TestCommand tests[] = {
|
||||
|
||||
{
|
||||
"diag\n",
|
||||
@@ -205,16 +204,14 @@ void TestDiag(void)
|
||||
"sending 0x14 packet(s), length 0x64\r\nstatus 0x00\r\n",
|
||||
},
|
||||
{
|
||||
" diag \t send \t 20\t100", // Check parsing of extra space chars between args
|
||||
" diag \t send \t 20\t100", // Check parsing of extra space chars between args
|
||||
"sending 0x14 packet(s), length 0x64\r\nstatus 0x00\r\n",
|
||||
},
|
||||
{
|
||||
"diag repeat 100 100\n",
|
||||
"sending packets of length 0x64 at the delay of 0x64 ms\r\nstatus 0x00\r\n"
|
||||
},
|
||||
{"diag repeat 100 100\n", "sending packets of length 0x64 at the delay of 0x64 ms\r\nstatus 0x00\r\n"},
|
||||
{
|
||||
"diag stop\n",
|
||||
"received packets: 0\r\nsent packets: 0\r\nfirst received packet: rssi=0, lqi=0\r\n\nstop diagnostics mode\r\nstatus 0x00\r\n",
|
||||
"received packets: 0\r\nsent packets: 0\r\nfirst received packet: rssi=0, lqi=0\r\n\nstop diagnostics "
|
||||
"mode\r\nstatus 0x00\r\n",
|
||||
},
|
||||
{
|
||||
"diag",
|
||||
@@ -227,11 +224,10 @@ void TestDiag(void)
|
||||
{
|
||||
NULL,
|
||||
NULL,
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
// initialize platform layer
|
||||
int argc = 2;
|
||||
int argc = 2;
|
||||
char *argv[8] = {(char *)"test_diag", (char *)"1"};
|
||||
PlatformInit(argc, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user