Skip to content

Commit

Permalink
Log decimal setup payload in the esp example (#3280)
Browse files Browse the repository at this point in the history
* Log decimal setup payload in the esp example

* Update log text

* Update log text
  • Loading branch information
andy31415 authored and pull[bot] committed Dec 7, 2020
1 parent 131b5e7 commit 2832f8e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/wifi-echo/server/esp32/main/wifi-echo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#include <crypto/CHIPCryptoPAL.h>
#include <platform/CHIPDeviceLayer.h>
#include <setup_payload/ManualSetupPayloadGenerator.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <support/CHIPMem.h>
#include <support/ErrorStr.h>
Expand Down Expand Up @@ -415,6 +416,20 @@ std::string createSetupPayload()
err = generator.payloadBase41Representation(result);
}

{
ManualSetupPayloadGenerator generator(payload);
std::string outCode;

if (generator.payloadDecimalStringRepresentation(outCode) == CHIP_NO_ERROR)
{
ESP_LOGI(TAG, "Manual(decimal) setup code: %s", outCode.c_str());
}
else
{
ESP_LOGE(TAG, "Failed to get decimal setup code");
}
}

if (err != CHIP_NO_ERROR)
{
ESP_LOGE(TAG, "Couldn't get payload string %d", err);
Expand Down

0 comments on commit 2832f8e

Please sign in to comment.