AWS IoT C++ SDK
|
Define a class for NetworkReadActionRunner. More...
#include <NetworkRead.hpp>
Public Member Functions | |
NetworkReadActionRunner (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 Network Read Action in Async mode. 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 Member Functions | |
ResponseCode | DecodeRemainingLength (size_t &rem_len) |
Decode Remaining length from MQTT packet. More... | |
ResponseCode | ReadPacketFromNetwork (unsigned char &fixed_header_byte, util::Vector< unsigned char > &read_buf) |
Read MQTT Packet from buffer. More... | |
ResponseCode | HandleConnack (const util::Vector< unsigned char > &read_buf) |
Handle MQTT Connack packet. More... | |
ResponseCode | HandlePublish (const util::Vector< unsigned char > &read_buf, bool is_duplicate, bool is_retained, QoS qos) |
Handle MQTT Publish packet. More... | |
ResponseCode | HandlePuback (const util::Vector< unsigned char > &read_buf) |
Handle MQTT Puback packet. More... | |
ResponseCode | HandleSuback (const util::Vector< unsigned char > &read_buf) |
Handle MQTT Suback packet. More... | |
ResponseCode | HandleUnsuback (const util::Vector< unsigned char > &read_buf) |
Handle MQTT Unsuback packet. More... | |
![]() | |
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 | |
std::shared_ptr< ClientState > | p_client_state_ |
Shared Client State instance. | |
std::shared_ptr< NetworkConnection > | p_network_connection_ |
Shared Network Connection instance. | |
std::atomic_bool | is_waiting_for_connack_ |
Is this waiting for connack? | |
![]() | |
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 |
This class defines an Asynchronous action for performing a MQTT Read operation Can run both as a one time operation as well as in a separate thread
awsiotsdk::mqtt::NetworkReadActionRunner::NetworkReadActionRunner | ( | std::shared_ptr< ClientState > | p_client_state | ) |
p_client_state | - Shared Client State instance |
|
static |
p_client_state | - Shared Client State instance |
|
protected |
rem_len | reference in which to store decoded length |
|
protected |
read_buf | Reference to string buffer containing the MQTT Connack payload |
|
protected |
read_buf | Reference to string buffer containing the MQTT Puback payload |
|
protected |
read_buf | Reference to string buffer containing the MQTT Publish payload |
is_duplicate | MQTT Is Duplicate message flag |
is_retained | MQTT Is retained flag |
qos | QoS of received Publish message |
|
protected |
read_buf | Reference to string buffer containing the MQTT Suback payload |
|
protected |
read_buf | Reference to string buffer containing the MQTT Unsuback payload |
|
virtual |
Performs a Network read to see if there is any incoming MQTT packet in the provided Network Connection's Read buffer. Can be run as a one time operation or as a Client Core thread.
p_network_connection | - Network connection instance to use for performing this action |
p_action_data | - Action data specific to this execution of the Action |
Implements awsiotsdk::Action.
|
protected |
fixed_header_byte | Reference to string in which Fixed header byte should be stored |
read_buf | Reference to string in which the rest of the packet should be stored |