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

Holds Signal K meta data that is associated with the sk_path an SKEmitter class may optionally send to the server. According to the official Signal K specification: "All keys in the Signal K specification must have a <tt>description</tt>, and where the key is a numeric value it must have <tt>units</tt>". Thus, any paths that you output that are not already part of the official Signal K specification should have these two fields defined as metadata. More...

#include <sensesp/signalk/signalk_metadata.h>

Public Member Functions

 SKMetadata (String units, String display_name="", String description="", String short_name="", float timeout=-1.0)
 
 SKMetadata ()
 Default constructor creates a blank Metadata structure.
 
virtual void add_entry (String sk_path, JsonArray &meta)
 

Public Attributes

String display_name_
 
String units_
 
String description_
 
String short_name_
 
float timeout_
 

Detailed Description

Holds Signal K meta data that is associated with the sk_path an SKEmitter class may optionally send to the server. According to the official Signal K specification: "All keys in the Signal K specification must have a <tt>description</tt>, and where the key is a numeric value it must have <tt>units</tt>". Thus, any paths that you output that are not already part of the official Signal K specification should have these two fields defined as metadata.

Note that this structure is a subset of the complete meta model. These are the most common properties. More complex strctures can be created by creating a descendant class of SKMetadata and overriding add_entry()

See also
https://signalk.org/specification/1.5.0/doc/data_model_metadata.html
SKEmitter
SKOutput

Definition at line 24 of file signalk_metadata.h.

Constructor & Destructor Documentation

◆ SKMetadata() [1/2]

sensesp::SKMetadata::SKMetadata ( String  units,
String  display_name = "",
String  description = "",
String  short_name = "",
float  timeout = -1.0 
)
Parameters
unitsThe unit of measurement the value represents. See https://github.com/SignalK/specification/blob/master/schemas/definitions.json#L87
display_nameThis is used on or near any display or gauge which shows the data.
descriptionThis is the description for the Signal K path and must always be the same as the description property within the Signal K Schema for that path.
short_nameHuman readable name for the particular instance of this value. The short version may be used by consumers where space is at a premium
timeoutTells the consumer how long it should consider the value valid. This value is specified in seconds. Specify -1.0 if you do not want to specify a timeout.

Definition at line 5 of file signalk_metadata.cpp.

◆ SKMetadata() [2/2]

sensesp::SKMetadata::SKMetadata ( )
inline

Default constructor creates a blank Metadata structure.

Definition at line 51 of file signalk_metadata.h.

Member Function Documentation

◆ add_entry()

void sensesp::SKMetadata::add_entry ( String  sk_path,
JsonArray meta 
)
virtual

Adds an entry to the specified meta array that represents this metadata definition. The default implementation adds a single object that contains the member fields of this class as individual properties.

Parameters
[in]sk_pathThe Signal K path this metadata represents
[out]metaThe array the metadata entry is supposed to be added to

Definition at line 13 of file signalk_metadata.cpp.

Member Data Documentation

◆ description_

String sensesp::SKMetadata::description_

Definition at line 28 of file signalk_metadata.h.

◆ display_name_

String sensesp::SKMetadata::display_name_

Definition at line 26 of file signalk_metadata.h.

◆ short_name_

String sensesp::SKMetadata::short_name_

Definition at line 29 of file signalk_metadata.h.

◆ timeout_

float sensesp::SKMetadata::timeout_

Definition at line 30 of file signalk_metadata.h.

◆ units_

String sensesp::SKMetadata::units_

Definition at line 27 of file signalk_metadata.h.


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