AWS IoT C++ SDK
|
#include <Action.hpp>
Public Types | |
typedef std::function< std::unique_ptr< Action >(std::shared_ptr< ActionState > p_action_state)> | CreateHandlerPtr |
Public Member Functions | |
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... | |
Protected Member Functions | |
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... | |
Protected Attributes | |
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. | |
Defines a base class for SDK Actions. Provides basic template for concrete implementations. Also includes code for Thread sync with client core. All Actions that can be performed by the Client Core must inherit from this class. This is a pure virtual class and cannot be instantiated
typedef std::function<std::unique_ptr<Action>(std::shared_ptr<ActionState> p_action_state)> awsiotsdk::Action::CreateHandlerPtr |
Define a type for Create Factory method. Takes Action state as argument and returns a unique_ptr to a new action instance
awsiotsdk::Action::Action | ( | ActionType | action_type, |
util::String | action_info_string | ||
) |
action_type | - Type fo the Action being instantiated |
action_info_string | - Info string describing the action |
|
inline |
Gets runtime information about the currently running Action if it was set when the action was created
|
inline |
|
pure virtual |
This function is called by Client Core and defines how the Action is Performed. This is a pure virtual function. Inherited classes MUST implement this.
p_network_connection | - Network connection to be used to perform the Action |
p_action_data | - Action data to be used for this run of the action |
Implemented in awsiotsdk::discovery::DiscoverAction, awsiotsdk::mqtt::ConnectActionAsync, awsiotsdk::mqtt::DisconnectActionAsync, awsiotsdk::mqtt::KeepaliveActionRunner, awsiotsdk::mqtt::NetworkReadActionRunner, awsiotsdk::mqtt::PublishActionAsync, awsiotsdk::mqtt::PubackActionAsync, awsiotsdk::mqtt::SubscribeActionAsync, and awsiotsdk::mqtt::UnsubscribeActionAsync.
|
protected |
p_network_connection | - Network connection to be used to perform Read |
read_buf | - Buffer read data should be copied to. Assumed to already have enough memory reserved |
bytes_to_read | - Number of bytes to read |
|
inline |
p_thread_continue | - Pointer to the new sync variable to use |
|
protected |
p_network_connection | - Network connection to be used to perform Write |
read_buf | - Buffer containing data to be written to the network instance |