How to retrieve the Matter QR code?

Due to production requirements, I need to obtain the device's QR code. However, I found that the QR code can only be retrieved using the code snippet below after calling Nrf::Matter::StartServer().
Since there are several production test items that need to be performed, I would like to retrieve the QR code immediately after the hardware initialization.
Is there any way to obtain the QR code right after the device boots up?
My SDK version is NCS 2.9.0.

CHIP_ERROR Sunion::AppTask::StartApp()
{
	ReturnErrorOnFailure(Init());

	AppEvent event = {};

    DoorLockServer::Instance().SetSoundVolume(kLockEndpointId, Para.BuzzerPercent);


    char buffer[128 + 1];
    chip::MutableCharSpan qrCode(buffer);
    chip::RendezvousInformationFlags rendezvousFlags = chip::RendezvousInformationFlag::kBLE;

    if (GetQRCode(qrCode, rendezvousFlags) == CHIP_NO_ERROR)
    {
        ChipLogProgress(AppServer, "SetupQRCode: [%s]", qrCode.data());
    }
    else
    {
        ChipLogError(AppServer, "Failed to get QR code");
    }

	while (true) {
		k_msgq_get(&sAppEventQueue, &event, K_FOREVER);
		DispatchEvent(event);
		Ex_StateMachine();
	}

	return CHIP_NO_ERROR;
}

Parents Reply
  • Hi,

    I understand what you mean, and we do generate the QR code in that way as well. However, what I'm referring to is the production testing phase. I would like to verify that the hardware functions correctly before transmitting data using our custom communication protocol. You only need to tell me how to read the QR code before calling Nrf::Matter::StartServer().

Children
No Data
Related