#include <Subscription.hpp>
Public Types | |
typedef std::function< void(const msp::Message &)> | CallbackM |
typedef std::function< void(const T &)> | CallbackT |
Public Member Functions | |
virtual void | decode (msp::ByteVector &data) const override |
Virtual method for decoding received data. More... | |
const T & | getIoObject () const |
Gets a reference to the IO object. More... | |
virtual const msp::Message & | getMsgObject () const override |
Gets a reference to the internal IO object as a Message. More... | |
virtual void | handleResponse () const override |
Calls the receive callback if it exists. More... | |
virtual void | makeRequest () const override |
Calls the send callback if it exists. More... | |
void | setIoObject (std::unique_ptr< T > &&obj) const |
Sets the object used for packing and unpacking data. More... | |
void | setReceiveCallback (const CallbackT &recv_callback) const |
Sets the callback to be executed on success. More... | |
void | setSendCallback (const CallbackM &send_callback) const |
Sets the callback used to send the request. More... | |
Subscription () | |
Subscription constructor. More... | |
Subscription (const CallbackT &recv_callback, const CallbackM &send_callback, std::unique_ptr< T > &&io_object, const double &period=0.0) | |
Subscription constructor setting all parameters. More... | |
Public Member Functions inherited from msp::client::SubscriptionBase | |
bool | hasTimer () const |
Checks to see if the timer has been created. More... | |
bool | isAutomatic () const |
Checks to see if the subscription fires automatically. More... | |
void | setTimerFrequency (const double &rate_hz) |
setTimerFrequency change the update rate of timer More... | |
void | setTimerPeriod (const double &period_seconds) |
setTimerPeriod change the period of the timer More... | |
bool | start () const |
Start the timer for automatic execution. More... | |
bool | stop () const |
Stop the timer's automatic execution. More... | |
SubscriptionBase () | |
virtual | ~SubscriptionBase () |
Protected Attributes | |
std::unique_ptr< T > | io_object_ |
CallbackT | recv_callback_ |
CallbackM | send_callback_ |
Protected Attributes inherited from msp::client::SubscriptionBase | |
std::unique_ptr< PeriodicTimer > | timer_ |
Definition at line 88 of file Subscription.hpp.
typedef std::function<void(const msp::Message&)> msp::client::Subscription< T >::CallbackM |
Definition at line 91 of file Subscription.hpp.
typedef std::function<void(const T&)> msp::client::Subscription< T >::CallbackT |
Definition at line 90 of file Subscription.hpp.
|
inline |
Subscription constructor.
Definition at line 96 of file Subscription.hpp.
|
inline |
Subscription constructor setting all parameters.
recv_callback | Callback to execute upon receipt of message |
send_callback | Callback to execute periodically to send message |
io_object | Object which is used for encoding/decoding data |
period | Repition rate of the request |
Definition at line 105 of file Subscription.hpp.
|
inlineoverridevirtual |
Virtual method for decoding received data.
data | Data to be unpacked |
Implements msp::client::SubscriptionBase.
Definition at line 121 of file Subscription.hpp.
|
inline |
|
inlineoverridevirtual |
Gets a reference to the internal IO object as a Message.
Implements msp::client::SubscriptionBase.
Definition at line 144 of file Subscription.hpp.
|
inlineoverridevirtual |
Calls the receive callback if it exists.
Implements msp::client::SubscriptionBase.
Definition at line 159 of file Subscription.hpp.
|
inlineoverridevirtual |
Calls the send callback if it exists.
Implements msp::client::SubscriptionBase.
Definition at line 174 of file Subscription.hpp.
|
inline |
Sets the object used for packing and unpacking data.
obj | unique_ptr to a Message-derived object |
Definition at line 130 of file Subscription.hpp.
|
inline |
Sets the callback to be executed on success.
recv_callback | the callback to be executed |
Definition at line 152 of file Subscription.hpp.
|
inline |
Sets the callback used to send the request.
send_callback | the callback to be executed |
Definition at line 167 of file Subscription.hpp.
|
protected |
Definition at line 181 of file Subscription.hpp.
|
protected |
Definition at line 179 of file Subscription.hpp.
|
protected |
Definition at line 180 of file Subscription.hpp.