Giter Club home page Giter Club logo

Comments (3)

smeisner avatar smeisner commented on May 19, 2024

A few more details...

I did try changing the data type of the QRCode to MutableCharSpan and copying the returned string as QRCode.data(), which compiles. The problem I am seeing now is when calling GetQRCode() it returns CHIP_ERROR_BUFFER_TOO_SMALL (0x19).

I am assuming this is due to declaring QRCode simply as MutableCharSpan QRCode;. How do you provide storage when declaring the variable? ...or after?

from esp32-arduino-matter.

smeisner avatar smeisner commented on May 19, 2024

ok, it wasn't easy/obvious, but I got it working. Here's the code

.
.
.

  ESP_LOGE(TAG, "Calling esp_matter::start()\n");
  // Start Matter device
  esp_matter::start(on_device_event);

  // Get QR Code 
  std::string QRCode = "                                 ";  // 33 chars
  CHIP_ERROR err;

  ESP_LOGE(TAG, "Calling PrintOnboardingCodes()\n");
  // Print codes needed to setup Matter device
  #if 0
    PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kOnNetwork));
  #else
    err = GetQRCode((MutableCharSpan &)QRCode, RendezvousInformationFlag::kOnNetwork);
    if (err == CHIP_NO_ERROR)
    {
      // strcpy (OperatingParameters.MatterQR, QRCode.data());
      strcpy (OperatingParameters.MatterQR, QRCode.c_str());
      ESP_LOGE(TAG, "QR Pairing Code: '%s'\n", OperatingParameters.MatterQR);
    } else {
      ESP_LOGE(TAG, "Failed to GetQRCode() -- Error: %d\n", err.AsInteger());
    }
  #endif

from esp32-arduino-matter.

Yacubane avatar Yacubane commented on May 19, 2024

Thanks for sharing it ;)

Btw. there should be possibility to set these codes, however I haven't tested it:
https://github.com/espressif/esp-matter/blob/4707b88ceb5e6328f7b571b652487507429c1891/docs/en/developing.rst (2.5 Factory Data Providers section)

from esp32-arduino-matter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.