hyperion.ng/include/utils/Components.h

90 lines
2.6 KiB
C
Raw Normal View History

#pragma once
#include <QString>
namespace hyperion
{
2018-12-27 23:11:32 +01:00
/**
* Enumeration of components in Hyperion.
*/
enum Components
{
COMP_INVALID,
2018-12-27 23:11:32 +01:00
COMP_ALL,
COMP_SMOOTHING,
COMP_BLACKBORDER,
COMP_FORWARDER,
COMP_UDPLISTENER,
COMP_BOBLIGHTSERVER,
COMP_GRABBER,
COMP_V4L,
COMP_COLOR,
2018-12-27 23:11:32 +01:00
COMP_IMAGE,
COMP_EFFECT,
COMP_LEDDEVICE,
COMP_FLATBUFSERVER
};
inline const char* componentToString(Components c)
{
switch (c)
{
2018-12-27 23:11:32 +01:00
case COMP_ALL: return "Hyperion";
case COMP_SMOOTHING: return "Smoothing";
case COMP_BLACKBORDER: return "Blackborder detector";
case COMP_FORWARDER: return "Json/Proto forwarder";
case COMP_UDPLISTENER: return "UDP listener";
case COMP_BOBLIGHTSERVER:return "Boblight server";
case COMP_GRABBER: return "Framegrabber";
case COMP_V4L: return "V4L capture device";
case COMP_COLOR: return "Solid color";
case COMP_EFFECT: return "Effect";
2018-12-27 23:11:32 +01:00
case COMP_IMAGE: return "Image";
case COMP_LEDDEVICE: return "LED device";
case COMP_FLATBUFSERVER: return "Image Receiver";
default: return "";
}
}
inline const char* componentToIdString(Components c)
{
switch (c)
{
2018-12-27 23:11:32 +01:00
case COMP_ALL: return "ALL";
case COMP_SMOOTHING: return "SMOOTHING";
case COMP_BLACKBORDER: return "BLACKBORDER";
case COMP_FORWARDER: return "FORWARDER";
case COMP_UDPLISTENER: return "UDPLISTENER";
case COMP_BOBLIGHTSERVER:return "BOBLIGHTSERVER";
case COMP_GRABBER: return "GRABBER";
case COMP_V4L: return "V4L";
case COMP_COLOR: return "COLOR";
case COMP_EFFECT: return "EFFECT";
2018-12-27 23:11:32 +01:00
case COMP_IMAGE: return "IMAGE";
case COMP_LEDDEVICE: return "LEDDEVICE";
case COMP_FLATBUFSERVER: return "FLATBUFSERVER";
default: return "";
}
}
inline Components stringToComponent(QString component)
{
component = component.toUpper();
2018-12-27 23:11:32 +01:00
if (component == "ALL") return COMP_ALL;
if (component == "SMOOTHING") return COMP_SMOOTHING;
if (component == "BLACKBORDER") return COMP_BLACKBORDER;
if (component == "FORWARDER") return COMP_FORWARDER;
if (component == "UDPLISTENER") return COMP_UDPLISTENER;
if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
if (component == "GRABBER") return COMP_GRABBER;
if (component == "V4L") return COMP_V4L;
if (component == "COLOR") return COMP_COLOR;
if (component == "EFFECT") return COMP_EFFECT;
2018-12-27 23:11:32 +01:00
if (component == "IMAGE") return COMP_IMAGE;
if (component == "LEDDEVICE") return COMP_LEDDEVICE;
if (component == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
return COMP_INVALID;
}
}; // end of namespace