SensESP 3.4.0
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::SKListener Class Reference

An Obervable class that listens for Signal K stream deltas and notifies any observers of value changes. This serves as a base class for code that needs to listen to the stream, with the most common descendant being SKValueListener. More...

#include <sensesp/signalk/signalk_listener.h>

Inheritance diagram for sensesp::SKListener:
[legend]

Public Member Functions

 SKListener (const String &sk_path, int listen_delay, const String &config_path="")
String & get_sk_path ()
int get_listen_delay ()
virtual void parse_value (const JsonObject &json)
Public Member Functions inherited from sensesp::Observable
 Observable ()
 Observable (Observable &&other)
 Move constructor.
void notify ()
int attach (std::function< void()> observer)
 Attach an observer callback.
void detach (int id)
 Remove a previously attached observer by its ID.
Public Member Functions inherited from sensesp::FileSystemSaveable
 FileSystemSaveable (const String &config_path)
virtual bool load () override
 Load and populate the object from a persistent storage.
virtual bool save () override
 Save the object to a persistent storage.
virtual bool clear () override
 Delete the data from a persistent storage.
bool find_config_file (const String &config_path, String &filename)
Public Member Functions inherited from sensesp::Saveable
 Saveable (const String &config_path)
virtual bool refresh ()
 Refresh the object. This may or may not access the persistent storage but is not expected to overwrite the object's state.
const String & get_config_path () const

Static Public Member Functions

static const std::vector< SKListener * > & get_listeners ()
static bool take_semaphore (uint64_t timeout_ms=0)
static void release_semaphore ()

Protected Attributes

String sk_path {}
Protected Attributes inherited from sensesp::Saveable
const String config_path_

Detailed Description

An Obervable class that listens for Signal K stream deltas and notifies any observers of value changes. This serves as a base class for code that needs to listen to the stream, with the most common descendant being SKValueListener.

See also
SKValueListener

Definition at line 22 of file signalk_listener.h.

Constructor & Destructor Documentation

◆ SKListener()

sensesp::SKListener::SKListener ( const String & sk_path,
int listen_delay,
const String & config_path = "" )

The constructor

Parameters
sk_pathThe Signal K path that identifies this particular subscription to value
listen_delayHow often you want the SK Server to send the data you're subscribing to
config_pathThe optional configuration path that allows an end user to change the configuration of this object. See the Configurable class for more information.

Definition at line 13 of file signalk_listener.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ get_listen_delay()

int sensesp::SKListener::get_listen_delay ( )
inline

Definition at line 44 of file signalk_listener.h.

◆ get_listeners()

const std::vector< SKListener * > & sensesp::SKListener::get_listeners ( )
inlinestatic

Definition at line 48 of file signalk_listener.h.

Here is the caller graph for this function:

◆ get_sk_path()

String & sensesp::SKListener::get_sk_path ( )
inline

Returns the current Signal K path. An empty string is returned if this particular source is not configured or intended to return actual data.

Definition at line 42 of file signalk_listener.h.

Here is the caller graph for this function:

◆ parse_value()

virtual void sensesp::SKListener::parse_value ( const JsonObject & json)
inlinevirtual

Reimplemented in sensesp::SKValueListener< T >, sensesp::SKValueListener< bool >, sensesp::SKValueListener< float >, sensesp::SKValueListener< int >, and sensesp::SKValueListener< String >.

Definition at line 46 of file signalk_listener.h.

Here is the caller graph for this function:

◆ release_semaphore()

void sensesp::SKListener::release_semaphore ( )
static

Definition at line 30 of file signalk_listener.cpp.

Here is the caller graph for this function:

◆ take_semaphore()

bool sensesp::SKListener::take_semaphore ( uint64_t timeout_ms = 0)
static

Definition at line 22 of file signalk_listener.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ sk_path

String sensesp::SKListener::sk_path {}
protected

Definition at line 54 of file signalk_listener.h.


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