AWS IoT C++ SDK
|
Define a class for KeepaliveActionRunner. More...
#include <Connect.hpp>
Public Member Functions | |
KeepaliveActionRunner (const KeepaliveActionRunner &)=delete | |
KeepaliveActionRunner (KeepaliveActionRunner &&)=delete | |
KeepaliveActionRunner & | operator= (const KeepaliveActionRunner &) &=delete |
KeepaliveActionRunner & | operator= (KeepaliveActionRunner &&) &=delete |
KeepaliveActionRunner (std::shared_ptr< ClientState > p_client_state) | |
Constructor. More... | |
ResponseCode | PerformAction (std::shared_ptr< NetworkConnection > p_network_connection, std::shared_ptr< ActionData > p_action_data) |
Perform MQTT Keep Alive Action. Expects to run in a separate thread using ClientCore. More... | |
![]() | |
ActionType | GetActionType () |
Get Type of this Action. More... | |
util::String | GetActionInfo () |
Get information/description about the current action. More... | |
void | SetParentThreadSync (std::shared_ptr< std::atomic_bool > p_thread_continue) |
Sets the parent thread sync variable. More... | |
virtual ResponseCode | PerformAction (std::shared_ptr< NetworkConnection > p_network_connection, std::shared_ptr< ActionData > p_action_data)=0 |
Virtual base function for Performing Action. More... | |
Action (const Action &)=delete | |
Action (Action &&)=delete | |
Action & | operator= (const Action &) &=delete |
Action & | operator= (Action &&) &=delete |
Action (ActionType action_type, util::String action_info_string) | |
Action Constructor. More... | |
Static Public Member Functions | |
static std::unique_ptr< Action > | Create (std::shared_ptr< ActionState > p_action_state) |
Factory Create method. More... | |
Protected Attributes | |
std::shared_ptr< ClientState > | p_client_state_ |
Shared Client State instance. | |
![]() | |
ActionType | action_type_ |
Type of the action. | |
util::String | action_info_string_ |
Info string. | |
std::shared_ptr< std::atomic_bool > | p_thread_continue_ |
Shared atomic variable used for sync when action is run in separate thread. | |
Additional Inherited Members | |
![]() | |
typedef std::function< std::unique_ptr< Action >(std::shared_ptr< ActionState > p_action_state)> | CreateHandlerPtr |
![]() | |
ResponseCode | ReadFromNetworkBuffer (std::shared_ptr< NetworkConnection > p_network_connection, util::Vector< unsigned char > &read_buf, size_t bytes_to_read) |
Generic Network Read function for all actions. More... | |
ResponseCode | WriteToNetworkBuffer (std::shared_ptr< NetworkConnection > p_network_connection, const util::String &write_buf) |
Generic Network Write function for all actions. More... | |
This class defines an action for performing a MQTT Keep Alive operation. This is meant to be run in a separate thread using ClientCore and will not do anything if called for one single execution using Perform Action.
awsiotsdk::mqtt::KeepaliveActionRunner::KeepaliveActionRunner | ( | std::shared_ptr< ClientState > | p_client_state | ) |
p_client_state | - Shared Client State instance |
|
static |
p_client_state | - Shared Client State instance |
|
virtual |
Performs the MQTT Keep Alive operation. Will send out Ping requests at Half the specified Keepalive interval and expect a response to be received before that same period passes again. If a response is not received during that time, assumes connection has been lost and initiates and performs a reconnect. Also resubscribes to any existing subscribed topics. Uses exponential backoff using minimum and maximum values defined in Client state.
p_network_connection | - Network connection instance to use for performing this action |
p_action_data | - Action data specific to this execution of the Action |
NOTE: All callbacks used by the keepalive should be non-blocking
NOTE :The resubscribe response can be NETWORK_DISCONNECTED_ERROR as the network might have disconnected again after the reconnect was successful.
Implements awsiotsdk::Action.