mirror of
https://github.com/espressif/openthread.git
synced 2026-07-11 06:40:19 +00:00
[network-diagnostic] improve usability of Network Diagnostic API (#4619)
This commit improves usability of Network Diagnostic API by: - Define native structures to represent various Network Diagnostic TLV values. - Add facility function otThreadGetNextDiagnosticTlv to parse plain otMessage into structured data. - Dump parsed DIAG_GET.ans/.rsp message in readable format for networkdiagnostic CLI command.
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
#include "common/debug.hpp"
|
||||
#include "common/instance.hpp"
|
||||
#include "common/locator-getters.hpp"
|
||||
#include "common/logging.hpp"
|
||||
#include "common/settings.hpp"
|
||||
|
||||
using namespace ot;
|
||||
@@ -363,39 +362,6 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE
|
||||
void otThreadSetReceiveDiagnosticGetCallback(otInstance * aInstance,
|
||||
otReceiveDiagnosticGetCallback aCallback,
|
||||
void * aCallbackContext)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Get<NetworkDiagnostic::NetworkDiagnostic>().SetReceiveDiagnosticGetCallback(aCallback, aCallbackContext);
|
||||
}
|
||||
|
||||
otError otThreadSendDiagnosticGet(otInstance * aInstance,
|
||||
const otIp6Address *aDestination,
|
||||
const uint8_t aTlvTypes[],
|
||||
uint8_t aCount)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<NetworkDiagnostic::NetworkDiagnostic>().SendDiagnosticGet(
|
||||
*static_cast<const Ip6::Address *>(aDestination), aTlvTypes, aCount);
|
||||
}
|
||||
|
||||
otError otThreadSendDiagnosticReset(otInstance * aInstance,
|
||||
const otIp6Address *aDestination,
|
||||
const uint8_t aTlvTypes[],
|
||||
uint8_t aCount)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<NetworkDiagnostic::NetworkDiagnostic>().SendDiagnosticReset(
|
||||
*static_cast<const Ip6::Address *>(aDestination), aTlvTypes, aCount);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE
|
||||
|
||||
otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
Reference in New Issue
Block a user