Skip to content

Commit

Permalink
Print pin code and long discriminator on QR screen (#7514)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
cecille authored Jun 10, 2021
1 parent f9d5741 commit abe427b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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<QRCodeScreen>(qrCodeText));
})
->Item("Setup",
Expand Down

0 comments on commit abe427b

Please sign in to comment.