hyperion.ng
Classes | Signals | Public Member Functions | Static Public Attributes | List of all members
PriorityMuxer Class Reference

The PriorityMuxer handles the priority channels. More...

#include <PriorityMuxer.h>

Inheritance diagram for PriorityMuxer:

Classes

struct  InputInfo
 The information structure for a single priority channel. More...
 

Signals

void timeRunner ()
 Signal which emits when a effect or color with timeout > -1 is running, once per second.
 
void priorityChanged (const quint8 &priority, const bool &state)
 A priority has been added (registerInput()) or deleted, method clear or timeout clear. More...
 
void visiblePriorityChanged (const quint8 &priority)
 Emits whenever the visible priority has changed. More...
 
void activeStateChanged (const quint8 &priority, const bool &state)
 Emits whenever a priority changes active state. More...
 
void autoSelectChanged (const bool &state)
 Emits whenever the auto selection state has been changed. More...
 
void prioritiesChanged (void)
 Emits whenever something changes which influences the priorities listing Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1.
 
void signalTimeTrigger ()
 internal used signal to resolve treading issues with timer
 

Public Member Functions

 PriorityMuxer (int ledCount)
 Constructs the PriorityMuxer for the given number of leds (used to switch to black when there are no priority channels. More...
 
 ~PriorityMuxer ()
 Destructor.
 
void setEnable (const bool &enable)
 Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend. More...
 
bool setSourceAutoSelectEnabled (const bool &enabel, const bool &update=true)
 Enable or disable auto source selection. More...
 
bool isSourceAutoSelectEnabled () const
 Get the state of source auto selection. More...
 
bool setPriority (const uint8_t priority)
 Overwrite current lowest piority with manual selection; On success disables aito selection. More...
 
void updateLedColorsLength (const int &ledCount)
 Update all ledColos with min length of >= 1 to fit the new led length. More...
 
int getCurrentPriority () const
 Returns the current priority. More...
 
bool hasPriority (const int priority) const
 Returns the state (enabled/disabled) of a specific priority channel. More...
 
QList< int > getPriorities () const
 Returns the number of active priorities. More...
 
const InputInfo getInputInfo (const int priority) const
 Returns the information of a specified priority channel. More...
 
void registerInput (const int priority, const hyperion::Components &component, const QString &origin="System", const QString &owner="", unsigned smooth_cfg=SMOOTHING_MODE_DEFAULT)
 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...
 
bool setInput (const int priority, const std::vector< ColorRgb > &ledColors, int64_t timeout_ms=-1)
 Update the current color of a priority (prev registered with registerInput()) More...
 
bool setInputImage (const int priority, const Image< ColorRgb > &image, int64_t timeout_ms=-1)
 Update the current image of a priority (prev registered with registerInput()) More...
 
bool setInputInactive (const quint8 &priority)
 Set the given priority to inactive. More...
 
bool clearInput (const uint8_t priority)
 Clears the specified priority channel and update _currentPriority on success. More...
 
void clearAll (bool forceClearAll=false)
 Clears all priority channels.
 

Static Public Attributes

static const int LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max()
 The lowest possible priority, which is used when no priority channels are active.
 

Detailed Description

The PriorityMuxer handles the priority channels.

Led values input/ images are written to the priority map and the muxer keeps track of all active priorities. The current priority can be queried and per priority the led colors. Handles also manual/auto selection mode, provides a lot of signals to hook into priority related events

Constructor & Destructor Documentation

§ PriorityMuxer()

PriorityMuxer::PriorityMuxer ( int  ledCount)

Constructs the PriorityMuxer for the given number of leds (used to switch to black when there are no priority channels.

Parameters
ledCountThe number of leds

Member Function Documentation

§ activeStateChanged

void PriorityMuxer::activeStateChanged ( const quint8 &  priority,
const bool &  state 
)
signal

Emits whenever a priority changes active state.

Parameters
priorityThe priority who changed the active state
stateThe new state, state true = active else false

§ autoSelectChanged

void PriorityMuxer::autoSelectChanged ( const bool &  state)
signal

Emits whenever the auto selection state has been changed.

Parameters
stateThe new state of auto selection; True enabled else false

§ clearInput()

bool PriorityMuxer::clearInput ( const uint8_t  priority)

Clears the specified priority channel and update _currentPriority on success.

Parameters
[in]priorityThe priority of the channel to clear
Returns
True if priority has been cleared else false (not found)

§ getCurrentPriority()

int PriorityMuxer::getCurrentPriority ( ) const
inline

Returns the current priority.

Returns
The current priority

§ getInputInfo()

const PriorityMuxer::InputInfo PriorityMuxer::getInputInfo ( const int  priority) const

Returns the information of a specified priority channel.

If a priority is no longer available the _lowestPriorityInfo (255) is returned

Parameters
priorityThe priority channel
Returns
The information for the specified priority channel

§ getPriorities()

QList< int > PriorityMuxer::getPriorities ( ) const

Returns the number of active priorities.

Returns
The list with active priorities

§ hasPriority()

bool PriorityMuxer::hasPriority ( const int  priority) const

Returns the state (enabled/disabled) of a specific priority channel.

Parameters
priorityThe priority channel
Returns
True if the priority channel exists else false

§ isSourceAutoSelectEnabled()

bool PriorityMuxer::isSourceAutoSelectEnabled ( ) const
inline

Get the state of source auto selection.

Returns
True if enabled, else false

§ priorityChanged

void PriorityMuxer::priorityChanged ( const quint8 &  priority,
const bool &  state 
)
signal

A priority has been added (registerInput()) or deleted, method clear or timeout clear.

Parameters
priorityThe priority which has changed
stateIf true it was added else it was removed!

§ registerInput()

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

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]ownerSpeicifc owner string, might be empty
[in]smooth_cfgThe smooth id to use

§ setEnable()

void PriorityMuxer::setEnable ( const bool &  enable)

Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend.

Parameters
enableThe new state

§ setInput()

bool PriorityMuxer::setInput ( const int  priority,
const std::vector< ColorRgb > &  ledColors,
int64_t  timeout_ms = -1 
)

Update the current color of a priority (prev registered with registerInput())

Parameters
priorityThe priority to update
ledColorsThe colors
timeout_msThe new timeout (defaults to -1 endless)
Returns
True on success, false when priority is not found

§ setInputImage()

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

Update the current image of a priority (prev registered with registerInput())

Parameters
priorityThe priority to update
imageThe new image
timeout_msThe new timeout (defaults to -1 endless)
Returns
True on success, false when priority is not found

§ setInputInactive()

bool PriorityMuxer::setInputInactive ( const quint8 &  priority)

Set the given priority to inactive.

Parameters
priorityThe priority
Returns
True on success false if not found

§ setPriority()

bool PriorityMuxer::setPriority ( const uint8_t  priority)

Overwrite current lowest piority with manual selection; On success disables aito selection.

Parameters
priorityThe
Returns
True on success, false if priority not found

§ setSourceAutoSelectEnabled()

bool PriorityMuxer::setSourceAutoSelectEnabled ( const bool &  enabel,
const bool &  update = true 
)

Enable or disable auto source selection.

Parameters
enableTrue if it should be enabled else false
updateTrue to update _currentPriority - INTERNAL usage.
Returns
True if changed has been applied, false if the state is unchanged

§ updateLedColorsLength()

void PriorityMuxer::updateLedColorsLength ( const int &  ledCount)

Update all ledColos with min length of >= 1 to fit the new led length.

Parameters
[in]ledCountThe count of leds

§ visiblePriorityChanged

void PriorityMuxer::visiblePriorityChanged ( const quint8 &  priority)
signal

Emits whenever the visible priority has changed.

Parameters
priorityThe new visible priority

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