From 1983088ac8c7ee2b9c6866856a403ab81f9a5347 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Thu, 10 Jun 2021 15:38:08 -0400 Subject: [PATCH] Print pin code and long discriminator on QR screen (#7514) * Print pin code and long discriminator on QR screen This is very helpful info, and it's already part of the QR code string anyway. * Also add prints at QR code generation. Means other devices can see it too. --- examples/all-clusters-app/esp32/main/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index eaec0723c1ee66..4bcfb74491f916 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -445,6 +445,7 @@ std::string createSetupPayload() ESP_LOGE(TAG, "Couldn't get discriminator: %s", ErrorStr(err)); return result; } + ESP_LOGI(TAG, "Setup discriminator: %u (0x%x)", discriminator, discriminator); uint32_t setupPINCode; err = ConfigurationMgr().GetSetupPinCode(setupPINCode); @@ -453,6 +454,7 @@ std::string createSetupPayload() ESP_LOGE(TAG, "Couldn't get setupPINCode: %s", ErrorStr(err)); return result; } + ESP_LOGI(TAG, "Setup PIN code: %u (0x%x)", setupPINCode, setupPINCode); uint16_t vendorId; err = ConfigurationMgr().GetVendorId(vendorId); @@ -669,6 +671,16 @@ extern "C" void app_main() [=]() { ESP_LOGI(TAG, "Opening QR code screen"); ESP_LOGI(TAG, "QR CODE Text: '%s'", qrCodeText.c_str()); + uint16_t discriminator; + if (ConfigurationMgr().GetSetupDiscriminator(discriminator) == CHIP_NO_ERROR) + { + ESP_LOGI(TAG, "Setup discriminator: %u (0x%x)", discriminator, discriminator); + } + uint32_t setupPINCode; + if (ConfigurationMgr().GetSetupPinCode(setupPINCode) == CHIP_NO_ERROR) + { + ESP_LOGI(TAG, "Setup PIN code: %u (0x%x)", setupPINCode, setupPINCode); + } ScreenManager::PushScreen(chip::Platform::New(qrCodeText)); }) ->Item("Setup",