mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
Add DPP Enrollee example
1. Add Example for DPP Enrollee 2. Use DPP Supplicant API's to setup connection 3. Add support for multiple channels in Bootstrapping 4. Add Unity testcase for testing Offchannel operations Closes https://github.com/espressif/esp-idf/issues/5654
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
idf_component_register(SRCS "esp_qrcode_main.c" "esp_qrcode_wrapper.c" "qrcodegen.c"
|
||||
INCLUDE_DIRS "include"
|
||||
REQUIRES
|
||||
PRIV_REQUIRES )
|
||||
|
||||
INCLUDE_DIRS "include"
|
||||
)
|
||||
|
9
examples/common_components/qrcode/README.md
Normal file
9
examples/common_components/qrcode/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# QR Code generator component
|
||||
|
||||
This directory contains a QR code generator component written in C. This component is based on [QR-Code-generator](https://github.com/nayuki/QR-Code-generator).
|
||||
This component is used as part of the following ESP-IDF examples:
|
||||
- [DPP Enrollee Example](../../wifi/wifi_easy_connect/dpp-enrollee/).
|
||||
|
||||
To learn more about how to use this component, please check API Documentation from header file [qrcode.h](./include/qrcode.h).
|
||||
|
||||
Please note that this component is not considered to be a part of ESP-IDF stable API. It may change and may be removed in the future releases.
|
0
examples/common_components/qrcode/component.mk
Normal file
0
examples/common_components/qrcode/component.mk
Normal file
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -14,10 +14,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <esp_err.h>
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "qrcodegen.h"
|
||||
#include "qrcode.h"
|
||||
|
||||
static const char *TAG = "QRCODE";
|
||||
|
||||
static const char *lt[] = {
|
||||
/* 0 */ " ",
|
||||
/* 1 */ "\u2580 ",
|
||||
@@ -67,13 +70,14 @@ void esp_qrcode_print_console(esp_qrcode_handle_t qrcode)
|
||||
|
||||
esp_err_t esp_qrcode_generate(esp_qrcode_config_t *cfg, const char *text)
|
||||
{
|
||||
enum qrcodegen_Ecc ecc_lvl;
|
||||
enum qrcodegen_Ecc ecc_lvl;
|
||||
uint8_t *qrcode, *tempbuf;
|
||||
esp_err_t err = ESP_FAIL;
|
||||
|
||||
qrcode = calloc(1, qrcodegen_BUFFER_LEN_FOR_VERSION(cfg->max_qrcode_version));
|
||||
if (!qrcode)
|
||||
if (!qrcode) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
tempbuf = calloc(1, qrcodegen_BUFFER_LEN_FOR_VERSION(cfg->max_qrcode_version));
|
||||
if (!tempbuf) {
|
||||
@@ -99,12 +103,15 @@ esp_err_t esp_qrcode_generate(esp_qrcode_config_t *cfg, const char *text)
|
||||
break;
|
||||
}
|
||||
|
||||
// Make and print the QR Code symbol
|
||||
bool ok = qrcodegen_encodeText(text, tempbuf, qrcode, ecc_lvl,
|
||||
qrcodegen_VERSION_MIN, cfg->max_qrcode_version,
|
||||
ESP_LOGI(TAG, "Encoding below text with ECC LVL %d & QR Code Version %d",
|
||||
ecc_lvl, cfg->max_qrcode_version);
|
||||
ESP_LOGI(TAG, "%s", text);
|
||||
// Make and print the QR Code symbol
|
||||
bool ok = qrcodegen_encodeText(text, tempbuf, qrcode, ecc_lvl,
|
||||
qrcodegen_VERSION_MIN, cfg->max_qrcode_version,
|
||||
qrcodegen_Mask_AUTO, true);
|
||||
if (ok && cfg->display_func) {
|
||||
cfg->display_func((esp_qrcode_handle_t)qrcode);
|
||||
if (ok && cfg->display_func) {
|
||||
cfg->display_func((esp_qrcode_handle_t)qrcode);
|
||||
err = ESP_OK;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -95,9 +95,9 @@ bool esp_qrcode_get_module(esp_qrcode_handle_t qrcode, int x, int y);
|
||||
|
||||
#define ESP_QRCODE_CONFIG_DEFAULT() (esp_qrcode_config_t) { \
|
||||
.display_func = esp_qrcode_print_console, \
|
||||
.qrcode_ecc_level = ESP_QRCODE_ECC_LOW, \
|
||||
.max_qrcode_version = 10, \
|
||||
} \
|
||||
.qrcode_ecc_level = ESP_QRCODE_ECC_LOW, \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user