hyperion.ng
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Hyperion Class Reference

The main class of Hyperion. More...

#include <Hyperion.h>

Inheritance diagram for Hyperion:

Public Types

enum  RgbChannel {
  BLACK, WHITE, RED, GREEN,
  BLUE, CYAN, MAGENTA, YELLOW,
  INVALID
}
 RGB-Color channel enumeration.
 
typedef PriorityMuxer::InputInfo InputInfo
 Type definition of the info structure used by the priority muxer.
 

Public Slots

bool setInput (const int priority, const std::vector< ColorRgb > &ledColors, const int timeout_ms=-1, const bool &clearEffect=true)
 Update the current color of a priority (prev registered with registerInput()) DO NOT use this together with setInputImage() at the same time! More...
 
bool setInputImage (const int priority, const Image< ColorRgb > &image, int64_t timeout_ms=-1, const bool &clearEffect=true)
 Update the current image of a priority (prev registered with registerInput()) DO NOT use this together with setInput() at the same time! More...
 
bool setInputInactive (const quint8 &priority)
 Set the given priority to inactive. More...
 
void setColor (int priority, const ColorRgb &ledColor, const int timeout_ms=-1, const QString &origin="System", bool clearEffects=true)
 Writes a single color to all the leds for the given time and priority Registers comp color or provided type against muxer Should be never used to update leds continuous. More...
 
const QStringList & getAdjustmentIds () const
 Returns the list with unique adjustment identifiers. More...
 
ColorAdjustmentgetAdjustment (const QString &id)
 Returns the ColorAdjustment with the given identifier. More...
 
void adjustmentsUpdated ()
 Tell Hyperion that the corrections have changed and the leds need to be updated.
 
bool clear (int priority)
 Clears the given priority channel. More...
 
void clearall (bool forceClearAll=false)
 Clears all priority channels. More...
 
int setEffect (const QString &effectName, int priority, int timeout=-1, const QString &origin="System")
 Run the specified effect on the given priority channel and optionally specify a timeout. More...
 
int setEffect (const QString &effectName, const QJsonObject &args, int priority, int timeout=-1, const QString &pythonScript="", const QString &origin="System", const QString &imageData="")
 Run the specified effect on the given priority channel and optionally specify a timeout. More...
 
void setLedMappingType (const int &mappingType)
 sets the methode how image is maped to leds at ImageProcessor
 
void setVideoMode (const VideoMode &mode)
 Set the video mode (2D/3D) More...
 

Signals

void channelCleared (int priority)
 Signal which is emitted when a priority channel is actively cleared This signal will not be emitted when a priority channel time out.
 
void allChannelsCleared ()
 Signal which is emitted when all priority channels are actively cleared This signal will not be emitted when a priority channel time out.
 
void componentStateChanged (const hyperion::Components component, bool enabled)
 Emits whenever a user request a component state change, it's up the component to listen and update the component state at the componentRegister. More...
 
void imageToLedsMappingChanged (const int &mappingType)
 Emits whenever the imageToLedsMapping has changed. More...
 
void currentImage (const Image< ColorRgb > &image)
 Emits whenever the visible priority delivers a image which is applied in update() priorities with ledColors won't emit this signal. More...
 
void closing ()
 
void forwardJsonMessage (QJsonObject)
 Signal which is emitted, when a new json message should be forwarded.
 
void forwardSystemProtoMessage (const QString, const Image< ColorRgb >)
 Signal which is emitted, when a new system proto image should be forwarded.
 
void forwardV4lProtoMessage (const QString, const Image< ColorRgb >)
 Signal which is emitted, when a new V4l proto image should be forwarded.
 
void videoMode (const VideoMode &mode)
 Is emitted from clients who request a videoMode change.
 
void newVideoMode (const VideoMode &mode)
 A new videoMode was requested (called from Daemon!)
 
void settingsChanged (const settings::type &type, const QJsonDocument &data)
 Emits whenever a config part changed. More...
 
void adjustmentChanged ()
 Emits whenever the adjustments have been updated.
 
void effectListUpdated ()
 Signal pipe from EffectEngine to external, emits when effect list has been updated.
 
void ledDeviceData (const std::vector< ColorRgb > &ledValues)
 Emits whenever new data should be pushed to the LedDeviceWrapper which forwards it to the threaded LedDevice.
 
void rawLedColors (const std::vector< ColorRgb > &ledValues)
 Emits whenever new untransformed ledColos data is available, reflects the current visible device.
 

Public Member Functions

 ~Hyperion ()
 Destructor; cleans up resources.
 
void freeObjects (bool emitCloseSignal=false)
 free all alocated objects, should be called only from constructor or before restarting hyperion
 
EffectEnginegetEffectEngineInstance ()
 Get a pointer to the effect engine. More...
 
PriorityMuxergetMuxerInstance ()
 Get a pointer to the priorityMuxer instance. More...
 
ImageProcessorgetImageProcessor ()
 
QJsonDocument getSetting (const settings::type &type)
 Get a setting by settings::type from SettingsManager. More...
 
bool saveSettings (QJsonObject config, const bool &correct=false)
 Save a complete json config. More...
 
unsigned getLedCount () const
 Returns the number of attached leds.
 
QSize getLedGridSize () const
 Return the size of led grid.
 
int getCurrentPriority () const
 Returns the current priority. More...
 
bool isCurrentPriority (const int priority) const
 Returns true if current priority is given priority. More...
 
QList< int > getActivePriorities () const
 Returns a list of all registered priorities. More...
 
const InputInfo getPriorityInfo (const int priority) const
 Returns the information of a specific priorrity channel. More...
 
bool saveEffect (const QJsonObject &obj, QString &resultMsg)
 Save an effect. More...
 
bool deleteEffect (const QString &effectName, QString &resultMsg)
 Delete an effect by name. More...
 
const std::list< EffectDefinition > & getEffects () const
 Get the list of available effects. More...
 
const std::list< ActiveEffectDefinition > & getActiveEffects ()
 Get the list of active effects. More...
 
const std::list< EffectSchema > & getEffectSchemas ()
 Get the list of available effect schema files. More...
 
const QJsonObject & getQJsonConfig ()
 gets the current json config object from SettingsManager More...
 
QString getConfigFilePath ()
 get path+filename of configfile More...
 
QString getConfigFileName () const
 get filename of configfile More...
 
void registerInput (const int priority, const hyperion::Components &component, const QString &origin="System", const QString &owner="", unsigned smooth_cfg=0)
 Register a new input by priority, the priority is not active (timeout -100 isn't muxer recognized) until you start to update the data with setInput() A repeated call to update the base data of a known priority won't overwrite their current timeout. More...
 
void setSourceAutoSelectEnabled (bool enabled)
 enable/disable automatic/priorized source selection More...
 
bool setCurrentSourcePriority (int priority)
 set current input source to visible More...
 
bool sourceAutoSelectEnabled ()
 gets current state of automatic/priorized source selection More...
 
void setNewComponentState (const hyperion::Components &component, const bool &state)
 Called from components to update their current state. More...
 
void setComponentState (const hyperion::Components component, const bool state)
 Enable/Disable components during runtime, called from external API (requests) More...
 
ComponentRegistergetComponentRegister ()
 
bool configModified ()
 
bool configWriteable ()
 
const int & getLedMappingType ()
 gets the methode how image is maped to leds
 
const QString & getRootPath ()
 get the root path for all hyperion user data files
 
const QString & getId ()
 get unique id per instance
 
void setId (QString id)
 set unique id
 
int getLatchTime () const
 
unsigned addSmoothingConfig (int settlingTime_ms, double ledUpdateFrequency_hz=25.0, unsigned updateDelay=0)
 forward smoothing config
 
const VideoMode & getCurrentVideoMode ()
 
const QString & getActiveDevice ()
 Get the current active led device. More...
 

Static Public Member Functions

static HyperioninitInstance (HyperionDaemon *daemon, const quint8 &instance, const QString configFile, const QString rootPath)
 creates a new Hyperion instance, usually called from the Hyperion Daemon More...
 
static HyperiongetInstance ()
 Get a pointer of this Hyperion instance. More...
 

Static Public Attributes

static Hyperion_hyperion = nullptr
 

Detailed Description

The main class of Hyperion.

This gives other 'users' access to the attached LedDevice through the priority muxer.

Member Function Documentation

§ clear

bool Hyperion::clear ( int  priority)
slot

Clears the given priority channel.

This will switch the led-colors to the colors of the next lower priority channel (or off if no more channels are set)

Parameters
[in]priorityThe priority channel
Returns
True on success else false (not found)

§ clearall

void Hyperion::clearall ( bool  forceClearAll = false)
slot

Clears all priority channels.

This will switch the leds off until a new priority is written.

§ componentStateChanged

void Hyperion::componentStateChanged ( const hyperion::Components  component,
bool  enabled 
)
signal

Emits whenever a user request a component state change, it's up the component to listen and update the component state at the componentRegister.

Parameters
componentThe component from enum
enabledThe new state of the component

§ currentImage

void Hyperion::currentImage ( const Image< ColorRgb > &  image)
signal

Emits whenever the visible priority delivers a image which is applied in update() priorities with ledColors won't emit this signal.

Parameters
imageThe current image

§ deleteEffect()

bool Hyperion::deleteEffect ( const QString &  effectName,
QString &  resultMsg 
)

Delete an effect by name.

Parameters
[in]effectNameThe effect name to delete
[out]resultMsgThe message on error
Returns
True on success else false

§ getActiveDevice()

const QString & Hyperion::getActiveDevice ( )

Get the current active led device.

Returns
The device nam e

§ getActiveEffects()

const std::list< ActiveEffectDefinition > & Hyperion::getActiveEffects ( )

Get the list of active effects.

Returns
The list of active effects

§ getActivePriorities()

QList< int > Hyperion::getActivePriorities ( ) const

Returns a list of all registered priorities.

Returns
The list with priorities

§ getAdjustment

ColorAdjustment * Hyperion::getAdjustment ( const QString &  id)
slot

Returns the ColorAdjustment with the given identifier.

Returns
The adjustment with the given identifier (or nullptr if the identifier does not exist)

§ getAdjustmentIds

const QStringList & Hyperion::getAdjustmentIds ( ) const
slot

Returns the list with unique adjustment identifiers.

Returns
The list with adjustment identifiers

§ getConfigFileName()

QString Hyperion::getConfigFileName ( ) const

get filename of configfile

Returns
the current config filename

§ getConfigFilePath()

QString Hyperion::getConfigFilePath ( )
inline

get path+filename of configfile

Returns
the current config path+filename

§ getCurrentPriority()

int Hyperion::getCurrentPriority ( ) const

Returns the current priority.

Returns
The current priority

§ getEffectEngineInstance()

EffectEngine* Hyperion::getEffectEngineInstance ( )
inline

Get a pointer to the effect engine.

Returns
EffectEngine instance pointer

§ getEffects()

const std::list< EffectDefinition > & Hyperion::getEffects ( ) const

Get the list of available effects.

Returns
The list of available effects

§ getEffectSchemas()

const std::list< EffectSchema > & Hyperion::getEffectSchemas ( )

Get the list of available effect schema files.

Returns
The list of available effect schema files

§ getInstance()

Hyperion * Hyperion::getInstance ( )
static

Get a pointer of this Hyperion instance.

Returns
Hyperion instance pointer

§ getMuxerInstance()

PriorityMuxer* Hyperion::getMuxerInstance ( )
inline

Get a pointer to the priorityMuxer instance.

Returns
PriorityMuxer instance pointer

§ getPriorityInfo()

const Hyperion::InputInfo Hyperion::getPriorityInfo ( const int  priority) const

Returns the information of a specific priorrity channel.

Parameters
[in]priorityThe priority channel
Returns
The information of the given, a not found priority will return lowest priority as fallback

§ getQJsonConfig()

const QJsonObject & Hyperion::getQJsonConfig ( )

gets the current json config object from SettingsManager

Returns
json config

§ getSetting()

QJsonDocument Hyperion::getSetting ( const settings::type &  type)

Get a setting by settings::type from SettingsManager.

Parameters
typeThe settingsType from enum
Returns
Data Document

§ imageToLedsMappingChanged

void Hyperion::imageToLedsMappingChanged ( const int &  mappingType)
signal

Emits whenever the imageToLedsMapping has changed.

Parameters
mappingTypeThe new mapping type

§ initInstance()

Hyperion * Hyperion::initInstance ( HyperionDaemon daemon,
const quint8 &  instance,
const QString  configFile,
const QString  rootPath 
)
static

creates a new Hyperion instance, usually called from the Hyperion Daemon

Parameters
[in]daemonThe Hyperion daemon parent
[in]instanceThe instance id
[in]rootPathRoot path of all hyperion userdata
Returns
Hyperion instance pointer

§ isCurrentPriority()

bool Hyperion::isCurrentPriority ( const int  priority) const

Returns true if current priority is given priority.

Returns
bool

§ registerInput()

void Hyperion::registerInput ( const int  priority,
const hyperion::Components component,
const QString &  origin = "System",
const QString &  owner = "",
unsigned  smooth_cfg = 0 
)

Register a new input by priority, the priority is not active (timeout -100 isn't muxer recognized) until you start to update the data with setInput() A repeated call to update the base data of a known priority won't overwrite their current timeout.

Parameters
[in]priorityThe priority of the channel
[in]componentThe component of the channel
[in]originWho set the channel (CustomString)
[in]ownerSpecific owner string, might be empty
[in]smooth_cfgThe smooth id to use

§ saveEffect()

bool Hyperion::saveEffect ( const QJsonObject &  obj,
QString &  resultMsg 
)

Save an effect.

Parameters
objThe effect args
[out]resultMsgThe feedback message
Returns
True on success else false

§ saveSettings()

bool Hyperion::saveSettings ( QJsonObject  config,
const bool &  correct = false 
)

Save a complete json config.

Parameters
configThe entire config object
correctIf true will correct json against schema before save
Returns
True on success else false

§ setColor

void Hyperion::setColor ( int  priority,
const ColorRgb ledColor,
const int  timeout_ms = -1,
const QString &  origin = "System",
bool  clearEffects = true 
)
slot

Writes a single color to all the leds for the given time and priority Registers comp color or provided type against muxer Should be never used to update leds continuous.

Parameters
[in]priorityThe priority of the written color
[in]ledColorThe color to write to the leds
[in]originThe setter
[in]timeout_msThe time the leds are set to the given color [ms]

§ setComponentState()

void Hyperion::setComponentState ( const hyperion::Components  component,
const bool  state 
)

Enable/Disable components during runtime, called from external API (requests)

Parameters
componentThe component from enum
stateThe state of the component [true | false]

§ setCurrentSourcePriority()

bool Hyperion::setCurrentSourcePriority ( int  priority)

set current input source to visible

Parameters
prioritythe priority channel which should be vidible
Returns
true if success, false on error

§ setEffect [1/2]

int Hyperion::setEffect ( const QString &  effectName,
int  priority,
int  timeout = -1,
const QString &  origin = "System" 
)
slot

Run the specified effect on the given priority channel and optionally specify a timeout.

Parameters
effectNameName of the effec to run
priorityThe priority channel of the effect
timeoutThe timeout of the effect (after the timout, the effect will be cleared)

§ setEffect [2/2]

int Hyperion::setEffect ( const QString &  effectName,
const QJsonObject &  args,
int  priority,
int  timeout = -1,
const QString &  pythonScript = "",
const QString &  origin = "System",
const QString &  imageData = "" 
)
slot

Run the specified effect on the given priority channel and optionally specify a timeout.

Parameters
effectNameName of the effec to run
argsarguments of the effect script
priorityThe priority channel of the effect
timeoutThe timeout of the effect (after the timout, the effect will be cleared)

§ setInput

bool Hyperion::setInput ( const int  priority,
const std::vector< ColorRgb > &  ledColors,
const int  timeout_ms = -1,
const bool &  clearEffect = true 
)
slot

Update the current color of a priority (prev registered with registerInput()) DO NOT use this together with setInputImage() at the same time!

Parameters
priorityThe priority to update
ledColorsThe colors
timeout_msThe new timeout (defaults to -1 endless)
clearEffectShould be true when NOT called from an effect
Returns
True on success, false when priority is not found

§ setInputImage

bool Hyperion::setInputImage ( const int  priority,
const Image< ColorRgb > &  image,
int64_t  timeout_ms = -1,
const bool &  clearEffect = true 
)
slot

Update the current image of a priority (prev registered with registerInput()) DO NOT use this together with setInput() at the same time!

Parameters
priorityThe priority to update
imageThe new image
timeout_msThe new timeout (defaults to -1 endless)
clearEffectShould be true when NOT called from an effect
Returns
True on success, false when priority is not found

§ setInputInactive

bool Hyperion::setInputInactive ( const quint8 &  priority)
slot

Set the given priority to inactive.

Parameters
priorityThe priority
Returns
True on success false if not found

§ setNewComponentState()

void Hyperion::setNewComponentState ( const hyperion::Components component,
const bool &  state 
)

Called from components to update their current state.

DO NOT CALL FROM USERS

Parameters
[in]componentThe component from enum
[in]stateThe state of the component [true | false]

§ setSourceAutoSelectEnabled()

void Hyperion::setSourceAutoSelectEnabled ( bool  enabled)

enable/disable automatic/priorized source selection

Parameters
enabledthe state

§ settingsChanged

void Hyperion::settingsChanged ( const settings::type &  type,
const QJsonDocument &  data 
)
signal

Emits whenever a config part changed.

SIGNAL PIPE helper for SettingsManager -> HyperionDaemon

Parameters
typeThe settings type from enum
dataThe data as QJsonDocument

§ setVideoMode

void Hyperion::setVideoMode ( const VideoMode &  mode)
slot

Set the video mode (2D/3D)

Parameters
[in]modeThe new video mode

§ sourceAutoSelectEnabled()

bool Hyperion::sourceAutoSelectEnabled ( )

gets current state of automatic/priorized source selection

Returns
the state

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