Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 2bf2e95

Browse files
authored
Merge pull request #304 from robszewczyk/bug/missing-802154-MAC-on-Nordic
Populate 802.15.4 MAC address on Nordic
2 parents fdbbcf3 + 2a3eeea commit 2bf2e95

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

src/adaptations/device-layer/include/Weave/DeviceLayer/OpenThread/GenericThreadStackManagerImpl_OpenThread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class GenericThreadStackManagerImpl_OpenThread
7777
WEAVE_ERROR _GetAndLogThreadStatsCounters(void);
7878
WEAVE_ERROR _GetAndLogThreadTopologyMinimal(void);
7979
WEAVE_ERROR _GetAndLogThreadTopologyFull(void);
80+
WEAVE_ERROR _GetPrimary802154MACAddress(uint8_t *buf);
8081

8182
// ===== Members available to the implementation subclass.
8283

src/adaptations/device-layer/include/Weave/DeviceLayer/OpenThread/GenericThreadStackManagerImpl_OpenThread.ipp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,14 @@ exit:
806806
return err;
807807
}
808808

809+
template<class ImplClass>
810+
WEAVE_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_GetPrimary802154MACAddress(uint8_t *buf)
811+
{
812+
const otExtAddress *extendedAddr = otLinkGetExtendedAddress(mOTInst);
813+
memcpy(buf, extendedAddr, sizeof(otExtAddress));
814+
return WEAVE_NO_ERROR;
815+
};
816+
809817
template<class ImplClass>
810818
WEAVE_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstance * otInst)
811819
{
@@ -871,7 +879,6 @@ bool GenericThreadStackManagerImpl_OpenThread<ImplClass>::IsThreadAttachedNoLock
871879
return (curRole != OT_DEVICE_ROLE_DISABLED && curRole != OT_DEVICE_ROLE_DETACHED);
872880
}
873881

874-
875882
} // namespace Internal
876883
} // namespace DeviceLayer
877884
} // namespace Weave

src/adaptations/device-layer/include/Weave/DeviceLayer/ThreadStackManager.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ThreadStackManager
6666
WEAVE_ERROR GetAndLogThreadStatsCounters(void);
6767
WEAVE_ERROR GetAndLogThreadTopologyMinimal(void);
6868
WEAVE_ERROR GetAndLogThreadTopologyFull(void);
69+
WEAVE_ERROR GetPrimary802154MACAddress(uint8_t *buf);
6970

7071
private:
7172

@@ -75,6 +76,7 @@ class ThreadStackManager
7576
friend class ConfigurationManagerImpl;
7677
friend class Internal::DeviceControlServer;
7778
template<class> friend class Internal::GenericPlatformManagerImpl;
79+
template<class> friend class Internal::GenericConfigurationManagerImpl;
7880
template<class> friend class Internal::GenericPlatformManagerImpl_FreeRTOS;
7981
template<class> friend class Internal::GenericConnectivityManagerImpl_Thread;
8082
template<class> friend class Internal::GenericThreadStackManagerImpl_OpenThread;
@@ -236,6 +238,11 @@ inline WEAVE_ERROR ThreadStackManager::GetAndLogThreadTopologyFull(void)
236238
return static_cast<ImplClass*>(this)->_GetAndLogThreadTopologyFull();
237239
}
238240

241+
inline WEAVE_ERROR ThreadStackManager::GetPrimary802154MACAddress(uint8_t * buf)
242+
{
243+
return static_cast<ImplClass*>(this)->_GetPrimary802154MACAddress(buf);
244+
}
245+
239246
} // namespace DeviceLayer
240247
} // namespace Weave
241248
} // namespace nl

src/adaptations/device-layer/include/Weave/DeviceLayer/internal/GenericConfigurationManagerImpl.ipp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include <Weave/DeviceLayer/internal/GenericConfigurationManagerImpl.h>
3030
#include <BleLayer/WeaveBleServiceData.h>
3131

32+
#if WEAVE_DEVICE_CONFIG_ENABLE_THREAD
33+
#include <Weave/DeviceLayer/ThreadStackManager.h>
34+
#endif
3235

3336
namespace nl {
3437
namespace Weave {
@@ -195,7 +198,11 @@ WEAVE_ERROR GenericConfigurationManagerImpl<ImplClass>::_StorePrimaryWiFiMACAddr
195198
template<class ImplClass>
196199
WEAVE_ERROR GenericConfigurationManagerImpl<ImplClass>::_GetPrimary802154MACAddress(uint8_t * buf)
197200
{
201+
#if WEAVE_DEVICE_CONFIG_ENABLE_THREAD
202+
return ThreadStackManager().GetPrimary802154MACAddress(buf);
203+
#else
198204
return WEAVE_DEVICE_ERROR_CONFIG_NOT_FOUND;
205+
#endif // WEAVE_DEVICE_CONFIG_ENABLE_THREAD
199206
}
200207

201208
template<class ImplClass>

0 commit comments

Comments
 (0)