Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tizen] Add missing thread network connected callback #23454

Merged
merged 1 commit into from
Jul 20, 2023
Merged
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
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]() {
arkq marked this conversation as resolved.
Show resolved Hide resolved
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