Paho C++  1.0
The Paho MQTT C++ Client Library
 All Classes Files Functions Variables Typedefs Friends
callback.h
Go to the documentation of this file.
1 
8 /*******************************************************************************
9  * Copyright (c) 2013-2016 Frank Pagliughi <fpagliughi@mindspring.com>
10  *
11  * All rights reserved. This program and the accompanying materials
12  * are made available under the terms of the Eclipse Public License v1.0
13  * and Eclipse Distribution License v1.0 which accompany this distribution.
14  *
15  * The Eclipse Public License is available at
16  * http://www.eclipse.org/legal/epl-v10.html
17  * and the Eclipse Distribution License is available at
18  * http://www.eclipse.org/org/documents/edl-v10.php.
19  *
20  * Contributors:
21  * Frank Pagliughi - initial implementation and documentation
22  *******************************************************************************/
23 
24 #ifndef __mqtt_callback_h
25 #define __mqtt_callback_h
26 
27 #include "MQTTAsync.h"
28 #include "mqtt/delivery_token.h"
29 #include "mqtt/types.h"
30 #include <vector>
31 #include <memory>
32 
33 namespace mqtt {
34 
36 
41 class callback
42 {
43 public:
45  using ptr_t = std::shared_ptr<callback>;
47  using const_ptr_t = std::shared_ptr<const callback>;
48 
52  virtual ~callback() {}
53 
58  virtual void connected(const string& cause) {}
63  virtual void connection_lost(const string& cause) {}
68  virtual void message_arrived(const_message_ptr msg) {}
74  virtual void delivery_complete(delivery_token_ptr tok) {}
75 };
76 
78 using callback_ptr = callback::ptr_t;
79 
81 using const_callback_ptr = callback::const_ptr_t;
82 
84 // end namespace mqtt
85 }
86 
87 #endif // __mqtt_callback_h
88 
std::shared_ptr< callback > ptr_t
Smart/shared pointer to an object of this type.
Definition: callback.h:45
Basic types and type conversions for the Paho MQTT C++ library.
virtual void connection_lost(const string &cause)
This method is called when the connection to the server is lost.
Definition: callback.h:63
virtual void connected(const string &cause)
This method is called when the client is connected.
Definition: callback.h:58
virtual void delivery_complete(delivery_token_ptr tok)
Called when delivery for a message has been completed, and all acknowledgments have been received...
Definition: callback.h:74
std::shared_ptr< const callback > const_ptr_t
Smart/shared pointer to a const object of this type.
Definition: callback.h:47
Provides a mechanism for tracking the completion of an asynchronous action.
Definition: callback.h:41
Declaration of MQTT delivery_token class.
virtual ~callback()
Virtual destructor.
Definition: callback.h:52
virtual void message_arrived(const_message_ptr msg)
This method is called when a message arrives from the server.
Definition: callback.h:68