mirror of
https://github.com/espressif/openthread.git
synced 2026-08-09 20:27:47 +00:00
[dataset] check if dataset is present in otDatasetIsCommissioned (#4426)
otDatasetIsCommissioned API first reads out the Active Dataset from settings (i.e. non-volatile storage). However, the existing implementation does not check if the Active Dataset is actually present, as indicated by OT_ERROR_NOT_FOUND. This commit adds a necessary check and returns false if the Active Dataset is not present.
This commit is contained in:
@@ -44,12 +44,16 @@ using namespace ot;
|
||||
bool otDatasetIsCommissioned(otInstance *aInstance)
|
||||
{
|
||||
otOperationalDataset dataset;
|
||||
bool rval = false;
|
||||
|
||||
otDatasetGetActive(aInstance, &dataset);
|
||||
SuccessOrExit(otDatasetGetActive(aInstance, &dataset));
|
||||
|
||||
return ((dataset.mComponents.mIsMasterKeyPresent) && (dataset.mComponents.mIsNetworkNamePresent) &&
|
||||
rval = ((dataset.mComponents.mIsMasterKeyPresent) && (dataset.mComponents.mIsNetworkNamePresent) &&
|
||||
(dataset.mComponents.mIsExtendedPanIdPresent) && (dataset.mComponents.mIsPanIdPresent) &&
|
||||
(dataset.mComponents.mIsChannelPresent));
|
||||
|
||||
exit:
|
||||
return rval;
|
||||
}
|
||||
|
||||
otError otDatasetGetActive(otInstance *aInstance, otOperationalDataset *aDataset)
|
||||
|
||||
Reference in New Issue
Block a user