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

Set up a network commissioning cluster in linux lock-app. #17663

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
40 changes: 39 additions & 1 deletion examples/lock-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,46 @@
*/

#include "AppMain.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/Linux/NetworkCommissioningDriver.h>

void ApplicationInit() {}
using namespace chip;
using namespace chip::app;

namespace {
// We support either thread or wi-fi commissioning, not both. Prefer thread if
// both are available.
#if CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_THREAD
DeviceLayer::NetworkCommissioning::LinuxThreadDriver sNetworkCommissioningDriver;
Clusters::NetworkCommissioning::Instance sNetworkCommissioningInstance(0, &sNetworkCommissioningDriver);

void InitNetworkCommissioning()
{
sNetworkCommissioningInstance.Init();
}

#elif CHIP_DEVICE_CONFIG_ENABLE_WPA

DeviceLayer::NetworkCommissioning::LinuxWiFiDriver sNetworkCommissioningDriver;
Clusters::NetworkCommissioning::Instance sNetworkCommissioningInstance(0, &sNetworkCommissioningDriver);

void InitNetworkCommissioning()
{
sNetworkCommissioningInstance.Init();
}

#else // !CHIP_DEVICE_CONFIG_ENABLE_WPA && !(CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_THREAD)

void InitNetworkCommissioning() {}

#endif // (CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_THREAD) || CHIP_DEVICE_CONFIG_ENABLE_WPA

} // anonymous namespace

void ApplicationInit()
{
InitNetworkCommissioning();
}

int main(int argc, char * argv[])
{
Expand Down