diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 31ce1a2e0..c20bb9a01 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -86,6 +86,7 @@ Mle::Mle(Instance &aInstance) , mDataRequestAttempts(0) , mDataRequestState(kDataRequestNone) , mAddressRegistrationMode(kAppendAllAddresses) + , mHasRestored(false) , mParentLinkMargin(0) , mParentIsSingleton(false) , mReceivedResponseFromParent(false) @@ -439,6 +440,9 @@ otError Mle::Restore(void) } #endif + // Sucessfully restored the network information from non-volatile settings after boot. + mHasRestored = true; + exit: return error; } diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index efa4bb17a..d3c137021 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -915,6 +915,16 @@ public: */ otError GetLocatorAddress(Ip6::Address &aAddress, uint16_t aLocator) const; + /** + * This method indicates whether or not the device has restored the network information from + * non-volatile settings after boot. + * + * @retval true Sucessfully restored the network information. + * @retval false No valid network information was found. + * + */ + bool HasRestored(void) const { return mHasRestored; } + protected: /** * States during attach (when searching for a parent). @@ -1734,6 +1744,7 @@ private: AddressRegistrationMode mAddressRegistrationMode; + bool mHasRestored; uint8_t mParentLinkMargin; bool mParentIsSingleton; bool mReceivedResponseFromParent;