From bfd413589abc8ce10f348b4f352b88dee96f3ff2 Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Date: Wed, 2 Nov 2022 16:25:43 +0100 Subject: [PATCH] mqtt: Set state on stoping; Add error code to Subscribed event * Update submodule: git log --oneline ae53d799da294f03ef65c33e88fa33648e638134..fde00340f19b9f5ae81fff02ccfa9926f0e33687 Detailed description of the changes: * Fix the default configuration for event queue - See merge request espressif/esp-mqtt!153 - See commit https://github.com/espressif/esp-mqtt/commit/fb42588 * Adds missing header. - See merge request espressif/esp-mqtt!152 - See commit https://github.com/espressif/esp-mqtt/commit/8a60057 * Moves state change when stopping the client - See merge request espressif/esp-mqtt!150 - Closes https://github.com/espressif/esp-mqtt/issues/239 - See commit https://github.com/espressif/esp-mqtt/commit/3738fcd * Adds error code to MQTT_EVENT_SUBSCRIBED in case of failure - See merge request espressif/esp-mqtt!143 - - Closes https://github.com/espressif/esp-mqtt/issues/233 - See commit https://github.com/espressif/esp-mqtt/commit/9af5c26 * Adds debug information on sending dup messages - See merge request espressif/esp-mqtt!145 - See commit https://github.com/espressif/esp-mqtt/commit/47b3f9b * ci: Fix qemu build - See merge request espressif/esp-mqtt!147 - See commit https://github.com/espressif/esp-mqtt/commit/68e8c4f * ci: Build and Test QEMU on v5.0 - See merge request espressif/esp-mqtt!142 - See commit https://github.com/espressif/esp-mqtt/commit/9db9ee7 * client: Add support for user events - See merge request espressif/esp-mqtt!140 - Closes https://github.com/espressif/esp-mqtt/issues/230 - See commit https://github.com/espressif/esp-mqtt/commit/97503cc * Adds unregister event API - See merge request espressif/esp-mqtt!139 - Closes https://github.com/espressif/esp-idf/issues/9194 - See commit https://github.com/espressif/esp-mqtt/commit/a9a9fe7 --- components/mqtt/Kconfig | 7 +++++++ components/mqtt/host_test/CMakeLists.txt | 1 + .../mqtt/host_test/mocks/heap/CMakeLists.txt | 4 ++++ components/mqtt/host_test/mocks/heap/heap_mock.c | 16 ++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 components/mqtt/host_test/mocks/heap/CMakeLists.txt create mode 100644 components/mqtt/host_test/mocks/heap/heap_mock.c diff --git a/components/mqtt/Kconfig b/components/mqtt/Kconfig index 4db6e15..113bac7 100644 --- a/components/mqtt/Kconfig +++ b/components/mqtt/Kconfig @@ -124,6 +124,13 @@ menu "ESP-MQTT Configurations" help MQTT task priority. Higher number denotes higher priority. + config MQTT_EVENT_QUEUE_SIZE + int "Number of queued events." + default 1 + depends on MQTT_USE_CUSTOM_CONFIG + help + A value higher than 1 enables multiple queued events. + config MQTT_TASK_CORE_SELECTION_ENABLED bool "Enable MQTT task core selection" help diff --git a/components/mqtt/host_test/CMakeLists.txt b/components/mqtt/host_test/CMakeLists.txt index d1c1ac6..db98733 100644 --- a/components/mqtt/host_test/CMakeLists.txt +++ b/components/mqtt/host_test/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) set(COMPONENTS main) list(APPEND EXTRA_COMPONENT_DIRS + "mocks/heap/" "$ENV{IDF_PATH}/tools/mocks/esp_hw_support/" "$ENV{IDF_PATH}/tools/mocks/freertos/" "$ENV{IDF_PATH}/tools/mocks/esp_timer/" diff --git a/components/mqtt/host_test/mocks/heap/CMakeLists.txt b/components/mqtt/host_test/mocks/heap/CMakeLists.txt new file mode 100644 index 0000000..0a0c8a6 --- /dev/null +++ b/components/mqtt/host_test/mocks/heap/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_get_property(original_heap_dir heap COMPONENT_OVERRIDEN_DIR) + +idf_component_register(SRCS heap_mock.c + INCLUDE_DIRS "${original_heap_dir}/include") diff --git a/components/mqtt/host_test/mocks/heap/heap_mock.c b/components/mqtt/host_test/mocks/heap/heap_mock.c new file mode 100644 index 0000000..e0fc666 --- /dev/null +++ b/components/mqtt/host_test/mocks/heap/heap_mock.c @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "esp_heap_caps.h" +#include +#include + + + +void *heap_caps_calloc(size_t n, size_t size, uint32_t caps) { + (void)caps; + return calloc(n, size); + +}