diff --git a/CHANGELOG.md b/CHANGELOG.md index afc44a1d4..c01b5de4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 6.0.3 +* Fixed sync subscribe/unsubscribe with properties APIs dispatch to deprecated APIs problem. (#383) + ## 6.0.2 * Fixed moved from object access problem. (#378) * Fixed unexpected copy fallback of move operations. (#378) diff --git a/README.md b/README.md index b0f242392..d148037a8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MQTT client/server for C++14 based on Boost.Asio -Version 6.0.2 [![Build Status](https://travis-ci.org/redboltz/mqtt_cpp.svg?branch=master)](https://travis-ci.org/redboltz/mqtt_cpp)[![Build Status](https://dev.azure.com/redboltz/redboltz/_apis/build/status/redboltz.mqtt_cpp?branchName=master)](https://dev.azure.com/redboltz/redboltz/_build/latest?definitionId=6&branchName=master)[![codecov](https://codecov.io/gh/redboltz/mqtt_cpp/branch/master/graph/badge.svg)](https://codecov.io/gh/redboltz/mqtt_cpp) +Version 6.0.3 [![Build Status](https://travis-ci.org/redboltz/mqtt_cpp.svg?branch=master)](https://travis-ci.org/redboltz/mqtt_cpp)[![Build Status](https://dev.azure.com/redboltz/redboltz/_apis/build/status/redboltz.mqtt_cpp?branchName=master)](https://dev.azure.com/redboltz/redboltz/_build/latest?definitionId=6&branchName=master)[![codecov](https://codecov.io/gh/redboltz/mqtt_cpp/branch/master/graph/badge.svg)](https://codecov.io/gh/redboltz/mqtt_cpp) Important note https://github.com/redboltz/mqtt_cpp/wiki/News. diff --git a/include/mqtt/endpoint.hpp b/include/mqtt/endpoint.hpp index b84e3457f..c670b4cf1 100644 --- a/include/mqtt/endpoint.hpp +++ b/include/mqtt/endpoint.hpp @@ -1804,17 +1804,22 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * @return packet_id. * packet_id is automatically generated.
* You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161 */ - template packet_id_t subscribe( string_view topic_name, - std::uint8_t option) { + std::uint8_t option, + std::vector props = {} + ) { packet_id_t packet_id = acquire_unique_packet_id(); - acquired_subscribe(packet_id, topic_name, option); + acquired_subscribe(packet_id, topic_name, option, force_move(props)); return packet_id; } @@ -1855,6 +1860,10 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * @return packet_id. * packet_id is automatically generated.
* You can subscribe multiple topics all at once.
@@ -1862,9 +1871,11 @@ class endpoint : public std::enable_shared_from_this props = {} + ) { packet_id_t packet_id = acquire_unique_packet_id(); - acquired_subscribe(packet_id, topic_name, option); + acquired_subscribe(packet_id, topic_name, option, force_move(props)); return packet_id; } @@ -1905,6 +1916,10 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * @return packet_id. * packet_id is automatically generated.
* You can subscribe multiple topics all at once.
@@ -1912,9 +1927,11 @@ class endpoint : public std::enable_shared_from_this props = {} + ) { packet_id_t packet_id = acquire_unique_packet_id(); - acquired_subscribe(packet_id, force_move(topic_name), option); + acquired_subscribe(packet_id, force_move(topic_name), option, force_move(props)); return packet_id; } @@ -1997,14 +2014,20 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * @return packet_id. * packet_id is automatically generated.
* You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179 */ packet_id_t unsubscribe( - string_view topic_name) { - return unsubscribe(as::buffer(topic_name.data(), topic_name.size())); + string_view topic_name, + std::vector props = {} + ) { + return unsubscribe(as::buffer(topic_name.data(), topic_name.size()), force_move(props)); } /** @@ -2033,15 +2056,21 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * @return packet_id. * packet_id is automatically generated.
* You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179 */ packet_id_t unsubscribe( - as::const_buffer topic_name) { + as::const_buffer topic_name, + std::vector props = {} + ) { packet_id_t packet_id = acquire_unique_packet_id(); - acquired_unsubscribe(packet_id, topic_name); + acquired_unsubscribe(packet_id, topic_name, force_move(props)); return packet_id; } @@ -2073,15 +2102,21 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * @return packet_id. * packet_id is automatically generated.
* You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179 */ packet_id_t unsubscribe( - buffer topic_name) { + buffer topic_name, + std::vector props = {} + ) { packet_id_t packet_id = acquire_unique_packet_id(); - acquired_unsubscribe(packet_id, force_move(topic_name)); + acquired_unsubscribe(packet_id, force_move(topic_name), force_move(props)); return packet_id; } @@ -2581,6 +2616,10 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * @return If packet_id is used in the publishing/subscribing sequence, then returns false and * doesn't subscribe, otherwise return true and subscribes. * You can subscribe multiple topics all at once.
@@ -2589,9 +2628,11 @@ class endpoint : public std::enable_shared_from_this props = {} + ) { if (register_packet_id(packet_id)) { - acquired_subscribe(packet_id, topic_name, option); + acquired_subscribe(packet_id, topic_name, option, force_move(props)); return true; } return false; @@ -2607,6 +2648,10 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * @return If packet_id is used in the publishing/subscribing sequence, then returns false and * doesn't subscribe, otherwise return true and subscribes. * You can subscribe multiple topics all at once.
@@ -2615,9 +2660,11 @@ class endpoint : public std::enable_shared_from_this props = {} + ) { if (register_packet_id(packet_id)) { - acquired_subscribe(packet_id, topic_name, option); + acquired_subscribe(packet_id, topic_name, option, force_move(props)); return true; } return false; @@ -2740,6 +2787,10 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * @return If packet_id is used in the publishing/subscribing sequence, then returns false and * doesn't unsubscribe, otherwise return true and unsubscribes. * You can subscribe multiple topics all at once.
@@ -2747,9 +2798,11 @@ class endpoint : public std::enable_shared_from_this props = {} + ) { if (register_packet_id(packet_id)) { - acquired_unsubscribe(packet_id, topic_name); + acquired_unsubscribe(packet_id, topic_name, force_move(props)); return true; } return false; @@ -2761,6 +2814,10 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * @return If packet_id is used in the publishing/subscribing sequence, then returns false and * doesn't unsubscribe, otherwise return true and unsubscribes. * You can subscribe multiple topics all at once.
@@ -2768,9 +2825,11 @@ class endpoint : public std::enable_shared_from_this props = {} + ) { if (register_packet_id(packet_id)) { - acquired_unsubscribe(packet_id, topic_name); + acquired_unsubscribe(packet_id, topic_name, force_move(props)); return true; } return false; @@ -3430,15 +3489,21 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161
*/ void acquired_subscribe( packet_id_t packet_id, string_view topic_name, - std::uint8_t option) { + std::uint8_t option, + std::vector props = {} + ) { std::vector> params; - send_subscribe(force_move(params), packet_id, topic_name, option); + send_subscribe(force_move(params), packet_id, topic_name, option, force_move(props)); } /** @@ -3452,15 +3517,21 @@ class endpoint : public std::enable_shared_from_this * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
* 3.8.3.1 Subscription Options + * @param props + * Properties
+ * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901164
+ * 3.8.2.1 SUBSCRIBE Properties * You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901161
*/ void acquired_subscribe( packet_id_t packet_id, as::const_buffer topic_name, - std::uint8_t option) { + std::uint8_t option, + std::vector props = {} + ) { std::vector> params; - send_subscribe(force_move(params), packet_id, topic_name, option); + send_subscribe(force_move(params), packet_id, topic_name, option, force_move(props)); } /** @@ -3541,16 +3612,22 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179 */ void acquired_unsubscribe( packet_id_t packet_id, - string_view topic_name) { + string_view topic_name, + std::vector props = {} + ) { std::vector params; - send_unsubscribe(force_move(params), packet_id, topic_name); + send_unsubscribe(force_move(params), packet_id, topic_name, force_move(props)); } /** @@ -3560,16 +3637,22 @@ class endpoint : public std::enable_shared_from_this + * See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901182
+ * 3.10.2.1 UNSUBSCRIBE Properties * You can subscribe multiple topics all at once.
* See https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901179 */ void acquired_unsubscribe( packet_id_t packet_id, - as::const_buffer topic_name) { + as::const_buffer topic_name, + std::vector props = {} + ) { std::vector params; - send_unsubscribe(force_move(params), packet_id, topic_name); + send_unsubscribe(force_move(params), packet_id, topic_name, force_move(props)); } /**