From 0ed065075119d24796df4ad35295ddd78d0009ec Mon Sep 17 00:00:00 2001 From: Manav Mehta Date: Mon, 12 Dec 2022 15:16:43 +0000 Subject: [PATCH] Pull request #412: Print QR Code URL in logs in EFR32 Window Covering App Merge in WMN_TOOLS/matter from cherry-pick/wifi_window_qr_code_to_1.0.2 to RC_1.0.2-1.0 Squashed commit of the following: commit 16dbf3d73757f8983ab702b037889c6e7e31619b Author: Manav Mehta Date: Fri Dec 9 21:24:18 2022 +0530 Restore folder structure after cherry-pick commit 1867fa24963c101db358730234db658a093028cb Author: kurvaSai <111514131+kurvaSai@users.noreply.github.com> Date: Tue Nov 8 16:46:41 2022 +0530 Window Covering App QR Code Fix (#23539) commit 91a08360963d542b54e4e18670c9ac454c2c2d56 Author: Manav Mehta Date: Fri Dec 9 21:21:20 2022 +0530 Correction in temporary cherry-pick folder structure ... and 1 more commit --- .../silabs/efr32/src/WindowAppImpl.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp b/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp index 52af730d551f0c..873f6ec9cded62 100644 --- a/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp @@ -26,6 +26,10 @@ #include #ifdef QR_CODE_ENABLED #include +#else +#include "EFR32DeviceDataProvider.h" +#include +#include #endif // QR_CODE_ENABLED #include @@ -54,6 +58,8 @@ SilabsLCD slLCD; #define LCD_ICON_TIMEOUT 1000 using namespace chip::app::Clusters::WindowCovering; +using namespace chip; +using namespace ::chip::DeviceLayer; #define APP_STATE_LED &sl_led_led0 #define APP_ACTION_LED &sl_led_led1 @@ -212,6 +218,21 @@ CHIP_ERROR WindowAppImpl::Init() slLCD.Init(); #endif +#ifndef QR_CODE_ENABLED + // Create buffer for QR code that can fit max size and null terminator. + char qrCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; + chip::MutableCharSpan QRCode(qrCodeBuffer); + + if (EFR32::EFR32DeviceDataProvider::GetDeviceDataProvider().GetSetupPayload(QRCode) == CHIP_NO_ERROR) + { + PrintQrCodeURL(QRCode); + } + else + { + EFR32_LOG("Getting QR code failed!"); + } +#endif // QR_CODE_ENABLED + return CHIP_NO_ERROR; }