From 2eab47402529cac738f5d4e98c875893a0808dd6 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Mon, 5 Aug 2019 08:52:17 -0700 Subject: [PATCH] [ncp] use OT public link API to get factory-assigned EUI64 (#4047) This commit changes the get handler for `SPINEL_PROP_HWADDR` to use the public OT link API `otLinkGetFactoryAssignedIeeeEui64` instead of the platform API. It also adds implementation of this API under `OPENTREAD_RADIO` mode (for RCP build). --- src/core/api/link_raw_api.cpp | 5 +++++ src/ncp/ncp_base.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/api/link_raw_api.cpp b/src/core/api/link_raw_api.cpp index 0b1f2dec7..0528e4c7c 100644 --- a/src/core/api/link_raw_api.cpp +++ b/src/core/api/link_raw_api.cpp @@ -260,6 +260,11 @@ uint16_t otLinkGetShortAddress(otInstance *aInstance) return static_cast(aInstance)->Get().GetShortAddress(); } +void otLinkGetFactoryAssignedIeeeEui64(otInstance *aInstance, otExtAddress *aEui64) +{ + otPlatRadioGetIeeeEui64(aInstance, aEui64->m8); +} + #endif // OPENTHREAD_RADIO #endif // OPENTHREAD_RADIO || OPENTHREAD_CONFIG_LINK_RAW_ENABLE diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 7d1c6f1e0..9803ba95a 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -1947,7 +1947,8 @@ template <> otError NcpBase::HandlePropertySet(void) template <> otError NcpBase::HandlePropertyGet(void) { otExtAddress hwAddr; - otPlatRadioGetIeeeEui64(mInstance, hwAddr.m8); + + otLinkGetFactoryAssignedIeeeEui64(mInstance, &hwAddr); return mEncoder.WriteEui64(hwAddr); }