Skip to content

Commit

Permalink
Do not show QRcode url if wifi connected
Browse files Browse the repository at this point in the history
  • Loading branch information
pankore committed Nov 25, 2021
1 parent 6e00faf commit 8b54ba0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ std::string createSetupPayload()
ChipLogError(DeviceLayer, "Couldn't get discriminator: %s\r\n", ErrorStr(err));
return result;
}
ChipLogProgress(DeviceLayer, "Setup discriminator: %u (0x%x)\r\n", discriminator, discriminator);
ChipLogProgress(DeviceLayer, "Setup discriminator: %d (0x%x)\r\n", discriminator, discriminator);

uint32_t setupPINCode;
err = ConfigurationMgr().GetSetupPinCode(setupPINCode);
Expand All @@ -107,7 +107,7 @@ std::string createSetupPayload()
ChipLogError(DeviceLayer, "Couldn't get setupPINCode: %s\r\n", ErrorStr(err));
return result;
}
ChipLogProgress(DeviceLayer, "Setup PIN code: %u (0x%x)\r\n", setupPINCode, setupPINCode);
ChipLogProgress(DeviceLayer, "Setup PIN code: %lu (0x%lx)\r\n", setupPINCode, setupPINCode);

uint16_t vendorId;
err = ConfigurationMgr().GetVendorId(vendorId);
Expand Down Expand Up @@ -180,7 +180,7 @@ std::string createSetupPayload()

if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Couldn't get payload string %\r\n" CHIP_ERROR_FORMAT, err.Format());
ChipLogError(DeviceLayer, "Couldn't get payload string %lu\r\n" CHIP_ERROR_FORMAT, err.Format());
}
return result;
};
Expand Down Expand Up @@ -209,10 +209,11 @@ extern "C" void ChipTest(void)
// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

std::string qrCodeText = createSetupPayload();
ChipLogProgress(DeviceLayer, "QR CODE Text: '%s'\r\n", qrCodeText.c_str());

if( RTW_SUCCESS != wifi_is_connected_to_ap())
{
std::string qrCodeText = createSetupPayload();
ChipLogProgress(DeviceLayer, "QR CODE Text: '%s'\r\n", qrCodeText.c_str());

std::vector<char> qrCode(3 * qrCodeText.size() + 1);
err = EncodeQRCodeToUrl(qrCodeText.c_str(), qrCodeText.size(), qrCode.data(), qrCode.max_size());
if (err == CHIP_NO_ERROR)
Expand Down

0 comments on commit 8b54ba0

Please sign in to comment.