TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::SignalState Class Reference

State of a modulated broadcast signal. More...

#include <tsSignalState.h>

Inheritance diagram for ts::SignalState:
Collaboration diagram for ts::SignalState:

Classes

class  Value
 Implementation of a state value. More...
 

Public Types

enum class  Unit {
  COUNTER ,
  PERCENT ,
  MDB
}
 Unit of a state value. More...
 

Public Member Functions

 SignalState ()=default
 Constructor.
 
virtual void clear ()
 Clear content, reset all values, they become "unset".
 
virtual std::ostream & display (std::ostream &strm, const UString &margin=UString(), int level=Severity::Info) const override
 Display the content of this object to a stream.
 
void setPercent (std::optional< Value > SignalState::*field, int64_t value, int64_t min, int64_t max)
 Set a percentage value from a raw driver value.
 
void toJSON (json::Object &obj) const
 Build a JSON description of this object.
 
virtual UString toString () const override
 Convert to a string object.
 

Public Attributes

std::optional< Valuebit_error_rate {}
 Bit error rate (BER).
 
std::optional< Valuepacket_error_rate {}
 Packet error rate (PER).
 
bool signal_locked = false
 Set to true when the signal is confirmed to be locked at the input of the demodulator.
 
std::optional< Valuesignal_noise_ratio {}
 Signal to noise ratio (SNR).
 
std::optional< Valuesignal_strength {}
 Signal strength.
 

Detailed Description

State of a modulated broadcast signal.

The type of information on the state of a modulated broadcast signal highly depends on the operating systems and drivers. The units also differ. The value can be in decibels or percentage. So, this structure contains many different fields which can be set or not.

Member Enumeration Documentation

◆ Unit

enum class ts::SignalState::Unit
strong

Unit of a state value.

Enumerator
COUNTER 

A raw counter value, unit is 1, whatever it means.

PERCENT 

A value from 0 to 100.

MDB 

Milli-decibel, unit of 0.001 dB.

Member Function Documentation

◆ toString()

virtual UString ts::SignalState::toString ( ) const
overridevirtual

Convert to a string object.

Returns
This object, converted as a string.

Implements ts::StringifyInterface.

◆ display()

virtual std::ostream & ts::SignalState::display ( std::ostream &  stream,
const UString margin = UString(),
int  level = Severity::Info 
) const
overridevirtual

Display the content of this object to a stream.

Parameters
[in,out]streamThe stream where to print the content. Standard output by default.
[in]marginThe prefix string on each line, empty by default.
[in]levelSeverity level (for instance, Severity::Info or Severity::Debug may display more information).
Returns
A reference to stream.

Implements ts::DisplayInterface.

◆ toJSON()

void ts::SignalState::toJSON ( json::Object obj) const

Build a JSON description of this object.

Parameters
[in,out]objJSON object into which the signal state information is added.

◆ setPercent()

void ts::SignalState::setPercent ( std::optional< Value > SignalState::*  field,
int64_t  value,
int64_t  min,
int64_t  max 
)

Set a percentage value from a raw driver value.

This method is a utility for system-specific implementations.

Parameters
[out]fieldPointer-to-member for the field to update.
[in]valueRaw value as returned by the driver. The field is set with a value from 0 to 100, based on the range min to max.
[in]minMinimum value corresponding to 0 %.
[in]maxMaximum value corresponding to 100 %.

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