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

[EFR32] window app implementation for wifi #22451

Merged
merged 3 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions examples/window-app/common/src/WindowApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ CHIP_ERROR WindowApp::Run()
#else
oldState.isWiFiProvisioned = !ConnectivityMgr().IsWiFiStationProvisioned();
#endif
EFR32_LOG("App Started >>>");
while (true)
{
ProcessEvents();
Expand Down
4 changes: 4 additions & 0 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ declare_args() {
# PIN code for PASE session establishment.
setupPinCode = 20202021

#default Discriminator value
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false

Expand Down Expand Up @@ -128,6 +131,7 @@ efr32_sdk("sdk") {
defines = [
"BOARD_ID=${efr32_board}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down
4 changes: 3 additions & 1 deletion examples/window-app/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#endif
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
#endif
// For convenience, Chip Security Test Mode can be enabled and the
// requirement for authentication in various protocols can be disabled.
//
Expand Down
32 changes: 20 additions & 12 deletions examples/window-app/efr32/src/WindowAppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/EFR32/NetworkCommissioningWiFiDriver.h>
#endif

#ifdef DISPLAY_ENABLED
Expand All @@ -51,6 +53,10 @@ using namespace chip::app::Clusters::WindowCovering;
#define APP_STATE_LED &sl_led_led0
#define APP_ACTION_LED &sl_led_led1

#ifdef SL_WIFI
chip::app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(chip::DeviceLayer::NetworkCommissioning::SlWiFiDriver::GetInstance()));
#endif
//------------------------------------------------------------------------------
// Timers
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -145,6 +151,20 @@ WindowAppImpl::WindowAppImpl() {}

void WindowAppImpl::OnTaskCallback(void * parameter)
{
#ifdef SL_WIFI
/*
* Wait for the WiFi to be initialized
*/
EFR32_LOG("APP: Wait WiFi Init");
while (!wfx_hw_ready())
{
vTaskDelay(10);
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */
sWiFiNetworkCommissioningInstance.Init();
#endif

sInstance.Run();
}

Expand All @@ -158,18 +178,6 @@ void WindowAppImpl::OnIconTimeout(WindowApp::Timer & timer)

CHIP_ERROR WindowAppImpl::Init()
{
#ifdef SL_WIFI
/*
* Wait for the WiFi to be initialized
*/
EFR32_LOG("APP: Wait WiFi Init");
while (!wfx_hw_ready())
{
vTaskDelay(10);
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */
#endif
WindowApp::Init();

// Initialize App Task
Expand Down