SensESP 3.0.0-beta.6
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::AsyncResponseHandler Class Reference

Handle async command responses from remote systems. More...

#include <sensesp/system/async_response_handler.h>

Inheritance diagram for sensesp::AsyncResponseHandler:
[legend]

Public Member Functions

 AsyncResponseHandler ()
 
 AsyncResponseHandler (int timeout)
 
void activate ()
 Activate must be called when a command is sent to the remote system.
 
void set (const bool &success) override
 
const AsyncResponseStatus get_status () const
 
- Public Member Functions inherited from sensesp::ValueConsumer< bool >
virtual void set_input (const bool &new_value)
 
void connect_from (ValueProducer< bool > *producer)
 
- Public Member Functions inherited from sensesp::ValueProducer< AsyncResponseStatus >
 ValueProducer ()
 
 ValueProducer (const AsyncResponseStatus &initial_value)
 
virtual const AsyncResponseStatusget () const
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< AsyncResponseStatus, typenameVConsumer::input_type >::value, std::shared_ptr< VConsumer > >::type connect_to (std::shared_ptr< VConsumer > consumer)
 Connect a producer to a transform with a different input type.
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< AsyncResponseStatus, typenameVConsumer::input_type >::value, VConsumer * >::type connect_to (VConsumer *consumer)
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< AsyncResponseStatus, typenameVConsumer::input_type >::value, VConsumer * >::type connect_to (VConsumer &consumer)
 
void emit (const AsyncResponseStatus &new_value)
 
- Public Member Functions inherited from sensesp::Observable
 Observable ()
 
 Observable (Observable &&other)
 Move constructor.
 
void notify ()
 
void attach (std::function< void()> observer)
 

Protected Attributes

reactesp::DelayEvent * timeout_event_ = nullptr
 
AsyncResponseStatus status_ = AsyncResponseStatus::kReady
 
String result_message_
 
int timeout_ = 3000
 
elapsedMillis elapsed_millis_
 
- Protected Attributes inherited from sensesp::ValueProducer< AsyncResponseStatus >
AsyncResponseStatus output_
 

Additional Inherited Members

- Public Types inherited from sensesp::ValueConsumer< bool >
using input_type
 

Detailed Description

Handle async command responses from remote systems.

This class is used to report responses to commands sent to a remote system. The class should consume a boolean value when a response is received. The boolean value indicates whether the command was successful or not. The response handler also emits the response status to its subscribers.

Definition at line 31 of file async_response_handler.h.

Constructor & Destructor Documentation

◆ AsyncResponseHandler() [1/2]

sensesp::AsyncResponseHandler::AsyncResponseHandler ( )
inline

Definition at line 34 of file async_response_handler.h.

◆ AsyncResponseHandler() [2/2]

sensesp::AsyncResponseHandler::AsyncResponseHandler ( int timeout)
inline

Definition at line 36 of file async_response_handler.h.

Member Function Documentation

◆ activate()

void sensesp::AsyncResponseHandler::activate ( )
inline

Activate must be called when a command is sent to the remote system.

Parameters
value

Definition at line 46 of file async_response_handler.h.

Here is the call graph for this function:

◆ get_status()

const AsyncResponseStatus sensesp::AsyncResponseHandler::get_status ( ) const
inline

Definition at line 91 of file async_response_handler.h.

◆ set()

void sensesp::AsyncResponseHandler::set ( const bool & new_value)
inlineoverridevirtual

Used to set an input of this consumer. It is called automatically by a ValueProducer but can also be called manually.

Parameters
new_valuethe value of the input

Reimplemented from sensesp::ValueConsumer< bool >.

Definition at line 67 of file async_response_handler.h.

Here is the call graph for this function:

Member Data Documentation

◆ elapsed_millis_

elapsedMillis sensesp::AsyncResponseHandler::elapsed_millis_
protected

Definition at line 98 of file async_response_handler.h.

◆ result_message_

String sensesp::AsyncResponseHandler::result_message_
protected

Definition at line 96 of file async_response_handler.h.

◆ status_

AsyncResponseStatus sensesp::AsyncResponseHandler::status_ = AsyncResponseStatus::kReady
protected

Definition at line 95 of file async_response_handler.h.

◆ timeout_

int sensesp::AsyncResponseHandler::timeout_ = 3000
protected

Definition at line 97 of file async_response_handler.h.

◆ timeout_event_

reactesp::DelayEvent* sensesp::AsyncResponseHandler::timeout_event_ = nullptr
protected

Definition at line 94 of file async_response_handler.h.


The documentation for this class was generated from the following file: