Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions samples/connectedhomeip/lock/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,31 @@ int main()
return ret;
}

ret = ThreadStackMgr().InitThreadStack();
ret = PlatformMgr().StartEventLoopTask();
if (ret != CHIP_NO_ERROR) {
LOG_ERR("ThreadStackMgr().InitThreadStack() failed");
LOG_ERR("PlatformMgr().StartEventLoopTask() failed");
return ret;
}

ret = PlatformMgr().StartEventLoopTask();
ret = ThreadStackMgr().InitThreadStack();
if (ret != CHIP_NO_ERROR) {
LOG_ERR("PlatformMgr().StartEventLoopTask() failed");
LOG_ERR("ThreadStackMgr().InitThreadStack() failed");
return ret;
}

/* Until all CHIP data needed to perform full communication are not saved in the persistent storage,
* Thread configuration should not be saved either.
* TODO: Remove it after having full support for persistent storage in CHIP */
if(otDatasetIsCommissioned(openthread_get_default_instance())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(otDatasetIsCommissioned(openthread_get_default_instance())) {
if (otDatasetIsCommissioned(openthread_get_default_instance())) {

ConnectivityMgr().ErasePersistentInfo();
}

ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
if (ret != CHIP_NO_ERROR)
{
LOG_ERR("ConnectivityMgr().SetThreadDeviceType() failed");
return ret;
}

return GetAppTask().StartApp();
}