Loading...
Searching...
No Matches
iasync_client.h
Go to the documentation of this file.
/*******************************************************************************
* Copyright (c) 2013-2016 Frank Pagliughi <fpagliughi@mindspring.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v20.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Frank Pagliughi - initial implementation and documentation
*******************************************************************************/
#ifndef __mqtt_iasync_client_h
#define __mqtt_iasync_client_h
#include <vector>
#include "mqtt/callback.h"
#include "mqtt/connect_options.h"
#include "mqtt/delivery_token.h"
#include "mqtt/disconnect_options.h"
#include "mqtt/event.h"
#include "mqtt/exception.h"
#include "mqtt/iaction_listener.h"
#include "mqtt/iclient_persistence.h"
#include "mqtt/message.h"
#include "mqtt/subscribe_options.h"
#include "mqtt/token.h"
#include "mqtt/types.h"
namespace mqtt {
class iasync_client
{
friend class token;
virtual void remove_token(token* tok) = 0;
public:
using qos_collection = std::vector<int>;
virtual ~iasync_client() {}
virtual token_ptr connect() = 0;
virtual token_ptr connect(connect_options options) = 0;
virtual token_ptr connect(
connect_options options, void* userContext, iaction_listener& cb
) = 0;
virtual token_ptr connect(void* userContext, iaction_listener& cb) = 0;
virtual token_ptr reconnect() = 0;
virtual token_ptr disconnect() = 0;
virtual token_ptr disconnect(disconnect_options opts) = 0;
virtual token_ptr disconnect(int timeout) = 0;
virtual token_ptr disconnect(int timeout, void* userContext, iaction_listener& cb) = 0;
virtual token_ptr disconnect(void* userContext, iaction_listener& cb) = 0;
virtual delivery_token_ptr get_pending_delivery_token(int msgID) const = 0;
virtual std::vector<delivery_token_ptr> get_pending_delivery_tokens() const = 0;
virtual string get_client_id() const = 0;
virtual string get_server_uri() const = 0;
virtual bool is_connected() const = 0;
virtual delivery_token_ptr publish(
string_ref topic, const void* payload, size_t n, int qos, bool retained,
const properties& props = properties()
) = 0;
virtual delivery_token_ptr publish(string_ref topic, const void* payload, size_t n) = 0;
virtual delivery_token_ptr publish(
string_ref topic, const void* payload, size_t n, int qos, bool retained,
void* userContext, iaction_listener& cb
) = 0;
virtual delivery_token_ptr publish(
string_ref topic, binary_ref payload, int qos, bool retained,
const properties& props = properties()
) = 0;
virtual delivery_token_ptr publish(string_ref topic, binary_ref payload) = 0;
virtual delivery_token_ptr publish(const_message_ptr msg) = 0;
virtual delivery_token_ptr publish(
const_message_ptr msg, void* userContext, iaction_listener& cb
) = 0;
virtual void set_callback(callback& cb) = 0;
virtual void disable_callbacks() = 0;
virtual token_ptr subscribe(
const string& topicFilter, int qos,
const subscribe_options& opts = subscribe_options(),
const properties& props = properties()
) = 0;
virtual token_ptr subscribe(
const string& topicFilter, int qos, void* userContext, iaction_listener& callback,
const subscribe_options& opts = subscribe_options(),
const properties& props = properties()
) = 0;
virtual token_ptr subscribe(
const_string_collection_ptr topicFilters, const qos_collection& qos,
const std::vector<subscribe_options>& opts = std::vector<subscribe_options>(),
const properties& props = properties()
) = 0;
virtual token_ptr subscribe(
const_string_collection_ptr topicFilters, const qos_collection& qos,
void* userContext, iaction_listener& callback,
const std::vector<subscribe_options>& opts = std::vector<subscribe_options>(),
const properties& props = properties()
) = 0;
virtual token_ptr unsubscribe(
const string& topicFilter, const properties& props = properties()
) = 0;
virtual token_ptr unsubscribe(
const_string_collection_ptr topicFilters, const properties& props = properties()
) = 0;
virtual token_ptr unsubscribe(
const_string_collection_ptr topicFilters, void* userContext, iaction_listener& cb,
const properties& props = properties()
) = 0;
virtual token_ptr unsubscribe(
const string& topicFilter, void* userContext, iaction_listener& cb,
const properties& props = properties()
) = 0;
virtual void start_consuming() = 0;
virtual void stop_consuming() = 0;
virtual void clear_consumer() {}
virtual bool consumer_closed() noexcept { return false; }
virtual bool consumer_done() noexcept { return false; }
virtual std::size_t consumer_queue_size() const { return 0; }
virtual const_message_ptr consume_message() = 0;
virtual bool try_consume_message(const_message_ptr* msg) = 0;
virtual event consume_event() { return event{}; }
virtual bool try_consume_event(event* evt) {
(void)evt;
return false;
}
};
} // namespace mqtt
#endif // __mqtt_iasync_client_h
callback.h
mqtt::callback
Definition callback.h:43
mqtt::connect_options
Definition connect_options.h:50
mqtt::disconnect_options
Definition disconnect_options.h:41
mqtt::event
Definition event.h:87
mqtt::iaction_listener
Definition iaction_listener.h:50
mqtt::iasync_client
Definition iasync_client.h:60
mqtt::iasync_client::consume_event
virtual event consume_event()
Definition iasync_client.h:501
mqtt::iasync_client::clear_consumer
virtual void clear_consumer()
Definition iasync_client.h:457
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(const_message_ptr msg, void *userContext, iaction_listener &cb)=0
mqtt::iasync_client::disable_callbacks
virtual void disable_callbacks()=0
mqtt::iasync_client::start_consuming
virtual void start_consuming()=0
mqtt::iasync_client::get_server_uri
virtual string get_server_uri() const =0
mqtt::iasync_client::get_pending_delivery_tokens
virtual std::vector< delivery_token_ptr > get_pending_delivery_tokens() const =0
mqtt::iasync_client::consumer_closed
virtual bool consumer_closed() noexcept
Definition iasync_client.h:465
mqtt::iasync_client::try_consume_message
virtual bool try_consume_message(const_message_ptr *msg)=0
mqtt::iasync_client::connect
virtual token_ptr connect()=0
mqtt::iasync_client::unsubscribe
virtual token_ptr unsubscribe(const_string_collection_ptr topicFilters, const properties &props=properties())=0
mqtt::iasync_client::is_connected
virtual bool is_connected() const =0
mqtt::iasync_client::consume_message
virtual const_message_ptr consume_message()=0
mqtt::iasync_client::connect
virtual token_ptr connect(connect_options options, void *userContext, iaction_listener &cb)=0
mqtt::iasync_client::try_consume_event
virtual bool try_consume_event(event *evt)
Definition iasync_client.h:508
mqtt::iasync_client::unsubscribe
virtual token_ptr unsubscribe(const_string_collection_ptr topicFilters, void *userContext, iaction_listener &cb, const properties &props=properties())=0
mqtt::iasync_client::~iasync_client
virtual ~iasync_client()
Definition iasync_client.h:71
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(string_ref topic, const void *payload, size_t n, int qos, bool retained, void *userContext, iaction_listener &cb)=0
mqtt::iasync_client::unsubscribe
virtual token_ptr unsubscribe(const string &topicFilter, void *userContext, iaction_listener &cb, const properties &props=properties())=0
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(string_ref topic, const void *payload, size_t n)=0
mqtt::iasync_client::get_pending_delivery_token
virtual delivery_token_ptr get_pending_delivery_token(int msgID) const =0
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(string_ref topic, binary_ref payload, int qos, bool retained, const properties &props=properties())=0
mqtt::iasync_client::consumer_queue_size
virtual std::size_t consumer_queue_size() const
Definition iasync_client.h:482
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(const_message_ptr msg)=0
mqtt::iasync_client::stop_consuming
virtual void stop_consuming()=0
mqtt::iasync_client::subscribe
virtual token_ptr subscribe(const_string_collection_ptr topicFilters, const qos_collection &qos, const std::vector< subscribe_options > &opts=std::vector< subscribe_options >(), const properties &props=properties())=0
mqtt::iasync_client::consumer_done
virtual bool consumer_done() noexcept
Definition iasync_client.h:473
mqtt::iasync_client::unsubscribe
virtual token_ptr unsubscribe(const string &topicFilter, const properties &props=properties())=0
mqtt::iasync_client::connect
virtual token_ptr connect(void *userContext, iaction_listener &cb)=0
mqtt::iasync_client::get_client_id
virtual string get_client_id() const =0
mqtt::iasync_client::subscribe
virtual token_ptr subscribe(const_string_collection_ptr topicFilters, const qos_collection &qos, void *userContext, iaction_listener &callback, const std::vector< subscribe_options > &opts=std::vector< subscribe_options >(), const properties &props=properties())=0
mqtt::iasync_client::disconnect
virtual token_ptr disconnect(disconnect_options opts)=0
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(string_ref topic, const void *payload, size_t n, int qos, bool retained, const properties &props=properties())=0
mqtt::iasync_client::set_callback
virtual void set_callback(callback &cb)=0
mqtt::iasync_client::disconnect
virtual token_ptr disconnect(void *userContext, iaction_listener &cb)=0
mqtt::iasync_client::subscribe
virtual token_ptr subscribe(const string &topicFilter, int qos, void *userContext, iaction_listener &callback, const subscribe_options &opts=subscribe_options(), const properties &props=properties())=0
mqtt::iasync_client::reconnect
virtual token_ptr reconnect()=0
mqtt::iasync_client::publish
virtual delivery_token_ptr publish(string_ref topic, binary_ref payload)=0
mqtt::iasync_client::connect
virtual token_ptr connect(connect_options options)=0
mqtt::iasync_client::subscribe
virtual token_ptr subscribe(const string &topicFilter, int qos, const subscribe_options &opts=subscribe_options(), const properties &props=properties())=0
mqtt::iasync_client::token
friend class token
Definition iasync_client.h:61
mqtt::iasync_client::qos_collection
std::vector< int > qos_collection
Definition iasync_client.h:66
mqtt::iasync_client::disconnect
virtual token_ptr disconnect(int timeout, void *userContext, iaction_listener &cb)=0
mqtt::iasync_client::disconnect
virtual token_ptr disconnect()=0
mqtt::iasync_client::disconnect
virtual token_ptr disconnect(int timeout)=0
mqtt::properties
Definition properties.h:293
mqtt::subscribe_options
Definition subscribe_options.h:49
mqtt::topic
Definition topic.h:54
connect_options.h
delivery_token.h
disconnect_options.h
event.h
exception.h
iaction_listener.h
iclient_persistence.h
message.h
mqtt
Definition async_client.h:60
mqtt::binary_ref
buffer_ref< char > binary_ref
Definition buffer_ref.h:305
mqtt::delivery_token_ptr
delivery_token::ptr_t delivery_token_ptr
Definition delivery_token.h:127
mqtt::token_ptr
token::ptr_t token_ptr
Definition token.h:513
mqtt::const_string_collection_ptr
string_collection::const_ptr_t const_string_collection_ptr
Definition string_collection.h:259
mqtt::const_message_ptr
message::const_ptr_t const_message_ptr
Definition message.h:372
mqtt::string_ref
buffer_ref< char > string_ref
Definition buffer_ref.h:297
subscribe_options.h
token.h
types.h