diff --git a/include/openthread.h b/include/openthread.h index df715a6ff..2283d450e 100644 --- a/include/openthread.h +++ b/include/openthread.h @@ -930,6 +930,16 @@ OTAPI ThreadError OTCALL otGetActiveDataset(otInstance *aInstance, otOperational */ OTAPI ThreadError OTCALL otSetActiveDataset(otInstance *aInstance, const otOperationalDataset *aDataset); +/** + * This function indicates whether a valid network is present in the Active Operational Dataset or not. + * + * @param[in] aInstance A pointer to an OpenThread instance. + * + * @returns TRUE if a valid network is present in the Active Operational Dataset, FALSE otherwise. + * + */ +OTAPI bool OTCALL otIsNodeCommissioned(otInstance *aInstance); + /** * This function gets the Pending Operational Dataset. * diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp index fbe9266ab..c6f9690fc 100644 --- a/src/core/openthread.cpp +++ b/src/core/openthread.cpp @@ -1636,6 +1636,21 @@ exit: return error; } +bool otIsNodeCommissioned(otInstance *aInstance) +{ + otOperationalDataset dataset; + + otGetActiveDataset(aInstance, &dataset); + + if ((dataset.mIsMasterKeySet) && (dataset.mIsNetworkNameSet) && + (dataset.mIsExtendedPanIdSet) && (dataset.mIsPanIdSet) && (dataset.mIsChannelSet)) + { + return true; + } + + return false; +} + ThreadError otGetPendingDataset(otInstance *aInstance, otOperationalDataset *aDataset) { ThreadError error = kThreadError_None;