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

Update bridge app to init network commissioning #29612

Merged
merged 2 commits into from
Oct 10, 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
40 changes: 11 additions & 29 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,6 @@ bool emberAfActionsClusterInstantActionCallback(app::CommandHandler * commandObj
return true;
}

void ApplicationInit() {}

void ApplicationShutdown() {}

const EmberAfDeviceType gBridgedOnOffDeviceTypes[] = { { DEVICE_TYPE_LO_ON_OFF_LIGHT, DEVICE_VERSION_DEFAULT },
{ DEVICE_TYPE_BRIDGED_NODE, DEVICE_VERSION_DEFAULT } };

Expand Down Expand Up @@ -891,7 +887,7 @@ void * bridge_polling_thread(void * context)
return nullptr;
}

int main(int argc, char * argv[])
void ApplicationInit()
{
// Clear out the device database
memset(gDevices, 0, sizeof(gDevices));
Expand Down Expand Up @@ -934,26 +930,6 @@ int main(int argc, char * argv[])
ComposedTempSensor2.SetChangeCallback(&HandleDeviceTempSensorStatusChanged);
ComposedPowerSource.SetChangeCallback(&HandleDevicePowerSourceStatusChanged);

if (ChipLinuxAppInit(argc, argv) != 0)
{
return -1;
}

// Init Data Model and CHIP App Server
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();

#if CHIP_DEVICE_ENABLE_PORT_PARAMS
// use a different service port to make testing possible with other sample devices running on same host
initParams.operationalServicePort = LinuxDeviceOptions::GetInstance().securedDevicePort;
#endif

initParams.interfaceId = LinuxDeviceOptions::GetInstance().interfaceId;
chip::Server::GetInstance().Init(initParams);

// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

// Set starting endpoint id where dynamic endpoints will be assigned, which
// will be the next consecutive endpoint id after the last fixed endpoint.
gFirstDynamicEndpointId = static_cast<chip::EndpointId>(
Expand Down Expand Up @@ -1022,11 +998,17 @@ int main(int argc, char * argv[])
}
}

// Run CHIP

ApplicationInit();
registerAttributeAccessOverride(&gPowerAttrAccess);
chip::DeviceLayer::PlatformMgr().RunEventLoop();
}

void ApplicationShutdown() {}

int main(int argc, char * argv[])
{
if (ChipLinuxAppInit(argc, argv) != 0)
{
return -1;
}
ChipLinuxAppMainLoop();
return 0;
}
Loading