Components.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #pragma once
  2. #include <QString>
  3. #include "HyperionConfig.h"
  4. namespace hyperion
  5. {
  6. /**
  7. * Enumeration of components in Hyperion.
  8. */
  9. enum Components
  10. {
  11. COMP_INVALID,
  12. COMP_ALL,
  13. COMP_SMOOTHING,
  14. COMP_BLACKBORDER,
  15. #if defined(ENABLE_FORWARDER)
  16. COMP_FORWARDER,
  17. #endif
  18. #if defined(ENABLE_BOBLIGHT_SERVER)
  19. COMP_BOBLIGHTSERVER,
  20. #endif
  21. COMP_GRABBER,
  22. COMP_V4L,
  23. COMP_AUDIO,
  24. COMP_COLOR,
  25. COMP_IMAGE,
  26. COMP_EFFECT,
  27. COMP_LEDDEVICE,
  28. #if defined(ENABLE_FLATBUF_SERVER)
  29. COMP_FLATBUFSERVER,
  30. #endif
  31. #if defined(ENABLE_PROTOBUF_SERVER)
  32. COMP_PROTOSERVER
  33. #endif
  34. };
  35. inline const char* componentToString(Components c)
  36. {
  37. switch (c)
  38. {
  39. case COMP_ALL: return "Hyperion";
  40. case COMP_SMOOTHING: return "Smoothing";
  41. case COMP_BLACKBORDER: return "Blackborder detector";
  42. #if defined(ENABLE_FORWARDER)
  43. case COMP_FORWARDER: return "Json/Proto forwarder";
  44. #endif
  45. #if defined(ENABLE_BOBLIGHT_SERVER)
  46. case COMP_BOBLIGHTSERVER:return "Boblight server";
  47. #endif
  48. case COMP_GRABBER: return "Framegrabber";
  49. case COMP_V4L: return "V4L capture device";
  50. case COMP_AUDIO: return "Audio capture device";
  51. case COMP_COLOR: return "Solid color";
  52. case COMP_EFFECT: return "Effect";
  53. case COMP_IMAGE: return "Image";
  54. case COMP_LEDDEVICE: return "LED device";
  55. #if defined(ENABLE_FLATBUF_SERVER)
  56. case COMP_FLATBUFSERVER: return "Image Receiver";
  57. #endif
  58. #if defined(ENABLE_PROTOBUF_SERVER)
  59. case COMP_PROTOSERVER: return "Proto Server";
  60. #endif
  61. default: return "";
  62. }
  63. }
  64. inline const char* componentToIdString(Components c)
  65. {
  66. switch (c)
  67. {
  68. case COMP_ALL: return "ALL";
  69. case COMP_SMOOTHING: return "SMOOTHING";
  70. case COMP_BLACKBORDER: return "BLACKBORDER";
  71. #if defined(ENABLE_FORWARDER)
  72. case COMP_FORWARDER: return "FORWARDER";
  73. #endif
  74. #if defined(ENABLE_BOBLIGHT_SERVER)
  75. case COMP_BOBLIGHTSERVER:return "BOBLIGHTSERVER";
  76. #endif
  77. case COMP_GRABBER: return "GRABBER";
  78. case COMP_V4L: return "V4L";
  79. case COMP_AUDIO: return "AUDIO";
  80. case COMP_COLOR: return "COLOR";
  81. case COMP_EFFECT: return "EFFECT";
  82. case COMP_IMAGE: return "IMAGE";
  83. case COMP_LEDDEVICE: return "LEDDEVICE";
  84. #if defined(ENABLE_FLATBUF_SERVER)
  85. case COMP_FLATBUFSERVER: return "FLATBUFSERVER";
  86. #endif
  87. #if defined(ENABLE_PROTOBUF_SERVER)
  88. case COMP_PROTOSERVER: return "PROTOSERVER";
  89. #endif
  90. default: return "";
  91. }
  92. }
  93. inline Components stringToComponent(const QString& component)
  94. {
  95. const QString cmp = component.toUpper();
  96. if (cmp == "ALL") return COMP_ALL;
  97. if (cmp == "SMOOTHING") return COMP_SMOOTHING;
  98. if (cmp == "BLACKBORDER") return COMP_BLACKBORDER;
  99. #if defined(ENABLE_FORWARDER)
  100. if (cmp == "FORWARDER") return COMP_FORWARDER;
  101. #endif
  102. #if defined(ENABLE_BOBLIGHT_SERVER)
  103. if (cmp == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
  104. #endif
  105. if (cmp == "GRABBER") return COMP_GRABBER;
  106. if (cmp == "V4L") return COMP_V4L;
  107. if (cmp == "AUDIO") return COMP_AUDIO;
  108. if (cmp == "COLOR") return COMP_COLOR;
  109. if (cmp == "EFFECT") return COMP_EFFECT;
  110. if (cmp == "IMAGE") return COMP_IMAGE;
  111. if (cmp == "LEDDEVICE") return COMP_LEDDEVICE;
  112. #if defined(ENABLE_FLATBUF_SERVER)
  113. if (cmp == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
  114. #endif
  115. #if defined(ENABLE_PROTOBUF_SERVER)
  116. if (cmp == "PROTOSERVER") return COMP_PROTOSERVER;
  117. #endif
  118. return COMP_INVALID;
  119. }
  120. } // end of namespace