Compare commits

...

12 Commits

Author SHA1 Message Date
f8a776d8a5 Merge pull request #519 from gabsuren/mdns1.2.5
bump(mdns): 1.2.4 -> 1.2.5
2024-03-06 10:56:24 +04:00
a82c7922aa bump(mdns): 1.2.4 -> 1.2.5
1.2.5
Bug Fixes
- Fixed build issues for targets without WiFi caps (302b46f)
2024-03-06 10:32:17 +04:00
d31ad025c8 Merge pull request #515 from david-cermak/fix/ws_dyn_buffer
[ws-client]: Fix usage of the dynamic buffer
2024-03-05 16:25:51 +01:00
4977f96a61 Merge pull request #517 from david-cermak/fix/examples_format_warn
Fix remaining format warnings
2024-03-05 15:02:44 +01:00
dcdf31187a Merge pull request #518 from gabsuren/mdns_docs_update
fix(mdns): updated the document to clarify self-querying mechanism (IDFGH-7528)
2024-03-05 14:23:06 +04:00
b6bbe47cae fix(mdns): updated the document to clarify self-querying mechanism 2024-03-05 12:38:07 +04:00
302b46f8e2 fix(mdns): Fixed build issues for targets without WiFi caps 2024-03-01 10:24:29 +01:00
45b1597ac3 fix(examples): Fix SLIP example print format warnings 2024-03-01 10:08:27 +01:00
a06de6431b fix(examples): Fix MQTT example print format warnings
Partially addresses https://github.com/espressif/esp-protocols/issues/79
2024-02-28 19:25:28 +01:00
3b80181d30 fix(modem): Fix remaining print format warnings
Partially addresses https://github.com/espressif/esp-protocols/issues/79
2024-02-28 19:24:52 +01:00
9c54b72e1f fix(websocket): Fixed to use int return value in Tx functions 2024-02-28 12:48:06 +01:00
16174470ee fix(websocket): Fixed Tx functions with DYNAMIC_BUFFER 2024-02-28 12:47:59 +01:00
16 changed files with 43 additions and 52 deletions

View File

@ -26,7 +26,7 @@ jobs:
. ${IDF_PATH}/export.sh
python -m pip install idf-build-apps
# Build default configs for all targets
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }} -r default -m components/mdns/.build-test-rules.yml -d
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }} -r default -d
# Build specific configs for test targets
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }}
cd components/mdns/${{ matrix.test.path }}

View File

@ -45,8 +45,3 @@ set_target_properties(${COMPONENT_LIB} PROPERTIES
if(CONFIG_ESP_MODEM_ADD_CUSTOM_MODULE)
idf_component_optional_requires(PUBLIC main)
endif()
if(${target} STREQUAL "linux")
# This is needed for ESP_LOGx() macros, as integer formats differ on ESP32(..) and x64
set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS -Wno-format)
endif()

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -13,6 +13,12 @@
using namespace esp_modem;
#ifdef CONFIG_IDF_TARGET_LINUX
#define PRIsize_t "lu"
#else
#define PRIsize_t "u"
#endif
#ifdef CONFIG_ESP_MODEM_CMUX_DEFRAGMENT_PAYLOAD
/**
* @brief Define this to defragment partially received data of CMUX payload
@ -245,7 +251,7 @@ bool CMux::on_header(CMuxFrame &frame)
bool CMux::on_payload(CMuxFrame &frame)
{
ESP_LOGD("CMUX", "Payload frame: dlci:%02x type:%02x payload:%d available:%d", dlci, type, payload_len, frame.len);
ESP_LOGD("CMUX", "Payload frame: dlci:%02x type:%02x payload:%" PRIsize_t " available:%" PRIsize_t, dlci, type, payload_len, frame.len);
if (frame.len < payload_len) { // payload
state = cmux_state::PAYLOAD;
if (!data_available(frame.ptr, frame.len)) { // partial read
@ -312,7 +318,7 @@ bool CMux::on_cmux_data(uint8_t *data, size_t actual_len)
auto data_end = buffer.get() + buffer.size;
data_to_read = payload_len + 2; // 2 -- CMUX protocol footer
if (data + data_to_read >= data_end) {
ESP_LOGW("CUMX", "Failed to defragment longer payload (payload=%d)", payload_len);
ESP_LOGW("CUMX", "Failed to defragment longer payload (payload=%" PRIsize_t ")", payload_len);
// If you experience this error, your device uses longer payloads while
// the configured buffer is too small to defragment the payload properly.
// To resolve this issue you can:

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -550,9 +550,13 @@ static int esp_websocket_client_send_with_exact_opcode(esp_websocket_client_hand
int ret = -1;
int need_write = len;
int wlen = 0, widx = 0;
bool contained_fin = opcode & WS_TRANSPORT_OPCODES_FIN;
if (esp_websocket_new_buf(client, true) != ESP_OK) {
ESP_LOGE(TAG, "Failed to setup tx buffer");
return -1;
}
while (widx < len || opcode) { // allow for sending "current_opcode" only message with len==0
if (need_write > client->buffer_size) {
need_write = client->buffer_size;
@ -1204,33 +1208,27 @@ int esp_websocket_client_send_fin(esp_websocket_client_handle_t client, TickType
int esp_websocket_client_send_with_opcode(esp_websocket_client_handle_t client, ws_transport_opcodes_t opcode, const uint8_t *data, int len, TickType_t timeout)
{
int ret = ESP_OK;
int ret = -1;
if (client == NULL || len < 0 || (data == NULL && len > 0)) {
ESP_LOGE(TAG, "Invalid arguments");
return ESP_FAIL;
return -1;
}
if (xSemaphoreTakeRecursive(client->lock, timeout) != pdPASS) {
ESP_LOGE(TAG, "Could not lock ws-client within %" PRIu32 " timeout", timeout);
return ESP_FAIL;
return -1;
}
if (!esp_websocket_client_is_connected(client)) {
ESP_LOGE(TAG, "Websocket client is not connected");
ret = ESP_FAIL;
goto unlock_and_return;
}
if (client->transport == NULL) {
ESP_LOGE(TAG, "Invalid transport");
ret = ESP_FAIL;
goto unlock_and_return;
}
if (esp_websocket_new_buf(client, true) != ESP_OK) {
ESP_LOGE(TAG, "Failed to setup tx buffer");
ret = ESP_FAIL;
goto unlock_and_return;
}
ret = esp_websocket_client_send_with_exact_opcode(client, opcode | WS_TRANSPORT_OPCODES_FIN, data, len, timeout);
if (ret < 0) {
ESP_LOGE(TAG, "Failed to send the buffer");

View File

@ -1,11 +0,0 @@
components/mdns/examples:
disable:
- if: IDF_TARGET in ["esp32h2"]
components/mdns/tests/unit_test:
disable:
- if: IDF_TARGET in ["esp32h2"]
components/mdns/tests/test_apps:
disable:
- if: IDF_TARGET in ["esp32h2"]

View File

@ -3,6 +3,6 @@ commitizen:
bump_message: 'bump(mdns): $current_version -> $new_version'
pre_bump_hooks: python ../../ci/changelog.py mdns
tag_format: mdns-v$version
version: 1.2.4
version: 1.2.5
version_files:
- idf_component.yml

View File

@ -1,5 +1,11 @@
# Changelog
## [1.2.5](https://github.com/espressif/esp-protocols/commits/mdns-v1.2.5)
### Bug Fixes
- Fixed build issues for targets without WiFi caps ([302b46f](https://github.com/espressif/esp-protocols/commit/302b46f))
## [1.2.4](https://github.com/espressif/esp-protocols/commits/mdns-v1.2.4)
### Bug Fixes

View File

@ -1,4 +1,4 @@
version: "1.2.4"
version: "1.2.5"
description: mDNS
url: https://github.com/espressif/esp-protocols/tree/master/components/mdns
dependencies:

View File

@ -5386,13 +5386,13 @@ static inline void set_default_duplicated_interfaces(void)
static inline void unregister_predefined_handlers(void)
{
#if defined(MDNS_ESP_WIFI_ENABLED) && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
#if MDNS_ESP_WIFI_ENABLED && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event);
#endif
#if CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP || CONFIG_MDNS_PREDEF_NETIF_ETH
esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event);
#endif
#if defined(CONFIG_ETH_ENABLED) && CONFIG_MDNS_PREDEF_NETIF_ETH
#if CONFIG_ETH_ENABLED && CONFIG_MDNS_PREDEF_NETIF_ETH
esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event);
#endif
}
@ -5483,7 +5483,7 @@ esp_err_t mdns_init(void)
goto free_queue;
}
#if defined(MDNS_ESP_WIFI_ENABLED) && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
#if MDNS_ESP_WIFI_ENABLED && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
if ((err = esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event, NULL)) != ESP_OK) {
goto free_event_handlers;
}
@ -5493,7 +5493,7 @@ esp_err_t mdns_init(void)
goto free_event_handlers;
}
#endif
#if defined(CONFIG_ETH_ENABLED) && CONFIG_MDNS_PREDEF_NETIF_ETH
#if CONFIG_ETH_ENABLED && CONFIG_MDNS_PREDEF_NETIF_ETH
if ((err = esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event, NULL)) != ESP_OK) {
goto free_event_handlers;
}

View File

@ -39,7 +39,7 @@ Example method to start mDNS for the STA interface and set ``hostname`` and ``de
mDNS Services
^^^^^^^^^^^^^
mDNS can advertise information about network services that your device offers. Each service is defined by a few properties.
mDNS can advertise information about network services that your device offers. Each service is defined by a few properties. (Please note Self-querying names is not supported in Espressif's mDNS library, a deliberate design choice to simplify implementation, preventing local network pollution and addressing WiFi multicast behavior)
* ``instance_name``: friendly name for your service, like ``Jhon's E{IDF_TARGET_NAME} Web Server``. If not defined, ``default_instance`` will be used.
* ``service_type``: (required) service type, prepended with underscore. Some common types can be found `here <http://www.dns-sd.org/serviceTypes.html>`_.

View File

@ -5,4 +5,3 @@ idf_component_register(
INCLUDE_DIRS "include"
REQUIRES esp_netif driver
)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -1,10 +1,11 @@
/*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include <inttypes.h>
#include "slip_modem.h"
#include "esp_netif.h"
@ -176,7 +177,7 @@ static esp_err_t slip_modem_transmit(void *slip_driver, void *buffer, size_t len
int32_t res = uart_write_bytes(slip_modem->uart.uart_dev, (char *)buffer, len);
if (res < 0) {
// Handle errors
ESP_LOGE(TAG, "%s: uart_write_bytes error %i", __func__, res);
ESP_LOGE(TAG, "%s: uart_write_bytes error %" PRId32, __func__, res);
return ESP_FAIL;
}
return ESP_OK;
@ -212,7 +213,7 @@ static void slip_modem_uart_rx_task(void *arg)
slip_modem_handle slip_modem = (slip_modem_handle) arg;
ESP_LOGD(TAG, "Start SLIP modem RX task (slip_modem %p filter: %p)", slip_modem, slip_modem->rx_filter);
ESP_LOGD(TAG, "Uart: %d, buffer: %p (%d bytes)", slip_modem->uart.uart_dev, slip_modem->buffer, slip_modem->buffer_len);
ESP_LOGD(TAG, "Uart: %d, buffer: %p (%" PRIu32 " bytes)", slip_modem->uart.uart_dev, slip_modem->buffer, slip_modem->buffer_len);
while (slip_modem->running == true) {
// Read data from the UART

View File

@ -5,4 +5,3 @@ idf_component_register(
INCLUDE_DIRS "."
REQUIRES esp_netif slip_modem driver
)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -121,7 +121,7 @@ static void slip_set_prefix(slip_modem_handle slip)
{
uint8_t buff[10] = {0};
const esp_ip6_addr_t addr = slip_modem_get_ipv6_address(slip);
ESP_LOGI(TAG, "%s: prefix set (%08x:%08x)", __func__,
ESP_LOGI(TAG, "%s: prefix set (%08" PRIx32 ":%08" PRIx32 ")", __func__,
lwip_ntohl(addr.addr[0]), lwip_ntohl(addr.addr[1]));
// Build slip set message

View File

@ -1,4 +1,2 @@
idf_component_register(SRCS "app_main.cpp"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -40,8 +40,8 @@ static void log_error_if_nonzero(const char *message, int error_code)
*/
static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data)
{
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
esp_mqtt_event_handle_t event = (esp_mqtt_event_handle_t)event_data;
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRIi32 "", base, event_id);
auto event = (esp_mqtt_event_handle_t)event_data;
esp_mqtt_client_handle_t client = event->client;
int msg_id;
switch ((esp_mqtt_event_id_t)event_id) {
@ -95,7 +95,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
}
}
static void mqtt_app_start(void)
static void mqtt_app_start()
{
esp_mqtt_client_config_t mqtt_cfg = {};
mqtt_cfg.broker.address.uri = CONFIG_BROKER_URL;
@ -111,7 +111,7 @@ static void mqtt_app_start(void)
extern "C" void app_main(void)
{
ESP_LOGI(TAG, "[APP] Startup..");
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
esp_log_level_set("*", ESP_LOG_INFO);