diff --git a/src/core/api/border_agent_api.cpp b/src/core/api/border_agent_api.cpp index d517ac4ec..908f1ab8a 100644 --- a/src/core/api/border_agent_api.cpp +++ b/src/core/api/border_agent_api.cpp @@ -112,7 +112,7 @@ void otBorderAgentSetEphemeralKeyCallback(otInstance *aIns const otBorderAgentCounters *otBorderAgentGetCounters(otInstance *aInstance) { - return AsCoreType(aInstance).Get().GetCounters(); + return &AsCoreType(aInstance).Get().GetCounters(); } void otBorderAgentDisconnect(otInstance *aInstance) { AsCoreType(aInstance).Get().Disconnect(); } diff --git a/src/core/meshcop/border_agent.hpp b/src/core/meshcop/border_agent.hpp index fc85eabff..f7b93ec14 100644 --- a/src/core/meshcop/border_agent.hpp +++ b/src/core/meshcop/border_agent.hpp @@ -83,7 +83,8 @@ public: */ static constexpr uint32_t kMaxEphemeralKeyTimeout = OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT; - typedef otBorderAgentId Id; ///< Border Agent ID. + typedef otBorderAgentId Id; ///< Border Agent ID. + typedef otBorderAgentCounters Counters; ///< Border Agent Counters. /** * Defines the Border Agent state. @@ -240,7 +241,7 @@ public: * * @returns The border agent counters. */ - const otBorderAgentCounters *GetCounters(void) { return &mCounters; } + const Counters &GetCounters(void) { return mCounters; } /** * Returns the UDP Proxy port to which the commissioner is currently @@ -335,7 +336,7 @@ private: EphemeralKeyTask mEphemeralKeyTask; Callback mEphemeralKeyCallback; #endif - otBorderAgentCounters mCounters; + Counters mCounters; }; DeclareTmfHandler(BorderAgent, kUriRelayRx);