Skip to content

shell: mqtt: use topic levels #92677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/releases/migration-guide-4.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ Networking
Other subsystems
****************

Shell
=====

* The MQTT topics related to :kconfig:option:`SHELL_BACKEND_MQTT` have been renamed. Renamed
``<device_id>_rx`` to ``<device_id>/sh/rx`` and ``<device_id>_tx`` to ``<device_id>/sh/rx``.
(:github:`92677`).

Modules
*******

Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/shell/shell_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C" {
#define SH_MQTT_BUFFER_SIZE 64
#define DEVICE_ID_BIN_MAX_SIZE 3
#define DEVICE_ID_HEX_MAX_SIZE ((DEVICE_ID_BIN_MAX_SIZE * 2) + 1)
#define SH_MQTT_TOPIC_MAX_SIZE DEVICE_ID_HEX_MAX_SIZE + 3
#define SH_MQTT_TOPIC_MAX_SIZE DEVICE_ID_HEX_MAX_SIZE + 6 /* /sh/rx */

extern const struct shell_transport_api shell_mqtt_transport_api;

Expand Down
4 changes: 2 additions & 2 deletions subsys/shell/backends/shell_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ static int init(const struct shell_transport *transport, const void *config,

LOG_DBG("Client ID is %s", sh->device_id);

(void)snprintf(sh->pub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s_tx", sh->device_id);
(void)snprintf(sh->sub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s_rx", sh->device_id);
(void)snprintf(sh->pub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s/sh/tx", sh->device_id);
(void)snprintf(sh->sub_topic, SH_MQTT_TOPIC_MAX_SIZE, "%s/sh/rx", sh->device_id);

ring_buf_init(&sh->rx_rb, RX_RB_SIZE, sh->rx_rb_buf);

Expand Down