mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 15:17:47 +00:00
Adding a helper function to determine if node is commissioned or not. (#1190)
This commit is contained in:
committed by
Jonathan Hui
parent
0d6866e013
commit
5a6f10d1e7
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user