Skip to content

Commit

Permalink
[Tizen] Add missing thread network connected callback (#184) (#23454)
Browse files Browse the repository at this point in the history
Co-authored-by: ravinder.01@samsung.com <ravinder.01@samsung.com>
  • Loading branch information
2 people authored and pull[bot] committed Sep 21, 2023
1 parent e032a00 commit 1079430
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/platform/Tizen/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <platform/PlatformManager.h>

#include <platform/Tizen/ThreadStackManagerImpl.h>
#include <platform/internal/CHIPDeviceLayerInternal.h>

namespace chip {
namespace DeviceLayer {
Expand Down Expand Up @@ -311,9 +312,26 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val)
if (val && !isEnabled)
{
threadErr = thread_network_attach(mThreadInstance);
DeviceLayer::SystemLayer().ScheduleLambda([&, threadErr]() {
if (this->mpConnectCallback != nullptr && threadErr != THREAD_ERROR_NONE)
{
this->mpConnectCallback->OnResult(NetworkCommissioning::Status::kUnknownError, CharSpan(), 0);
this->mpConnectCallback = nullptr;
}
});

VerifyOrExit(threadErr == THREAD_ERROR_NONE, ChipLogError(DeviceLayer, "FAIL: attach thread network"));

threadErr = thread_start(mThreadInstance);
DeviceLayer::SystemLayer().ScheduleLambda([&, threadErr]() {
if (this->mpConnectCallback != nullptr)
{
this->mpConnectCallback->OnResult(threadErr == THREAD_ERROR_NONE ? NetworkCommissioning::Status::kSuccess
: NetworkCommissioning::Status::kUnknownError,
CharSpan(), 0);
this->mpConnectCallback = nullptr;
}
});
VerifyOrExit(threadErr == THREAD_ERROR_NONE, ChipLogError(DeviceLayer, "FAIL: start thread network"));
}
else if (!val && isEnabled)
Expand Down

0 comments on commit 1079430

Please sign in to comment.