Merge pull request #775 from euripedesrocha/feature/mosquitto_plugin

Add config to enable SYS on mosquito and bump version
This commit is contained in:
Euripedes
2025-03-06 14:48:20 -03:00
committed by GitHub
8 changed files with 62 additions and 9 deletions

View File

@@ -3,6 +3,6 @@ commitizen:
bump_message: 'bump(mosq): $current_version -> $new_version'
pre_bump_hooks: python ../../ci/changelog.py mosquitto
tag_format: mosq-v$version
version: 2.0.20~1
version: 2.0.20~2
version_files:
- idf_component.yml

View File

@@ -1,5 +1,16 @@
# Changelog
## [2.0.20~2](https://github.com/espressif/esp-protocols/commits/mosq-v2.0.20_2)
### Features
- Allow user to enable SYS topic ([905b84fb](https://github.com/espressif/esp-protocols/commit/905b84fb))
### Bug Fixes
- Remove temp modification of IDF files ([9162de11](https://github.com/espressif/esp-protocols/commit/9162de11))
- Add a note about stack size ([dbd164dd](https://github.com/espressif/esp-protocols/commit/dbd164dd))
## [2.0.20~1](https://github.com/espressif/esp-protocols/commits/mosq-v2.0.20_1)
### Bug Fixes

View File

@@ -21,7 +21,6 @@ set(m_srcs
${m_lib_dir}/handle_pubrec.c
${m_lib_dir}/handle_pubrel.c
${m_lib_dir}/handle_ping.c
${m_lib_dir}/time_mosq.c
${m_lib_dir}/utf8_mosq.c
${m_src_dir}/bridge.c
@@ -75,6 +74,7 @@ idf_component_register(SRCS ${m_srcs}
port/config.c
port/signals.c
port/broker.c
port/mosq_time.c
port/files.c
port/net__esp_tls.c
port/sysconf.c
@@ -82,9 +82,12 @@ idf_component_register(SRCS ${m_srcs}
${m_incl_dir} ${m_lib_dir} ${m_deps_dir}
INCLUDE_DIRS ${m_incl_dir} port/include
REQUIRES esp-tls
PRIV_REQUIRES newlib sock_utils)
PRIV_REQUIRES newlib sock_utils esp_timer)
target_compile_definitions(${COMPONENT_LIB} PRIVATE "WITH_BROKER")
if (CONFIG_MOSQ_ENABLE_SYS)
target_compile_definitions(${COMPONENT_LIB} PRIVATE "WITH_SYS_TREE")
endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
# Some mosquitto source unconditionally define `_GNU_SOURCE` which collides with IDF build system

View File

@@ -0,0 +1,15 @@
menu "Mosquitto"
config MOSQ_ENABLE_SYS
bool "Enable $SYS topics"
default n
help
Enable the $SYS topics for the broker
config MOSQ_SYS_UPDATE_INTERVAL
int "Update interval for the SYS topic"
default 10
depends on MOSQ_ENABLE_SYS
help
Time in seconds for the update of the $SYS topics for the broker
endmenu

View File

@@ -1,4 +1,4 @@
version: "2.0.20~1"
version: "2.0.20~2"
url: https://github.com/espressif/esp-protocols/tree/master/components/mosquitto
description: The component provides a simple ESP32 port of mosquitto broker
dependencies:

View File

@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*
* SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2024-2025 Espressif Systems (Shanghai) CO LTD
*/
#include "mosquitto_internal.h"
#include "mosquitto_broker.h"
@@ -14,6 +14,7 @@
#include "utlist.h"
#include "lib_load.h"
#include "syslog.h"
#include "sdkconfig.h"
void config__init(struct mosquitto__config *config)
@@ -66,7 +67,7 @@ void config__init(struct mosquitto__config *config)
config->log_file = NULL;
config->log_facility = LOG_DAEMON;
config->log_dest = MQTT3_LOG_STDERR | MQTT3_LOG_DLT;
config->log_dest = MQTT3_LOG_STDERR | MQTT3_LOG_TOPIC;
if (db.verbose) {
config->log_type = UINT_MAX;
} else {
@@ -91,7 +92,9 @@ void config__init(struct mosquitto__config *config)
config->queue_qos0_messages = false;
config->retain_available = true;
config->set_tcp_nodelay = false;
config->sys_interval = 10;
#if defined(WITH_SYS_TREE)
config->sys_interval = CONFIG_MOSQ_SYS_UPDATE_INTERVAL;
#endif
config->upgrade_outgoing_qos = false;
config->daemon = false;

View File

@@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2024 Roger Light <roger@atchoo.org>
*
* SPDX-License-Identifier: EPL-2.0
*
* SPDX-FileContributor: 2025 Espressif Systems (Shanghai) CO LTD
*/
#include <time.h>
#include "time_mosq.h"
#include "esp_timer.h"
void mosquitto_time_init(void)
{
}
time_t mosquitto_time(void)
{
return esp_timer_get_time() / 1000000; // Convert microseconds to seconds
}

View File

@@ -12,4 +12,4 @@
#include_next "config.h"
#define VERSION "v2.0.20~1"
#define VERSION "v2.0.20~2"