Commit Graph

258 Commits

Author SHA1 Message Date
Euripedes Rocha
da6d38a17e Removes pending message count
The information was used only to log remaining messages on debug log.
It was checked on writing but updated prior to every call making the
verification meaningless.
2023-04-21 08:40:12 +02:00
Euripedes Rocha
5729048683 Bugfix: Dispatch transport error on all write operations
- During connect the error wasn't dispatched.
- Merged esp_mqtt_write with mqtt_write_data since the only difference
  was the error dispatched.
2023-04-20 09:29:33 +02:00
Euripedes Rocha
72833c7f8a Merge enqueue functions
- enqueue and oversized enqueue did the same work with small differences
  this clean up the extra unnecessary function
2023-04-20 09:29:33 +02:00
yuanjianmin
5cce2c4f35 mqtt5: Fix flow control will increase count when send fragmented packet
Closes https://github.com/espressif/esp-mqtt/issues/255
2023-03-17 16:55:25 +08:00
Euripedes Rocha
32102558d3 Feature: Enable SUBSCRIBE to multiple topics
- Adds an api for multiple topics on SUBSCRIBE message.

Apply 2 suggestion(s) to 1 file(s)

Removing headers

y
2023-02-03 14:19:24 +01:00
Rocha Euripedes
e9b865eb9d Fix formatting when using printf nano 2023-02-02 20:24:24 +08:00
yuanjianmin
ed76036744 mqtt5: Fix flow control will regard the DUP packet and not consider PUBCOMP packet
Closes https://github.com/espressif/esp-mqtt/issues/243
2023-01-18 14:16:28 +08:00
Rocha Euripedes
c96f6f804c Merge branch 'bugfix/coverity_fix' into 'master'
Remove possible null pointer dereferences

See merge request espressif/esp-mqtt!157
2023-01-04 20:26:27 +08:00
Euripedes Rocha
159b1638b2 Reorganize mqtt build structure
- Integrate build definitions from idf
- Changes CMakeLists to allow import
- Added host test from idf
- Added test code from idf
2022-12-16 08:52:54 +01:00
Euripedes Rocha
f80772b8d7 Bugfix: Remove Remove possible null pointer dereferences
- Removed a possible derefrence on data in case of MQTT5 SUBACK with
  MQTT5 disabled.
- Covered a case of NULL data on message with negative size.
- Use correct type on calloc for alpn_protos
- Changed strcasecmp to strncasecmp.
2022-12-15 13:02:46 +01:00
Euripedes Rocha
d1f6ad23b7 Fix error code verification on SUBSCRIBE error
- Return codes other than 0x1, 0x2, 0x3 and 0x80 are reserved and
  forbidden by the specification.
2022-12-05 15:22:48 +01:00
Euripedes Rocha
8a6005781d Adds missing header.
- esp_heap_caps is directly needed and wasn't included.
- For target it's indirecly included but for host test it's needed.
2022-11-03 15:26:43 +01:00
Euripedes Rocha
3738fcd196 Moves state change when stopping the client
- In some situations client could be left in a state where it's
  impossible to restart due to a state change while waiting for the
  stop. This guarantee that it's possible to start after calling stop.

Closes https://github.com/espressif/esp-mqtt/issues/239
2022-10-26 14:37:28 +02:00
Euripedes Rocha
9af5c26045 Adds error code to MQTT_EVENT_SUBSCRIBED in case of failure
- Payload data parsed for error codes. Check only for first filter
  because our subscribe function only handle one topic filter in each
  call.

- Closes https://github.com/espressif/esp-mqtt/issues/233
2022-10-20 13:29:16 +02:00
Euripedes Rocha
47b3f9b899 Adds debug information on sending dup messages
- To support debug of resending dup messages QoS 1 and 2 a debug
  log was added.
2022-10-03 07:43:01 +00:00
David Cermak
97503cceb3 client: Add support for user events
Also supporting configurable queue size for the internal event loop.

Closes https://github.com/espressif/esp-mqtt/issues/230
2022-07-29 09:08:52 +02:00
Euripedes Rocha
a9a9fe76bf Adds unregister event API
- Added to enable users to unregister event handler.

 Closes https://github.com/espressif/esp-idf/issues/9194
2022-07-28 10:36:24 +00:00
Euripedes Rocha
ae53d799da Restructure the client configuration struct
- Groups configuration fields by context.
- Removes user_context in favor of the event loop.
2022-07-13 08:37:20 -03:00
Euripedes Rocha
89e5c6014f fix: MQTT tick not starting on connect and switch to esp_timer
- Tick should be updated on connect
- Dependency of system timer removed to avoid issues when updating via
  SNTP

Closes https://github.com/espressif/esp-mqtt/issues/225
2022-06-23 12:43:58 -03:00
yuanjm
fdf2aeb36f Seperate MQTT5 from MQTT 3.1.1 2022-06-14 09:37:46 +00:00
yuanjm
3d275f42b9 mqtt: Support MQTT5 protocol 2022-06-14 09:37:46 +00:00
Laukik Hase
7253211a45 mqtt_tcp: Fix build issue when MQTT_SSL is disabled 2022-06-14 13:43:45 +05:30
David Čermák
a21c387d62 Merge branch 'refactor/tcp_transport' into 'master'
mqtt_client: Added checks for cleanly-closed connection and timeout

See merge request espressif/esp-mqtt!118
2022-06-09 15:20:24 +08:00
David Čermák
7a31a555e9 Merge branch 'bugfix/fix_esp_mqtt_client_enqueue' into 'master'
mqtt_client: fix esp_mqtt_client_enqueue for len=0 (GitHub PR)

See merge request espressif/esp-mqtt!135
2022-06-08 19:33:38 +08:00
Laukik Hase
e05d873aa2 Added checks for cleanly-closed connection and timeout
- Related MR: https://gitlab.espressif.cn:6688/espressif/esp-idf/-/merge_requests/16394
2022-06-08 16:12:11 +05:30
David Cermak
9299f5400f Fix implicit malloc/free inclusion
This fails when building on host
2022-06-08 05:16:29 +00:00
Craig Kewley
69b6493423 mqtt_client: fix esp_mqtt_client_enqueue for len=0
Commit 372b323 (mqtt_client: Fix mqtt send long data error, 2021-12-21)
removed the length calculation from esp_mqtt_client_enqueue_priv and
added it to esp_mqtt_client_publish. However, esp_mqtt_client_enqueue
was missed. Currently calls to esp_mqtt_client_enqueue appear to send no
data, fix this by adding the length calculation to esp_mqtt_client_enqueue.
2022-05-30 21:56:33 +01:00
Yuan Jian Min
647e0eff32 feat(mqtt): Optimize mqtt transport list and remove unused transport 2022-05-23 22:19:24 +08:00
David Čermák
59b48a4d49 Merge branch 'bugfix/keep_alive_ping_periodic' into 'master'
Changes the moment we update keepalive_tick.

See merge request espressif/esp-mqtt!127
2022-04-19 22:16:19 +08:00
gabsuren
6b794e4708 MQTT: Fix signature matching for integer values
Closes https://github.com/espressif/esp-idf/issues/8482
2022-04-08 19:56:56 +04:00
Euripedes Rocha
2c2e6f38b5 Changes the moment we update keepalive_tick.
In order to keep sending keep alive messages in the scenario were client
publish too often with QoS0 the keepalive is updated when the response
is received.
2022-04-07 09:14:03 -03:00
AndriiFilippov
fb3184cc14 Make the mqtt submodule logging tags lower case 2022-04-04 10:33:06 +02:00
Darian Leung
6ef98d6510 Client: Remove usage of legacy FreeRTOS types 2022-01-13 00:34:53 +08:00
yuanjm
372b323535 mqtt_client: Fix mqtt send long data error
Closes https://github.com/espressif/esp-mqtt/issues/214
2021-12-21 15:31:56 +08:00
yuanjm
df8dc92870 Client: Fix use esp_mqtt_client_enqueue API to send data, data dup flag will be set 1 2021-11-26 15:52:04 +08:00
Euripedes Rocha
09287a1156 Removes redundant field on mqtt state
Client connection_info was unnecessarilly repeated. Removed from
mqtt_state and kept on mqtt_client.
2021-11-01 18:17:29 +01:00
Euripedes Rocha
1fd50dd2cb Adds a config flag to allow an empty client id
This commit covers a use case where the user can select to send an
empty user id.
2021-11-01 18:17:29 +01:00
David Cermak
3f05b1aedc Client: Fix reconnect/disconnect if auto_reconnect=off
Closes https://github.com/espressif/esp-mqtt/issues/206
2021-10-06 17:46:32 +02:00
David Cermak
86e40f8615 Send disconnect message if client asked to disconnect
https://github.com/espressif/esp-mqtt/issues/208
2021-10-06 17:46:32 +02:00
Bert Melis
de47f1c341 add payload to MQTT_EVENT_SUBSCRIBE
+ documentation
+ cleanup logging

Closes https://github.com/espressif/esp-mqtt/issues/200
Merges https://github.com/espressif/esp-mqtt/pull/203
2021-10-04 10:38:02 +02:00
Bert Melis
e1d5a9402f add qos and dup to MQTT_EVENT_DATA 2021-09-23 18:09:39 +02:00
David Čermák
89894bd0c6 Merge branch 'feature/configurable_retransmit' into 'master'
Add configurable retransmit (GitHub PR)

See merge request espressif/esp-mqtt!110
2021-09-15 18:10:50 +00:00
David Čermák
1d10608409 Merge branch 'feature/set_config_error_reporting' into 'master'
Reports config conflicts error to the user

See merge request espressif/esp-mqtt!102
2021-09-15 16:46:35 +00:00
Umer Ilyas
1b009c840b Config: Add configurable retransmit timeout
sometime user want to configure retransmit timeout due to network or other requirement

Merges https://github.com/espressif/esp-mqtt/pull/199
2021-09-15 18:43:23 +02:00
Euripedes Rocha
88f4b8ed50 Reports config conflicts error to the user
- Configuration conflicts were verified, logged but not reported to the
  user.
2021-09-15 15:09:23 +08:00
David Cermak
5b3c81ee48 Config: Fix build issue if WS/WSS transport disabled
Closes https://github.com/espressif/esp-idf/issues/7535
2021-09-10 09:15:41 +02:00
David Cermak
1b71980575 Config: Add error message if certbunde is not enabled
Merges https://github.com/espressif/esp-mqtt/pull/198
2021-09-07 15:42:11 +02:00
fractal-def
4a89bff610 Check CONFIG_MBEDTLS_CERTIFICATE_BUNDLE is set
Fixes a compilation error where `esp_transport_ssl_crt_bundle_attach` is undefined in this scenario.
2021-08-10 15:02:35 -06:00
David Čermák
026ea95338 Merge branch 'remove_outbox_cleanup_function' into 'master'
Removes unnecessary outbox_cleanup

See merge request espressif/esp-mqtt!108
2021-07-09 16:13:48 +00:00
Euripedes Rocha
ebef896b00 Removes unnecessary outbox_cleanup
The states that were cleaned by this function, CONFIRMED, are no longer reachable.
Itens were marked with this status previously in PUBCOMP and PUBREL
receive handlers.
2021-07-01 14:40:45 +01:00