SensESP 3.4.1-alpha
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::SKEmitter Class Reference

A class that produces Signal K output to be forwarded to the Signal K server (if the system is connected to one). Signal K is reported via the as_signalK() method. More...

#include <sensesp/signalk/signalk_emitter.h>

Inheritance diagram for sensesp::SKEmitter:
[legend]

Public Member Functions

 SKEmitter (const String &sk_path)
 
virtual ~SKEmitter ()
 
virtual void as_signalk_json (JsonDocument &doc)
 
virtual SKMetadataget_metadata ()
 
virtual void add_metadata (JsonArray &meta)
 
String & get_sk_path ()
 
void set_sk_path (const String &path)
 
- 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.
 

Static Public Member Functions

static const std::vector< SKEmitter * > & get_sources ()
 
static void clear_registry ()
 

Protected Attributes

String sk_path_ {}
 

Detailed Description

A class that produces Signal K output to be forwarded to the Signal K server (if the system is connected to one). Signal K is reported via the as_signalK() method.

Definition at line 20 of file signalk_emitter.h.

Constructor & Destructor Documentation

◆ SKEmitter()

sensesp::SKEmitter::SKEmitter ( const String &  sk_path)

The constructor

Parameters
sk_pathThe Signal K path that identifies this particular output

Definition at line 9 of file signalk_emitter.cpp.

◆ ~SKEmitter()

sensesp::SKEmitter::~SKEmitter ( )
virtual

Unregisters this emitter from the static source registry so the registry never holds a dangling pointer.

Definition at line 13 of file signalk_emitter.cpp.

Member Function Documentation

◆ add_metadata()

void sensesp::SKEmitter::add_metadata ( JsonArray &  meta)
virtual

Adds this emitter's Signal K meta data to the specified meta object. The default implementation calls the add_entry() method of the SKMetadata class returned by get_metadata(). If get_metadata() returns NULL, this method does nothing.

See also
get_metdata()

Definition at line 20 of file signalk_emitter.cpp.

Here is the call graph for this function:

◆ as_signalk_json()

◆ clear_registry()

void sensesp::SKEmitter::clear_registry ( )
static

Empties the source registry. Intended for clean app restart and test isolation; not for normal runtime use.

Definition at line 18 of file signalk_emitter.cpp.

Here is the caller graph for this function:

◆ get_metadata()

virtual SKMetadata * sensesp::SKEmitter::get_metadata ( )
inlinevirtual

Returns a Metadata structure that describes the sk_path this SKEmitter is associated with. If this emitter has no metadata, NULL is returned.

See also
add_metadata()

Reimplemented in sensesp::SKOutput< T >, and sensesp::SKOutput< String >.

Definition at line 51 of file signalk_emitter.h.

Here is the caller graph for this function:

◆ get_sk_path()

String & sensesp::SKEmitter::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 68 of file signalk_emitter.h.

Here is the caller graph for this function:

◆ get_sources()

static const std::vector< SKEmitter * > & sensesp::SKEmitter::get_sources ( )
inlinestatic

Definition at line 72 of file signalk_emitter.h.

Here is the caller graph for this function:

◆ set_sk_path()

void sensesp::SKEmitter::set_sk_path ( const String &  path)
inline

Definition at line 70 of file signalk_emitter.h.

Here is the caller graph for this function:

Member Data Documentation

◆ sk_path_

String sensesp::SKEmitter::sk_path_ {}
protected

Definition at line 81 of file signalk_emitter.h.


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