Skip to content

Commit

Permalink
Window Covering App QR Code Fix (#23539)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurvaSai authored and pull[bot] committed Jun 8, 2023
1 parent 83f59ce commit 1088680
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/window-app/efr32/src/WindowAppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#include <platform/CHIPDeviceLayer.h>
#ifdef QR_CODE_ENABLED
#include <qrcodegen.h>
#else
#include "EFR32DeviceDataProvider.h"
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>
#endif // QR_CODE_ENABLED
#include <sl_simple_button_instances.h>

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 1088680

Please sign in to comment.