AWS IoT C++ SDK
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes
awsiotsdk::mqtt::ClientState Class Reference
Inheritance diagram for awsiotsdk::mqtt::ClientState:
awsiotsdk::ClientCoreState awsiotsdk::ActionState

Public Member Functions

 ClientState (const ClientState &)=delete
 
 ClientState (ClientState &&)=delete
 
ClientStateoperator= (const ClientState &) &=delete
 
ClientStateoperator= (ClientState &&) &=delete
 
 ClientState (std::chrono::milliseconds mqtt_command_timeout)
 
bool IsSessionPresent ()
 
void SetSessionPresent (bool value)
 
bool IsConnected ()
 
void SetConnected (bool value)
 
bool IsAutoReconnectEnabled ()
 
void SetAutoReconnectEnabled (bool value)
 
bool IsAutoReconnectRequired ()
 
void SetAutoReconnectRequired (bool value)
 
bool IsPingreqPending ()
 
void SetPingreqPending (bool value)
 
bool isDisconnectCallbackPending ()
 
void setDisconnectCallbackPending (bool value)
 
virtual uint16_t GetNextPacketId ()
 
virtual uint16_t GetNextActionId ()
 Overload for Get next Action ID. More...
 
std::chrono::seconds GetKeepAliveTimeout ()
 Get duration of Keep alive interval in seconds. More...
 
void SetKeepAliveTimeout (std::chrono::seconds keep_alive_timeout)
 
std::chrono::milliseconds GetMqttCommandTimeout ()
 
void SetMqttCommandTimeout (std::chrono::milliseconds mqtt_command_timeout)
 
std::chrono::seconds GetMinReconnectBackoffTimeout ()
 
void SetMinReconnectBackoffTimeout (std::chrono::seconds min_reconnect_backoff_timeout)
 
std::chrono::seconds GetMaxReconnectBackoffTimeout ()
 
void SetMaxReconnectBackoffTimeout (std::chrono::seconds max_reconnect_backoff_timeout)
 
std::shared_ptr< ActionDataGetAutoReconnectData ()
 
void SetAutoReconnectData (std::shared_ptr< ActionData > p_connect_data)
 
std::shared_ptr< SubscriptionGetSubscription (util::String p_topic_name)
 
std::shared_ptr< SubscriptionSetSubscriptionPacketInfo (util::String p_topic_name, uint16_t packet_id, uint8_t index_in_packet)
 
ResponseCode SetSubscriptionActive (uint16_t packet_id, uint8_t index_in_sub_packet, mqtt::QoS max_qos)
 
ResponseCode RemoveSubscription (uint16_t packet_id, uint8_t index_in_sub_packet)
 
ResponseCode RemoveAllSubscriptionsForPacketId (uint16_t packet_id)
 
ResponseCode RemoveSubscription (util::String p_topic_name)
 
- Public Member Functions inherited from awsiotsdk::ClientCoreState
virtual uint16_t GetNextActionId ()
 Overload for Get next Action ID. More...
 
size_t GetMaxActionQueueSize ()
 Get current value of maximum action queue size. More...
 
void SetMaxActionQueueSize (size_t max_queue_size)
 Set max size for action queue. More...
 
std::shared_ptr< std::atomic_bool > GetCoreExecutionSyncPoint ()
 Get pointer to sync point used for execution status of the Core instance. More...
 
void SetProcessQueuedActions (bool process_queued_actions)
 Sets whether the Client is allowed to process queue actions. More...
 
bool CanProcessQueuedActions ()
 Get whether the Client can process queued actions. More...
 
void ProcessOutboundActionQueue (std::shared_ptr< std::atomic_bool > thread_task_out_sync)
 Process the outbound action queue. More...
 
ResponseCode PerformAction (ActionType action_type, std::shared_ptr< ActionData > action_data, std::chrono::milliseconds action_reponse_timeout)
 Perform Action in Blocking Mode. More...
 
ResponseCode RegisterAction (ActionType action_type, Action::CreateHandlerPtr p_action_create_handler, std::shared_ptr< ActionState > p_action_state)
 Register Action for execution by Client Core. More...
 
ResponseCode GetActionCreateHandler (ActionType action_type, Action::CreateHandlerPtr *p_action_create_handler)
 Get the Create Factory Method for the specified action type. More...
 
ResponseCode EnqueueOutboundAction (ActionType action_type, std::shared_ptr< ActionData > action_data, uint16_t &action_id_out)
 Enqueue Action for processing in Outbound Queue. More...
 
ResponseCode RegisterPendingAck (uint16_t action_id, ActionData::AsyncAckNotificationHandlerPtr p_async_ack_handler)
 Register Ack Handler for provided action id. More...
 
void DeletePendingAck (uint16_t action_id)
 Delete Ack Handler for specified Action ID. More...
 
void ForwardReceivedAck (uint16_t action_id, ResponseCode rc)
 Call registered Ack handler if it exists for specified Packet id. More...
 
void DeleteExpiredAcks ()
 Delete all expired Acks. More...
 
void ClearRegisteredActions ()
 Clears all registered Actions. More...
 
void ClearOutboundActionQueue ()
 Clears all pending outbound Actions. More...
 
 ClientCoreState ()
 Default Constructor.
 
virtual ~ClientCoreState ()
 Destructor.
 
 ClientCoreState (const ClientCoreState &)=delete
 
 ClientCoreState (ClientCoreState &&)=delete
 
ClientCoreStateoperator= (const ClientCoreState &) &=delete
 
ClientCoreStateoperator= (ClientCoreState &&) &=delete
 
- Public Member Functions inherited from awsiotsdk::ActionState
virtual uint16_t GetNextActionId ()=0
 Get Action ID of the next Action. More...
 
 ActionState (const ActionState &)=delete
 
 ActionState (ActionState &&)=delete
 
ActionStateoperator= (const ActionState &) &=delete
 
ActionStateoperator= (ActionState &&) &=delete
 

Static Public Member Functions

static std::shared_ptr< ClientStateCreate (std::chrono::milliseconds mqtt_command_timeout)
 

Data Fields

util::Map< util::String, std::shared_ptr< Subscription > > subscription_map_
 
- Data Fields inherited from awsiotsdk::ClientCoreState
ApplicationDisconnectCallbackPtr disconnect_handler_ptr_
 Pointer to the Application Disconnect Callback.
 
std::shared_ptr< DisconnectCallbackContextDatap_disconnect_app_handler_data_
 Data to be passed to the Application Handler.
 
ApplicationReconnectCallbackPtr reconnect_handler_ptr_
 Pointer to the Application Reconnect Callback.
 
std::shared_ptr< ReconnectCallbackContextDatap_reconnect_app_handler_data_
 Data to be passed to the Application Handler.
 
ApplicationResubscribeCallbackPtr resubscribe_handler_ptr_
 Pointer to the Application Resubscribe Callback.
 
std::shared_ptr< ResubscribeCallbackContextDatap_resubscribe_app_handler_data_
 Data to be passed to the Application Handler.
 
std::shared_ptr< NetworkConnectionp_network_connection_
 Network connection instance to use for this instance of the Client This is shared between Actions, public to avoid multiple shared pointer operations while passing as argument by ClientCore.
 

Protected Attributes

bool is_session_present_
 
std::atomic_bool is_connected_
 
std::atomic_bool is_auto_reconnect_enabled_
 
std::atomic_bool is_auto_reconnect_required_
 
std::atomic_bool is_pingreq_pending_
 
uint16_t last_sent_packet_id_
 
std::chrono::seconds keep_alive_timeout_
 
std::chrono::seconds min_reconnect_backoff_timeout_
 
std::chrono::seconds max_reconnect_backoff_timeout_
 
std::chrono::milliseconds mqtt_command_timeout_
 
std::shared_ptr< ActionDatap_connect_data_
 
std::atomic_bool trigger_disconnect_callback_
 
- Protected Attributes inherited from awsiotsdk::ClientCoreState
std::atomic< uint16_t > next_action_id_
 Atomic, ID of the next Action that will be enqueued.
 
std::atomic_int cur_core_threads_
 Atomic, Count of currently running core threads.
 
std::atomic_int max_hardware_threads_
 Atomic, Count of the maximum allowed hardware threads.
 
std::atomic_size_t max_queue_size_
 Atomic, Current configured max queue size.
 
std::chrono::seconds ack_timeout_
 Timeout for pending Acks, older Acks are deleted with a failed response.
 
std::mutex register_action_lock_
 Mutex for Register Action Request flow.
 
std::mutex ack_map_lock_
 Mutex for Ack Map operations.
 
std::mutex sync_action_request_lock_
 Mutex for Sync Action Request flow.
 
std::mutex sync_action_response_lock_
 Mutex for Sync Action Response flow.
 
std::condition_variable sync_action_response_wait_
 Condition variable used to wake up calling thread on Sync Action response.
 
ResponseCode sync_action_response_
 Variable to store received Sync Action response.
 
std::atomic_bool process_queued_actions_
 Atomic, indicates whether currently queued Actions should be processed or not.
 
std::shared_ptr< std::atomic_bool > continue_execution_
 Atomic, Used to synchronize running threads, false value causes running threads to stop.
 
util::Map< ActionType, std::unique_ptr< Action > > action_map_
 Map containing currently initialized Action Instances.
 
util::Map< uint16_t, std::unique_ptr< PendingAckData > > pending_ack_map_
 Map containing currently pending Acks.
 
util::Map< ActionType, Action::CreateHandlerPtraction_create_handler_map_
 Map containing currently registered Action Types and corrosponding Factories.
 
util::Queue< std::pair< ActionType, std::shared_ptr< ActionData > > > outbound_action_queue_
 Queue of outbound actions.
 

Additional Inherited Members

- Public Types inherited from awsiotsdk::ClientCoreState
typedef std::function< ResponseCode(util::String mqtt_client_id, std::shared_ptr< DisconnectCallbackContextData > p_app_handler_data)> ApplicationDisconnectCallbackPtr
 Define Handler for Disconnect Callbacks. More...
 
typedef std::function< ResponseCode(util::String mqtt_client_id, std::shared_ptr< ReconnectCallbackContextData > p_app_handler_data, ResponseCode reconnect_result)> ApplicationReconnectCallbackPtr
 Define Handler for Reconnect Callbacks. More...
 
typedef std::function< ResponseCode(util::String mqtt_client_id, std::shared_ptr< ResubscribeCallbackContextData > p_app_handler_data, ResponseCode resubscribe_result)> ApplicationResubscribeCallbackPtr
 Define Handler for Resubscribe Callbacks. More...
 
- Protected Member Functions inherited from awsiotsdk::ClientCoreState
void SyncActionHandler (uint16_t action_id, ResponseCode rc)
 Internal Action Handler for Sync Action responses. More...
 

Member Function Documentation

◆ GetKeepAliveTimeout()

std::chrono::seconds awsiotsdk::mqtt::ClientState::GetKeepAliveTimeout ( )
inline
Returns
std::chrono::seconds Keep alive interval duration

◆ GetNextActionId()

virtual uint16_t awsiotsdk::mqtt::ClientState::GetNextActionId ( )
inlinevirtual
Returns
uint16_t Action ID

Reimplemented from awsiotsdk::ClientCoreState.