From 396573793bd814cbd8220e260bd8ca643139cfe6 Mon Sep 17 00:00:00 2001 From: kurvaSai <111514131+kurvaSai@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:46:41 +0530 Subject: [PATCH] Window Covering App QR Code Fix (#23539) --- .../window-app/efr32/src/WindowAppImpl.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/examples/window-app/efr32/src/WindowAppImpl.cpp b/examples/window-app/efr32/src/WindowAppImpl.cpp index 7f9eeaca724f0d..2675b7398d50a1 100644 --- a/examples/window-app/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/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; }