Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
do not build GenericNetworkCommissioningThreadDriver for linux
  • Loading branch information
jmartinez-silabs committed Feb 2, 2022
1 parent 29ef531 commit b1c93d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/include/platform/ThreadStackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ ThreadStackManager::AttachToThreadNetwork(ByteSpan netInfo,

inline void ThreadStackManager::OnThreadAttachFinished(void)
{
return static_cast<ImplClass *>(this)->_OnThreadAttachFinished();
static_cast<ImplClass *>(this)->_OnThreadAttachFinished();
}

inline CHIP_ERROR ThreadStackManager::StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback)
Expand Down
3 changes: 2 additions & 1 deletion src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ if (chip_device_platform != "none") {
"PlatformEventSupport.cpp",
]

if (chip_enable_openthread) {
# Linux has his own NetworkCommissioningThreadDriver
if (chip_enable_openthread && chip_device_platform != "linux") {
sources += [
"OpenThread/GenericNetworkCommissioningThreadDriver.cpp",
"OpenThread/GenericNetworkCommissioningThreadDriver.h",
Expand Down
10 changes: 5 additions & 5 deletions src/platform/Linux/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val)
VerifyOrReturnError(mProxy, CHIP_ERROR_INCORRECT_STATE);
if (val)
{
openthread_io_openthread_border_router_call_attach(mProxy.get(), nullptr, _OnThreadAttachFinished, this);
openthread_io_openthread_border_router_call_attach(mProxy.get(), nullptr, _OnThreadBrAttachFinished, this);
}
else
{
Expand All @@ -311,7 +311,7 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val)
return CHIP_NO_ERROR;
}

void ThreadStackManagerImpl::_OnThreadAttachFinished(GObject * source_object, GAsyncResult * res, gpointer user_data)
void ThreadStackManagerImpl::_OnThreadBrAttachFinished(GObject * source_object, GAsyncResult * res, gpointer user_data)
{
ThreadStackManagerImpl * this_ = reinterpret_cast<ThreadStackManagerImpl *>(user_data);
std::unique_ptr<GVariant, GVariantDeleter> attachRes;
Expand Down Expand Up @@ -507,7 +507,7 @@ CHIP_ERROR ThreadStackManagerImpl::_JoinerStart()
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR ThreadStackManagerImpl::StartThreadScan(ThreadDriver::ScanCallback * callback)
CHIP_ERROR ThreadStackManagerImpl::_StartThreadScan(ThreadDriver::ScanCallback * callback)
{
// There is another ongoing scan request, reject the new one.
VerifyOrReturnError(mpScanCallback == nullptr, CHIP_ERROR_INCORRECT_STATE);
Expand Down Expand Up @@ -637,8 +637,8 @@ CHIP_ERROR ThreadStackManagerImpl::_WriteThreadNetworkDiagnosticAttributeToTlv(A
}

CHIP_ERROR
ThreadStackManagerImpl::AttachToThreadNetwork(ByteSpan netInfo,
NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback)
ThreadStackManagerImpl::_AttachToThreadNetwork(ByteSpan netInfo,
NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback)
{
// There is another ongoing connect request, reject the new one.
VerifyOrReturnError(mpConnectCallback == nullptr, CHIP_ERROR_INCORRECT_STATE);
Expand Down
14 changes: 11 additions & 3 deletions src/platform/Linux/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ class ThreadStackManagerImpl : public ThreadStackManager

bool _IsThreadAttached();

CHIP_ERROR AttachToThreadNetwork(ByteSpan netInfo, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback);
CHIP_ERROR _AttachToThreadNetwork(ByteSpan netInfo, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback);

CHIP_ERROR _SetThreadEnabled(bool val);
static void _OnThreadAttachFinished(GObject * source_object, GAsyncResult * res, gpointer user_data);

void _OnThreadAttachFinished(void);

static void _OnThreadBrAttachFinished(GObject * source_object, GAsyncResult * res, gpointer user_data);

ConnectivityManager::ThreadDeviceType _GetThreadDeviceType();

Expand Down Expand Up @@ -100,7 +103,7 @@ class ThreadStackManagerImpl : public ThreadStackManager

CHIP_ERROR _WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, app::AttributeValueEncoder & encoder);

CHIP_ERROR StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback);
CHIP_ERROR _StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback);

~ThreadStackManagerImpl() = default;

Expand Down Expand Up @@ -145,5 +148,10 @@ class ThreadStackManagerImpl : public ThreadStackManager
bool mAttached;
};

inline void ThreadStackManagerImpl::_OnThreadAttachFinished(void)
{
// stub for ThreadStackManager.h
}

} // namespace DeviceLayer
} // namespace chip

0 comments on commit b1c93d9

Please sign in to comment.