├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── CODING_STYLE.md ├── CompileHowto.txt ├── CompileOnOrangepi.md ├── CrossCompileHowto.txt ├── HyperionConfig.h.in ├── ISSUE_TEMPLATE ├── LICENSE ├── PULL_REQUEST_TEMPLATE ├── README.md ├── assets └── webconfig │ ├── css │ └── index.css │ ├── index.html │ ├── js │ ├── app │ │ ├── api │ │ │ ├── ChromeLocalStorage.js │ │ │ ├── ChromeNetwork.js │ │ │ ├── ChromeTcpSocket.js │ │ │ ├── LocalStorage.js │ │ │ ├── Network.js │ │ │ ├── Socket.js │ │ │ └── WebSocket.js │ │ ├── controllers │ │ │ └── AppController.js │ │ ├── data │ │ │ └── ServerControl.js │ │ ├── main.js │ │ ├── main_chrome.js │ │ ├── models │ │ │ └── Settings.js │ │ ├── utils │ │ │ └── Tools.js │ │ └── views │ │ │ ├── EffectsView.js │ │ │ ├── MainView.js │ │ │ ├── ServerList.js │ │ │ ├── SettingsView.js │ │ │ ├── Slider.js │ │ │ └── TransformView.js │ ├── background.js │ └── vendor │ │ ├── require.js │ │ ├── stapes.js │ │ └── tinycolor.js │ ├── manifest.json │ ├── manifest.webapp │ └── res │ ├── colorwheel.png │ ├── fontello.ttf │ ├── fontello.woff │ └── icon_128.png ├── bin ├── copy_binaries_to_deploy.sh ├── create_all_releases.sh ├── create_oe_depedencies.sh ├── create_release.sh ├── install_hyperion.sh ├── openelec │ ├── hyperion-remote.sh │ ├── hyperion-v4l2.sh │ └── hyperiond.sh ├── remove_hyperion.sh ├── scripts │ └── setup_hyperion_forward.sh └── service │ ├── hyperion.init.sh │ ├── hyperion.initctl.sh │ └── hyperion.systemd.sh ├── cmake ├── FindBCM.cmake ├── FindCoreFoundation.cmake ├── FindGitVersion.cmake ├── FindIOKit.cmake ├── FindPNG.cmake ├── FindUDev.cmake ├── Findlibusb-1.0.cmake ├── Toolchain-imx6.cmake ├── Toolchain-rpi.cmake ├── Toolchain-x32.cmake ├── cmake_uninstall.cmake.in ├── debian │ └── postinst ├── packages.cmake ├── qt4 │ ├── FindPackageHandleStandardArgs.cmake │ ├── FindQt4.cmake │ ├── Qt4ConfigDependentSettings.cmake │ └── Qt4Macros.cmake └── rpm │ └── postinst ├── config └── hyperion.config.json.example ├── dependencies ├── CMakeLists.txt ├── LightberryHDUSBAPA1021.1.zip ├── LightberryHDUSBAPA1021.1 │ └── LightberryHDUSBAPA1021.1.ino ├── build │ ├── getoptPlusPlus │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── Makefile │ │ ├── README │ │ ├── config.doxygen │ │ ├── getoptpp.cc │ │ └── test.cc │ ├── hidapi │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── hid-libusb.c │ │ └── hid-mac.c │ ├── jsoncpp │ │ ├── AUTHORS │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── json_batchallocator.h │ │ ├── json_internalarray.inl │ │ ├── json_internalmap.inl │ │ ├── json_reader.cpp │ │ ├── json_tool.h │ │ ├── json_value.cpp │ │ ├── json_valueiterator.inl │ │ ├── json_writer.cpp │ │ └── sconscript │ ├── serial │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── serial │ │ │ │ ├── impl │ │ │ │ ├── unix.h │ │ │ │ └── win.h │ │ │ │ ├── serial.h │ │ │ │ └── v8stdint.h │ │ └── src │ │ │ ├── impl │ │ │ ├── unix.cc │ │ │ └── win.cc │ │ │ └── serial.cc │ └── tinkerforge │ │ ├── CMakeLists.txt │ │ ├── bricklet_led_strip.c │ │ └── ip_connection.c ├── getoptPlusPlus-master-20130810.zip ├── hidapi-master-20131122.zip ├── include │ ├── getoptPlusPlus │ │ ├── getoptpp.h │ │ └── parameter.include.cc │ ├── hidapi │ │ └── hidapi.h │ ├── json │ │ ├── autolink.h │ │ ├── config.h │ │ ├── features.h │ │ ├── forwards.h │ │ ├── json.h │ │ ├── reader.h │ │ ├── value.h │ │ └── writer.h │ ├── serial │ │ ├── impl │ │ │ ├── unix.h │ │ │ └── win.h │ │ ├── serial.h │ │ └── v8stdint.h │ └── tinkerforge │ │ ├── bricklet_led_strip.h │ │ └── ip_connection.h ├── tinkerforge_c_bindings_2_0_13.zip └── wjwwood-serial-master-20131105.zip ├── doc ├── CMakeLists.txt ├── hyperion-build-doc.in.sh ├── hyperion-footer.html ├── hyperion-header.html ├── hyperion-stylesheet.css └── hyperion.in.doxygen ├── effects ├── cinema-fade-in.json ├── cinema-fade-off.json ├── fade.py ├── knight-rider.json ├── knight-rider.py ├── mood-blobs-blue.json ├── mood-blobs-cold.json ├── mood-blobs-full.json ├── mood-blobs-green.json ├── mood-blobs-red.json ├── mood-blobs-warm.json ├── mood-blobs.py ├── police-lights-single.json ├── police-lights-solid.json ├── police.py ├── rainbow-mood.json ├── rainbow-mood.py ├── rainbow-swirl-fast.json ├── rainbow-swirl.json ├── rainbow-swirl.py ├── random.json ├── random.py ├── running_dots.json ├── running_dots.py ├── shutdown.json ├── shutdown.py ├── snake.json ├── snake.py ├── sparks-color.json ├── sparks.json ├── sparks.py ├── strobe-blue.json ├── strobe-raspbmc.json ├── strobe-white.json ├── strobe.py ├── traces.json ├── traces.py ├── udp-mcast.json ├── udp.json ├── udp.py ├── x-mas.json └── x-mas.py ├── include ├── blackborder │ ├── BlackBorderDetector.h │ └── BlackBorderProcessor.h ├── boblightserver │ └── BoblightServer.h ├── bonjour │ ├── bonjourrecord.h │ └── bonjourserviceregister.h ├── effectengine │ ├── ActiveEffectDefinition.h │ ├── EffectDefinition.h │ └── EffectEngine.h ├── grabber │ ├── AmlogicGrabber.h │ ├── AmlogicWrapper.h │ ├── DispmanxFrameGrabber.h │ ├── DispmanxWrapper.h │ ├── FramebufferFrameGrabber.h │ ├── FramebufferWrapper.h │ ├── OpenCVGrabber.h │ ├── OpenCVWrapper.h │ ├── OsxFrameGrabber.h │ ├── OsxWrapper.h │ ├── V4L2Grabber.h │ ├── V4L2Wrapper.h │ ├── VideoStandard.h │ └── X11Grabber.h ├── hyperion │ ├── ColorAdjustment.h │ ├── ColorCorrection.h │ ├── ColorTransform.h │ ├── Hyperion.h │ ├── ImageProcessor.h │ ├── ImageProcessorFactory.h │ ├── ImageToLedsMap.h │ ├── LedString.h │ ├── MessageForwarder.h │ └── PriorityMuxer.h ├── jsonserver │ └── JsonServer.h ├── leddevice │ ├── LedDevice.h │ └── LedDeviceFactory.h ├── protoserver │ ├── ProtoConnection.h │ ├── ProtoConnectionWrapper.h │ └── ProtoServer.h ├── utils │ ├── ColorArgb.h │ ├── ColorBgr.h │ ├── ColorRgb.h │ ├── ColorRgba.h │ ├── ColorRgbw.h │ ├── GrabbingMode.h │ ├── HslTransform.h │ ├── HsvTransform.h │ ├── Image.h │ ├── ImageResampler.h │ ├── Logger.h │ ├── PixelFormat.h │ ├── Profiler.h │ ├── RgbChannelAdjustment.h │ ├── RgbChannelCorrection.h │ ├── RgbChannelTransform.h │ ├── RgbToRgbw.h │ ├── Sleep.h │ ├── VideoMode.h │ └── jsonschema │ │ ├── JsonFactory.h │ │ └── JsonSchemaChecker.h ├── webconfig │ └── WebConfig.h └── xbmcvideochecker │ └── XBMCVideoChecker.h ├── libsrc ├── CMakeLists.txt ├── blackborder │ ├── BlackBorderDetector.cpp │ ├── BlackBorderProcessor.cpp │ └── CMakeLists.txt ├── boblightserver │ ├── BoblightClientConnection.cpp │ ├── BoblightClientConnection.h │ ├── BoblightServer.cpp │ └── CMakeLists.txt ├── bonjour │ ├── CMakeLists.txt │ ├── bonjourserviceregister.cpp │ ├── fortuneserver.pro │ ├── main.cpp │ ├── server.cpp │ └── server.h ├── effectengine │ ├── CMakeLists.txt │ ├── Effect.cpp │ ├── Effect.h │ ├── EffectDefinition.schema.json │ ├── EffectEngine.cpp │ └── EffectEngine.qrc ├── grabber │ ├── CMakeLists.txt │ ├── amlogic │ │ ├── AmlogicGrabber.cpp │ │ ├── AmlogicWrapper.cpp │ │ └── CMakeLists.txt │ ├── dispmanx │ │ ├── CMakeLists.txt │ │ ├── DispmanxFrameGrabber.cpp │ │ └── DispmanxWrapper.cpp │ ├── framebuffer │ │ ├── CMakeLists.txt │ │ ├── FramebufferFrameGrabber.cpp │ │ └── FramebufferWrapper.cpp │ ├── opencv │ │ ├── CMakeLists.txt │ │ ├── OpenCVGrabber.cpp │ │ └── OpenCVWrapper.cpp │ ├── osx │ │ ├── CMakeLists.txt │ │ ├── OsxFrameGrabber.cpp │ │ └── OsxWrapper.cpp │ ├── v4l2 │ │ ├── CMakeLists.txt │ │ ├── V4L2Grabber.cpp │ │ └── V4L2Wrapper.cpp │ └── x11 │ │ ├── CMakeLists.txt │ │ └── X11Grabber.cpp ├── hyperion │ ├── CMakeLists.txt │ ├── Hyperion.cpp │ ├── ImageProcessor.cpp │ ├── ImageProcessorFactory.cpp │ ├── ImageToLedsMap.cpp │ ├── LedString.cpp │ ├── LinearColorSmoothing.cpp │ ├── LinearColorSmoothing.h │ ├── MessageForwarder.cpp │ ├── MultiColorAdjustment.cpp │ ├── MultiColorAdjustment.h │ ├── MultiColorCorrection.cpp │ ├── MultiColorCorrection.h │ ├── MultiColorTransform.cpp │ ├── MultiColorTransform.h │ ├── PriorityMuxer.cpp │ ├── hyperion.schema.json │ └── resource.qrc ├── jsonserver │ ├── CMakeLists.txt │ ├── JsonClientConnection.cpp │ ├── JsonClientConnection.h │ ├── JsonSchemas.qrc │ ├── JsonServer.cpp │ └── schema │ │ ├── schema-adjustment.json │ │ ├── schema-clear.json │ │ ├── schema-clearall.json │ │ ├── schema-color.json │ │ ├── schema-correction.json │ │ ├── schema-effect.json │ │ ├── schema-image.json │ │ ├── schema-serverinfo.json │ │ ├── schema-temperature.json │ │ ├── schema-transform.json │ │ └── schema.json ├── leddevice │ ├── CMakeLists.txt │ ├── LedDeviceAPA102.cpp │ ├── LedDeviceAPA102.h │ ├── LedDeviceAdalight.cpp │ ├── LedDeviceAdalight.h │ ├── LedDeviceAdalightApa102.cpp │ ├── LedDeviceAdalightApa102.h │ ├── LedDeviceAmbiLed.cpp │ ├── LedDeviceAmbiLed.h │ ├── LedDeviceAtmo.cpp │ ├── LedDeviceAtmo.h │ ├── LedDeviceAtmoOrb.cpp │ ├── LedDeviceAtmoOrb.h │ ├── LedDeviceAurora.cpp │ ├── LedDeviceAurora.h │ ├── LedDeviceFactory.cpp │ ├── LedDeviceFadeCandy.cpp │ ├── LedDeviceFadeCandy.h │ ├── LedDeviceFile.cpp │ ├── LedDeviceFile.h │ ├── LedDeviceHyperionUsbasp.cpp │ ├── LedDeviceHyperionUsbasp.h │ ├── LedDeviceLightpack-hidapi.cpp │ ├── LedDeviceLightpack-hidapi.h │ ├── LedDeviceLightpack.cpp │ ├── LedDeviceLightpack.h │ ├── LedDeviceLpd6803.cpp │ ├── LedDeviceLpd6803.h │ ├── LedDeviceLpd8806.cpp │ ├── LedDeviceLpd8806.h │ ├── LedDeviceMultiLightpack.cpp │ ├── LedDeviceMultiLightpack.h │ ├── LedDeviceP9813.cpp │ ├── LedDeviceP9813.h │ ├── LedDevicePaintpack.cpp │ ├── LedDevicePaintpack.h │ ├── LedDevicePhilipsHue.cpp │ ├── LedDevicePhilipsHue.h │ ├── LedDevicePiBlaster.cpp │ ├── LedDevicePiBlaster.h │ ├── LedDeviceRawHID.cpp │ ├── LedDeviceRawHID.h │ ├── LedDeviceSedu.cpp │ ├── LedDeviceSedu.h │ ├── LedDeviceTinkerforge.cpp │ ├── LedDeviceTinkerforge.h │ ├── LedDeviceTpm2.cpp │ ├── LedDeviceTpm2.h │ ├── LedDeviceUdp.cpp │ ├── LedDeviceUdp.h │ ├── LedDeviceUdpRaw.cpp │ ├── LedDeviceUdpRaw.h │ ├── LedDeviceWS2812b.cpp │ ├── LedDeviceWS2812b.h │ ├── LedDeviceWS281x.cpp │ ├── LedDeviceWS281x.h │ ├── LedDeviceWs2801.cpp │ ├── LedDeviceWs2801.h │ ├── LedDeviceWs2812SPI.cpp │ ├── LedDeviceWs2812SPI.h │ ├── LedHIDDevice.cpp │ ├── LedHIDDevice.h │ ├── LedRs232Device.cpp │ ├── LedRs232Device.h │ ├── LedSpiDevice.cpp │ ├── LedSpiDevice.h │ ├── LedUdpDevice.cpp │ └── LedUdpDevice.h ├── protoserver │ ├── CMakeLists.txt │ ├── ProtoClientConnection.cpp │ ├── ProtoClientConnection.h │ ├── ProtoConnection.cpp │ ├── ProtoConnectionWrapper.cpp │ ├── ProtoServer.cpp │ └── message.proto ├── utils │ ├── CMakeLists.txt │ ├── ColorArgb.cpp │ ├── ColorBgr.cpp │ ├── ColorRgb.cpp │ ├── ColorRgba.cpp │ ├── ColorRgbw.cpp │ ├── HslTransform.cpp │ ├── HsvTransform.cpp │ ├── ImageResampler.cpp │ ├── Logger.cpp │ ├── Profiler.cpp │ ├── RgbChannelAdjustment.cpp │ ├── RgbChannelCorrection.cpp │ ├── RgbChannelTransform.cpp │ ├── RgbToRgbw.cpp │ └── jsonschema │ │ └── JsonSchemaChecker.cpp ├── webconfig │ ├── CMakeLists.txt │ ├── CgiHandler.cpp │ ├── CgiHandler.h │ ├── QtHttpClientWrapper.cpp │ ├── QtHttpClientWrapper.h │ ├── QtHttpHeader.cpp │ ├── QtHttpHeader.h │ ├── QtHttpReply.cpp │ ├── QtHttpReply.h │ ├── QtHttpRequest.cpp │ ├── QtHttpRequest.h │ ├── QtHttpServer.cpp │ ├── QtHttpServer.h │ ├── StaticFileServing.cpp │ ├── StaticFileServing.h │ └── WebConfig.cpp └── xbmcvideochecker │ ├── CMakeLists.txt │ └── XBMCVideoChecker.cpp ├── src ├── CMakeLists.txt ├── hyperion-aml │ ├── AmlogicWrapper.cpp │ ├── AmlogicWrapper.h │ ├── CMakeLists.txt │ └── hyperion-aml.cpp ├── hyperion-dispmanx │ ├── CMakeLists.txt │ ├── DispmanxWrapper.cpp │ ├── DispmanxWrapper.h │ └── hyperion-dispmanx.cpp ├── hyperion-framebuffer │ ├── CMakeLists.txt │ ├── FramebufferWrapper.cpp │ ├── FramebufferWrapper.h │ └── hyperion-framebuffer.cpp ├── hyperion-osx │ ├── CMakeLists.txt │ ├── OsxWrapper.cpp │ ├── OsxWrapper.h │ └── hyperion-osx.cpp ├── hyperion-remote │ ├── CMakeLists.txt │ ├── ColorAdjustmentValues.h │ ├── ColorCorrectionValues.h │ ├── ColorTransformValues.h │ ├── CustomParameter.h │ ├── JsonConnection.cpp │ ├── JsonConnection.h │ └── hyperion-remote.cpp ├── hyperion-v4l2 │ ├── CMakeLists.txt │ ├── PixelFormatParameter.h │ ├── ScreenshotHandler.cpp │ ├── ScreenshotHandler.h │ ├── VideoStandardParameter.h │ └── hyperion-v4l2.cpp ├── hyperion-x11 │ ├── CMakeLists.txt │ ├── X11Wrapper.cpp │ ├── X11Wrapper.h │ └── hyperion-x11.cpp └── hyperiond │ ├── CMakeLists.txt │ └── hyperiond.cpp └── test ├── CMakeLists.txt ├── TestBlackBorderDetector.cpp ├── TestBlackBorderProcessor.cpp ├── TestColorTransform.cpp ├── TestConfigFile.cpp ├── TestHyperionPng.cpp ├── TestImage2LedsMap.cpp ├── TestQRegExp.cpp ├── TestQtScreenshot.cpp ├── TestRgbImage.cpp ├── TestSpi.cpp ├── TestX11Performance.cpp ├── dispmanx2png ├── CMakeLists.txt └── dispmanx2png.cpp ├── spidev_test.c └── switchPinCtrl.c /.gitignore: -------------------------------------------------------------------------------- 1 | /*.user 2 | /build* 3 | .DS_Store 4 | 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dependencies/external/protobuf"] 2 | path = dependencies/external/protobuf 3 | url = https://github.com/tvdzwan/protobuf.git 4 | [submodule "dependencies/external/rpi_ws281x"] 5 | path = dependencies/external/rpi_ws281x 6 | url = https://github.com/hyperion-project/rpi_ws281x.git 7 | branch = master 8 | -------------------------------------------------------------------------------- /CODING_STYLE.md: -------------------------------------------------------------------------------- 1 | ### Please use the following code style/guidelines 2 | 3 | - use QT wherever it's possible (except there is a good reason) 4 | - use unix line endings (not windows) 5 | - indent your code with TABs instead of spaces 6 | - follow this rule for curly brackets 7 | ``` 8 | bad: 9 | if (conditon) { 10 | code 11 | } 12 | 13 | good: 14 | if (condition) 15 | { 16 | code 17 | } 18 | 19 | ``` -------------------------------------------------------------------------------- /HyperionConfig.h.in: -------------------------------------------------------------------------------- 1 | // Generated config file 2 | 3 | // Define to enable the dispmanx grabber 4 | #cmakedefine ENABLE_DISPMANX 5 | 6 | // Define to enable the v4l2 grabber 7 | #cmakedefine ENABLE_V4L2 8 | 9 | // Define to enable the spi-device 10 | #cmakedefine ENABLE_SPIDEV 11 | 12 | // Define to enable the ws2812b-pwm-device 13 | #cmakedefine ENABLE_WS2812BPWM 14 | 15 | // Define to enable the ws281x-pwm-via-dma-device using jgarff's library 16 | #cmakedefine ENABLE_WS281XPWM 17 | 18 | // Define to enable the spi-device 19 | #cmakedefine ENABLE_TINKERFORGE 20 | 21 | // Define to enable the framebuffer grabber 22 | #cmakedefine ENABLE_FB 23 | 24 | // Define to enable the amlogic grabber 25 | #cmakedefine ENABLE_AMLOGIC 26 | 27 | // Define to enable the osx grabber 28 | #cmakedefine ENABLE_OSX 29 | 30 | // Define to enable the opencv grabber 31 | #cmakedefine ENABLE_OPENCV 32 | 33 | // Define to enable the bonjour/zeroconf publishing 34 | #cmakedefine ENABLE_ZEROCONF 35 | 36 | // Define to enable profiler for development purpose 37 | #cmakedefine ENABLE_PROFILER 38 | #cmakedefine ENABLE_QT5 39 | 40 | // the hyperion build id string 41 | #define HYPERION_VERSION_ID "${HYPERION_VERSION_ID}" 42 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE: -------------------------------------------------------------------------------- 1 | BEFORE YOU OPEN A NEW ISSUE! 2 | 3 | Search at our wiki: wiki.hyperion-project.org 4 | Our FAQ: https://hyperion-project.org/wiki/FAQ-Frequently-Asked-Questions 5 | And have a look at our forum: forum.hyperion-project.org 6 | If you need help please open a new thread their! 7 | 8 | WE PROVIDE NO SUPPORT AT GITHUB! 9 | All misleading issues will be closed without a announcement! 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014 hyperion team 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE: -------------------------------------------------------------------------------- 1 | IMPORTANT: This repository no longer accepts new features or additions. Just bugfixes! Please commit to the repository "hyperion.ng" for new features. 2 | **1.** Tell us something about your changes. 3 | **2.** If this changes affect the .conf file. Please provide the changed section 4 | **3.** Reference a issue (optional) 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # **Hyperion Classic (this git) has been discontinued. Please go to [Hyperion.NG (Next Generation)](https://github.com/hyperion-project/hyperion.ng)** 3 | 4 | HYPERION 5 | ======== 6 | 7 | Hyperion is an opensource 'AmbiLight' implementation supported by many devices. The main features of Hyperion are: 8 | * Low CPU load. For a led string of 50 leds the CPU usage will typically be below 1.5% on a non-overclocked Pi. 9 | * Json interface which allows easy integration into scripts. 10 | * A command line utility allows easy testing and configuration of the color transforms (Transformation settings are not preserved over a restart at the moment...). 11 | * Priority channels are not coupled to a specific led data provider which means that a provider can post led data and leave without the need to maintain a connection to Hyperion. This is ideal for a remote application (like our Android app). 12 | * HyperCon. A tool which helps generate a Hyperion configuration file. 13 | * Kodi-checker which checks the playing status of Kodi and decides whether or not to capture the screen. 14 | * Black border detector. 15 | * A scriptable effect engine. 16 | * Generic software architecture to support new devices and new algorithms easily. 17 | 18 | More information can be found on the official Hyperion [Wiki](https://wiki.hyperion-project.org) 19 | 20 | If you need further support please open a topic at the our new forum! 21 | [Hyperion webpage/forum](https://www.hyperion-project.org). 22 | 23 | The source is released under MIT-License (see http://opensource.org/licenses/MIT). 24 | -------------------------------------------------------------------------------- /assets/webconfig/js/app/api/ChromeLocalStorage.js: -------------------------------------------------------------------------------- 1 | /*global define, chrome */ 2 | define(['api/LocalStorage'], function (LocalStorage) { 3 | 'use strict'; 4 | return LocalStorage.subclass(/** @lends ChromeLocalStorage.prototype */{ 5 | 6 | /** 7 | * @class ChromeLocalStorage 8 | * @classdesc Chrome's persistent storage 9 | * @constructs 10 | * @extends LocalStorage 11 | */ 12 | constructor: function () { 13 | }, 14 | 15 | get: function () { 16 | chrome.storage.local.get('data', function (entry) { 17 | if (chrome.runtime.lastError) { 18 | this.emit('error', chrome.runtime.lastError.message); 19 | } else { 20 | this.emit('got', entry.data); 21 | } 22 | }.bind(this)); 23 | }, 24 | 25 | set: function (data) { 26 | var entry = {}; 27 | entry.data = data; 28 | chrome.storage.local.set(entry, function () { 29 | if (chrome.runtime.lastError) { 30 | this.emit('error', chrome.runtime.lastError.message); 31 | } else { 32 | this.emit('set'); 33 | } 34 | }.bind(this)); 35 | } 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /assets/webconfig/js/app/api/LocalStorage.js: -------------------------------------------------------------------------------- 1 | /*global define */ 2 | define(['lib/stapes'], function (Stapes) { 3 | 'use strict'; 4 | return Stapes.subclass(/** @lends LocalStorage.prototype */{ 5 | 6 | /** 7 | * @class LocalStorage 8 | * @classdesc LocalStorage handler using HTML5 localStorage 9 | * @constructs 10 | * 11 | * @fires got 12 | * @fires error 13 | * @fires set 14 | */ 15 | constructor: function () { 16 | }, 17 | 18 | /** 19 | * Gets stored data 20 | */ 21 | get: function () { 22 | var data; 23 | 24 | if (!window.localStorage) { 25 | this.emit('error', 'Local Storage not supported'); 26 | return; 27 | } 28 | 29 | if (localStorage.data) { 30 | data = JSON.parse(localStorage.data); 31 | this.emit('got', data); 32 | } 33 | }, 34 | 35 | /** 36 | * Stores settings 37 | * @param {object} data - Data object to store 38 | */ 39 | set: function (data) { 40 | if (!window.localStorage) { 41 | this.emit('error', 'Local Storage not supported'); 42 | return; 43 | } 44 | 45 | localStorage.data = JSON.stringify(data); 46 | this.emit('set'); 47 | } 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /assets/webconfig/js/background.js: -------------------------------------------------------------------------------- 1 | /*global chrome */ 2 | chrome.app.runtime.onLaunched.addListener(function () { 3 | 'use strict'; 4 | chrome.app.window.create('index.html', { 5 | 'id': 'fakeIdForSingleton', 6 | 'innerBounds': { 7 | 'width': 320, 8 | 'height': 480, 9 | 'minWidth': 320, 10 | 'minHeight': 480 11 | }, 12 | resizable: false 13 | }); 14 | }); 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /assets/webconfig/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyperion remote control", 3 | "short_name": "hyperion remote", 4 | "description": "Client side app for controlling the hyperion server over the local network.", 5 | "author": { 6 | "name": "Daniel Wiese", 7 | "email": "gamadril.dev@gmail.com" 8 | }, 9 | "manifest_version": 2, 10 | "version": "0.6.0", 11 | "minimum_chrome_version": "36", 12 | "permissions": [ 13 | "storage", "system.network" 14 | ], 15 | "app": { 16 | "background": { 17 | "scripts": ["js/background.js"] 18 | } 19 | }, 20 | "sockets": { 21 | "tcp": { 22 | "connect": "*" 23 | }, 24 | "udp": { 25 | "send": "*", 26 | "bind": "*" 27 | } 28 | }, 29 | "icons": { 30 | "128": "res/icon_128.png" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assets/webconfig/manifest.webapp: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyperion remote control", 3 | "description": "Client side app for controlling the hyperion server over the local network.", 4 | "launch_path": "/hyperion-remote/index.html", 5 | "icons": { 6 | "128": "/hyperion-remote/res/icon_128.png" 7 | }, 8 | "developer": { 9 | "name": "Daniel Wiese", 10 | "email": "gamadril.dev@gmail.com", 11 | "url": "https://github.com/Gamadril" 12 | }, 13 | "default_locale": "en" 14 | } -------------------------------------------------------------------------------- /assets/webconfig/res/colorwheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/assets/webconfig/res/colorwheel.png -------------------------------------------------------------------------------- /assets/webconfig/res/fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/assets/webconfig/res/fontello.ttf -------------------------------------------------------------------------------- /assets/webconfig/res/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/assets/webconfig/res/fontello.woff -------------------------------------------------------------------------------- /assets/webconfig/res/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/assets/webconfig/res/icon_128.png -------------------------------------------------------------------------------- /bin/copy_binaries_to_deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$#" -ne 2 ] || ! [ -d "$1" ] || ! [ -d "$2" ]; then 4 | echo "Usage: $0 " >&2 5 | exit 1 6 | fi 7 | 8 | builddir="$1" 9 | repodir="$2" 10 | echo build directory = $builddir 11 | echo repository root dirrectory = $repodir 12 | 13 | outfile="$repodir/deploy/hyperion.tar.gz" 14 | echo create $outfile 15 | 16 | tar --create --verbose --gzip --absolute-names --show-transformed-names \ 17 | --file "$outfile" \ 18 | --transform "s:$builddir/bin/:hyperion/bin/:" \ 19 | --transform "s:$repodir/effects/:hyperion/effects/:" \ 20 | --transform "s:$repodir/config/:hyperion/config/:" \ 21 | --transform "s:$repodir/bin/hyperion.init.sh:hyperion/init.d/hyperion.init.sh:" \ 22 | --transform "s://:/:g" \ 23 | "$builddir/bin/hyperiond" \ 24 | "$builddir/bin/hyperion-remote" \ 25 | "$builddir/bin/hyperion-v4l2" \ 26 | "$builddir/bin/gpio2spi" \ 27 | "$builddir/bin/dispmanx2png" \ 28 | "$repodir/effects/"* \ 29 | "$repodir/bin/hyperion.init.sh" \ 30 | "$repodir/config/hyperion.config.json" 31 | -------------------------------------------------------------------------------- /bin/create_all_releases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # make_release [] 4 | make_release() 5 | { 6 | echo 7 | echo "--- build release for $1 ---" 8 | echo 9 | RELEASE=$1 10 | PLATFORM=$2 11 | shift 2 12 | 13 | mkdir -p build-${RELEASE} 14 | mkdir -p deploy/${RELEASE} 15 | cd build-${RELEASE} 16 | cmake -DCMAKE_INSTALL_PREFIX=/usr -DPLATFORM=${PLATFORM} $@ -DCMAKE_BUILD_TYPE=Release -Wno-dev .. || exit 1 17 | make -j $(nproc) || exit 1 18 | #strip bin/* 19 | make package -j $(nproc) 20 | mv hyperion-*-ambilight.* ../deploy/${RELEASE} 21 | cd .. 22 | bin/create_release.sh . ${RELEASE} 23 | } 24 | 25 | export PATH="$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin" 26 | CMAKE_PROTOC_FLAG="-DIMPORT_PROTOC=../build-x86x64/protoc_export.cmake" 27 | 28 | make_release x86x64 x86 29 | #make_release x32 x86 ${CMAKE_PROTOC_FLAG} 30 | make_release rpi rpi-pwm -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG} 31 | make_release wetek wetek -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG} 32 | #make_release imx6 imx6 -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-imx6.cmake" ${CMAKE_PROTOC_FLAG} 33 | 34 | 35 | -------------------------------------------------------------------------------- /bin/create_oe_depedencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | RPI_ROOTFS=/home/tvdzwan/hummingboard/rootfs 4 | IMX6_ROOTFS=/home/tvdzwan/hummingboard/rootfs 5 | outfile=hyperion.deps.openelec-imx6.tar.gz 6 | 7 | tar --create --verbose --gzip --absolute-names --show-transformed-names --dereference \ 8 | --file "$outfile" \ 9 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libaudio.so.2" \ 10 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libffi.so.6" \ 11 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libICE.so.6" \ 12 | "$IMX6_ROOTFS/lib/arm-linux-gnueabihf/libpcre.so.3" \ 13 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libpng12.so.0" \ 14 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libQtCore.so.4" \ 15 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libQtGui.so.4" \ 16 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libQtNetwork.so.4" \ 17 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libSM.so.6" \ 18 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libX11.so.6" \ 19 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXau.so.6" \ 20 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libxcb.so.1" \ 21 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXdmcp.so.6" \ 22 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXext.so.6" \ 23 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXrender.so.1" \ 24 | "$IMX6_ROOTFS/usr/lib/arm-linux-gnueabihf/libXt.so.6" \ 25 | "./openelec/hyperiond.sh" \ 26 | "./openelec/hyperion-v4l2.sh" \ 27 | "./openelec/hyperion-remote.sh" 28 | 29 | -------------------------------------------------------------------------------- /bin/create_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$#" -ne 2 ] || ! [ -d "$1" ]; then 4 | echo "Usage: $0 " >&2 5 | exit 1 6 | fi 7 | 8 | repodir="$1" 9 | buildid="$2" 10 | builddir=$repodir/build-$buildid 11 | echo build directory = $builddir 12 | echo repository root dirrectory = $repodir 13 | if ! [ -d "$builddir" ]; then 14 | echo "Could not find build director" 15 | exit 1 16 | fi 17 | 18 | outfile="$repodir/deploy/hyperion_$buildid.tar.gz" 19 | echo create $outfile 20 | 21 | tar --create --gzip --absolute-names --show-transformed-names --ignore-failed-read\ 22 | --file "$outfile" \ 23 | --transform "s:$builddir/bin/:hyperion/bin/:" \ 24 | --transform "s:$repodir/effects/:hyperion/effects/:" \ 25 | --transform "s:$repodir/config/:hyperion/config/:" \ 26 | --transform "s:$repodir/bin/service/hyperion.init.sh:hyperion/services/hyperion.init.sh:" \ 27 | --transform "s:$repodir/bin/service/hyperion.systemd.sh:hyperion/services/hyperion.systemd.sh:" \ 28 | --transform "s:$repodir/bin/service/hyperion.initctl.sh:hyperion/services/hyperion.initctl.sh:" \ 29 | --transform "s://:/:g" \ 30 | "$builddir/bin/hyperion"* \ 31 | "$repodir/effects/"* \ 32 | "$repodir/bin/service/hyperion.init.sh" \ 33 | "$repodir/bin/service/hyperion.systemd.sh" \ 34 | "$repodir/bin/service/hyperion.initctl.sh" \ 35 | "$repodir/config/hyperion.config.json.example" 36 | 37 | -------------------------------------------------------------------------------- /bin/openelec/hyperion-remote.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-remote "$@" 3 | -------------------------------------------------------------------------------- /bin/openelec/hyperion-v4l2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-v4l2 "$@" 3 | -------------------------------------------------------------------------------- /bin/openelec/hyperiond.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperiond "$@" 3 | -------------------------------------------------------------------------------- /bin/service/hyperion.initctl.sh: -------------------------------------------------------------------------------- 1 | ## Hyperion daemon initctl script 2 | 3 | description "hyperion" 4 | author "poljvd & tvdzwan" 5 | 6 | start on (runlevel [2345]) 7 | stop on (runlevel [!2345]) 8 | 9 | respawn 10 | 11 | exec /usr/bin/hyperiond /etc/hyperion/hyperion.config.json 12 | -------------------------------------------------------------------------------- /bin/service/hyperion.systemd.sh: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Hyperion Systemd service 3 | 4 | [Service] 5 | Type=simple 6 | User=root 7 | Group=root 8 | UMask=007 9 | ExecStart=/usr/bin/hyperiond /etc/hyperion/hyperion.config.json 10 | ExecReload=/bin/kill -HUP $MAINPID 11 | Restart=on-failure 12 | TimeoutStopSec=10 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | -------------------------------------------------------------------------------- /cmake/FindBCM.cmake: -------------------------------------------------------------------------------- 1 | # - Find the native BCM includes and library 2 | # 3 | 4 | # This module defines 5 | # BCM_INCLUDE_DIR, where to find png.h, etc. 6 | # BCM_LIBRARIES, the libraries to link against to use PNG. 7 | # BCM_FOUND, If false, do not try to use PNG. 8 | # 9 | 10 | FIND_PATH(BCM_INCLUDE_DIR 11 | bcm_host.h 12 | /usr/include 13 | /usr/local/include 14 | /opt/vc/include) 15 | 16 | SET(BCM_INCLUDE_DIRS 17 | ${BCM_INCLUDE_DIR} 18 | ${BCM_INCLUDE_DIR}/interface/vcos/pthreads 19 | ${BCM_INCLUDE_DIR}/interface/vmcs_host/linux) 20 | 21 | FIND_LIBRARY(BCM_LIBRARIES 22 | NAMES bcm_host 23 | PATHS /usr/lib /usr/local/lib /opt/vc/lib) 24 | -------------------------------------------------------------------------------- /cmake/FindCoreFoundation.cmake: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # Find IOKit framework (Mac OS X). 3 | # 4 | # Define: 5 | # CoreFoundation_FOUND 6 | # CoreFoundation_INCLUDE_DIR 7 | # CoreFoundation_LIBRARY 8 | 9 | set(CoreFoundation_FOUND false) 10 | set(CoreFoundation_INCLUDE_DIR) 11 | set(CoreFoundation_LIBRARY) 12 | 13 | if(APPLE) 14 | # The only platform it makes sense to check for CoreFoundation 15 | find_library(CoreFoundation CoreFoundation) 16 | if(CoreFoundation) 17 | set(CoreFoundation_FOUND true) 18 | set(CoreFoundation_INCLUDE_DIR ${CoreFoundation}) 19 | set(CoreFoundation_LIBRARY ${CoreFoundation}) 20 | endif() 21 | endif() 22 | -------------------------------------------------------------------------------- /cmake/FindGitVersion.cmake: -------------------------------------------------------------------------------- 1 | 2 | execute_process( COMMAND git log -1 --format=%cn-%t/%h-%ct WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BUILD_ID ERROR_QUIET ) 3 | execute_process( COMMAND sh -c "git branch | grep '^*' | sed 's;^*;;g' " WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION_ID ERROR_QUIET ) 4 | 5 | STRING ( STRIP "${BUILD_ID}" BUILD_ID ) 6 | STRING ( STRIP "${VERSION_ID}" VERSION_ID ) 7 | SET ( HYPERION_VERSION_ID "${VERSION_ID} (${BUILD_ID}" ) 8 | message ( STATUS "Current Version: ${HYPERION_VERSION_ID})" ) 9 | 10 | -------------------------------------------------------------------------------- /cmake/FindIOKit.cmake: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # Find IOKit framework (Mac OS X). 3 | # 4 | # Define: 5 | # IOKit_FOUND 6 | # IOKit_INCLUDE_DIR 7 | # IOKit_LIBRARY 8 | 9 | set(IOKit_FOUND false) 10 | set(IOKit_INCLUDE_DIR) 11 | set(IOKit_LIBRARY) 12 | 13 | if(APPLE) 14 | # The only platform it makes sense to check for IOKit 15 | find_library(IOKit IOKit) 16 | if(IOKit) 17 | set(IOKit_FOUND true) 18 | set(IOKit_INCLUDE_DIR ${IOKit}) 19 | set(IOKit_LIBRARY ${IOKit}) 20 | endif(IOKit) 21 | endif(APPLE) 22 | -------------------------------------------------------------------------------- /cmake/Toolchain-imx6.cmake: -------------------------------------------------------------------------------- 1 | SET(CUBIXCROSS_DIR $ENV{HOME}/hummingboard) 2 | 3 | SET(CMAKE_SYSTEM_NAME Linux) 4 | SET(CMAKE_SYSTEM_VERSION 1) 5 | 6 | # specify the cross compiler 7 | SET(CMAKE_C_COMPILER ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc) 8 | SET(CMAKE_CXX_COMPILER ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++) 9 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard") 10 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard") 11 | 12 | # where is the target environment 13 | SET(CMAKE_FIND_ROOT_PATH ${CUBIXCROSS_DIR}/rootfs) 14 | 15 | # search for programs in the build host directories 16 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 17 | 18 | # for libraries and headers in the target directories 19 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 20 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 21 | 22 | include_directories(${CMAKE_FIND_ROOT_PATH}/usr/include) 23 | -------------------------------------------------------------------------------- /cmake/Toolchain-rpi.cmake: -------------------------------------------------------------------------------- 1 | SET(RASPCROSS_DIR $ENV{HOME}/raspberrypi) 2 | 3 | SET(CMAKE_SYSTEM_NAME Linux) 4 | SET(CMAKE_SYSTEM_VERSION 1) 5 | 6 | # specify the cross compiler 7 | SET(CMAKE_C_COMPILER ${RASPCROSS_DIR}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc) 8 | SET(CMAKE_CXX_COMPILER ${RASPCROSS_DIR}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++) 9 | 10 | # where is the target environment 11 | SET(CMAKE_FIND_ROOT_PATH ${RASPCROSS_DIR}/rootfs) 12 | 13 | # search for programs in the build host directories 14 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 15 | 16 | # for libraries and headers in the target directories 17 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | 20 | -------------------------------------------------------------------------------- /cmake/Toolchain-x32.cmake: -------------------------------------------------------------------------------- 1 | # toolchain file for building a 32bit version on a 64bit host 2 | 3 | # use it like this: 4 | # cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain-x32.cmake 5 | 6 | set(CMAKE_SYSTEM_NAME Linux) 7 | set(CMAKE_SYSTEM_VERSION 1) 8 | set(CMAKE_SYSTEM_PROCESSOR "i686") 9 | 10 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") 11 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") 12 | 13 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | 23 | -------------------------------------------------------------------------------- /cmake/packages.cmake: -------------------------------------------------------------------------------- 1 | # cmake file for generating distribution packages 2 | 3 | SET ( CPACK_GENERATOR "DEB" "TGZ" "STGZ" ) # "RPM" 4 | 5 | SET ( CPACK_PACKAGE_NAME "hyperion" ) 6 | SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an opensource 'AmbiLight' implementation" ) 7 | SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" ) 8 | SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" ) 9 | 10 | SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "hyperion team") 11 | SET ( CPACK_DEBIAN_PACKAGE_NAME "hyperion" ) 12 | SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst" ) 13 | SET ( CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/hyperion-project/hyperion" ) 14 | SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libqtcore4 (>= 4:4.8.0), libqt4-network (>= 4:4.8.0), libusb-1.0-0, libpython2.7, libc6" ) 15 | SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" ) 16 | 17 | SET ( CPACK_RPM_PACKAGE_NAME "hyperion" ) 18 | SET ( CPACK_RPM_PACKAGE_URL "https://github.com/hyperion-project/hyperion" ) 19 | SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/postinst" ) 20 | 21 | SET(CPACK_PACKAGE_VERSION_MAJOR "1") 22 | SET(CPACK_PACKAGE_VERSION_MINOR "3") 23 | SET(CPACK_PACKAGE_VERSION_PATCH "0") 24 | 25 | SET ( CPACK_COMPONENTS_ALL ambilight ) 26 | SET ( CPACK_ARCHIVE_COMPONENT_INSTALL ON ) 27 | SET ( CPACK_DEB_COMPONENT_INSTALL ON ) 28 | SET ( CPACK_RPM_COMPONENT_INSTALL ON ) 29 | SET ( CPACK_STRIP_FILES ON ) 30 | 31 | # no code after following line! 32 | INCLUDE ( CPack ) 33 | -------------------------------------------------------------------------------- /dependencies/LightberryHDUSBAPA1021.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/dependencies/LightberryHDUSBAPA1021.1.zip -------------------------------------------------------------------------------- /dependencies/build/getoptPlusPlus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(getoptPlusPlus) 2 | 3 | include_directories( 4 | ../../include/getoptPlusPlus) 5 | 6 | add_library(getoptPlusPlus 7 | ../../include/getoptPlusPlus/getoptpp.h 8 | ../../include/getoptPlusPlus/parameter.include.cc 9 | getoptpp.cc) 10 | -------------------------------------------------------------------------------- /dependencies/build/getoptPlusPlus/Makefile: -------------------------------------------------------------------------------- 1 | SOURCES=getoptpp.cc test.cc 2 | HEADERS=getoptpp.h 3 | OBJECTS=$(SOURCES:.cc=.o) 4 | LDFLAGS= 5 | CXXFLAGS=-O0 -ggdb -Wall 6 | CFLAGS=$(CXXFLAGS) 7 | CC=g++ 8 | TARGET=getopt-test 9 | 10 | all: $(TARGET) 11 | $(TARGET): $(OBJECTS) 12 | $(CXX) $(LDFLAGS) -o $(TARGET) $(OBJECTS) 13 | $(SOURCES): $(HEADERS) 14 | 15 | clean: 16 | rm -rf $(TARGET) $(OBJECTS) *~ 17 | -------------------------------------------------------------------------------- /dependencies/build/getoptPlusPlus/README: -------------------------------------------------------------------------------- 1 | A very small class library that replaces getopt() and 2 | getopt_long()-functionality with a more C++-friendly approach. 3 | 4 | Additionally, it does not rely on UNIX-specific code. 5 | 6 | See test.cc for a sample application and COPYING for license information. 7 | 8 | 9 | -------------------------------------------------------------------------------- /dependencies/build/hidapi/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.la 4 | *.lo 5 | *.a 6 | .libs 7 | .deps 8 | hidtest-libusb 9 | -------------------------------------------------------------------------------- /dependencies/build/hidapi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(hidapi) 2 | 3 | # Add the 'generic' hidapi include directory 4 | include_directories(../../include/hidapi) 5 | 6 | #TODO[TvdZ]: Rename hidapi-??? to hidapi 7 | if(APPLE) 8 | 9 | find_package(IOKit REQUIRED) 10 | find_package(CoreFoundation REQUIRED) 11 | 12 | include_directories($IOKit_INCLUDE_DIRS}) 13 | include_directories($CoreFoundation_INCLUDE_DIRS}) 14 | 15 | # HIDAPI library specific for MacOS 16 | add_library(hidapi-mac hid-mac.c) 17 | 18 | target_link_libraries(hidapi-mac 19 | ${IOKit_LIBRARY} 20 | ${CoreFoundation_LIBRARY}) 21 | elseif(UNIX) 22 | # HIDAPI library based on lib-usb 23 | 24 | #add libusb and pthreads 25 | find_package(libusb-1.0 REQUIRED) 26 | find_package(Threads REQUIRED) 27 | 28 | include_directories(${LIBUSB_1_INCLUDE_DIRS}) 29 | 30 | add_library(hidapi-libusb hid-libusb.c) 31 | 32 | target_link_libraries(hidapi-libusb 33 | ${LIBUSB_1_LIBRARIES} #apt-get install libusb-1.0-0-dev 34 | ${CMAKE_THREAD_LIBS_INIT} 35 | ) 36 | 37 | endif() 38 | -------------------------------------------------------------------------------- /dependencies/build/jsoncpp/AUTHORS: -------------------------------------------------------------------------------- 1 | Baptiste Lepilleur 2 | -------------------------------------------------------------------------------- /dependencies/build/jsoncpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(jsoncpp) 2 | 3 | # define the current source/header path 4 | set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/dependencies/include/json) 5 | set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/dependencies/build/jsoncpp) 6 | 7 | add_library(jsoncpp 8 | ${CURRENT_HEADER_DIR}/autolink.h 9 | ${CURRENT_HEADER_DIR}/config.h 10 | ${CURRENT_HEADER_DIR}/features.h 11 | ${CURRENT_HEADER_DIR}/forwards.h 12 | ${CURRENT_HEADER_DIR}/json.h 13 | ${CURRENT_HEADER_DIR}/reader.h 14 | ${CURRENT_HEADER_DIR}/value.h 15 | ${CURRENT_HEADER_DIR}/writer.h 16 | 17 | ${CURRENT_SOURCE_DIR}/json_batchallocator.h 18 | ${CURRENT_SOURCE_DIR}/json_internalarray.inl 19 | ${CURRENT_SOURCE_DIR}/json_internalmap.inl 20 | ${CURRENT_SOURCE_DIR}/json_reader.cpp 21 | ${CURRENT_SOURCE_DIR}/json_tool.h 22 | ${CURRENT_SOURCE_DIR}/json_value.cpp 23 | ${CURRENT_SOURCE_DIR}/json_valueiterator.inl 24 | ${CURRENT_SOURCE_DIR}/json_writer.cpp) 25 | -------------------------------------------------------------------------------- /dependencies/build/jsoncpp/sconscript: -------------------------------------------------------------------------------- 1 | Import( 'env buildLibrary' ) 2 | 3 | buildLibrary( env, Split( """ 4 | json_reader.cpp 5 | json_value.cpp 6 | json_writer.cpp 7 | """ ), 8 | 'json' ) 9 | -------------------------------------------------------------------------------- /dependencies/build/serial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | project(serialport) 3 | 4 | include_directories(../../include) 5 | 6 | ## Sources 7 | set(serial_SRCS 8 | src/serial.cc 9 | ../../include/serial/serial.h 10 | ../../include/serial/v8stdint.h) 11 | 12 | if(UNIX) 13 | list(APPEND serial_SRCS src/impl/unix.cc) 14 | else() 15 | list(APPEND serial_SRCS src/impl/win.cc) 16 | endif() 17 | 18 | ## Add serial library 19 | add_library(${PROJECT_NAME} ${serial_SRCS}) 20 | 21 | if(UNIX AND NOT APPLE) 22 | target_link_libraries(${PROJECT_NAME} rt) 23 | endif() 24 | -------------------------------------------------------------------------------- /dependencies/build/tinkerforge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(tinkerforge) 2 | 3 | # define the current source/header path 4 | set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/dependencies/include/tinkerforge) 5 | set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/dependencies/build/tinkerforge) 6 | 7 | include_directories(${CURRENT_HEADER_DIR}) 8 | 9 | add_library(tinkerforge 10 | ${CURRENT_HEADER_DIR}/bricklet_led_strip.h 11 | ${CURRENT_HEADER_DIR}/ip_connection.h 12 | 13 | ${CURRENT_SOURCE_DIR}/bricklet_led_strip.c 14 | ${CURRENT_SOURCE_DIR}/ip_connection.c) 15 | -------------------------------------------------------------------------------- /dependencies/getoptPlusPlus-master-20130810.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/dependencies/getoptPlusPlus-master-20130810.zip -------------------------------------------------------------------------------- /dependencies/hidapi-master-20131122.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/dependencies/hidapi-master-20131122.zip -------------------------------------------------------------------------------- /dependencies/include/json/autolink.h: -------------------------------------------------------------------------------- 1 | // Copyright 2007-2010 Baptiste Lepilleur 2 | // Distributed under MIT license, or public domain if desired and 3 | // recognized in your jurisdiction. 4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE 5 | 6 | #ifndef JSON_AUTOLINK_H_INCLUDED 7 | # define JSON_AUTOLINK_H_INCLUDED 8 | 9 | # include "config.h" 10 | 11 | # ifdef JSON_IN_CPPTL 12 | # include 13 | # endif 14 | 15 | # if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL) 16 | # define CPPTL_AUTOLINK_NAME "json" 17 | # undef CPPTL_AUTOLINK_DLL 18 | # ifdef JSON_DLL 19 | # define CPPTL_AUTOLINK_DLL 20 | # endif 21 | # include "autolink.h" 22 | # endif 23 | 24 | #endif // JSON_AUTOLINK_H_INCLUDED 25 | -------------------------------------------------------------------------------- /dependencies/include/json/forwards.h: -------------------------------------------------------------------------------- 1 | // Copyright 2007-2010 Baptiste Lepilleur 2 | // Distributed under MIT license, or public domain if desired and 3 | // recognized in your jurisdiction. 4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE 5 | 6 | #ifndef JSON_FORWARDS_H_INCLUDED 7 | # define JSON_FORWARDS_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | # include "config.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | namespace Json { 14 | 15 | // writer.h 16 | class FastWriter; 17 | class StyledWriter; 18 | 19 | // reader.h 20 | class Reader; 21 | 22 | // features.h 23 | class Features; 24 | 25 | // value.h 26 | typedef unsigned int ArrayIndex; 27 | class StaticString; 28 | class Path; 29 | class PathArgument; 30 | class Value; 31 | class ValueIteratorBase; 32 | class ValueIterator; 33 | class ValueConstIterator; 34 | #ifdef JSON_VALUE_USE_INTERNAL_MAP 35 | class ValueMapAllocator; 36 | class ValueInternalLink; 37 | class ValueInternalArray; 38 | class ValueInternalMap; 39 | #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP 40 | 41 | } // namespace Json 42 | 43 | 44 | #endif // JSON_FORWARDS_H_INCLUDED 45 | -------------------------------------------------------------------------------- /dependencies/include/json/json.h: -------------------------------------------------------------------------------- 1 | // Copyright 2007-2010 Baptiste Lepilleur 2 | // Distributed under MIT license, or public domain if desired and 3 | // recognized in your jurisdiction. 4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE 5 | 6 | #ifndef JSON_JSON_H_INCLUDED 7 | # define JSON_JSON_H_INCLUDED 8 | 9 | # include "autolink.h" 10 | # include "value.h" 11 | # include "reader.h" 12 | # include "writer.h" 13 | # include "features.h" 14 | 15 | #endif // JSON_JSON_H_INCLUDED 16 | -------------------------------------------------------------------------------- /dependencies/tinkerforge_c_bindings_2_0_13.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/dependencies/tinkerforge_c_bindings_2_0_13.zip -------------------------------------------------------------------------------- /dependencies/wjwwood-serial-master-20131105.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperion-project/hyperion/9059f7f32804ed12e10061fc3c95e055e755f83b/dependencies/wjwwood-serial-master-20131105.zip -------------------------------------------------------------------------------- /doc/hyperion-build-doc.in.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Fail on error. 4 | set -e 5 | 6 | # Log file containing documentation errors and warnings (if any). 7 | log_file=${CMAKE_CURRENT_BINARY_DIR}/hyperion-doxygen.log 8 | 9 | # Remove the log file before building the documentation. 10 | rm -f $log_file 11 | 12 | # Generate the documentation. 13 | ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/hyperion.doxygen 14 | 15 | # At this point, the log file should have been generated. 16 | # If not, an error is displayed on stderr and 1 is returned to indicate an error. 17 | if [ -f $log_file ] ; then 18 | # So the log file exists. If its size is > 0, show its contents on stderr and exit 1. 19 | if [ -s $log_file ] ; then 20 | cat $log_file 1>&2 21 | exit 1; 22 | else 23 | # The log file exists, but its size is zero, meaning there were no documentation warnings or errors. 24 | # Exit with 0 to indicate success. 25 | exit 0; 26 | fi 27 | else 28 | echo "The doxygen log file ($log_file) does not exist. Ensure that WARN_LOGFILE is set correctly in hyperion-cmake.doxyfile." 1>&2 29 | exit 1; 30 | fi 31 | -------------------------------------------------------------------------------- /doc/hyperion-footer.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
Generated at $datetime for $projectname by doxygen $doxygenversion.
7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/hyperion-header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $title 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /effects/cinema-fade-in.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Cinema brighten lights", 3 | "script" : "fade.py", 4 | "args" : 5 | { 6 | "fade-time" : 5.0, 7 | "color-start" : [ 136, 97, 7 ], 8 | "color-end" : [ 238, 173, 47 ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/cinema-fade-off.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Cinema dim lights", 3 | "script" : "fade.py", 4 | "args" : 5 | { 6 | "fade-time" : 5.0, 7 | "color-start" : [ 238, 173, 47 ], 8 | "color-end" : [ 136, 97, 7 ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/fade.py: -------------------------------------------------------------------------------- 1 | import hyperion, time 2 | 3 | # Get the parameters 4 | fadeTime = float(hyperion.args.get('fade-time', 5.0)) 5 | colorStart = hyperion.args.get('color-start', (255,174,11)) 6 | colorEnd = hyperion.args.get('color-end', (100,100,100)) 7 | 8 | color_step = ( 9 | (colorEnd[0] - colorStart[0]) / 256.0, 10 | (colorEnd[1] - colorStart[1]) / 256.0, 11 | (colorEnd[2] - colorStart[2]) / 256.0 12 | ) 13 | 14 | # fade color 15 | calcChannel = lambda i: min(max(int(colorStart[i] + color_step[i]*step),0),255) 16 | for step in range(256): 17 | if hyperion.abort(): 18 | break 19 | 20 | hyperion.setColor( calcChannel(0),calcChannel(1),calcChannel(2) ) 21 | time.sleep( fadeTime / 256 ) 22 | 23 | # maintain color until effect end 24 | hyperion.setColor(colorEnd[0],colorEnd[1],colorEnd[2]) 25 | while not hyperion.abort(): 26 | time.sleep(1) 27 | 28 | -------------------------------------------------------------------------------- /effects/knight-rider.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Knight rider", 3 | "script" : "knight-rider.py", 4 | "args" : 5 | { 6 | "speed" : 1.0, 7 | "fadeFactor" : 0.7, 8 | "color" : [255,0,0] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/knight-rider.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | 5 | # Get the parameters 6 | speed = float(hyperion.args.get('speed', 1.0)) 7 | fadeFactor = float(hyperion.args.get('fadeFactor', 0.7)) 8 | color = hyperion.args.get('color', (255,0,0)) 9 | 10 | # Check parameters 11 | speed = max(0.0001, speed) 12 | fadeFactor = max(0.0, min(fadeFactor, 1.0)) 13 | 14 | # Initialize the led data 15 | width = 25 16 | imageData = bytearray(width * (0,0,0)) 17 | imageData[0] = color[0] 18 | imageData[1] = color[1] 19 | imageData[2] = color[2] 20 | 21 | # Calculate the sleep time and rotation increment 22 | increment = 1 23 | sleepTime = 1.0 / (speed * width) 24 | while sleepTime < 0.05: 25 | increment *= 2 26 | sleepTime *= 2 27 | 28 | # Start the write data loop 29 | position = 0 30 | direction = 1 31 | while not hyperion.abort(): 32 | hyperion.setImage(width, 1, imageData) 33 | 34 | # Move data into next state 35 | for i in range(increment): 36 | position += direction 37 | if position == -1: 38 | position = 1 39 | direction = 1 40 | elif position == width: 41 | position = width-2 42 | direction = -1 43 | 44 | # Fade the old data 45 | for j in range(width): 46 | imageData[3*j] = int(fadeFactor * imageData[3*j]) 47 | imageData[3*j+1] = int(fadeFactor * imageData[3*j+1]) 48 | imageData[3*j+2] = int(fadeFactor * imageData[3*j+2]) 49 | 50 | # Insert new data 51 | imageData[3*position] = color[0] 52 | imageData[3*position+1] = color[1] 53 | imageData[3*position+2] = color[2] 54 | 55 | # Sleep for a while 56 | time.sleep(sleepTime) 57 | -------------------------------------------------------------------------------- /effects/mood-blobs-blue.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Blue mood blobs", 3 | "script" : "mood-blobs.py", 4 | "args" : 5 | { 6 | "rotationTime" : 60.0, 7 | "color" : [0,0,255], 8 | "hueChange" : 60.0, 9 | "blobs" : 5, 10 | "reverse" : false 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /effects/mood-blobs-cold.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Cold mood blobs", 3 | "script" : "mood-blobs.py", 4 | "args" : 5 | { 6 | "rotationTime" : 60.0, 7 | "color" : [0,0,255], 8 | "hueChange" : 30.0, 9 | "blobs" : 5, 10 | "reverse" : false, 11 | "baseChange" : true, 12 | "baseColorRangeLeft" : 160, 13 | "baseColorRangeRight" : 320, 14 | "baseColorChangeRate" : 2.0 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /effects/mood-blobs-full.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Full color mood blobs", 3 | "script" : "mood-blobs.py", 4 | "args" : 5 | { 6 | "rotationTime" : 60.0, 7 | "colorRandom" : true, 8 | "hueChange" : 30.0, 9 | "blobs" : 5, 10 | "reverse" : false, 11 | "baseChange" : true, 12 | "baseColorRangeLeft" : 0, 13 | "baseColorRangeRight" : 360, 14 | "baseColorChangeRate" : 0.2 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /effects/mood-blobs-green.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Green mood blobs", 3 | "script" : "mood-blobs.py", 4 | "args" : 5 | { 6 | "rotationTime" : 60.0, 7 | "color" : [0,255,0], 8 | "hueChange" : 60.0, 9 | "blobs" : 5, 10 | "reverse" : false 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /effects/mood-blobs-red.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Red mood blobs", 3 | "script" : "mood-blobs.py", 4 | "args" : 5 | { 6 | "rotationTime" : 60.0, 7 | "color" : [255,0,0], 8 | "hueChange" : 60.0, 9 | "blobs" : 5, 10 | "reverse" : false 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /effects/mood-blobs-warm.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Warm mood blobs", 3 | "script" : "mood-blobs.py", 4 | "args" : 5 | { 6 | "rotationTime" : 60.0, 7 | "color" : [255,0,0], 8 | "hueChange" : 30.0, 9 | "blobs" : 5, 10 | "reverse" : false, 11 | "baseChange" : true, 12 | "baseColorRangeLeft" : 333, 13 | "baseColorRangeRight" : 151, 14 | "baseColorChangeRate" : 2.0 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /effects/police-lights-single.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Police Lights Single", 3 | "script" : "police.py", 4 | "args" : 5 | { 6 | "rotation-time" : 1.5, 7 | "color_one" : [ 255, 0, 0 ], 8 | "color_two" : [ 0, 0, 255 ], 9 | "colors_count" : 10, 10 | "reverse" : false 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /effects/police-lights-solid.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Police Lights Solid", 3 | "script" : "police.py", 4 | "args" : 5 | { 6 | "rotation-time" : 1.0, 7 | "color_one" : [ 255, 0, 0 ], 8 | "color_two" : [ 0, 0, 255 ], 9 | "reverse" : false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /effects/police.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | 5 | # Get the parameters 6 | rotationTime = float(hyperion.args.get('rotation-time', 2.0)) 7 | colorOne = hyperion.args.get('color_one', (255,0,0)) 8 | colorTwo = hyperion.args.get('color_two', (0,0,255)) 9 | colorsCount = hyperion.args.get('colors_count', hyperion.ledCount/2) 10 | reverse = bool(hyperion.args.get('reverse', False)) 11 | 12 | # Check parameters 13 | rotationTime = max(0.1, rotationTime) 14 | colorsCount = min(hyperion.ledCount/2, colorsCount) 15 | 16 | # Initialize the led data 17 | hsv1 = colorsys.rgb_to_hsv(colorOne[0]/255.0, colorOne[1]/255.0, colorOne[2]/255.0) 18 | hsv2 = colorsys.rgb_to_hsv(colorTwo[0]/255.0, colorTwo[1]/255.0, colorTwo[2]/255.0) 19 | colorBlack = (0,0,0) 20 | ledData = bytearray() 21 | for i in range(hyperion.ledCount): 22 | if i <= colorsCount: 23 | rgb = colorsys.hsv_to_rgb(hsv1[0], hsv1[1], hsv1[2]) 24 | elif (i >= hyperion.ledCount/2-1) & (i < (hyperion.ledCount/2) + colorsCount): 25 | rgb = colorsys.hsv_to_rgb(hsv2[0], hsv2[1], hsv2[2]) 26 | else: 27 | rgb = colorBlack 28 | ledData += bytearray((int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2]))) 29 | 30 | # Calculate the sleep time and rotation increment 31 | increment = 3 32 | sleepTime = rotationTime / hyperion.ledCount 33 | while sleepTime < 0.05: 34 | increment *= 2 35 | sleepTime *= 2 36 | increment %= hyperion.ledCount 37 | 38 | # Switch direction if needed 39 | if reverse: 40 | increment = -increment 41 | 42 | # Start the write data loop 43 | while not hyperion.abort(): 44 | hyperion.setColor(ledData) 45 | ledData = ledData[-increment:] + ledData[:-increment] 46 | time.sleep(sleepTime) 47 | -------------------------------------------------------------------------------- /effects/rainbow-mood.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Rainbow mood", 3 | "script" : "rainbow-mood.py", 4 | "args" : 5 | { 6 | "rotation-time" : 60.0, 7 | "brightness" : 1.0, 8 | "reverse" : false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/rainbow-mood.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | 5 | # Get the parameters 6 | rotationTime = float(hyperion.args.get('rotation-time', 30.0)) 7 | brightness = float(hyperion.args.get('brightness', 1.0)) 8 | saturation = float(hyperion.args.get('saturation', 1.0)) 9 | reverse = bool(hyperion.args.get('reverse', False)) 10 | 11 | # Check parameters 12 | rotationTime = max(0.1, rotationTime) 13 | brightness = max(0.0, min(brightness, 1.0)) 14 | saturation = max(0.0, min(saturation, 1.0)) 15 | 16 | # Calculate the sleep time and hue increment 17 | sleepTime = 0.1 18 | hueIncrement = sleepTime / rotationTime 19 | 20 | # Switch direction if needed 21 | if reverse: 22 | increment = -increment 23 | 24 | # Start the write data loop 25 | hue = 0.0 26 | while not hyperion.abort(): 27 | rgb = colorsys.hsv_to_rgb(hue, saturation, brightness) 28 | hyperion.setColor(int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2])) 29 | hue = (hue + hueIncrement) % 1.0 30 | time.sleep(sleepTime) 31 | -------------------------------------------------------------------------------- /effects/rainbow-swirl-fast.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Rainbow swirl fast", 3 | "script" : "rainbow-swirl.py", 4 | "args" : 5 | { 6 | "rotation-time" : 3.0, 7 | "brightness" : 1.0, 8 | "reverse" : false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/rainbow-swirl.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Rainbow swirl", 3 | "script" : "rainbow-swirl.py", 4 | "args" : 5 | { 6 | "rotation-time" : 20.0, 7 | "brightness" : 1.0, 8 | "reverse" : false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/rainbow-swirl.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | 5 | # Get the parameters 6 | rotationTime = float(hyperion.args.get('rotation-time', 3.0)) 7 | brightness = float(hyperion.args.get('brightness', 1.0)) 8 | saturation = float(hyperion.args.get('saturation', 1.0)) 9 | reverse = bool(hyperion.args.get('reverse', False)) 10 | 11 | # Check parameters 12 | rotationTime = max(0.1, rotationTime) 13 | brightness = max(0.0, min(brightness, 1.0)) 14 | saturation = max(0.0, min(saturation, 1.0)) 15 | 16 | # Initialize the led data 17 | ledData = bytearray() 18 | for i in range(hyperion.ledCount): 19 | hue = float(i)/hyperion.ledCount 20 | rgb = colorsys.hsv_to_rgb(hue, saturation, brightness) 21 | ledData += bytearray((int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2]))) 22 | 23 | # Calculate the sleep time and rotation increment 24 | increment = 3 25 | sleepTime = rotationTime / hyperion.ledCount 26 | while sleepTime < 0.05: 27 | increment *= 2 28 | sleepTime *= 2 29 | increment %= hyperion.ledCount 30 | 31 | # Switch direction if needed 32 | if reverse: 33 | increment = -increment 34 | 35 | # Start the write data loop 36 | while not hyperion.abort(): 37 | hyperion.setColor(ledData) 38 | ledData = ledData[-increment:] + ledData[:-increment] 39 | time.sleep(sleepTime) 40 | -------------------------------------------------------------------------------- /effects/random.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Random", 3 | "script" : "random.py", 4 | "args" : 5 | { 6 | "speed" : 1.0, 7 | "saturation" : 1.0 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /effects/random.py: -------------------------------------------------------------------------------- 1 | import hyperion, time, colorsys, random 2 | 3 | # get args 4 | sleepTime = float(hyperion.args.get('speed', 1.0)) 5 | saturation = float(hyperion.args.get('saturation', 1.0)) 6 | ledData = bytearray() 7 | 8 | # Initialize the led data 9 | for i in range(hyperion.ledCount): 10 | ledData += bytearray((0,0,0)) 11 | 12 | # Start the write data loop 13 | while not hyperion.abort(): 14 | hyperion.setColor(ledData) 15 | for i in range(hyperion.ledCount): 16 | if random.randrange(10) == 1: 17 | rgb = colorsys.hsv_to_rgb(random.random(), saturation, random.random()) 18 | ledData[i*3 ] = int(255*rgb[0]) 19 | ledData[i*3+1] = int(255*rgb[1]) 20 | ledData[i*3+2] = int(255*rgb[2]) 21 | time.sleep(sleepTime) 22 | -------------------------------------------------------------------------------- /effects/running_dots.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Running dots", 3 | "script" : "running_dots.py", 4 | "args" : 5 | { 6 | "speed" : 1.5, 7 | "whiteLevel" : 100, 8 | "colorLevel" : 230 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/running_dots.py: -------------------------------------------------------------------------------- 1 | import hyperion, time, colorsys, random 2 | 3 | # get options from args 4 | sleepTime = float(hyperion.args.get('speed', 1.5)) * 0.005 5 | whiteLevel = int(hyperion.args.get('whiteLevel', 0)) 6 | lvl = int(hyperion.args.get('colorLevel', 220)) 7 | 8 | # check value 9 | whiteLevel = min( whiteLevel, 254 ) 10 | lvl = min( lvl, 255 ) 11 | 12 | if whiteLevel >= lvl: 13 | lvl = 255 14 | 15 | # Initialize the led data 16 | ledData = bytearray() 17 | for i in range(hyperion.ledCount): 18 | ledData += bytearray((0,0,0)) 19 | 20 | runners = [ 21 | { "pos":0, "step": 4, "lvl":lvl}, 22 | { "pos":1, "step": 5, "lvl":lvl}, 23 | { "pos":2, "step": 6, "lvl":lvl}, 24 | { "pos":0, "step": 7, "lvl":lvl}, 25 | { "pos":1, "step": 8, "lvl":lvl}, 26 | { "pos":2, "step": 9, "lvl":lvl}, 27 | #{ "pos":0, "step":10, "lvl":lvl}, 28 | #{ "pos":1, "step":11, "lvl":lvl}, 29 | #{ "pos":2, "step":12, "lvl":lvl}, 30 | ] 31 | 32 | # Start the write data loop 33 | counter = 0 34 | while not hyperion.abort(): 35 | counter += 1 36 | for r in runners: 37 | if counter % r["step"] == 0: 38 | ledData[r["pos"]] = whiteLevel 39 | r["pos"] = (r["pos"]+3) % (hyperion.ledCount*3) 40 | ledData[r["pos"]] = r["lvl"] 41 | 42 | hyperion.setColor(ledData) 43 | time.sleep(sleepTime) 44 | -------------------------------------------------------------------------------- /effects/shutdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "System Shutdown", 3 | "script" : "shutdown.py", 4 | "args" : 5 | { 6 | "speed" : 1.2, 7 | "alarm-color" : [255,0,0], 8 | "post-color" : [255,174,11], 9 | "shutdown-enabled" : false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /effects/shutdown.py: -------------------------------------------------------------------------------- 1 | import hyperion, time, subprocess 2 | 3 | def setPixel(x,y,rgb): 4 | global imageData, width 5 | offset = y*width*3 + x*3 6 | if offset+2 < len(imageData): 7 | imageData[offset] = rgb[0] 8 | imageData[offset+1] = rgb[1] 9 | imageData[offset+2] = rgb[2] 10 | 11 | # Initialize the led data and args 12 | sleepTime = float(hyperion.args.get('speed', 1.0))*0.5 13 | alarmColor = hyperion.args.get('alarm-color', (255,0,0)) 14 | postColor = hyperion.args.get('post-color', (255,174,11)) 15 | off = bool(hyperion.args.get('shutdown-enabled', False)) 16 | width = 12 17 | height = 10 18 | 19 | imageData = bytearray(height * width * (0,0,0)) 20 | 21 | # Start the write data loop 22 | for i in range(6): 23 | if hyperion.abort(): 24 | off = False 25 | break 26 | if i % 2: 27 | hyperion.setColor(alarmColor[0], alarmColor[1], alarmColor[2]) 28 | else: 29 | hyperion.setColor(0, 0, 0) 30 | time.sleep(sleepTime) 31 | 32 | for y in range(height,0,-1): 33 | if hyperion.abort(): 34 | off = False 35 | break 36 | for x in range(width): 37 | setPixel(x, y-1, alarmColor) 38 | hyperion.setImage(width, height, imageData) 39 | time.sleep(sleepTime) 40 | time.sleep(1) 41 | 42 | for y in range(height): 43 | for x in range(width): 44 | setPixel(x, y, postColor) 45 | hyperion.setImage(width, height, imageData) 46 | time.sleep(2) 47 | 48 | if off and not hyperion.abort(): 49 | subprocess.call("halt") 50 | -------------------------------------------------------------------------------- /effects/snake.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Snake", 3 | "script" : "snake.py", 4 | "args" : 5 | { 6 | "rotation-time" : 12.0, 7 | "color" : [255, 0, 0], 8 | "percentage" : 10 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /effects/snake.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | 5 | # Get the parameters 6 | rotationTime = float(hyperion.args.get('rotation-time', 10.0)) 7 | color = hyperion.args.get('color', (255,0,0)) 8 | percentage = int(hyperion.args.get('percentage', 10)) 9 | 10 | # Check parameters 11 | rotationTime = max(0.1, rotationTime) 12 | percentage = max(1, min(percentage, 100)) 13 | 14 | # Process parameters 15 | factor = percentage/100.0 16 | hsv = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0) 17 | 18 | # Initialize the led data 19 | snakeLeds = max(1, int(hyperion.ledCount*factor)) 20 | ledData = bytearray() 21 | 22 | for i in range(hyperion.ledCount-snakeLeds): 23 | ledData += bytearray((0, 0, 0)) 24 | 25 | for i in range(1,snakeLeds+1): 26 | rgb = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2]*(snakeLeds-i)/snakeLeds) 27 | ledData += bytearray((int(rgb[0]*255), int(rgb[1]*255), int(rgb[2]*255))) 28 | 29 | # Calculate the sleep time and rotation increment 30 | increment = 3 31 | sleepTime = rotationTime / hyperion.ledCount 32 | while sleepTime < 0.05: 33 | increment *= 2 34 | sleepTime *= 2 35 | increment %= hyperion.ledCount 36 | 37 | # Start the write data loop 38 | while not hyperion.abort(): 39 | hyperion.setColor(ledData) 40 | ledData = ledData[increment:] + ledData[:increment] 41 | time.sleep(sleepTime) 42 | -------------------------------------------------------------------------------- /effects/sparks-color.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sparks Color", 3 | "script" : "sparks.py", 4 | "args" : 5 | { 6 | "rotation-time" : 3.0, 7 | "sleep-time" : 0.05, 8 | "brightness" : 1.0, 9 | "saturation" : 1.0, 10 | "reverse" : false, 11 | "color" : [255,255,255], 12 | "random-color" : true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /effects/sparks.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sparks", 3 | "script" : "sparks.py", 4 | "args" : 5 | { 6 | "rotation-time" : 3.0, 7 | "sleep-time" : 0.05, 8 | "brightness" : 1.0, 9 | "saturation" : 1.0, 10 | "reverse" : false, 11 | "color" : [255,255,255], 12 | "random-color" : false 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /effects/sparks.py: -------------------------------------------------------------------------------- 1 | import hyperion, time, colorsys, random 2 | 3 | # Get the parameters 4 | rotationTime = float(hyperion.args.get('rotation-time', 3.0)) 5 | sleepTime = float(hyperion.args.get('sleep-time', 0.05)) 6 | brightness = float(hyperion.args.get('brightness', 1.0)) 7 | saturation = float(hyperion.args.get('saturation', 1.0)) 8 | reverse = bool(hyperion.args.get('reverse', False)) 9 | color = list(hyperion.args.get('color', (255,255,255))) 10 | randomColor = bool(hyperion.args.get('random-color', False)) 11 | 12 | # Check parameters 13 | rotationTime = max(0.1, rotationTime) 14 | brightness = max(0.0, min(brightness, 1.0)) 15 | saturation = max(0.0, min(saturation, 1.0)) 16 | 17 | # Initialize the led data 18 | ledData = bytearray() 19 | for i in range(hyperion.ledCount): 20 | ledData += bytearray((0, 0, 0)) 21 | 22 | # Start the write data loop 23 | while not hyperion.abort(): 24 | ledData[:] = bytearray(3*hyperion.ledCount) 25 | for i in range(hyperion.ledCount): 26 | if random.random() < 0.005: 27 | 28 | if randomColor: 29 | rgb = colorsys.hsv_to_rgb(random.random(), 1, 1) 30 | for n in range(3): 31 | color[n] = int(rgb[n]*255) 32 | 33 | for n in range(3): 34 | ledData[i*3+n] = color[n] 35 | 36 | hyperion.setColor(ledData) 37 | time.sleep(sleepTime) 38 | -------------------------------------------------------------------------------- /effects/strobe-blue.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Strobe blue", 3 | "script" : "strobe.py", 4 | "args" : 5 | { 6 | "color" : [ 0, 0, 255 ], 7 | "frequency" : 10.0 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /effects/strobe-raspbmc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Strobe Raspbmc", 3 | "script" : "strobe.py", 4 | "args" : 5 | { 6 | "color" : [ 188, 17, 66 ], 7 | "frequency" : 10.0 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /effects/strobe-white.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Strobe white", 3 | "script" : "strobe.py", 4 | "args" : 5 | { 6 | "color" : [ 255, 255, 255 ], 7 | "frequency" : 10.0 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /effects/strobe.py: -------------------------------------------------------------------------------- 1 | import hyperion, time 2 | 3 | # Get the rotation time 4 | color = hyperion.args.get('color', (255,255,255)) 5 | frequency = float(hyperion.args.get('frequency', 10.0)) 6 | 7 | # Check parameters 8 | frequency = min(100.0, frequency) 9 | 10 | # Compute the strobe interval 11 | sleepTime = 1.0 / frequency 12 | 13 | # Start the write data loop 14 | while not hyperion.abort(): 15 | hyperion.setColor(0, 0, 0) 16 | time.sleep(sleepTime) 17 | hyperion.setColor(color[0], color[1], color[2]) 18 | time.sleep(sleepTime) 19 | -------------------------------------------------------------------------------- /effects/traces.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Color traces", 3 | "script" : "traces.py", 4 | "args" : 5 | { 6 | "speed" : 1.0 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /effects/traces.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | import random 5 | 6 | # Initialize the led data 7 | ledData = bytearray() 8 | for i in range(hyperion.ledCount): 9 | ledData += bytearray((0,0,0)) 10 | 11 | sleepTime = float(hyperion.args.get('speed', 1.0)) * 0.004 12 | 13 | runners = [ 14 | { "i":0, "pos":0, "c":0, "step":9 , "lvl":255}, 15 | { "i":1, "pos":0, "c":0, "step":8 , "lvl":255}, 16 | { "i":2, "pos":0, "c":0, "step":7 , "lvl":255}, 17 | { "i":0, "pos":0, "c":0, "step":6 , "lvl":100}, 18 | { "i":1, "pos":0, "c":0, "step":5 , "lvl":100}, 19 | { "i":2, "pos":0, "c":0, "step":4, "lvl":100}, 20 | ] 21 | 22 | # Start the write data loop 23 | while not hyperion.abort(): 24 | for r in runners: 25 | if r["c"] == 0: 26 | #ledData[r["pos"]*3+r["i"]] = 0 27 | r["c"] = r["step"] 28 | r["pos"] = (r["pos"]+1)%hyperion.ledCount 29 | ledData[r["pos"]*3+r["i"]] = int(r["lvl"]*(0.2+0.8*random.random())) 30 | else: 31 | r["c"] -= 1 32 | 33 | hyperion.setColor(ledData) 34 | time.sleep(sleepTime) 35 | -------------------------------------------------------------------------------- /effects/udp-mcast.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "UDP multicast listener", 3 | "script" : "udp.py", 4 | "args" : 5 | { 6 | "ListenPort" : 2801, 7 | "ListenIP" : "239.255.28.01" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /effects/udp.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "UDP listener", 3 | "script" : "udp.py", 4 | "args" : 5 | { 6 | "ListenPort" : 2391 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /effects/x-mas.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "X-Mas", 3 | "script" : "x-mas.py", 4 | "args" : 5 | { 6 | "sleepTime" : 0.75 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /effects/x-mas.py: -------------------------------------------------------------------------------- 1 | import hyperion 2 | import time 3 | import colorsys 4 | 5 | # Get the parameters 6 | sleepTime = float(hyperion.args.get('sleepTime', 1.0)) 7 | 8 | # Initialize the led data 9 | ledDataOdd = bytearray() 10 | for i in range(hyperion.ledCount): 11 | if i%2 == 0: 12 | ledDataOdd += bytearray((int(255), int(0), int(0))) 13 | else: 14 | ledDataOdd += bytearray((int(255), int(255), int(255))) 15 | 16 | ledDataEven = bytearray() 17 | for i in range(hyperion.ledCount): 18 | if i%2 == 0: 19 | ledDataEven += bytearray((int(255), int(255), int(255))) 20 | else: 21 | ledDataEven += bytearray((int(255), int(0), int(0))) 22 | 23 | # Start the write data loop 24 | while not hyperion.abort(): 25 | hyperion.setColor(ledDataOdd) 26 | time.sleep(sleepTime) 27 | hyperion.setColor(ledDataEven) 28 | time.sleep(sleepTime) -------------------------------------------------------------------------------- /include/boblightserver/BoblightServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // system includes 4 | #include 5 | 6 | // Qt includes 7 | #include 8 | #include 9 | 10 | // Hyperion includes 11 | #include 12 | 13 | class BoblightClientConnection; 14 | 15 | /// 16 | /// This class creates a TCP server which accepts connections from boblight clients. 17 | /// 18 | class BoblightServer : public QObject 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | /// 24 | /// BoblightServer constructor 25 | /// @param hyperion Hyperion instance 26 | /// @param port port number on which to start listening for connections 27 | /// 28 | BoblightServer(Hyperion * hyperion, const int priority, uint16_t port = 19333); 29 | ~BoblightServer(); 30 | 31 | /// 32 | /// @return the port number on which this TCP listens for incoming connections 33 | /// 34 | uint16_t getPort() const; 35 | 36 | private slots: 37 | /// 38 | /// Slot which is called when a client tries to create a new connection 39 | /// 40 | void newConnection(); 41 | 42 | /// 43 | /// Slot which is called when a client closes a connection 44 | /// @param connection The Connection object which is being closed 45 | /// 46 | void closedConnection(BoblightClientConnection * connection); 47 | 48 | private: 49 | /// Hyperion instance 50 | Hyperion * _hyperion; 51 | 52 | /// The TCP server object 53 | QTcpServer _server; 54 | 55 | /// List with open connections 56 | QSet _openConnections; 57 | 58 | /// hyperion priority 59 | const int _priority; 60 | }; 61 | -------------------------------------------------------------------------------- /include/effectengine/ActiveEffectDefinition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // stl include 4 | #include 5 | 6 | // json include 7 | #include 8 | 9 | struct ActiveEffectDefinition 10 | { 11 | std::string name; 12 | std::string script; 13 | int priority; 14 | int timeout; 15 | Json::Value args; 16 | }; 17 | -------------------------------------------------------------------------------- /include/effectengine/EffectDefinition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // stl include 4 | #include 5 | 6 | // json include 7 | #include 8 | 9 | struct EffectDefinition 10 | { 11 | std::string name; 12 | std::string script; 13 | Json::Value args; 14 | }; 15 | -------------------------------------------------------------------------------- /include/grabber/OpenCVGrabber.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Qt includes 4 | #include 5 | 6 | // util includes 7 | #include 8 | #include 9 | 10 | // grabber includes 11 | #include 12 | 13 | /// Capture class for OpenCV 14 | class OpenCVGrabber : public QObject 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | OpenCVGrabber(int input, int width, int height); 20 | virtual ~OpenCVGrabber(); 21 | 22 | public slots: 23 | void grabFrame(Image & image); 24 | 25 | private: 26 | cv::VideoCapture _capture; 27 | }; 28 | -------------------------------------------------------------------------------- /include/grabber/OpenCVWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Qt includes 4 | #include 5 | 6 | // Hyperion includes 7 | #include 8 | #include 9 | 10 | // Grabber includes 11 | #include 12 | 13 | class OpenCVWrapper : public QObject 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | OpenCVWrapper(int input, 19 | int width, 20 | int height, 21 | int frequency, 22 | int hyperionPriority, 23 | Hyperion * hyperion); 24 | virtual ~OpenCVWrapper(); 25 | 26 | public slots: 27 | void start(); 28 | 29 | void stop(); 30 | 31 | signals: 32 | void emitColors(int priority, const std::vector &ledColors, const int timeout_ms); 33 | void emitImage(int priority, const Image & image, const int timeout_ms); 34 | 35 | private slots: 36 | void grabFrame(); 37 | void checkSources(); 38 | 39 | private: 40 | /// The timeout of the led colors [ms] 41 | const int _timeout_ms; 42 | 43 | /// The priority of the led colors 44 | const int _priority; 45 | 46 | /// Grab frequency [Hz] 47 | const int _frequency; 48 | 49 | /// The OpenCV grabber 50 | OpenCVGrabber _grabber; 51 | 52 | /// The processor for transforming images to led colors 53 | ImageProcessor * _processor; 54 | 55 | /// The Hyperion instance 56 | Hyperion * _hyperion; 57 | 58 | /// The list with computed led colors 59 | std::vector _ledColors; 60 | 61 | /// Timer which tests if a higher priority source is active 62 | QTimer _priority_check_timer; 63 | 64 | QTimer _grab_timer; 65 | }; 66 | -------------------------------------------------------------------------------- /include/grabber/VideoStandard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | /** 7 | * Enumeration of the possible video standards the grabber can be set to 8 | */ 9 | enum VideoStandard { 10 | VIDEOSTANDARD_PAL, 11 | VIDEOSTANDARD_NTSC, 12 | VIDEOSTANDARD_NO_CHANGE 13 | }; 14 | 15 | inline VideoStandard parseVideoStandard(std::string videoStandard) 16 | { 17 | // convert to lower case 18 | std::transform(videoStandard.begin(), videoStandard.end(), videoStandard.begin(), ::tolower); 19 | 20 | if (videoStandard == "pal") 21 | { 22 | return VIDEOSTANDARD_PAL; 23 | } 24 | else if (videoStandard == "ntsc") 25 | { 26 | return VIDEOSTANDARD_NTSC; 27 | } 28 | 29 | // return the default NO_CHANGE 30 | return VIDEOSTANDARD_NO_CHANGE; 31 | } 32 | -------------------------------------------------------------------------------- /include/grabber/X11Grabber.h: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion-utils includes 3 | #include 4 | #include 5 | #include 6 | 7 | // X11 includes 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class X11Grabber 15 | { 16 | public: 17 | 18 | X11Grabber(bool useXGetImage, int cropLeft, int cropRight, int cropTop, int cropBottom, int horizontalPixelDecimation, int verticalPixelDecimation); 19 | 20 | virtual ~X11Grabber(); 21 | 22 | /// 23 | /// Set the video mode (2D/3D) 24 | /// @param[in] mode The new video mode 25 | /// 26 | void setVideoMode(const VideoMode videoMode); 27 | 28 | bool Setup(); 29 | 30 | Image & grab(); 31 | 32 | private: 33 | ImageResampler _imageResampler; 34 | 35 | bool _useXGetImage, _XShmAvailable, _XShmPixmapAvailable, _XRenderAvailable; 36 | int _cropLeft; 37 | int _cropRight; 38 | int _cropTop; 39 | int _cropBottom; 40 | 41 | XImage* _xImage; 42 | XShmSegmentInfo _shminfo; 43 | 44 | /// Reference to the X11 display (nullptr if not opened) 45 | Display* _x11Display; 46 | Window _window; 47 | XWindowAttributes _windowAttr; 48 | 49 | Pixmap _pixmap; 50 | XRenderPictFormat* _srcFormat; 51 | XRenderPictFormat* _dstFormat; 52 | XRenderPictureAttributes _pictAttr; 53 | Picture _srcPicture; 54 | Picture _dstPicture; 55 | 56 | unsigned _screenWidth; 57 | unsigned _screenHeight; 58 | unsigned _croppedWidth; 59 | unsigned _croppedHeight; 60 | 61 | Image _image; 62 | 63 | void freeResources(); 64 | void setupResources(); 65 | 66 | int updateScreenDimensions(); 67 | }; 68 | -------------------------------------------------------------------------------- /include/hyperion/ColorAdjustment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Utils includes 7 | #include 8 | 9 | class ColorAdjustment 10 | { 11 | public: 12 | 13 | /// Unique identifier for this color transform 14 | std::string _id; 15 | 16 | /// The RED-Channel (RGB) adjustment 17 | RgbChannelAdjustment _rgbRedAdjustment; 18 | /// The GREEN-Channel (RGB) transform 19 | RgbChannelAdjustment _rgbGreenAdjustment; 20 | /// The BLUE-Channel (RGB) transform 21 | RgbChannelAdjustment _rgbBlueAdjustment; 22 | }; 23 | -------------------------------------------------------------------------------- /include/hyperion/ColorCorrection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Utils includes 7 | #include 8 | 9 | class ColorCorrection 10 | { 11 | public: 12 | 13 | /// Unique identifier for this color correction 14 | std::string _id; 15 | 16 | /// The RGB correction 17 | RgbChannelCorrection _rgbCorrection; 18 | }; 19 | -------------------------------------------------------------------------------- /include/hyperion/ColorTransform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Utils includes 7 | #include 8 | #include 9 | #include 10 | 11 | class ColorTransform 12 | { 13 | public: 14 | 15 | /// Unique identifier for this color transform 16 | std::string _id; 17 | 18 | /// The RED-Channel (RGB) transform 19 | RgbChannelTransform _rgbRedTransform; 20 | /// The GREEN-Channel (RGB) transform 21 | RgbChannelTransform _rgbGreenTransform; 22 | /// The BLUE-Channel (RGB) transform 23 | RgbChannelTransform _rgbBlueTransform; 24 | 25 | /// The HSV Transform for applying Saturation and Value transforms 26 | HsvTransform _hsvTransform; 27 | 28 | /// The HSL Transform for applying Saturation and Value transforms 29 | HslTransform _hslTransform; 30 | }; 31 | -------------------------------------------------------------------------------- /include/hyperion/ImageProcessorFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Jsoncpp includes 7 | #include 8 | 9 | #include 10 | 11 | // Forward class declaration 12 | class ImageProcessor; 13 | 14 | /// 15 | /// The ImageProcessor is a singleton factor for creating ImageProcessors that translate images to 16 | /// led color values. 17 | /// 18 | class ImageProcessorFactory 19 | { 20 | public: 21 | /// 22 | /// Returns the 'singleton' instance (creates the singleton if it does not exist) 23 | /// 24 | /// @return The singleton instance of the ImageProcessorFactory 25 | /// 26 | static ImageProcessorFactory& getInstance(); 27 | 28 | public: 29 | /// 30 | /// Initialises this factory with the given led-configuration 31 | /// 32 | /// @param[in] ledString The led configuration 33 | /// @param[in] enableBlackBorderDetector Flag indicating if the blacborder detector should be enabled 34 | /// @param[in] blackborderThreshold The threshold which the blackborder detector should use 35 | /// 36 | void init(const LedString& ledString, const Json::Value &blackborderConfig); 37 | 38 | /// 39 | /// Creates a new ImageProcessor. The onwership of the processor is transferred to the caller. 40 | /// 41 | /// @return The newly created ImageProcessor 42 | /// 43 | ImageProcessor* newImageProcessor() const; 44 | 45 | private: 46 | /// The Led-string specification 47 | LedString _ledString; 48 | 49 | // Reference to the blackborder json configuration values 50 | Json::Value _blackborderConfig; 51 | }; 52 | -------------------------------------------------------------------------------- /include/hyperion/MessageForwarder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | // QT includes 10 | #include 11 | #include 12 | #include 13 | 14 | // Utils includes 15 | #include 16 | class MessageForwarder 17 | { 18 | public: 19 | 20 | struct JsonSlaveAddress { 21 | QHostAddress addr; 22 | quint16 port; 23 | }; 24 | 25 | MessageForwarder(); 26 | ~MessageForwarder(); 27 | 28 | void addJsonSlave(std::string slave); 29 | void addProtoSlave(std::string slave); 30 | 31 | bool protoForwardingEnabled(); 32 | QStringList getProtoSlaves(); 33 | QList getJsonSlaves(); 34 | 35 | private: 36 | QStringList _protoSlaves; 37 | QList _jsonSlaves; 38 | }; 39 | -------------------------------------------------------------------------------- /include/jsonserver/JsonServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // system includes 4 | #include 5 | 6 | // Qt includes 7 | #include 8 | #include 9 | 10 | // Hyperion includes 11 | #include 12 | 13 | class JsonClientConnection; 14 | 15 | /// 16 | /// This class creates a TCP server which accepts connections wich can then send 17 | /// in JSON encoded commands. This interface to Hyperion is used by hyperion-remote 18 | /// to control the leds 19 | /// 20 | class JsonServer : public QObject 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | /// 26 | /// JsonServer constructor 27 | /// @param hyperion Hyperion instance 28 | /// @param port port number on which to start listening for connections 29 | /// 30 | JsonServer(Hyperion * hyperion, uint16_t port = 19444); 31 | ~JsonServer(); 32 | 33 | /// 34 | /// @return the port number on which this TCP listens for incoming connections 35 | /// 36 | uint16_t getPort() const; 37 | 38 | private slots: 39 | /// 40 | /// Slot which is called when a client tries to create a new connection 41 | /// 42 | void newConnection(); 43 | 44 | /// 45 | /// Slot which is called when a client closes a connection 46 | /// @param connection The Connection object which is being closed 47 | /// 48 | void closedConnection(JsonClientConnection * connection); 49 | 50 | private: 51 | /// Hyperion instance 52 | Hyperion * _hyperion; 53 | 54 | /// The TCP server object 55 | QTcpServer _server; 56 | 57 | /// List with open connections 58 | QSet _openConnections; 59 | }; 60 | -------------------------------------------------------------------------------- /include/leddevice/LedDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL incldues 4 | #include 5 | 6 | // Utility includes 7 | #include 8 | #include 9 | #include 10 | 11 | /// 12 | /// Interface (pure virtual base class) for LedDevices. 13 | /// 14 | class LedDevice 15 | { 16 | public: 17 | 18 | /// 19 | /// Empty virtual destructor for pure virtual base class 20 | /// 21 | virtual ~LedDevice() 22 | { 23 | // empty 24 | } 25 | 26 | /// 27 | /// Writes the RGB-Color values to the leds. 28 | /// 29 | /// @param[in] ledValues The RGB-color per led 30 | /// 31 | /// @return Zero on success else negative 32 | /// 33 | virtual int write(const std::vector& ledValues) = 0; 34 | 35 | /// Switch the leds off 36 | virtual int switchOff() = 0; 37 | }; 38 | -------------------------------------------------------------------------------- /include/leddevice/LedDeviceFactory.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | // Json includes 5 | #include 6 | 7 | // Leddevice includes 8 | #include 9 | 10 | 11 | /// 12 | /// The LedDeviceFactory is responsible for constructing 'LedDevices' 13 | /// 14 | class LedDeviceFactory 15 | { 16 | public: 17 | 18 | /// 19 | /// Constructs a LedDevice based on the given configuration 20 | /// 21 | /// @param deviceConfig The configuration of the led-device 22 | /// 23 | /// @return The constructed LedDevice or nullptr if configuration is invalid. The ownership of 24 | /// the constructed LedDevice is tranferred to the caller 25 | /// 26 | static LedDevice * construct(const Json::Value & deviceConfig); 27 | }; 28 | -------------------------------------------------------------------------------- /include/protoserver/ProtoConnectionWrapper.h: -------------------------------------------------------------------------------- 1 | // Qt includes 2 | #include 3 | 4 | // hyperion includes 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | // hyperion proto includes 11 | #include "protoserver/ProtoConnection.h" 12 | 13 | /// This class handles callbacks from the V4L2 and X11 grabber 14 | class ProtoConnectionWrapper : public QObject 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | ProtoConnectionWrapper(const std::string & address, int priority, int duration_ms, bool skipProtoReply); 20 | virtual ~ProtoConnectionWrapper(); 21 | 22 | signals: 23 | /// 24 | /// Forwarding XBMC Video Checker Message 25 | /// 26 | void setGrabbingMode(const GrabbingMode mode); 27 | void setVideoMode(const VideoMode videoMode); 28 | 29 | public slots: 30 | /// Handle a single image 31 | /// @param image The image to process 32 | void receiveImage(const Image & image); 33 | 34 | private: 35 | /// Priority for calls to Hyperion 36 | const int _priority; 37 | 38 | /// Duration for color calls to Hyperion 39 | const int _duration_ms; 40 | 41 | /// Hyperion proto connection object 42 | ProtoConnection _connection; 43 | }; 44 | -------------------------------------------------------------------------------- /include/utils/ColorArgb.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | #include 6 | 7 | struct ColorArgb; 8 | 9 | struct ColorArgb 10 | { 11 | 12 | /// The alpha mask channel 13 | uint8_t alpha; 14 | 15 | /// The red color channel 16 | uint8_t red; 17 | /// The green color channel 18 | uint8_t green; 19 | /// The blue color channel 20 | uint8_t blue; 21 | 22 | /// 'Black' RgbColor (255, 0, 0, 0) 23 | static ColorArgb BLACK; 24 | /// 'Red' RgbColor (255, 255, 0, 0) 25 | static ColorArgb RED; 26 | /// 'Green' RgbColor (255, 0, 255, 0) 27 | static ColorArgb GREEN; 28 | /// 'Blue' RgbColor (255, 0, 0, 255) 29 | static ColorArgb BLUE; 30 | /// 'Yellow' RgbColor (255, 255, 255, 0) 31 | static ColorArgb YELLOW; 32 | /// 'White' RgbColor (255, 255, 255, 255) 33 | static ColorArgb WHITE; 34 | }; 35 | 36 | 37 | /// Assert to ensure that the size of the structure is 'only' 3 bytes 38 | static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB"); 39 | 40 | /// 41 | /// Stream operator to write ColorRgb to an outputstream (format "'{'[alpha]', '[red]','[green]','[blue]'}'") 42 | /// 43 | /// @param os The output stream 44 | /// @param color The color to write 45 | /// @return The output stream (with the color written to it) 46 | /// 47 | inline std::ostream& operator<<(std::ostream& os, const ColorArgb& color) 48 | { 49 | os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; 50 | return os; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /include/utils/ColorRgba.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | #include 6 | 7 | struct ColorRgba; 8 | 9 | struct ColorRgba 10 | { 11 | 12 | /// The red color channel 13 | uint8_t red; 14 | /// The green color channel 15 | uint8_t green; 16 | /// The blue color channel 17 | uint8_t blue; 18 | 19 | /// The alpha mask channel 20 | uint8_t alpha; 21 | 22 | /// 'Black' RgbColor (0, 0, 0, 255) 23 | static ColorRgba BLACK; 24 | /// 'Red' RgbColor (255, 0, 0, 255) 25 | static ColorRgba RED; 26 | /// 'Green' RgbColor (0, 255, 0, 255) 27 | static ColorRgba GREEN; 28 | /// 'Blue' RgbColor (0, 0, 255, 255) 29 | static ColorRgba BLUE; 30 | /// 'Yellow' RgbColor (255, 255, 0, 255) 31 | static ColorRgba YELLOW; 32 | /// 'White' RgbColor (255, 255, 255, 255 33 | static ColorRgba WHITE; 34 | }; 35 | 36 | 37 | /// Assert to ensure that the size of the structure is 'only' 3 bytes 38 | static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB"); 39 | 40 | /// 41 | /// Stream operator to write ColorRgb to an outputstream (format "'{'[alpha]', '[red]','[green]','[blue]'}'") 42 | /// 43 | /// @param os The output stream 44 | /// @param color The color to write 45 | /// @return The output stream (with the color written to it) 46 | /// 47 | inline std::ostream& operator<<(std::ostream& os, const ColorRgba& color) 48 | { 49 | os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; 50 | return os; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /include/utils/GrabbingMode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * Enumeration of the possible modes in which frame-grabbing is performed. 5 | */ 6 | enum GrabbingMode 7 | { 8 | /** Frame grabbing is switched off */ 9 | GRABBINGMODE_OFF, 10 | /** Frame grabbing during video */ 11 | GRABBINGMODE_VIDEO, 12 | GRABBINGMODE_PAUSE, 13 | GRABBINGMODE_PHOTO, 14 | GRABBINGMODE_AUDIO, 15 | GRABBINGMODE_MENU, 16 | GRABBINGMODE_INVALID 17 | }; 18 | -------------------------------------------------------------------------------- /include/utils/ImageResampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class ImageResampler 9 | { 10 | public: 11 | ImageResampler(); 12 | ~ImageResampler(); 13 | 14 | void setHorizontalPixelDecimation(int decimator); 15 | 16 | void setVerticalPixelDecimation(int decimator); 17 | 18 | void setCropping(int cropLeft, 19 | int cropRight, 20 | int cropTop, 21 | int cropBottom); 22 | 23 | void set3D(VideoMode mode); 24 | 25 | void processImage(const uint8_t * data, int width, int height, int lineLength, PixelFormat pixelFormat, Image & outputImage) const; 26 | 27 | private: 28 | static inline uint8_t clamp(int x); 29 | static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b); 30 | 31 | private: 32 | int _horizontalDecimation; 33 | int _verticalDecimation; 34 | int _cropLeft; 35 | int _cropRight; 36 | int _cropTop; 37 | int _cropBottom; 38 | VideoMode _videoMode; 39 | }; 40 | -------------------------------------------------------------------------------- /include/utils/PixelFormat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | /** 7 | * Enumeration of the possible pixel formats the grabber can be set to 8 | */ 9 | enum PixelFormat { 10 | PIXELFORMAT_YUYV, 11 | PIXELFORMAT_UYVY, 12 | PIXELFORMAT_BGR16, 13 | PIXELFORMAT_BGR24, 14 | PIXELFORMAT_RGB32, 15 | PIXELFORMAT_BGR32, 16 | PIXELFORMAT_NO_CHANGE 17 | }; 18 | 19 | inline PixelFormat parsePixelFormat(std::string pixelFormat) 20 | { 21 | // convert to lower case 22 | std::transform(pixelFormat.begin(), pixelFormat.end(), pixelFormat.begin(), ::tolower); 23 | 24 | if (pixelFormat == "yuyv") 25 | { 26 | return PIXELFORMAT_YUYV; 27 | } 28 | else if (pixelFormat == "uyvy") 29 | { 30 | return PIXELFORMAT_UYVY; 31 | } 32 | else if (pixelFormat == "bgr16") 33 | { 34 | return PIXELFORMAT_BGR16; 35 | } 36 | else if (pixelFormat == "bgr24") 37 | { 38 | return PIXELFORMAT_BGR24; 39 | } 40 | else if (pixelFormat == "rgb32") 41 | { 42 | return PIXELFORMAT_RGB32; 43 | } 44 | else if (pixelFormat == "bgr32") 45 | { 46 | return PIXELFORMAT_BGR32; 47 | } 48 | 49 | // return the default NO_CHANGE 50 | return PIXELFORMAT_NO_CHANGE; 51 | } 52 | -------------------------------------------------------------------------------- /include/utils/Profiler.h: -------------------------------------------------------------------------------- 1 | #include "utils/Logger.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #ifndef ENABLE_PROFILER 9 | #error "Profiler is not for productive code, enable it via cmake or remove header include" 10 | #endif 11 | 12 | // profiler 13 | #define PROFILER_BLOCK_EXECUTION_TIME Profiler DEBUG_PROFILE__BLOCK__EXECUTION__TIME_messure_object(__FILE__, _FUNCNAME_, __LINE__ ); 14 | #define PROFILER_TIMER_START(stopWatchName) Profiler::TimerStart(stopWatchName, __FILE__, _FUNCNAME_, __LINE__); 15 | #define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, _FUNCNAME_, __LINE__); 16 | #define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);} } 17 | 18 | 19 | class Profiler 20 | { 21 | public: 22 | Profiler(const char* sourceFile, const char* func, unsigned int line); 23 | ~Profiler(); 24 | 25 | static void TimerStart(const std::string stopWatchName, const char* sourceFile, const char* func, unsigned int line); 26 | static void TimerGetTime(const std::string stopWatchName, const char* sourceFile, const char* func, unsigned int line); 27 | 28 | private: 29 | static void initLogger(); 30 | 31 | static Logger* _logger; 32 | const char* _file; 33 | const char* _func; 34 | unsigned int _line; 35 | unsigned int _blockId; 36 | clock_t _startTime; 37 | }; 38 | -------------------------------------------------------------------------------- /include/utils/RgbToRgbw.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, std::string _whiteAlgorithm); 5 | -------------------------------------------------------------------------------- /include/utils/Sleep.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Sleep : protected QThread { 6 | public: 7 | static inline void msleep(unsigned long msecs) { 8 | QThread::msleep(msecs); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /include/utils/VideoMode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | /** 7 | * Enumeration of the possible modes in which video can be playing (2D, 3D) 8 | */ 9 | enum VideoMode 10 | { 11 | VIDEO_2D, 12 | VIDEO_3DSBS, 13 | VIDEO_3DTAB 14 | }; 15 | 16 | inline VideoMode parse3DMode(std::string videoMode) 17 | { 18 | // convert to lower case 19 | std::transform(videoMode.begin(), videoMode.end(), videoMode.begin(), ::toupper); 20 | 21 | if (videoMode == "3DTAB") 22 | { 23 | return VIDEO_3DTAB; 24 | } 25 | else if (videoMode == "3DSBS") 26 | { 27 | return VIDEO_3DSBS; 28 | } 29 | 30 | // return the default 2D 31 | return VIDEO_2D; 32 | } 33 | -------------------------------------------------------------------------------- /include/webconfig/WebConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef WEBCONFIG_H 2 | #define WEBCONFIG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class StaticFileServing; 11 | 12 | class WebConfig : public QObject { 13 | Q_OBJECT 14 | 15 | public: 16 | WebConfig (Hyperion *hyperion, QObject * parent = NULL); 17 | 18 | virtual ~WebConfig (void); 19 | 20 | void start(); 21 | void stop(); 22 | 23 | private: 24 | Hyperion* _hyperion; 25 | QString _baseUrl; 26 | quint16 _port; 27 | StaticFileServing* _server; 28 | 29 | const std::string WEBCONFIG_DEFAULT_PATH = "/usr/share/hyperion/webconfig"; 30 | const quint16 WEBCONFIG_DEFAULT_PORT = 8099; 31 | }; 32 | 33 | #endif // WEBCONFIG_H 34 | 35 | -------------------------------------------------------------------------------- /libsrc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) 4 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) 5 | 6 | add_subdirectory(hyperion) 7 | add_subdirectory(blackborder) 8 | add_subdirectory(jsonserver) 9 | 10 | add_subdirectory(protoserver) 11 | 12 | if (ENABLE_ZEROCONF) 13 | add_subdirectory(bonjour) 14 | endif (ENABLE_ZEROCONF) 15 | 16 | add_subdirectory(boblightserver) 17 | add_subdirectory(leddevice) 18 | add_subdirectory(utils) 19 | add_subdirectory(xbmcvideochecker) 20 | add_subdirectory(effectengine) 21 | add_subdirectory(grabber) 22 | 23 | if(ENABLE_QT5) 24 | add_subdirectory(webconfig) 25 | endif() 26 | -------------------------------------------------------------------------------- /libsrc/blackborder/BlackBorderDetector.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | // BlackBorders includes 3 | #include 4 | #include 5 | 6 | using namespace hyperion; 7 | 8 | BlackBorderDetector::BlackBorderDetector(double threshold) : 9 | _blackborderThreshold(calculateThreshold(threshold)) 10 | { 11 | // empty 12 | } 13 | 14 | uint8_t BlackBorderDetector::calculateThreshold(double threshold) 15 | { 16 | int rgbThreshold = int(std::ceil(threshold * 255)); 17 | if (rgbThreshold < 0) 18 | rgbThreshold = 0; 19 | else if (rgbThreshold > 255) 20 | rgbThreshold = 255; 21 | 22 | uint8_t blackborderThreshold = uint8_t(rgbThreshold); 23 | 24 | std::cout << "BLACKBORDER INFO: threshold set to " << threshold << " (" << int(blackborderThreshold) << ")" << std::endl; 25 | 26 | return blackborderThreshold; 27 | } 28 | -------------------------------------------------------------------------------- /libsrc/blackborder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/blackborder) 4 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/blackborder) 5 | 6 | SET(Blackborder_HEADERS 7 | ${CURRENT_HEADER_DIR}/BlackBorderDetector.h 8 | ${CURRENT_HEADER_DIR}/BlackBorderProcessor.h 9 | ) 10 | 11 | SET(Blackborder_SOURCES 12 | ${CURRENT_SOURCE_DIR}/BlackBorderDetector.cpp 13 | ${CURRENT_SOURCE_DIR}/BlackBorderProcessor.cpp 14 | ) 15 | 16 | add_library(blackborder 17 | ${Blackborder_HEADERS} 18 | ${Blackborder_SOURCES} 19 | ) 20 | 21 | target_link_libraries(blackborder 22 | hyperion-utils 23 | ) 24 | -------------------------------------------------------------------------------- /libsrc/boblightserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/boblightserver) 4 | set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/boblightserver) 5 | 6 | # Group the headers that go through the MOC compiler 7 | set(BoblightServer_QT_HEADERS 8 | ${CURRENT_HEADER_DIR}/BoblightServer.h 9 | ${CURRENT_SOURCE_DIR}/BoblightClientConnection.h 10 | ) 11 | 12 | set(BoblightServer_HEADERS 13 | ) 14 | 15 | set(BoblightServer_SOURCES 16 | ${CURRENT_SOURCE_DIR}/BoblightServer.cpp 17 | ${CURRENT_SOURCE_DIR}/BoblightClientConnection.cpp 18 | ) 19 | 20 | if(ENABLE_QT5) 21 | qt5_wrap_cpp(BoblightServer_HEADERS_MOC ${BoblightServer_QT_HEADERS}) 22 | else() 23 | qt4_wrap_cpp(BoblightServer_HEADERS_MOC ${BoblightServer_QT_HEADERS}) 24 | endif() 25 | 26 | add_library(boblightserver 27 | ${BoblightServer_HEADERS} 28 | ${BoblightServer_QT_HEADERS} 29 | ${BoblightServer_SOURCES} 30 | ${BoblightServer_HEADERS_MOC} 31 | ) 32 | 33 | if(ENABLE_QT5) 34 | qt5_use_modules(boblightserver Widgets) 35 | endif() 36 | 37 | target_link_libraries(boblightserver 38 | hyperion 39 | hyperion-utils 40 | ${QT_LIBRARIES}) 41 | -------------------------------------------------------------------------------- /libsrc/bonjour/fortuneserver.pro: -------------------------------------------------------------------------------- 1 | HEADERS = server.h \ 2 | bonjourserviceregister.h 3 | SOURCES = server.cpp \ 4 | main.cpp \ 5 | bonjourserviceregister.cpp 6 | QT += network 7 | 8 | !mac:x11:LIBS+=-ldns_sd 9 | 10 | win32 { 11 | LIBS+=-ldnssd 12 | # Add your path to bonjour here. 13 | LIBPATH=C:/Temp/mDNSResponder-107.6/mDNSWindows/DLL/Debug 14 | INCLUDEPATH += c:/Temp/mDNSResponder-107.6/mDNSShared 15 | } 16 | -------------------------------------------------------------------------------- /libsrc/bonjour/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2004-2007 Trolltech ASA. All rights reserved. 4 | ** 5 | ** This file is part of the example classes of the Qt Toolkit. 6 | ** 7 | ** This file may be used under the terms of the GNU General Public 8 | ** License version 2.0 as published by the Free Software Foundation 9 | ** and appearing in the file LICENSE.GPL included in the packaging of 10 | ** this file. Please review the following information to ensure GNU 11 | ** General Public Licensing requirements will be met: 12 | ** http://www.trolltech.com/products/qt/opensource.html 13 | ** 14 | ** If you are unsure which license is appropriate for your use, please 15 | ** review the following information: 16 | ** http://www.trolltech.com/products/qt/licensing.html or contact the 17 | ** sales department at sales@trolltech.com. 18 | ** 19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 | ** 22 | ****************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include "server.h" 30 | 31 | int main(int argc, char *argv[]) 32 | { 33 | QApplication app(argc, argv); 34 | Server server; 35 | server.show(); 36 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); 37 | int x = server.exec(); 38 | return x; 39 | } 40 | -------------------------------------------------------------------------------- /libsrc/bonjour/server.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2004-2007 Trolltech ASA. All rights reserved. 4 | ** 5 | ** This file is part of the example classes of the Qt Toolkit. 6 | ** 7 | ** This file may be used under the terms of the GNU General Public 8 | ** License version 2.0 as published by the Free Software Foundation 9 | ** and appearing in the file LICENSE.GPL included in the packaging of 10 | ** this file. Please review the following information to ensure GNU 11 | ** General Public Licensing requirements will be met: 12 | ** http://www.trolltech.com/products/qt/opensource.html 13 | ** 14 | ** If you are unsure which license is appropriate for your use, please 15 | ** review the following information: 16 | ** http://www.trolltech.com/products/qt/licensing.html or contact the 17 | ** sales department at sales@trolltech.com. 18 | ** 19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 | ** 22 | ****************************************************************************/ 23 | 24 | #ifndef SERVER_H 25 | #define SERVER_H 26 | 27 | #include 28 | 29 | class QLabel; 30 | class QPushButton; 31 | class QTcpServer; 32 | class BonjourServiceRegister; 33 | 34 | class Server : public QDialog 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | Server(QWidget *parent = 0); 40 | 41 | private slots: 42 | void sendFortune(); 43 | 44 | private: 45 | QLabel *statusLabel; 46 | QPushButton *quitButton; 47 | QTcpServer *tcpServer; 48 | QStringList fortunes; 49 | BonjourServiceRegister *bonjourRegister; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libsrc/effectengine/EffectEngine.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | EffectDefinition.schema.json 4 | 5 | 6 | -------------------------------------------------------------------------------- /libsrc/grabber/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (ENABLE_AMLOGIC) 2 | add_subdirectory(amlogic) 3 | endif (ENABLE_AMLOGIC) 4 | 5 | if (ENABLE_DISPMANX) 6 | add_subdirectory(dispmanx) 7 | endif (ENABLE_DISPMANX) 8 | 9 | if (ENABLE_FB) 10 | add_subdirectory(framebuffer) 11 | endif (ENABLE_FB) 12 | 13 | if (ENABLE_OSX) 14 | add_subdirectory(osx) 15 | endif() 16 | 17 | if (ENABLE_V4L2) 18 | add_subdirectory(v4l2) 19 | endif (ENABLE_V4L2) 20 | 21 | if (ENABLE_OPENCV) 22 | add_subdirectory(opencv) 23 | endif (ENABLE_OPENCV) 24 | 25 | if (ENABLE_X11) 26 | add_subdirectory(x11) 27 | endif() 28 | -------------------------------------------------------------------------------- /libsrc/grabber/amlogic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 4 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic) 5 | 6 | # Group the headers that go through the MOC compiler 7 | SET(AmlogicQT_HEADERS ${CURRENT_HEADER_DIR}/AmlogicWrapper.h) 8 | 9 | SET(AmlogicHEADERS 10 | ${CURRENT_HEADER_DIR}/AmlogicGrabber.h 11 | ) 12 | 13 | SET(AmlogicSOURCES 14 | ${CURRENT_SOURCE_DIR}/AmlogicWrapper.cpp 15 | ${CURRENT_SOURCE_DIR}/AmlogicGrabber.cpp 16 | ) 17 | 18 | if(ENABLE_QT5) 19 | QT5_WRAP_CPP(AmlogicHEADERS_MOC ${AmlogicQT_HEADERS}) 20 | else(ENABLE_QT5) 21 | QT4_WRAP_CPP(AmlogicHEADERS_MOC ${AmlogicQT_HEADERS}) 22 | endif(ENABLE_QT5) 23 | 24 | add_library(amlogic-grabber 25 | ${AmlogicHEADERS} 26 | ${AmlogicQT_HEADERS} 27 | ${AmlogicHEADERS_MOC} 28 | ${AmlogicSOURCES} 29 | ) 30 | 31 | target_link_libraries(amlogic-grabber 32 | hyperion 33 | ${QT_LIBRARIES}) 34 | -------------------------------------------------------------------------------- /libsrc/grabber/dispmanx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Find the BCM-package (VC control) 3 | find_package(BCM REQUIRED) 4 | include_directories(${BCM_INCLUDE_DIRS}) 5 | 6 | # Define the current source locations 7 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 8 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx) 9 | 10 | # Group the headers that go through the MOC compiler 11 | SET(DispmanxGrabberQT_HEADERS 12 | ${CURRENT_HEADER_DIR}/DispmanxWrapper.h 13 | ) 14 | 15 | SET(DispmanxGrabberHEADERS 16 | ${CURRENT_HEADER_DIR}/DispmanxFrameGrabber.h 17 | ) 18 | 19 | SET(DispmanxGrabberSOURCES 20 | ${CURRENT_SOURCE_DIR}/DispmanxWrapper.cpp 21 | ${CURRENT_SOURCE_DIR}/DispmanxFrameGrabber.cpp 22 | ) 23 | 24 | if(ENABLE_QT5) 25 | QT5_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS}) 26 | else() 27 | QT4_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS}) 28 | endif() 29 | 30 | add_library(dispmanx-grabber 31 | ${DispmanxGrabberHEADERS} 32 | ${DispmanxGrabberQT_HEADERS} 33 | ${DispmanxGrabberHEADERS_MOC} 34 | ${DispmanxGrabberSOURCES} 35 | ) 36 | 37 | target_link_libraries(dispmanx-grabber 38 | hyperion 39 | ${QT_LIBRARIES} 40 | ${BCM_LIBRARIES} 41 | ) 42 | -------------------------------------------------------------------------------- /libsrc/grabber/framebuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Find the BCM-package (VC control) 3 | # find_package(BCM REQUIRED) 4 | # include_directories(${BCM_INCLUDE_DIRS}) 5 | 6 | # Define the current source locations 7 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 8 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer) 9 | 10 | # Group the headers that go through the MOC compiler 11 | SET(FramebufferGrabberQT_HEADERS 12 | ${CURRENT_HEADER_DIR}/FramebufferWrapper.h 13 | ) 14 | 15 | SET(FramebufferGrabberHEADERS 16 | ${CURRENT_HEADER_DIR}/FramebufferFrameGrabber.h 17 | ) 18 | 19 | SET(FramebufferGrabberSOURCES 20 | ${CURRENT_SOURCE_DIR}/FramebufferWrapper.cpp 21 | ${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.cpp 22 | ) 23 | 24 | if(ENABLE_QT5) 25 | QT5_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS}) 26 | else() 27 | QT4_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS}) 28 | endif() 29 | 30 | add_library(framebuffer-grabber 31 | ${FramebufferGrabberHEADERS} 32 | ${FramebufferGrabberQT_HEADERS} 33 | ${FramebufferGrabberHEADERS_MOC} 34 | ${FramebufferGrabberSOURCES} 35 | ) 36 | 37 | target_link_libraries(framebuffer-grabber 38 | hyperion 39 | ${QT_LIBRARIES}) 40 | -------------------------------------------------------------------------------- /libsrc/grabber/opencv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(OpenCV REQUIRED) 2 | 3 | # Define the current source locations 4 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 5 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/opencv) 6 | 7 | SET(OPENCV_GRABBER_QT_HEADERS 8 | ${CURRENT_HEADER_DIR}/OpenCVGrabber.h 9 | ${CURRENT_HEADER_DIR}/OpenCVWrapper.h 10 | ) 11 | 12 | SET(OPENCV_GRABBER_SOURCES 13 | ${CURRENT_SOURCE_DIR}/OpenCVGrabber.cpp 14 | ${CURRENT_SOURCE_DIR}/OpenCVWrapper.cpp 15 | ) 16 | 17 | if(ENABLE_QT5) 18 | QT5_WRAP_CPP(OPENCV_GRABBER_HEADERS_MOC ${OPENCV_GRABBER_QT_HEADERS}) 19 | else() 20 | QT4_WRAP_CPP(OPENCV_GRABBER_HEADERS_MOC ${OPENCV_GRABBER_QT_HEADERS}) 21 | endif() 22 | 23 | add_library(opencv-grabber 24 | ${OPENCV_GRABBER_HEADERS} 25 | ${OPENCV_GRABBER_SOURCES} 26 | ${OPENCV_GRABBER_QT_HEADERS} 27 | ${OPENCV_GRABBER_HEADERS_MOC} 28 | ) 29 | 30 | if(ENABLE_QT5) 31 | qt5_use_modules(opencv-grabber Widgets) 32 | endif(ENABLE_QT5) 33 | 34 | target_link_libraries(opencv-grabber 35 | hyperion 36 | ${QT_LIBRARIES} 37 | ${OpenCV_LIBS} 38 | ) 39 | -------------------------------------------------------------------------------- /libsrc/grabber/opencv/OpenCVGrabber.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "grabber/OpenCVGrabber.h" 7 | 8 | 9 | OpenCVGrabber::OpenCVGrabber(int input, int width, int height) 10 | : _capture(input) 11 | { 12 | if (width && height) { 13 | _capture.set(CV_CAP_PROP_FRAME_WIDTH, width); 14 | _capture.set(CV_CAP_PROP_FRAME_HEIGHT, height); 15 | } 16 | } 17 | 18 | OpenCVGrabber::~OpenCVGrabber() 19 | { 20 | } 21 | 22 | void OpenCVGrabber::grabFrame(Image & image) 23 | { 24 | cv::Mat frame; 25 | _capture >> frame; 26 | 27 | const int width = frame.cols, height = frame.rows; 28 | 29 | cv::Mat rgbFrame(width, height, CV_8UC3); 30 | cvtColor(frame, rgbFrame, cv::COLOR_BGR2RGB); 31 | 32 | image.resize(width, height); 33 | memcpy(image.memptr(), rgbFrame.ptr(), width * height * 3); 34 | } 35 | -------------------------------------------------------------------------------- /libsrc/grabber/osx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the current source locations 2 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 3 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx) 4 | 5 | # Group the headers that go through the MOC compiler 6 | SET(OsxGrabberQT_HEADERS 7 | ${CURRENT_HEADER_DIR}/OsxWrapper.h 8 | ) 9 | 10 | SET(OsxGrabberHEADERS 11 | ${CURRENT_HEADER_DIR}/OsxFrameGrabber.h 12 | ) 13 | 14 | SET(OsxGrabberSOURCES 15 | ${CURRENT_SOURCE_DIR}/OsxWrapper.cpp 16 | ${CURRENT_SOURCE_DIR}/OsxFrameGrabber.cpp 17 | ) 18 | 19 | if(ENABLE_QT5) 20 | QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS}) 21 | else() 22 | QT4_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS}) 23 | endif() 24 | 25 | add_library(osx-grabber 26 | ${OsxGrabberHEADERS} 27 | ${OsxGrabberQT_HEADERS} 28 | ${OsxGrabberHEADERS_MOC} 29 | ${OsxGrabberSOURCES} 30 | ) 31 | 32 | target_link_libraries(osx-grabber 33 | hyperion 34 | ${QT_LIBRARIES}) 35 | -------------------------------------------------------------------------------- /libsrc/grabber/v4l2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the current source locations 2 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 3 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/v4l2) 4 | 5 | SET(V4L2_QT_HEADERS 6 | ${CURRENT_HEADER_DIR}/V4L2Grabber.h 7 | ${CURRENT_HEADER_DIR}/V4L2Wrapper.h 8 | ) 9 | 10 | SET(V4L2_HEADERS 11 | ${CURRENT_HEADER_DIR}/VideoStandard.h 12 | ) 13 | 14 | SET(V4L2_SOURCES 15 | ${CURRENT_SOURCE_DIR}/V4L2Grabber.cpp 16 | ${CURRENT_SOURCE_DIR}/V4L2Wrapper.cpp 17 | ) 18 | 19 | if(ENABLE_QT5) 20 | QT5_WRAP_CPP(V4L2_HEADERS_MOC ${V4L2_QT_HEADERS}) 21 | else() 22 | QT4_WRAP_CPP(V4L2_HEADERS_MOC ${V4L2_QT_HEADERS}) 23 | endif() 24 | 25 | add_library(v4l2-grabber 26 | ${V4L2_HEADERS} 27 | ${V4L2_SOURCES} 28 | ${V4L2_QT_HEADERS} 29 | ${V4L2_HEADERS_MOC} 30 | ) 31 | 32 | if(ENABLE_QT5) 33 | qt5_use_modules(v4l2-grabber Widgets) 34 | endif(ENABLE_QT5) 35 | 36 | target_link_libraries(v4l2-grabber 37 | hyperion 38 | ${QT_LIBRARIES} 39 | ) 40 | -------------------------------------------------------------------------------- /libsrc/grabber/x11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the current source locations 2 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) 3 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/x11) 4 | 5 | # Find X11 6 | find_package(X11 REQUIRED) 7 | 8 | include_directories( 9 | ${QT_INCLUDES} 10 | ${X11_INCLUDES} 11 | ) 12 | 13 | SET(X11_QT_HEADERS 14 | ${CURRENT_HEADER_DIR}/X11Grabber.h 15 | ) 16 | 17 | SET(X11_HEADERS 18 | ${CURRENT_HEADER_DIR}/X11Grabber.h 19 | ) 20 | 21 | SET(X11_SOURCES 22 | ${CURRENT_SOURCE_DIR}/X11Grabber.cpp 23 | ) 24 | 25 | if(ENABLE_QT5) 26 | QT5_WRAP_CPP(X11_HEADERS_MOC ${X11_QT_HEADERS}) 27 | else() 28 | QT4_WRAP_CPP(X11_HEADERS_MOC ${X11_QT_HEADERS}) 29 | endif() 30 | 31 | add_library(x11-grabber 32 | ${X11_HEADERS} 33 | ${X11_SOURCES} 34 | ${X11_QT_HEADERS} 35 | ${X11_HEADERS_MOC} 36 | ) 37 | 38 | target_link_libraries(x11-grabber 39 | hyperion 40 | ${QT_LIBRARIES} 41 | ) 42 | -------------------------------------------------------------------------------- /libsrc/hyperion/ImageProcessorFactory.cpp: -------------------------------------------------------------------------------- 1 | // Hyperion includes 2 | #include 3 | #include 4 | 5 | ImageProcessorFactory& ImageProcessorFactory::getInstance() 6 | { 7 | static ImageProcessorFactory instance; 8 | // Return the singleton instance 9 | return instance; 10 | } 11 | 12 | void ImageProcessorFactory::init(const LedString& ledString, const Json::Value & blackborderConfig) 13 | { 14 | _ledString = ledString; 15 | _blackborderConfig = blackborderConfig; 16 | } 17 | 18 | ImageProcessor* ImageProcessorFactory::newImageProcessor() const 19 | { 20 | return new ImageProcessor(_ledString, _blackborderConfig); 21 | } 22 | -------------------------------------------------------------------------------- /libsrc/hyperion/LedString.cpp: -------------------------------------------------------------------------------- 1 | // STL includes 2 | #include 3 | #include 4 | #include 5 | 6 | // Json includes 7 | #include 8 | 9 | // hyperion includes 10 | #include 11 | 12 | 13 | LedString::LedString() 14 | { 15 | // empty 16 | } 17 | 18 | LedString::~LedString() 19 | { 20 | // empty 21 | } 22 | 23 | std::vector& LedString::leds() 24 | { 25 | return mLeds; 26 | } 27 | 28 | const std::vector& LedString::leds() const 29 | { 30 | return mLeds; 31 | } 32 | -------------------------------------------------------------------------------- /libsrc/hyperion/MessageForwarder.cpp: -------------------------------------------------------------------------------- 1 | // STL includes 2 | #include 3 | 4 | #include 5 | 6 | 7 | MessageForwarder::MessageForwarder() 8 | { 9 | } 10 | 11 | MessageForwarder::~MessageForwarder() 12 | { 13 | } 14 | 15 | 16 | void MessageForwarder::addJsonSlave(std::string slave) 17 | { 18 | QStringList parts = QString(slave.c_str()).split(":"); 19 | if (parts.size() != 2) 20 | throw std::runtime_error(QString("HYPERION (forwarder) ERROR: Wrong address: unable to parse address (%1)").arg(slave.c_str()).toStdString()); 21 | 22 | bool ok; 23 | quint16 port = parts[1].toUShort(&ok); 24 | if (!ok) 25 | throw std::runtime_error(QString("HYPERION (forwarder) ERROR: Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString()); 26 | 27 | JsonSlaveAddress c; 28 | c.addr = QHostAddress(parts[0]); 29 | c.port = port; 30 | _jsonSlaves << c; 31 | } 32 | 33 | void MessageForwarder::addProtoSlave(std::string slave) 34 | { 35 | _protoSlaves << QString(slave.c_str()); 36 | } 37 | 38 | QStringList MessageForwarder::getProtoSlaves() 39 | { 40 | return _protoSlaves; 41 | } 42 | 43 | QList MessageForwarder::getJsonSlaves() 44 | { 45 | return _jsonSlaves; 46 | } 47 | 48 | bool MessageForwarder::protoForwardingEnabled() 49 | { 50 | return ! _protoSlaves.empty(); 51 | } 52 | -------------------------------------------------------------------------------- /libsrc/hyperion/resource.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | hyperion.schema.json 4 | 5 | 6 | -------------------------------------------------------------------------------- /libsrc/jsonserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/jsonserver) 4 | set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/jsonserver) 5 | 6 | # Group the headers that go through the MOC compiler 7 | set(JsonServer_QT_HEADERS 8 | ${CURRENT_HEADER_DIR}/JsonServer.h 9 | ${CURRENT_SOURCE_DIR}/JsonClientConnection.h 10 | ) 11 | 12 | set(JsonServer_HEADERS 13 | ) 14 | 15 | set(JsonServer_SOURCES 16 | ${CURRENT_SOURCE_DIR}/JsonServer.cpp 17 | ${CURRENT_SOURCE_DIR}/JsonClientConnection.cpp 18 | ) 19 | 20 | set(JsonServer_RESOURCES 21 | ${CURRENT_SOURCE_DIR}/JsonSchemas.qrc 22 | ) 23 | if(ENABLE_QT5) 24 | qt5_wrap_cpp(JsonServer_HEADERS_MOC ${JsonServer_QT_HEADERS}) 25 | qt5_add_resources(JsonServer_RESOURCES_RCC ${JsonServer_RESOURCES} OPTIONS "-no-compress") 26 | else() 27 | qt4_wrap_cpp(JsonServer_HEADERS_MOC ${JsonServer_QT_HEADERS}) 28 | qt4_add_resources(JsonServer_RESOURCES_RCC ${JsonServer_RESOURCES} OPTIONS "-no-compress") 29 | endif() 30 | 31 | add_library(jsonserver 32 | ${JsonServer_HEADERS} 33 | ${JsonServer_QT_HEADERS} 34 | ${JsonServer_SOURCES} 35 | ${JsonServer_RESOURCES} 36 | ${JsonServer_HEADERS_MOC} 37 | ${JsonServer_RESOURCES_RCC} 38 | ) 39 | 40 | if(ENABLE_QT5) 41 | qt5_use_modules(jsonserver Widgets Network) 42 | endif() 43 | 44 | target_link_libraries(jsonserver 45 | hyperion 46 | hyperion-utils 47 | jsoncpp 48 | ${QT_LIBRARIES}) 49 | -------------------------------------------------------------------------------- /libsrc/jsonserver/JsonSchemas.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | schema/schema.json 4 | schema/schema-color.json 5 | schema/schema-image.json 6 | schema/schema-serverinfo.json 7 | schema/schema-clear.json 8 | schema/schema-clearall.json 9 | schema/schema-transform.json 10 | schema/schema-correction.json 11 | schema/schema-temperature.json 12 | schema/schema-adjustment.json 13 | schema/schema-effect.json 14 | 15 | 16 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-adjustment.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["adjustment"] 9 | }, 10 | "adjustment": { 11 | "type": "object", 12 | "required": true, 13 | "properties": { 14 | "id" : { 15 | "type" : "string", 16 | "required" : false 17 | }, 18 | "redAdjust": { 19 | "type": "array", 20 | "required": false, 21 | "items" : { 22 | "type": "integer", 23 | "minimum": 0, 24 | "maximum": 255 25 | }, 26 | "minItems": 3, 27 | "maxItems": 3 28 | }, 29 | "greenAdjust": { 30 | "type": "array", 31 | "required": false, 32 | "items" : { 33 | "type": "integer", 34 | "minimum": 0, 35 | "maximum": 255 36 | }, 37 | "minItems": 3, 38 | "maxItems": 3 39 | }, 40 | "blueAdjust": { 41 | "type": "array", 42 | "required": false, 43 | "items" : { 44 | "type": "integer", 45 | "minimum": 0, 46 | "maximum": 255 47 | }, 48 | "minItems": 3, 49 | "maxItems": 3 50 | } 51 | }, 52 | "additionalProperties": false 53 | } 54 | }, 55 | "additionalProperties": false 56 | } 57 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-clear.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["clear"] 9 | }, 10 | "priority": { 11 | "type": "integer", 12 | "required": true 13 | } 14 | }, 15 | "additionalProperties": false 16 | } 17 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-clearall.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["clearall"] 9 | } 10 | }, 11 | "additionalProperties": false 12 | } 13 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-color.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["color"] 9 | }, 10 | "priority": { 11 | "type": "integer", 12 | "required": true 13 | }, 14 | "duration": { 15 | "type": "integer", 16 | "required": false 17 | }, 18 | "color": { 19 | "type": "array", 20 | "required": true, 21 | "items" :{ 22 | "type" : "integer" 23 | }, 24 | "minItems": 3 25 | } 26 | }, 27 | "additionalProperties": false 28 | } 29 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-correction.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["correction"] 9 | }, 10 | "correction": { 11 | "type": "object", 12 | "required": true, 13 | "properties": { 14 | "id" : { 15 | "type" : "string", 16 | "required" : false 17 | }, 18 | "correctionValues" : { 19 | "type": "array", 20 | "required": false, 21 | "items" : { 22 | "type": "integer", 23 | "minimum": 0, 24 | "maximum": 255 25 | }, 26 | "minItems": 3, 27 | "maxItems": 3 28 | } 29 | }, 30 | "additionalProperties": false 31 | } 32 | }, 33 | "additionalProperties": false 34 | } 35 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-effect.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["effect"] 9 | }, 10 | "priority": { 11 | "type": "integer", 12 | "required": true 13 | }, 14 | "duration": { 15 | "type": "integer", 16 | "required": false 17 | }, 18 | "effect": { 19 | "type": "object", 20 | "required": true, 21 | "properties" :{ 22 | "name" : { 23 | "type" : "string", 24 | "required" : true 25 | }, 26 | "args" : { 27 | "type" : "object", 28 | "required" : false 29 | } 30 | }, 31 | "additionalProperties": false 32 | } 33 | }, 34 | "additionalProperties": false 35 | } 36 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-image.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["image"] 9 | }, 10 | "priority": { 11 | "type": "integer", 12 | "required": true 13 | }, 14 | "duration": { 15 | "type": "integer", 16 | "required": false 17 | }, 18 | "imagewidth": { 19 | "type" : "integer", 20 | "required": true, 21 | "minimum": 0 22 | }, 23 | "imageheight": { 24 | "type" : "integer", 25 | "required": true, 26 | "minimum": 0 27 | }, 28 | "imagedata": { 29 | "type": "string", 30 | "required": true 31 | } 32 | }, 33 | "additionalProperties": false 34 | } 35 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-serverinfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["serverinfo"] 9 | } 10 | }, 11 | "additionalProperties": false 12 | } 13 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema-temperature.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["temperature"] 9 | }, 10 | "temperature": { 11 | "type": "object", 12 | "required": true, 13 | "properties": { 14 | "id" : { 15 | "type" : "string", 16 | "required" : false 17 | }, 18 | "correctionValues" : { 19 | "type": "array", 20 | "required": false, 21 | "items" : { 22 | "type": "integer", 23 | "minimum": 0, 24 | "maximum": 255 25 | }, 26 | "minItems": 3, 27 | "maxItems": 3 28 | } 29 | }, 30 | "additionalProperties": false 31 | } 32 | }, 33 | "additionalProperties": false 34 | } 35 | -------------------------------------------------------------------------------- /libsrc/jsonserver/schema/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"object", 3 | "required":true, 4 | "properties":{ 5 | "command": { 6 | "type" : "string", 7 | "required" : true, 8 | "enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform", "correction", "temperature", "adjustment"] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAPA102.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedSpiDevice.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to APA102 led device. 11 | /// 12 | /// APA102 is 13 | /// 14 | class LedDeviceAPA102 : public LedSpiDevice 15 | { 16 | public: 17 | /// 18 | /// Constructs the LedDevice for a string containing leds of the type APA102 19 | /// 20 | /// @param outputDevice The name of the output device (eg '/etc/SpiDev.0.0') 21 | /// @param baudrate The used baudrate for writing to the output device 22 | /// 23 | LedDeviceAPA102(const std::string& outputDevice, 24 | const unsigned baudrate, const unsigned ledcount ); 25 | 26 | 27 | /// 28 | /// Writes the led color values to the led-device 29 | /// 30 | /// @param ledValues The color-value per led 31 | /// @return Zero on succes else negative 32 | /// 33 | virtual int write(const std::vector &ledValues); 34 | 35 | /// Switch the leds off 36 | virtual int switchOff(); 37 | 38 | private: 39 | 40 | /// The buffer containing the packed RGB values 41 | std::vector _ledBuffer; 42 | unsigned int _HW_ledcount; 43 | unsigned int _mLedCount; 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAdalight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Qt includes 7 | #include 8 | 9 | // hyperion include 10 | #include "LedRs232Device.h" 11 | 12 | /// 13 | /// Implementation of the LedDevice interface for writing to an Adalight led device. 14 | /// 15 | class LedDeviceAdalight : public LedRs232Device 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | /// 21 | /// Constructs the LedDevice for attached Adalight device 22 | /// 23 | /// @param outputDevice The name of the output device (eg '/dev/ttyS0') 24 | /// @param baudrate The used baudrate for writing to the output device 25 | /// 26 | LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector & ledValues); 35 | 36 | /// Switch the leds off 37 | virtual int switchOff(); 38 | 39 | private slots: 40 | /// Write the last data to the leds again 41 | void rewriteLeds(); 42 | 43 | protected: 44 | /// The buffer containing the packed RGB values 45 | std::vector _ledBuffer; 46 | 47 | /// Timer object which makes sure that led data is written at a minimum rate 48 | /// The Adalight device will switch off when it does not receive data at least 49 | /// every 15 seconds 50 | QTimer _timer; 51 | }; 52 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAdalightApa102.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Qt includes 7 | #include 8 | 9 | // hyperion incluse 10 | #include "LedRs232Device.h" 11 | 12 | /// 13 | /// Implementation of the LedDevice interface for writing to an Adalight led device for APA102. 14 | /// 15 | class LedDeviceAdalightApa102 : public LedRs232Device 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | /// 21 | /// Constructs the LedDevice for attached Adalight device 22 | /// 23 | /// @param outputDevice The name of the output device (eg '/dev/ttyS0') 24 | /// @param baudrate The used baudrate for writing to the output device 25 | /// 26 | LedDeviceAdalightApa102(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector & ledValues); 35 | virtual int switchOff(); 36 | 37 | 38 | private slots: 39 | /// Write the last data to the leds again 40 | void rewriteLeds(); 41 | 42 | private: 43 | /// The buffer containing the packed RGB values 44 | std::vector _ledBuffer; 45 | unsigned int ledCount; 46 | /// Timer object which makes sure that led data is written at a minimum rate 47 | /// The Adalight device will switch off when it does not receive data at least 48 | /// every 15 seconds 49 | QTimer _timer; 50 | }; 51 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAmbiLed.cpp: -------------------------------------------------------------------------------- 1 | // STL includes 2 | #include 3 | #include 4 | #include 5 | 6 | // hyperion local includes 7 | #include "LedDeviceAmbiLed.h" 8 | 9 | LedDeviceAmbiLed::LedDeviceAmbiLed(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms) : 10 | LedRs232Device(outputDevice, baudrate, delayAfterConnect_ms), 11 | _ledBuffer(0), 12 | _timer() 13 | { 14 | // setup the timer 15 | _timer.setSingleShot(false); 16 | _timer.setInterval(5000); 17 | connect(&_timer, SIGNAL(timeout()), this, SLOT(rewriteLeds())); 18 | 19 | // start the timer 20 | _timer.start(); 21 | } 22 | 23 | int LedDeviceAmbiLed::write(const std::vector & ledValues) 24 | { 25 | if (_ledBuffer.size() == 0) 26 | { 27 | _ledBuffer.resize(1 + 3*ledValues.size()); 28 | _ledBuffer[3*ledValues.size()] = 255; 29 | } 30 | 31 | // restart the timer 32 | _timer.start(); 33 | 34 | // write data 35 | memcpy( _ledBuffer.data(), ledValues.data(), ledValues.size() * 3); 36 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 37 | } 38 | 39 | int LedDeviceAmbiLed::switchOff() 40 | { 41 | // restart the timer 42 | _timer.start(); 43 | 44 | // write data 45 | memset(_ledBuffer.data(), 0, _ledBuffer.size()-6); 46 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 47 | } 48 | 49 | void LedDeviceAmbiLed::rewriteLeds() 50 | { 51 | writeBytes(_ledBuffer.size(), _ledBuffer.data()); 52 | } 53 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAmbiLed.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Qt includes 7 | #include 8 | 9 | // hyperion incluse 10 | #include "LedRs232Device.h" 11 | 12 | /// 13 | /// Implementation of the LedDevice interface for writing to an Adalight led device. 14 | /// 15 | class LedDeviceAmbiLed : public LedRs232Device 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | /// 21 | /// Constructs the LedDevice for attached Adalight device 22 | /// 23 | /// @param outputDevice The name of the output device (eg '/dev/ttyS0') 24 | /// @param baudrate The used baudrate for writing to the output device 25 | /// 26 | LedDeviceAmbiLed(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector & ledValues); 35 | 36 | /// Switch the leds off 37 | virtual int switchOff(); 38 | 39 | private slots: 40 | /// Write the last data to the leds again 41 | void rewriteLeds(); 42 | 43 | private: 44 | /// The buffer containing the packed RGB values 45 | std::vector _ledBuffer; 46 | 47 | /// Timer object which makes sure that led data is written at a minimum rate 48 | /// The Adalight device will switch off when it does not receive data at least 49 | /// every 15 seconds 50 | QTimer _timer; 51 | }; 52 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAtmo.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | 6 | // hyperion local includes 7 | #include "LedDeviceAtmo.h" 8 | 9 | LedDeviceAtmo::LedDeviceAtmo(const std::string& outputDevice, const unsigned baudrate) : 10 | LedRs232Device(outputDevice, baudrate), 11 | _ledBuffer(4 + 5*3) // 4-byte header, 5 RGB values 12 | { 13 | _ledBuffer[0] = 0xFF; // Startbyte 14 | _ledBuffer[1] = 0x00; // StartChannel(Low) 15 | _ledBuffer[2] = 0x00; // StartChannel(High) 16 | _ledBuffer[3] = 0x0F; // Number of Databytes send (always! 15) 17 | } 18 | 19 | int LedDeviceAtmo::write(const std::vector &ledValues) 20 | { 21 | // The protocol is shomehow limited. we always need to send exactly 5 channels + header 22 | // (19 bytes) for the hardware to recognize the data 23 | if (ledValues.size() != 5) 24 | { 25 | std::cerr << "AtmoLight: " << ledValues.size() << " channels configured. This should always be 5!" << std::endl; 26 | return 0; 27 | } 28 | 29 | // write data 30 | memcpy(4 + _ledBuffer.data(), ledValues.data(), ledValues.size() * sizeof(ColorRgb)); 31 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 32 | } 33 | 34 | int LedDeviceAtmo::switchOff() 35 | { 36 | memset(4 + _ledBuffer.data(), 0, _ledBuffer.size() - 4); 37 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 38 | } 39 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceAtmo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedRs232Device.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to serial device using tpm2 protocol. 11 | /// 12 | class LedDeviceAtmo : public LedRs232Device 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for attached serial device using supporting tpm2 protocol 17 | /// All LEDs in the stripe are handled as one frame 18 | /// 19 | /// @param outputDevice The name of the output device (eg '/dev/ttyAMA0') 20 | /// @param baudrate The used baudrate for writing to the output device 21 | /// 22 | LedDeviceAtmo(const std::string& outputDevice, const unsigned baudrate); 23 | 24 | /// 25 | /// Writes the led color values to the led-device 26 | /// 27 | /// @param ledValues The color-value per led 28 | /// @return Zero on succes else negative 29 | /// 30 | virtual int write(const std::vector &ledValues); 31 | 32 | /// Switch the leds off 33 | virtual int switchOff(); 34 | 35 | private: 36 | /// The buffer containing the packed RGB values 37 | std::vector _ledBuffer; 38 | }; 39 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceFile.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Local-Hyperion includes 3 | #include "LedDeviceFile.h" 4 | 5 | LedDeviceFile::LedDeviceFile(const std::string& output) : 6 | _ofs(output.empty()?"/dev/null":output.c_str()) 7 | { 8 | // empty 9 | } 10 | 11 | LedDeviceFile::~LedDeviceFile() 12 | { 13 | // empty 14 | } 15 | 16 | int LedDeviceFile::write(const std::vector & ledValues) 17 | { 18 | _ofs << "["; 19 | for (const ColorRgb& color : ledValues) 20 | { 21 | _ofs << color; 22 | } 23 | _ofs << "]" << std::endl; 24 | 25 | return 0; 26 | } 27 | 28 | int LedDeviceFile::switchOff() 29 | { 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes0 4 | #include 5 | 6 | // Leddevice includes 7 | #include 8 | 9 | /// 10 | /// Implementation of the LedDevice that write the led-colors to an 11 | /// ASCII-textfile('/home/pi/LedDevice.out') 12 | /// 13 | class LedDeviceFile : public LedDevice 14 | { 15 | public: 16 | /// 17 | /// Constructs the test-device, which opens an output stream to the file 18 | /// 19 | LedDeviceFile(const std::string& output); 20 | 21 | /// 22 | /// Destructor of this test-device 23 | /// 24 | virtual ~LedDeviceFile(); 25 | 26 | /// 27 | /// Writes the given led-color values to the output stream 28 | /// 29 | /// @param ledValues The color-value per led 30 | /// 31 | /// @return Zero on success else negative 32 | /// 33 | virtual int write(const std::vector & ledValues); 34 | 35 | /// Switch the leds off 36 | virtual int switchOff(); 37 | 38 | private: 39 | /// The outputstream 40 | std::ofstream _ofs; 41 | }; 42 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceLpd6803.cpp: -------------------------------------------------------------------------------- 1 | // STL includes 2 | #include 3 | #include 4 | #include 5 | 6 | // Linux includes 7 | #include 8 | #include 9 | 10 | // hyperion local includes 11 | #include "LedDeviceLpd6803.h" 12 | 13 | LedDeviceLpd6803::LedDeviceLpd6803(const std::string& outputDevice, const unsigned baudrate) : 14 | LedSpiDevice(outputDevice, baudrate), 15 | _ledBuffer(0) 16 | { 17 | // empty 18 | } 19 | 20 | int LedDeviceLpd6803::write(const std::vector &ledValues) 21 | { 22 | unsigned messageLength = 4 + 2*ledValues.size() + ledValues.size()/8 + 1; 23 | // Reconfigure if the current connfiguration does not match the required configuration 24 | if (messageLength != _ledBuffer.size()) 25 | { 26 | // Initialise the buffer 27 | _ledBuffer.resize(messageLength, 0x00); 28 | } 29 | 30 | // Copy the colors from the ColorRgb vector to the Ldp6803 data vector 31 | for (unsigned iLed=0; iLed> 1) | (rgb.green >> 6); 36 | _ledBuffer[5 + 2 * iLed] = ((rgb.green & 0x38) << 2) | (rgb.blue >> 3); 37 | } 38 | 39 | // Write the data 40 | if (writeBytes(_ledBuffer.size(), _ledBuffer.data()) < 0) 41 | { 42 | return -1; 43 | } 44 | return 0; 45 | } 46 | 47 | int LedDeviceLpd6803::switchOff() 48 | { 49 | return write(std::vector(_ledBuffer.size(), ColorRgb{0,0,0})); 50 | } 51 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceLpd6803.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Local hyperion incluse 4 | #include "LedSpiDevice.h" 5 | 6 | /// 7 | /// Implementation of the LedDevice interface for writing to LDP6803 led device. 8 | /// 9 | /// 00000000 00000000 00000000 00000000 1RRRRRGG GGGBBBBB 1RRRRRGG GGGBBBBB ... 10 | /// |---------------------------------| |---------------| |---------------| 11 | /// 32 zeros to start the frame Led1 Led2 ... 12 | /// 13 | /// For each led, the first bit is always 1, and then you have 5 bits each for red, green and blue 14 | /// (R, G and B in the above illustration) making 16 bits per led. Total bytes = 4 + (2 x number of 15 | /// leds) 16 | /// 17 | class LedDeviceLpd6803 : public LedSpiDevice 18 | { 19 | public: 20 | /// 21 | /// Constructs the LedDevice for a string containing leds of the type LDP6803 22 | /// 23 | /// @param[in] outputDevice The name of the output device (eg '/dev/spidev0.0') 24 | /// @param[in] baudrate The used baudrate for writing to the output device 25 | /// 26 | LedDeviceLpd6803(const std::string& outputDevice, const unsigned baudrate); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector &ledValues); 35 | 36 | /// Switch the leds off 37 | virtual int switchOff(); 38 | 39 | private: 40 | /// The buffer containing the packed RGB values 41 | std::vector _ledBuffer; 42 | }; 43 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceLpd8806.cpp: -------------------------------------------------------------------------------- 1 | // STL includes 2 | #include 3 | #include 4 | #include 5 | 6 | // Linux includes 7 | #include 8 | #include 9 | 10 | // hyperion local includes 11 | #include "LedDeviceLpd8806.h" 12 | 13 | LedDeviceLpd8806::LedDeviceLpd8806(const std::string& outputDevice, const unsigned baudrate) : 14 | LedSpiDevice(outputDevice, baudrate), 15 | _ledBuffer(0) 16 | { 17 | // empty 18 | } 19 | 20 | int LedDeviceLpd8806::write(const std::vector &ledValues) 21 | { 22 | const unsigned clearSize = ledValues.size()/32+1; 23 | // Reconfigure if the current connfiguration does not match the required configuration 24 | if (3*ledValues.size() + clearSize != _ledBuffer.size()) 25 | { 26 | // Initialise the buffer 27 | _ledBuffer.resize(3*ledValues.size() + clearSize, 0x00); 28 | 29 | // Perform an initial reset to start accepting data on the first led 30 | writeBytes(clearSize, _ledBuffer.data()); 31 | } 32 | 33 | // Copy the colors from the ColorRgb vector to the Ldp8806 data vector 34 | for (unsigned iLed=0; iLed> 1); 39 | _ledBuffer[iLed*3+1] = 0x80 | (rgb.green >> 1); 40 | _ledBuffer[iLed*3+2] = 0x80 | (rgb.blue >> 1); 41 | } 42 | 43 | // Write the data 44 | if (writeBytes(_ledBuffer.size(), _ledBuffer.data()) < 0) 45 | { 46 | return -1; 47 | } 48 | return 0; 49 | } 50 | 51 | int LedDeviceLpd8806::switchOff() 52 | { 53 | return write(std::vector(_ledBuffer.size(), ColorRgb{0,0,0})); 54 | } 55 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceMultiLightpack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // stl includes 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | // libusb include 10 | #include 11 | 12 | // Hyperion includes 13 | #include 14 | #include "LedDeviceLightpack.h" 15 | 16 | /// 17 | /// LedDevice implementation for multiple lightpack devices 18 | /// 19 | class LedDeviceMultiLightpack : public LedDevice 20 | { 21 | public: 22 | /// 23 | /// Constructs the LedDeviceMultiLightpack 24 | /// 25 | LedDeviceMultiLightpack(); 26 | 27 | /// 28 | /// Destructor of the LedDevice; closes the output device if it is open 29 | /// 30 | virtual ~LedDeviceMultiLightpack(); 31 | 32 | /// 33 | /// Opens and configures the output device7 34 | /// 35 | /// @return Zero on succes else negative 36 | /// 37 | int open(); 38 | 39 | /// 40 | /// Writes the RGB-Color values to the leds. 41 | /// 42 | /// @param[in] ledValues The RGB-color per led 43 | /// 44 | /// @return Zero on success else negative 45 | /// 46 | virtual int write(const std::vector& ledValues); 47 | 48 | /// 49 | /// Switch the leds off 50 | /// 51 | /// @return Zero on success else negative 52 | /// 53 | virtual int switchOff(); 54 | 55 | private: 56 | static std::list getLightpackSerials(); 57 | static std::string getString(libusb_device * device, int stringDescriptorIndex); 58 | 59 | private: 60 | /// buffer for led data 61 | std::vector _lightpacks; 62 | }; 63 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceP9813.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | #include 6 | 7 | // Linux includes 8 | #include 9 | #include 10 | 11 | // hyperion local includes 12 | #include "LedDeviceP9813.h" 13 | 14 | LedDeviceP9813::LedDeviceP9813(const std::string& outputDevice, const unsigned baudrate) : 15 | LedSpiDevice(outputDevice, baudrate, 0), 16 | _ledCount(0) 17 | { 18 | // empty 19 | } 20 | 21 | int LedDeviceP9813::write(const std::vector &ledValues) 22 | { 23 | if (_ledCount != ledValues.size()) 24 | { 25 | _ledBuf.resize(ledValues.size() * 4 + 8, 0x00); 26 | _ledCount = ledValues.size(); 27 | } 28 | 29 | uint8_t * dataPtr = _ledBuf.data(); 30 | for (const ColorRgb & color : ledValues) 31 | { 32 | *dataPtr++ = calculateChecksum(color); 33 | *dataPtr++ = color.blue; 34 | *dataPtr++ = color.green; 35 | *dataPtr++ = color.red; 36 | } 37 | 38 | return writeBytes(_ledBuf.size(), _ledBuf.data()); 39 | } 40 | 41 | int LedDeviceP9813::switchOff() 42 | { 43 | return write(std::vector(_ledCount, ColorRgb{0,0,0})); 44 | } 45 | 46 | uint8_t LedDeviceP9813::calculateChecksum(const ColorRgb & color) const 47 | { 48 | uint8_t res = 0; 49 | 50 | res |= (uint8_t)0x03 << 6; 51 | res |= (uint8_t)(~(color.blue >> 6) & 0x03) << 4; 52 | res |= (uint8_t)(~(color.green >> 6) & 0x03) << 2; 53 | res |= (uint8_t)(~(color.red >> 6) & 0x03); 54 | 55 | return res; 56 | } 57 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceP9813.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion include 7 | #include "LedSpiDevice.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to P9813 led device. 11 | /// 12 | class LedDeviceP9813 : public LedSpiDevice 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for a string containing leds of the type P9813 17 | /// 18 | /// @param outputDevice The name of the output device (eg '/etc/SpiDev.0.0') 19 | /// @param baudrate The used baudrate for writing to the output device 20 | /// 21 | LedDeviceP9813(const std::string& outputDevice, 22 | const unsigned baudrate); 23 | 24 | /// 25 | /// Writes the led color values to the led-device 26 | /// 27 | /// @param ledValues The color-value per led 28 | /// @return Zero on succes else negative 29 | /// 30 | virtual int write(const std::vector &ledValues); 31 | 32 | /// Switch the leds off 33 | virtual int switchOff(); 34 | 35 | private: 36 | 37 | /// the number of leds 38 | size_t _ledCount; 39 | 40 | /// Buffer for writing/written led data 41 | std::vector _ledBuf; 42 | 43 | /// 44 | /// Calculates the required checksum for one led 45 | /// 46 | /// @param color The color of the led 47 | /// @return The checksum for the led 48 | /// 49 | uint8_t calculateChecksum(const ColorRgb & color) const; 50 | }; 51 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDevicePaintpack.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion includes 3 | #include "LedDevicePaintpack.h" 4 | 5 | // Use out report HID device 6 | LedDevicePaintpack::LedDevicePaintpack(const unsigned short VendorId, const unsigned short ProductId, int delayAfterConnect_ms) : 7 | LedHIDDevice(VendorId, ProductId, delayAfterConnect_ms, false), 8 | _ledBuffer(0) 9 | { 10 | // empty 11 | } 12 | 13 | 14 | int LedDevicePaintpack::write(const std::vector & ledValues) 15 | { 16 | if (_ledBuffer.size() < 2 + ledValues.size()*3) 17 | { 18 | _ledBuffer.resize(2 + ledValues.size()*3, uint8_t(0)); 19 | _ledBuffer[0] = 3; 20 | _ledBuffer[1] = 0; 21 | } 22 | 23 | auto bufIt = _ledBuffer.begin()+2; 24 | for (const ColorRgb & ledValue : ledValues) 25 | { 26 | *bufIt = ledValue.red; 27 | ++bufIt; 28 | *bufIt = ledValue.green; 29 | ++bufIt; 30 | *bufIt = ledValue.blue; 31 | ++bufIt; 32 | } 33 | 34 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 35 | } 36 | 37 | 38 | int LedDevicePaintpack::switchOff() 39 | { 40 | std::fill(_ledBuffer.begin() + 2, _ledBuffer.end(), uint8_t(0)); 41 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 42 | } 43 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDevicePaintpack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Hyperion includes 7 | #include "LedHIDDevice.h" 8 | 9 | /// 10 | /// LedDevice implementation for a paintpack device () 11 | /// 12 | class LedDevicePaintpack : public LedHIDDevice 13 | { 14 | public: 15 | /** 16 | * Constructs the paintpack device 17 | */ 18 | LedDevicePaintpack(const unsigned short VendorId, const unsigned short ProductId, int delayAfterConnect_ms); 19 | 20 | /// 21 | /// Writes the RGB-Color values to the leds. 22 | /// 23 | /// @param[in] ledValues The RGB-color per led 24 | /// 25 | /// @return Zero on success else negative 26 | /// 27 | virtual int write(const std::vector& ledValues); 28 | 29 | /// 30 | /// Switch the leds off 31 | /// 32 | /// @return Zero on success else negative 33 | /// 34 | virtual int switchOff(); 35 | 36 | private: 37 | /// buffer for led data 38 | std::vector _ledBuffer; 39 | }; 40 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDevicePiBlaster.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | // STL includes 5 | #include 6 | 7 | // jsoncpp includes 8 | #include 9 | 10 | // Hyperion-Leddevice includes 11 | #include 12 | 13 | class LedDevicePiBlaster : public LedDevice 14 | { 15 | public: 16 | /// 17 | /// Constructs the PiBlaster device which writes to the indicated device and for the assigned 18 | /// channels 19 | /// @param deviceName The name of the output device 20 | /// @param gpioMapping The RGB-Channel assignment json object 21 | /// 22 | LedDevicePiBlaster(const std::string & deviceName, const Json::Value & gpioMapping); 23 | 24 | virtual ~LedDevicePiBlaster(); 25 | 26 | /// 27 | /// Attempts to open the piblaster-device. This will only succeed if the device is not yet open 28 | /// and the device is available. 29 | /// 30 | /// @param report If true errors are writen to the standard error else silent 31 | /// @return Zero on succes else negative 32 | /// 33 | int open(bool report = true); 34 | 35 | /// 36 | /// Writes the colors to the PiBlaster device 37 | /// 38 | /// @param ledValues The color value for each led 39 | /// 40 | /// @return Zero on success else negative 41 | /// 42 | int write(const std::vector &ledValues); 43 | 44 | /// 45 | /// Switches off the leds 46 | /// 47 | /// @return Zero on success else negative 48 | /// 49 | int switchOff(); 50 | 51 | private: 52 | 53 | /// The name of the output device (very likely '/dev/pi-blaster') 54 | const std::string _deviceName; 55 | 56 | int _gpio_to_led[64]; 57 | char _gpio_to_color[64]; 58 | 59 | /// File-Pointer to the PiBlaster device 60 | FILE * _fid; 61 | }; 62 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceRawHID.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | #include 6 | 7 | // Linux includes 8 | #include 9 | #include 10 | 11 | // hyperion local includes 12 | #include "LedDeviceRawHID.h" 13 | 14 | // Use feature report HID device 15 | LedDeviceRawHID::LedDeviceRawHID(const unsigned short VendorId, const unsigned short ProductId, int delayAfterConnect_ms) : 16 | LedHIDDevice(VendorId, ProductId, delayAfterConnect_ms, true), 17 | _ledBuffer(0), 18 | _timer() 19 | { 20 | // setup the timer 21 | _timer.setSingleShot(false); 22 | _timer.setInterval(5000); 23 | connect(&_timer, SIGNAL(timeout()), this, SLOT(rewriteLeds())); 24 | 25 | // start the timer 26 | _timer.start(); 27 | } 28 | 29 | int LedDeviceRawHID::write(const std::vector & ledValues) 30 | { 31 | // Resize buffer if required 32 | if (_ledBuffer.size() < ledValues.size() * 3) { 33 | _ledBuffer.resize(3 * ledValues.size()); 34 | } 35 | 36 | // restart the timer 37 | _timer.start(); 38 | 39 | // write data 40 | memcpy(_ledBuffer.data(), ledValues.data(), ledValues.size() * 3); 41 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 42 | } 43 | 44 | int LedDeviceRawHID::switchOff() 45 | { 46 | // restart the timer 47 | _timer.start(); 48 | 49 | // write data 50 | std::fill(_ledBuffer.begin(), _ledBuffer.end(), uint8_t(0)); 51 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 52 | } 53 | 54 | void LedDeviceRawHID::rewriteLeds() 55 | { 56 | writeBytes(_ledBuffer.size(), _ledBuffer.data()); 57 | } 58 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceRawHID.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // Qt includes 7 | #include 8 | 9 | // hyperion include 10 | #include "LedHIDDevice.h" 11 | 12 | /// 13 | /// Implementation of the LedDevice interface for writing to an RawHID led device. 14 | /// 15 | class LedDeviceRawHID : public LedHIDDevice 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | /// 21 | /// Constructs the LedDevice for attached RawHID device 22 | /// 23 | LedDeviceRawHID(const unsigned short VendorId, const unsigned short ProductId, int delayAfterConnect_ms); 24 | 25 | /// 26 | /// Writes the led color values to the led-device 27 | /// 28 | /// @param ledValues The color-value per led 29 | /// @return Zero on succes else negative 30 | /// 31 | virtual int write(const std::vector & ledValues); 32 | 33 | /// Switch the leds off 34 | virtual int switchOff(); 35 | 36 | private slots: 37 | /// Write the last data to the leds again 38 | void rewriteLeds(); 39 | 40 | private: 41 | /// The buffer containing the packed RGB values 42 | std::vector _ledBuffer; 43 | 44 | /// Timer object which makes sure that led data is written at a minimum rate 45 | /// The RawHID device will switch off when it does not receive data at least 46 | /// every 15 seconds 47 | QTimer _timer; 48 | }; 49 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceSedu.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | #include 6 | 7 | // Linux includes 8 | #include 9 | #include 10 | 11 | // hyperion local includes 12 | #include "LedDeviceSedu.h" 13 | 14 | struct FrameSpec 15 | { 16 | uint8_t id; 17 | size_t size; 18 | }; 19 | 20 | LedDeviceSedu::LedDeviceSedu(const std::string& outputDevice, const unsigned baudrate) : 21 | LedRs232Device(outputDevice, baudrate), 22 | _ledBuffer(0) 23 | { 24 | // empty 25 | } 26 | 27 | int LedDeviceSedu::write(const std::vector &ledValues) 28 | { 29 | if (_ledBuffer.size() == 0) 30 | { 31 | std::vector frameSpecs{{0xA1, 256}, {0xA2, 512}, {0xB0, 768}, {0xB1, 1536}, {0xB2, 3072} }; 32 | 33 | const unsigned reqColorChannels = ledValues.size() * sizeof(ColorRgb); 34 | 35 | for (const FrameSpec& frameSpec : frameSpecs) 36 | { 37 | if (reqColorChannels <= frameSpec.size) 38 | { 39 | _ledBuffer.clear(); 40 | _ledBuffer.resize(frameSpec.size + 3, 0); 41 | _ledBuffer[0] = 0x5A; 42 | _ledBuffer[1] = frameSpec.id; 43 | _ledBuffer.back() = 0xA5; 44 | break; 45 | } 46 | } 47 | 48 | if (_ledBuffer.size() == 0) 49 | { 50 | std::cout << "More rgb-channels required then available" << std::endl; 51 | return -1; 52 | } 53 | } 54 | 55 | memcpy(_ledBuffer.data()+2, ledValues.data(), ledValues.size() * sizeof(ColorRgb)); 56 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 57 | } 58 | 59 | int LedDeviceSedu::switchOff() 60 | { 61 | memset(_ledBuffer.data()+2, 0, _ledBuffer.size()-3); 62 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 63 | } 64 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceSedu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedRs232Device.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to SEDU led device. 11 | /// 12 | class LedDeviceSedu : public LedRs232Device 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for attached via SEDU device 17 | /// 18 | /// @param outputDevice The name of the output device (eg '/dev/ttyS0') 19 | /// @param baudrate The used baudrate for writing to the output device 20 | /// 21 | LedDeviceSedu(const std::string& outputDevice, const unsigned baudrate); 22 | 23 | /// 24 | /// Writes the led color values to the led-device 25 | /// 26 | /// @param ledValues The color-value per led 27 | /// @return Zero on succes else negative 28 | /// 29 | virtual int write(const std::vector &ledValues); 30 | 31 | /// Switch the leds off 32 | virtual int switchOff(); 33 | 34 | private: 35 | /// The buffer containing the packed RGB values 36 | std::vector _ledBuffer; 37 | }; 38 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceTpm2.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | #include 6 | 7 | // hyperion local includes 8 | #include "LedDeviceTpm2.h" 9 | 10 | LedDeviceTpm2::LedDeviceTpm2(const std::string& outputDevice, const unsigned baudrate) : 11 | LedRs232Device(outputDevice, baudrate), 12 | _ledBuffer(0) 13 | { 14 | // empty 15 | } 16 | 17 | int LedDeviceTpm2::write(const std::vector &ledValues) 18 | { 19 | if (_ledBuffer.size() == 0) 20 | { 21 | _ledBuffer.resize(5 + 3*ledValues.size()); 22 | _ledBuffer[0] = 0xC9; // block-start byte 23 | _ledBuffer[1] = 0xDA; // DATA frame 24 | _ledBuffer[2] = ((3 * ledValues.size()) >> 8) & 0xFF; // frame size high byte 25 | _ledBuffer[3] = (3 * ledValues.size()) & 0xFF; // frame size low byte 26 | _ledBuffer.back() = 0x36; // block-end byte 27 | } 28 | 29 | // write data 30 | memcpy(4 + _ledBuffer.data(), ledValues.data(), ledValues.size() * 3); 31 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 32 | } 33 | 34 | int LedDeviceTpm2::switchOff() 35 | { 36 | memset(4 + _ledBuffer.data(), 0, _ledBuffer.size() - 5); 37 | return writeBytes(_ledBuffer.size(), _ledBuffer.data()); 38 | } 39 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceTpm2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedRs232Device.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to serial device using tpm2 protocol. 11 | /// 12 | class LedDeviceTpm2 : public LedRs232Device 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for attached serial device using supporting tpm2 protocol 17 | /// All LEDs in the stripe are handled as one frame 18 | /// 19 | /// @param outputDevice The name of the output device (eg '/dev/ttyAMA0') 20 | /// @param baudrate The used baudrate for writing to the output device 21 | /// 22 | LedDeviceTpm2(const std::string& outputDevice, const unsigned baudrate); 23 | 24 | /// 25 | /// Writes the led color values to the led-device 26 | /// 27 | /// @param ledValues The color-value per led 28 | /// @return Zero on succes else negative 29 | /// 30 | virtual int write(const std::vector &ledValues); 31 | 32 | /// Switch the leds off 33 | virtual int switchOff(); 34 | 35 | private: 36 | /// The buffer containing the packed RGB values 37 | std::vector _ledBuffer; 38 | }; 39 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceUdp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes0 4 | #include 5 | 6 | // Leddevice includes 7 | #include 8 | 9 | /// 10 | /// Implementation of the LedDevice that write the led-colors to an 11 | /// ASCII-textfile('/home/pi/LedDevice.out') 12 | /// 13 | class LedDeviceUdp : public LedDevice 14 | { 15 | public: 16 | /// 17 | /// Constructs the test-device, which opens an output stream to the file 18 | /// 19 | LedDeviceUdp(const std::string& output, const unsigned baudrate, const unsigned protocol, const unsigned maxPacket); 20 | 21 | /// 22 | /// Destructor of this test-device 23 | /// 24 | virtual ~LedDeviceUdp(); 25 | 26 | /// 27 | /// Writes the given led-color values to the output stream 28 | /// 29 | /// @param ledValues The color-value per led 30 | /// 31 | /// @return Zero on success else negative 32 | /// 33 | virtual int write(const std::vector & ledValues); 34 | 35 | /// Switch the leds off 36 | virtual int switchOff(); 37 | 38 | private: 39 | /// The outputstream 40 | // std::ofstream _ofs; 41 | 42 | /// the number of leds (needed when switching off) 43 | size_t mLedCount; 44 | }; 45 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceUdpRaw.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | #include 6 | 7 | // Linux includes 8 | #include 9 | #include 10 | 11 | // hyperion local includes 12 | #include "LedDeviceUdpRaw.h" 13 | 14 | LedDeviceUdpRaw::LedDeviceUdpRaw(const std::string& outputDevice, const unsigned baudrate) : 15 | LedUdpDevice(outputDevice, baudrate, 500000), 16 | mLedCount(0) 17 | { 18 | // empty 19 | } 20 | 21 | LedDeviceUdpRaw::LedDeviceUdpRaw(const std::string& outputDevice, const unsigned baudrate, const unsigned latchTime) : 22 | LedUdpDevice(outputDevice, baudrate, latchTime), 23 | mLedCount(0) 24 | { 25 | // empty 26 | } 27 | 28 | int LedDeviceUdpRaw::write(const std::vector &ledValues) 29 | { 30 | mLedCount = ledValues.size(); 31 | 32 | const unsigned dataLen = ledValues.size() * sizeof(ColorRgb); 33 | const uint8_t * dataPtr = reinterpret_cast(ledValues.data()); 34 | 35 | return writeBytes(dataLen, dataPtr); 36 | } 37 | 38 | int LedDeviceUdpRaw::switchOff() 39 | { 40 | return write(std::vector(mLedCount, ColorRgb{0,0,0})); 41 | } 42 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceUdpRaw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedUdpDevice.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to Ws2801 led device. 11 | /// 12 | class LedDeviceUdpRaw : public LedUdpDevice 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for a string containing leds of the type Ws2801 17 | /// 18 | /// @param outputDevice The name of the output device (eg '/etc/SpiDev.0.0') 19 | /// @param baudrate The used baudrate for writing to the output device 20 | /// 21 | LedDeviceUdpRaw(const std::string& outputDevice, 22 | const unsigned baudrate); 23 | 24 | LedDeviceUdpRaw(const std::string& outputDevice, 25 | const unsigned baudrate, 26 | const unsigned latchTime); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector &ledValues); 35 | 36 | /// Switch the leds off 37 | virtual int switchOff(); 38 | 39 | private: 40 | 41 | /// the number of leds (needed when switching off) 42 | size_t mLedCount; 43 | }; 44 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceWS281x.h: -------------------------------------------------------------------------------- 1 | #ifndef LEDDEVICEWS281X_H_ 2 | #define LEDDEVICEWS281X_H_ 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | class LedDeviceWS281x : public LedDevice 10 | { 11 | public: 12 | /// 13 | /// Constructs the LedDevice for WS281x (one wire 800kHz) 14 | /// 15 | /// @param gpio The gpio pin to use (BCM chip counting, default is 18) 16 | /// @param leds The number of leds attached to the gpio pin 17 | /// @param freq The target frequency for the data line, default is 800000 18 | /// @param dmanum The DMA channel to use, default is 5 19 | /// @param pwmchannel The pwm channel to use 20 | /// @param invert Invert the output line to support an inverting level shifter 21 | /// @param rgbw Send 32 bit rgbw colour data for sk6812 22 | 23 | /// 24 | LedDeviceWS281x(const int gpio, const int leds, const uint32_t freq, int dmanum, int pwmchannel, int invert, 25 | int rgbw, const std::string& whiteAlgorithm); 26 | 27 | /// 28 | /// Destructor of the LedDevice, waits for DMA to complete and then cleans up 29 | /// 30 | ~LedDeviceWS281x(); 31 | 32 | /// 33 | /// Writes the led color values to the led-device 34 | /// 35 | /// @param ledValues The color-value per led 36 | /// @return Zero on succes else negative 37 | /// 38 | virtual int write(const std::vector &ledValues); 39 | 40 | /// Switch the leds off 41 | virtual int switchOff(); 42 | 43 | private: 44 | ws2811_t led_string; 45 | int chan; 46 | bool initialized; 47 | std::string _whiteAlgorithm; 48 | ColorRgbw _temp_rgbw; 49 | }; 50 | 51 | #endif /* LEDDEVICEWS281X_H_ */ 52 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceWs2801.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | #include 5 | #include 6 | 7 | // Linux includes 8 | #include 9 | #include 10 | 11 | // hyperion local includes 12 | #include "LedDeviceWs2801.h" 13 | 14 | LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned baudrate) : 15 | LedSpiDevice(outputDevice, baudrate, 500000), 16 | mLedCount(0) 17 | { 18 | // empty 19 | } 20 | 21 | LedDeviceWs2801::LedDeviceWs2801(const std::string& outputDevice, const unsigned baudrate, const unsigned latchTime) : 22 | LedSpiDevice(outputDevice, baudrate, latchTime), 23 | mLedCount(0) 24 | { 25 | // empty 26 | } 27 | 28 | int LedDeviceWs2801::write(const std::vector &ledValues) 29 | { 30 | mLedCount = ledValues.size(); 31 | 32 | const unsigned dataLen = ledValues.size() * sizeof(ColorRgb); 33 | const uint8_t * dataPtr = reinterpret_cast(ledValues.data()); 34 | 35 | return writeBytes(dataLen, dataPtr); 36 | } 37 | 38 | int LedDeviceWs2801::switchOff() 39 | { 40 | return write(std::vector(mLedCount, ColorRgb{0,0,0})); 41 | } 42 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceWs2801.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedSpiDevice.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to Ws2801 led device. 11 | /// 12 | class LedDeviceWs2801 : public LedSpiDevice 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for a string containing leds of the type Ws2801 17 | /// 18 | /// @param outputDevice The name of the output device (eg '/etc/SpiDev.0.0') 19 | /// @param baudrate The used baudrate for writing to the output device 20 | /// 21 | LedDeviceWs2801(const std::string& outputDevice, 22 | const unsigned baudrate); 23 | 24 | LedDeviceWs2801(const std::string& outputDevice, 25 | const unsigned baudrate, 26 | const unsigned latchTime); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector &ledValues); 35 | 36 | /// Switch the leds off 37 | virtual int switchOff(); 38 | 39 | private: 40 | 41 | /// the number of leds (needed when switching off) 42 | size_t mLedCount; 43 | }; 44 | -------------------------------------------------------------------------------- /libsrc/leddevice/LedDeviceWs2812SPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // STL includes 4 | #include 5 | 6 | // hyperion incluse 7 | #include "LedSpiDevice.h" 8 | 9 | /// 10 | /// Implementation of the LedDevice interface for writing to Ws2801 led device. 11 | /// 12 | class LedDeviceWs2812SPI : public LedSpiDevice 13 | { 14 | public: 15 | /// 16 | /// Constructs the LedDevice for a string containing leds of the type Ws2812SPI 17 | /// 18 | /// @param outputDevice The name of the output device (eg '/etc/SpiDev.0.0') 19 | /// @param baudrate The used baudrate for writing to the output device 20 | /// 21 | LedDeviceWs2812SPI(const std::string& outputDevice, 22 | const unsigned baudrate); 23 | 24 | LedDeviceWs2812SPI(const std::string& outputDevice, 25 | const unsigned baudrate, 26 | const unsigned latchTime); 27 | 28 | /// 29 | /// Writes the led color values to the led-device 30 | /// 31 | /// @param ledValues The color-value per led 32 | /// @return Zero on succes else negative 33 | /// 34 | virtual int write(const std::vector &ledValues); 35 | 36 | /// Switch the leds off 37 | virtual int switchOff(); 38 | 39 | private: 40 | 41 | /// the number of leds (needed when switching off) 42 | size_t mLedCount; 43 | std::vector _spiBuffer; 44 | 45 | uint8_t bitpair_to_byte[4]; 46 | }; 47 | -------------------------------------------------------------------------------- /libsrc/protoserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/protoserver) 4 | set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/protoserver) 5 | 6 | include_directories( 7 | ${CMAKE_CURRENT_BINARY_DIR} 8 | ${PROTOBUF_INCLUDE_DIRS} 9 | ) 10 | 11 | # Group the headers that go through the MOC compiler 12 | set(ProtoServer_QT_HEADERS 13 | ${CURRENT_HEADER_DIR}/ProtoServer.h 14 | ${CURRENT_HEADER_DIR}/ProtoConnection.h 15 | ${CURRENT_SOURCE_DIR}/ProtoClientConnection.h 16 | ${CURRENT_HEADER_DIR}/ProtoConnectionWrapper.h 17 | ) 18 | 19 | set(ProtoServer_HEADERS 20 | ) 21 | 22 | set(ProtoServer_SOURCES 23 | ${CURRENT_SOURCE_DIR}/ProtoServer.cpp 24 | ${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp 25 | ${CURRENT_SOURCE_DIR}/ProtoConnection.cpp 26 | ${CURRENT_SOURCE_DIR}/ProtoConnectionWrapper.cpp 27 | ) 28 | 29 | set(ProtoServer_PROTOS 30 | ${CURRENT_SOURCE_DIR}/message.proto 31 | ) 32 | 33 | protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS 34 | ${ProtoServer_PROTOS} 35 | ) 36 | 37 | if(ENABLE_QT5) 38 | qt5_wrap_cpp(ProtoServer_HEADERS_MOC ${ProtoServer_QT_HEADERS}) 39 | else() 40 | qt4_wrap_cpp(ProtoServer_HEADERS_MOC ${ProtoServer_QT_HEADERS}) 41 | endif() 42 | 43 | add_library(protoserver 44 | ${ProtoServer_HEADERS} 45 | ${ProtoServer_QT_HEADERS} 46 | ${ProtoServer_SOURCES} 47 | ${ProtoServer_HEADERS_MOC} 48 | ${ProtoServer_PROTOS} 49 | ${ProtoServer_PROTO_SRCS} 50 | ${ProtoServer_PROTO_HDRS} 51 | ) 52 | if(ENABLE_QT5) 53 | qt5_use_modules(protoserver Widgets) 54 | endif() 55 | 56 | target_link_libraries(protoserver 57 | hyperion 58 | hyperion-utils 59 | protobuf 60 | ${QT_LIBRARIES} 61 | ) 62 | -------------------------------------------------------------------------------- /libsrc/protoserver/ProtoConnectionWrapper.cpp: -------------------------------------------------------------------------------- 1 | // protoserver includes 2 | #include "protoserver/ProtoConnectionWrapper.h" 3 | 4 | ProtoConnectionWrapper::ProtoConnectionWrapper(const std::string & address, int priority, int duration_ms, bool skipProtoReply) : 5 | _priority(priority), 6 | _duration_ms(duration_ms), 7 | _connection(address) 8 | { 9 | _connection.setSkipReply(skipProtoReply); 10 | connect(&_connection, SIGNAL(setGrabbingMode(GrabbingMode)), this, SIGNAL(setGrabbingMode(GrabbingMode))); 11 | connect(&_connection, SIGNAL(setVideoMode(VideoMode)), this, SIGNAL(setVideoMode(VideoMode))); 12 | } 13 | 14 | ProtoConnectionWrapper::~ProtoConnectionWrapper() 15 | { 16 | } 17 | 18 | void ProtoConnectionWrapper::receiveImage(const Image & image) 19 | { 20 | _connection.setImage(image, _priority, _duration_ms); 21 | } 22 | -------------------------------------------------------------------------------- /libsrc/utils/ColorArgb.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Utils includes 3 | #include 4 | 5 | ColorArgb ColorArgb::BLACK = { 255, 0, 0, 0 }; 6 | ColorArgb ColorArgb::RED = { 255, 255, 0, 0 }; 7 | ColorArgb ColorArgb::GREEN = { 255, 0, 255, 0 }; 8 | ColorArgb ColorArgb::BLUE = { 255, 0, 0, 255 }; 9 | ColorArgb ColorArgb::YELLOW= { 255, 255, 255, 0 }; 10 | ColorArgb ColorArgb::WHITE = { 255, 255, 255, 255 }; 11 | -------------------------------------------------------------------------------- /libsrc/utils/ColorBgr.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Local includes 3 | #include 4 | 5 | ColorBgr ColorBgr::BLACK = { 0, 0, 0 }; 6 | ColorBgr ColorBgr::RED = { 0, 0, 255 }; 7 | ColorBgr ColorBgr::GREEN = { 0, 255, 0 }; 8 | ColorBgr ColorBgr::BLUE = { 255, 0, 0 }; 9 | ColorBgr ColorBgr::YELLOW= { 0, 255, 255 }; 10 | ColorBgr ColorBgr::WHITE = { 255, 255, 255 }; 11 | 12 | -------------------------------------------------------------------------------- /libsrc/utils/ColorRgb.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Local includes 3 | #include 4 | 5 | ColorRgb ColorRgb::BLACK = { 0, 0, 0 }; 6 | ColorRgb ColorRgb::RED = { 255, 0, 0 }; 7 | ColorRgb ColorRgb::GREEN = { 0, 255, 0 }; 8 | ColorRgb ColorRgb::BLUE = { 0, 0, 255 }; 9 | ColorRgb ColorRgb::YELLOW= { 255, 255, 0 }; 10 | ColorRgb ColorRgb::WHITE = { 255, 255, 255 }; 11 | -------------------------------------------------------------------------------- /libsrc/utils/ColorRgba.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Utils includes 3 | #include 4 | 5 | ColorRgba ColorRgba::BLACK = { 0, 0, 0, 255 }; 6 | ColorRgba ColorRgba::RED = { 255, 0, 0, 255 }; 7 | ColorRgba ColorRgba::GREEN = { 0, 255, 0, 255 }; 8 | ColorRgba ColorRgba::BLUE = { 0, 0, 255, 255 }; 9 | ColorRgba ColorRgba::YELLOW= { 255, 255, 0, 255 }; 10 | ColorRgba ColorRgba::WHITE = { 255, 255, 255, 255 }; 11 | -------------------------------------------------------------------------------- /libsrc/utils/ColorRgbw.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Local includes 3 | #include 4 | 5 | ColorRgbw ColorRgbw::BLACK = { 0, 0, 0, 0 }; 6 | ColorRgbw ColorRgbw::RED = { 255, 0, 0, 0 }; 7 | ColorRgbw ColorRgbw::GREEN = { 0, 255, 0, 0 }; 8 | ColorRgbw ColorRgbw::BLUE = { 0, 0, 255, 0 }; 9 | ColorRgbw ColorRgbw::YELLOW= { 255, 255, 0, 0 }; 10 | ColorRgbw ColorRgbw::WHITE = { 0, 0, 0, 255 }; 11 | -------------------------------------------------------------------------------- /libsrc/utils/RgbToRgbw.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, std::string _whiteAlgorithm) { 5 | if (_whiteAlgorithm == "subtract_minimum") { 6 | output->white = std::min(input.red, input.green); 7 | output->white = std::min(output->white, input.blue); 8 | output->red = input.red - output->white; 9 | output->green = input.green - output->white; 10 | output->blue = input.blue - output->white; 11 | } 12 | else if (_whiteAlgorithm == "sub_min_warm_adjust") { 13 | } 14 | else if ( (_whiteAlgorithm == "") || (_whiteAlgorithm == "white_off") ) { 15 | output->red = input.red; 16 | output->green = input.green; 17 | output->blue = input.blue; 18 | output->white = 0; 19 | } 20 | else { 21 | std::cout << "ERROR: unknown whiteAlgorithm " << _whiteAlgorithm << std::endl; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /libsrc/webconfig/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/webconfig) 4 | set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/webconfig) 5 | 6 | # Group the headers that go through the MOC compiler 7 | set(WebConfig_QT_HEADERS 8 | ${CURRENT_SOURCE_DIR}/QtHttpClientWrapper.h 9 | ${CURRENT_SOURCE_DIR}/QtHttpHeader.h 10 | ${CURRENT_SOURCE_DIR}/QtHttpReply.h 11 | ${CURRENT_SOURCE_DIR}/QtHttpRequest.h 12 | ${CURRENT_SOURCE_DIR}/QtHttpServer.h 13 | ${CURRENT_SOURCE_DIR}/CgiHandler.h 14 | ${CURRENT_SOURCE_DIR}/StaticFileServing.h 15 | ${CURRENT_HEADER_DIR}/WebConfig.h 16 | ) 17 | 18 | set(WebConfig_HEADERS 19 | ) 20 | 21 | set(WebConfig_SOURCES 22 | ${CURRENT_SOURCE_DIR}/QtHttpClientWrapper.cpp 23 | ${CURRENT_SOURCE_DIR}/QtHttpHeader.cpp 24 | ${CURRENT_SOURCE_DIR}/QtHttpReply.cpp 25 | ${CURRENT_SOURCE_DIR}/QtHttpRequest.cpp 26 | ${CURRENT_SOURCE_DIR}/QtHttpServer.cpp 27 | ${CURRENT_SOURCE_DIR}/CgiHandler.cpp 28 | ${CURRENT_SOURCE_DIR}/StaticFileServing.cpp 29 | ${CURRENT_SOURCE_DIR}/WebConfig.cpp 30 | ) 31 | 32 | if(ENABLE_QT5) 33 | qt5_wrap_cpp(WebConfig_HEADERS_MOC ${WebConfig_QT_HEADERS}) 34 | else() 35 | qt4_wrap_cpp(WebConfigr_HEADERS_MOC ${WebConfig_QT_HEADERS}) 36 | endif() 37 | 38 | add_library(webconfig 39 | ${WebConfig_HEADERS} 40 | ${WebConfig_QT_HEADERS} 41 | ${WebConfig_SOURCES} 42 | ${WebConfig_HEADERS_MOC} 43 | ) 44 | 45 | if(ENABLE_QT5) 46 | qt5_use_modules(webconfig Widgets Network) 47 | endif() 48 | 49 | target_link_libraries(webconfig 50 | hyperion 51 | hyperion-utils 52 | ${QT_LIBRARIES} 53 | ) 54 | 55 | 56 | -------------------------------------------------------------------------------- /libsrc/webconfig/CgiHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef CGIHANDLER_H 2 | #define CGIHANDLER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include "QtHttpReply.h" 12 | 13 | class CgiHandler : public QObject { 14 | Q_OBJECT 15 | 16 | public: 17 | CgiHandler (Hyperion * hyperion, QObject * parent = NULL); 18 | virtual ~CgiHandler (void); 19 | 20 | void exec(const QStringList & args, QtHttpReply * reply); 21 | 22 | // cgi commands 23 | void cmd_cfg_jsonserver(const QStringList & args, QtHttpReply * reply); 24 | void cmd_cfg_hyperion (const QStringList & args, QtHttpReply * reply); 25 | 26 | private: 27 | Hyperion* _hyperion; 28 | QtHttpReply * _reply; 29 | const Json::Value &_hyperionConfig; 30 | }; 31 | 32 | #endif // CGIHANDLER_H 33 | 34 | 35 | -------------------------------------------------------------------------------- /libsrc/webconfig/QtHttpClientWrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef QTHTTPCLIENTWRAPPER_H 2 | #define QTHTTPCLIENTWRAPPER_H 3 | 4 | #include 5 | #include 6 | 7 | class QTcpSocket; 8 | 9 | class QtHttpRequest; 10 | class QtHttpReply; 11 | class QtHttpServer; 12 | 13 | class QtHttpClientWrapper : public QObject { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit QtHttpClientWrapper (QTcpSocket * sock, QtHttpServer * parent); 18 | 19 | static const char SPACE = ' '; 20 | static const char COLON = ':'; 21 | static const QByteArray & CRLF; 22 | 23 | enum ParsingStatus { 24 | ParsingError = -1, 25 | AwaitingRequest = 0, 26 | AwaitingHeaders = 1, 27 | AwaitingContent = 2, 28 | RequestParsed = 3 29 | }; 30 | 31 | QString getGuid (void); 32 | 33 | private slots: 34 | void onClientDataReceived (void); 35 | 36 | protected: 37 | ParsingStatus sendReplyToClient (QtHttpReply * reply); 38 | 39 | protected slots: 40 | void onReplySendHeadersRequested (void); 41 | void onReplySendDataRequested (void); 42 | 43 | private: 44 | QString m_guid; 45 | ParsingStatus m_parsingStatus; 46 | QTcpSocket * m_sockClient; 47 | QtHttpRequest * m_currentRequest; 48 | QtHttpServer * m_serverHandle; 49 | }; 50 | 51 | #endif // QTHTTPCLIENTWRAPPER_H 52 | -------------------------------------------------------------------------------- /libsrc/webconfig/QtHttpHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef QTHTTPHEADER_H 2 | #define QTHTTPHEADER_H 3 | 4 | class QByteArray; 5 | 6 | class QtHttpHeader { 7 | public: 8 | static const QByteArray & Server; 9 | static const QByteArray & Date; 10 | static const QByteArray & Host; 11 | static const QByteArray & Accept; 12 | static const QByteArray & ContentType; 13 | static const QByteArray & ContentLength; 14 | static const QByteArray & Connection; 15 | static const QByteArray & Cookie; 16 | static const QByteArray & UserAgent; 17 | static const QByteArray & AcceptCharset; 18 | static const QByteArray & AcceptEncoding; 19 | static const QByteArray & AcceptLanguage; 20 | static const QByteArray & Authorization; 21 | static const QByteArray & CacheControl; 22 | static const QByteArray & ContentMD5; 23 | static const QByteArray & ProxyAuthorization; 24 | static const QByteArray & Range; 25 | static const QByteArray & ContentEncoding; 26 | static const QByteArray & ContentLanguage; 27 | static const QByteArray & ContentLocation; 28 | static const QByteArray & ContentRange; 29 | static const QByteArray & Expires; 30 | static const QByteArray & LastModified; 31 | static const QByteArray & Location; 32 | static const QByteArray & SetCookie; 33 | static const QByteArray & TransferEncoding; 34 | static const QByteArray & ContentDisposition; 35 | }; 36 | 37 | #endif // QTHTTPHEADER_H 38 | -------------------------------------------------------------------------------- /libsrc/webconfig/QtHttpReply.h: -------------------------------------------------------------------------------- 1 | #ifndef QTHTTPREPLY_H 2 | #define QTHTTPREPLY_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class QtHttpServer; 10 | 11 | class QtHttpReply : public QObject { 12 | Q_OBJECT 13 | Q_ENUMS (StatusCode) 14 | 15 | public: 16 | explicit QtHttpReply (QtHttpServer * parent); 17 | 18 | enum StatusCode { 19 | Ok = 200, 20 | BadRequest = 400, 21 | Forbidden = 403, 22 | NotFound = 404, 23 | InternalError = 502, 24 | }; 25 | 26 | int getRawDataSize (void) const; 27 | bool useChunked (void) const; 28 | StatusCode getStatusCode (void) const; 29 | QByteArray getRawData (void) const; 30 | QList getHeadersList (void) const; 31 | 32 | QByteArray getHeader (const QByteArray & header) const; 33 | 34 | static const QByteArray getStatusTextForCode (StatusCode statusCode); 35 | 36 | public slots: 37 | void setUseChunked (bool chunked = false); 38 | void setStatusCode (StatusCode statusCode); 39 | void appendRawData (const QByteArray & data); 40 | void addHeader (const QByteArray & header, const QByteArray & value); 41 | void resetRawData (void); 42 | 43 | signals: 44 | void requestSendHeaders (void); 45 | void requestSendData (void); 46 | 47 | private: 48 | bool m_useChunked; 49 | StatusCode m_statusCode; 50 | QByteArray m_data; 51 | QtHttpServer * m_serverHandle; 52 | QHash m_headersHash; 53 | }; 54 | 55 | #endif // QTHTTPREPLY_H 56 | -------------------------------------------------------------------------------- /libsrc/webconfig/QtHttpRequest.h: -------------------------------------------------------------------------------- 1 | #ifndef QTHTTPREQUEST_H 2 | #define QTHTTPREQUEST_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class QtHttpServer; 11 | 12 | class QtHttpRequest : public QObject { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit QtHttpRequest (QtHttpServer * parent); 17 | 18 | int getRawDataSize (void) const; 19 | QUrl getUrl (void) const; 20 | QString getCommand (void) const; 21 | QByteArray getRawData (void) const; 22 | QList getHeadersList (void) const; 23 | 24 | QByteArray getHeader (const QByteArray & header) const; 25 | 26 | public slots: 27 | void setUrl (const QUrl & url); 28 | void setCommand (const QString & command); 29 | void addHeader (const QByteArray & header, const QByteArray & value); 30 | void appendRawData (const QByteArray & data); 31 | 32 | private: 33 | QUrl m_url; 34 | QString m_command; 35 | QByteArray m_data; 36 | QtHttpServer * m_serverHandle; 37 | QHash m_headersHash; 38 | }; 39 | 40 | #endif // QTHTTPREQUEST_H 41 | -------------------------------------------------------------------------------- /libsrc/webconfig/QtHttpServer.h: -------------------------------------------------------------------------------- 1 | #ifndef QTHTTPSERVER_H 2 | #define QTHTTPSERVER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class QTcpSocket; 9 | class QTcpServer; 10 | 11 | class QtHttpRequest; 12 | class QtHttpReply; 13 | class QtHttpClientWrapper; 14 | 15 | class QtHttpServer : public QObject { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit QtHttpServer (QObject * parent = Q_NULLPTR); 20 | 21 | static const QString & HTTP_VERSION; 22 | 23 | const QString getServerName (void) const; 24 | 25 | public slots: 26 | void start (quint16 port = 0); 27 | void stop (void); 28 | void setServerName (const QString & serverName); 29 | 30 | signals: 31 | void started (quint16 port); 32 | void stopped (void); 33 | void error (const QString & msg); 34 | void clientConnected (const QString & guid); 35 | void clientDisconnected (const QString & guid); 36 | void requestNeedsReply (QtHttpRequest * request, QtHttpReply * reply); 37 | 38 | private slots: 39 | void onClientConnected (void); 40 | void onClientDisconnected (void); 41 | 42 | private: 43 | QString m_serverName; 44 | QTcpServer * m_sockServer; 45 | QHash m_socksClientsHash; 46 | }; 47 | 48 | #endif // QTHTTPSERVER_H 49 | -------------------------------------------------------------------------------- /libsrc/webconfig/StaticFileServing.h: -------------------------------------------------------------------------------- 1 | #ifndef STATICFILESERVING_H 2 | #define STATICFILESERVING_H 3 | 4 | #include 5 | #include 6 | 7 | #include "QtHttpServer.h" 8 | #include "QtHttpRequest.h" 9 | #include "QtHttpReply.h" 10 | #include "QtHttpHeader.h" 11 | #include "CgiHandler.h" 12 | 13 | #include 14 | 15 | class StaticFileServing : public QObject { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit StaticFileServing (Hyperion *hyperion, QString baseUrl, quint16 port, QObject * parent = NULL); 20 | virtual ~StaticFileServing (void); 21 | 22 | public slots: 23 | void onServerStopped (void); 24 | void onServerStarted (quint16 port); 25 | void onServerError (QString msg); 26 | void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply); 27 | 28 | private: 29 | Hyperion * _hyperion; 30 | QString _baseUrl; 31 | QtHttpServer * _server; 32 | QMimeDatabase * _mimeDb; 33 | CgiHandler _cgi; 34 | }; 35 | 36 | #endif // STATICFILESERVING_H 37 | -------------------------------------------------------------------------------- /libsrc/webconfig/WebConfig.cpp: -------------------------------------------------------------------------------- 1 | #include "webconfig/WebConfig.h" 2 | #include "StaticFileServing.h" 3 | 4 | 5 | WebConfig::WebConfig(Hyperion *hyperion, QObject * parent) 6 | : QObject(parent) 7 | , _hyperion(hyperion) 8 | , _port(WEBCONFIG_DEFAULT_PORT) 9 | , _server(nullptr) 10 | { 11 | const Json::Value &config = hyperion->getJsonConfig(); 12 | _baseUrl = QString::fromStdString(WEBCONFIG_DEFAULT_PATH); 13 | 14 | bool webconfigEnable = true; 15 | 16 | if (config.isMember("webConfig")) 17 | { 18 | const Json::Value & webconfigConfig = config["webConfig"]; 19 | webconfigEnable = webconfigConfig.get("enable", true).asBool(); 20 | _port = webconfigConfig.get("port", WEBCONFIG_DEFAULT_PORT).asUInt(); 21 | _baseUrl = QString::fromStdString( webconfigConfig.get("document_root", WEBCONFIG_DEFAULT_PATH).asString() ); 22 | } 23 | 24 | if ( webconfigEnable ) 25 | start(); 26 | } 27 | 28 | 29 | WebConfig::~WebConfig() 30 | { 31 | stop(); 32 | } 33 | 34 | 35 | void WebConfig::start() 36 | { 37 | if ( _server == nullptr ) 38 | _server = new StaticFileServing (_hyperion, _baseUrl, _port, this); 39 | } 40 | 41 | void WebConfig::stop() 42 | { 43 | if ( _server != nullptr ) 44 | { 45 | delete _server; 46 | _server = nullptr; 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /libsrc/xbmcvideochecker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Define the current source locations 3 | SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/xbmcvideochecker) 4 | SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/xbmcvideochecker) 5 | 6 | # Group the headers that go through the MOC compiler 7 | SET(XBMCVideoChecker_QT_HEADERS 8 | ${CURRENT_HEADER_DIR}/XBMCVideoChecker.h 9 | ) 10 | 11 | SET(XBMCVideoChecker_HEADERS 12 | ) 13 | 14 | SET(XBMCVideoChecker_SOURCES 15 | ${CURRENT_SOURCE_DIR}/XBMCVideoChecker.cpp 16 | ) 17 | 18 | if(ENABLE_QT5) 19 | QT5_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS}) 20 | else() 21 | QT4_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS}) 22 | endif() 23 | 24 | add_library(xbmcvideochecker 25 | ${XBMCVideoChecker_HEADERS} 26 | ${XBMCVideoChecker_QT_HEADERS} 27 | ${XBMCVideoChecker_HEADERS_MOC} 28 | ${XBMCVideoChecker_SOURCES} 29 | ) 30 | 31 | if(ENABLE_QT5) 32 | qt5_use_modules(xbmcvideochecker Widgets) 33 | endif() 34 | 35 | target_link_libraries(xbmcvideochecker 36 | hyperion 37 | ${QT_LIBRARIES}) 38 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(hyperiond) 2 | add_subdirectory(hyperion-remote) 3 | 4 | # The following clients depend on the protobuf library 5 | if (ENABLE_AMLOGIC) 6 | add_subdirectory(hyperion-aml) 7 | endif() 8 | 9 | if(ENABLE_V4L2) 10 | add_subdirectory(hyperion-v4l2) 11 | endif() 12 | 13 | if(ENABLE_X11) 14 | add_subdirectory(hyperion-x11) 15 | endif() 16 | 17 | if(ENABLE_DISPMANX) 18 | add_subdirectory(hyperion-dispmanx) 19 | endif() 20 | 21 | if(ENABLE_FB) 22 | add_subdirectory(hyperion-framebuffer) 23 | endif() 24 | 25 | if(ENABLE_OSX) 26 | add_subdirectory(hyperion-osx) 27 | endif() 28 | 29 | -------------------------------------------------------------------------------- /src/hyperion-aml/AmlogicWrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion-AmLogic includes 3 | #include "AmlogicWrapper.h" 4 | 5 | AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) : 6 | _timer(this), 7 | _grabber(grabWidth, grabHeight) 8 | { 9 | _timer.setSingleShot(false); 10 | _timer.setInterval(updateRate_Hz); 11 | 12 | // Connect capturing to the timeout signal of the timer 13 | connect(&_timer, SIGNAL(timeout()), this, SLOT(capture())); 14 | } 15 | 16 | const Image & AmlogicWrapper::getScreenshot() 17 | { 18 | capture(); 19 | return _screenshot_rgb; 20 | } 21 | 22 | void AmlogicWrapper::start() 23 | { 24 | _timer.start(); 25 | } 26 | 27 | void AmlogicWrapper::stop() 28 | { 29 | _timer.stop(); 30 | } 31 | 32 | void AmlogicWrapper::capture() 33 | { 34 | _grabber.grabFrame(_screenshot); 35 | _screenshot.toRgb(_screenshot_rgb); 36 | 37 | emit sig_screenshot(_screenshot_rgb); 38 | } 39 | -------------------------------------------------------------------------------- /src/hyperion-aml/AmlogicWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | // QT includes 3 | #include 4 | 5 | // Hyperion-Dispmanx includes 6 | #include 7 | 8 | class AmlogicWrapper : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); 13 | 14 | const Image & getScreenshot(); 15 | 16 | /// 17 | /// Starts the timed capturing of screenshots 18 | /// 19 | void start(); 20 | 21 | void stop(); 22 | 23 | signals: 24 | void sig_screenshot(const Image & screenshot); 25 | 26 | private slots: 27 | /// 28 | /// Performs a single screenshot capture and publishes the capture screenshot on the screenshot signal. 29 | /// 30 | void capture(); 31 | 32 | private: 33 | /// The QT timer to generate capture-publish events 34 | QTimer _timer; 35 | 36 | /// The grabber for creating screenshots 37 | AmlogicGrabber _grabber; 38 | 39 | // image buffers 40 | Image _screenshot_rgb; 41 | Image _screenshot; 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /src/hyperion-aml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Configure minimum CMAKE version 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # Set the project name 5 | project(hyperion-aml) 6 | 7 | # find QT 8 | if(ENABLE_QT5) 9 | find_package(Qt5Widgets REQUIRED) 10 | else(ENABLE_QT5) 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) 12 | endif(ENABLE_QT5) 13 | 14 | include_directories( 15 | ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver 16 | ${QT_INCLUDES} 17 | ${PROTOBUF_INCLUDE_DIRS} 18 | ) 19 | 20 | set(Hyperion_AML_QT_HEADERS 21 | AmlogicWrapper.h 22 | ) 23 | 24 | set(Hyperion_AML_HEADERS 25 | ) 26 | 27 | set(Hyperion_AML_SOURCES 28 | hyperion-aml.cpp 29 | AmlogicWrapper.cpp 30 | ) 31 | 32 | if(ENABLE_QT5) 33 | QT5_WRAP_CPP(Hyperion_AML_HEADERS_MOC ${Hyperion_AML_QT_HEADERS}) 34 | else() 35 | QT4_WRAP_CPP(Hyperion_AML_HEADERS_MOC ${Hyperion_AML_QT_HEADERS}) 36 | endif() 37 | 38 | add_executable(${PROJECT_NAME} 39 | ${Hyperion_AML_HEADERS} 40 | ${Hyperion_AML_SOURCES} 41 | ${Hyperion_AML_HEADERS_MOC} 42 | ) 43 | 44 | target_link_libraries(${PROJECT_NAME} 45 | getoptPlusPlus 46 | blackborder 47 | hyperion-utils 48 | protoserver 49 | amlogic-grabber 50 | pthread 51 | ) 52 | 53 | if(ENABLE_QT5) 54 | qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) 55 | else() 56 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 57 | endif() 58 | 59 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 60 | -------------------------------------------------------------------------------- /src/hyperion-dispmanx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Configure minimum CMAKE version 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # Set the project name 5 | project(hyperion-dispmanx) 6 | 7 | # find QT 8 | if(ENABLE_QT5) 9 | find_package(Qt5Widgets REQUIRED) 10 | else() 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork ) 12 | endif() 13 | 14 | # Find the BCM-package (VC control) 15 | find_package(BCM REQUIRED) 16 | 17 | include_directories( 18 | ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver 19 | ${QT_INCLUDES} 20 | ${BCM_INCLUDE_DIRS} 21 | ${PROTOBUF_INCLUDE_DIRS} 22 | ) 23 | 24 | set(Hyperion_Dispmanx_QT_HEADERS 25 | DispmanxWrapper.h) 26 | 27 | set(Hyperion_Dispmanx_HEADERS 28 | ) 29 | 30 | set(Hyperion_Dispmanx_SOURCES 31 | hyperion-dispmanx.cpp 32 | DispmanxWrapper.cpp 33 | ) 34 | 35 | if(ENABLE_QT5) 36 | QT5_WRAP_CPP(Hyperion_Dispmanx_HEADERS_MOC ${Hyperion_Dispmanx_QT_HEADERS}) 37 | else() 38 | QT4_WRAP_CPP(Hyperion_Dispmanx_HEADERS_MOC ${Hyperion_Dispmanx_QT_HEADERS}) 39 | endif() 40 | 41 | add_executable( ${PROJECT_NAME} 42 | ${Hyperion_Dispmanx_HEADERS} 43 | ${Hyperion_Dispmanx_SOURCES} 44 | ${Hyperion_Dispmanx_HEADERS_MOC} 45 | ) 46 | 47 | target_link_libraries( ${PROJECT_NAME} 48 | getoptPlusPlus 49 | blackborder 50 | hyperion-utils 51 | protoserver 52 | dispmanx-grabber 53 | ${Dispmanx_LIBRARIES} 54 | pthread 55 | ) 56 | 57 | if(ENABLE_QT5) 58 | qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) 59 | else() 60 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 61 | endif() 62 | 63 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 64 | -------------------------------------------------------------------------------- /src/hyperion-dispmanx/DispmanxWrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion-Dispmanx includes 3 | #include "DispmanxWrapper.h" 4 | 5 | DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, 6 | const VideoMode& videoMode, 7 | const unsigned cropLeft, const unsigned cropRight, 8 | const unsigned cropTop, const unsigned cropBottom, 9 | const unsigned updateRate_Hz) : 10 | _timer(this), 11 | _grabber(grabWidth, grabHeight) 12 | { 13 | _grabber.setVideoMode(videoMode); 14 | _grabber.setCropping(cropLeft, cropRight, cropTop, cropBottom); 15 | _timer.setSingleShot(false); 16 | _timer.setInterval(updateRate_Hz); 17 | 18 | // Connect capturing to the timeout signal of the timer 19 | connect(&_timer, SIGNAL(timeout()), this, SLOT(capture())); 20 | } 21 | 22 | const Image & DispmanxWrapper::getScreenshot() 23 | { 24 | capture(); 25 | return _screenshot_rgb; 26 | } 27 | 28 | void DispmanxWrapper::start() 29 | { 30 | _timer.start(); 31 | } 32 | 33 | void DispmanxWrapper::stop() 34 | { 35 | _timer.stop(); 36 | } 37 | 38 | void DispmanxWrapper::capture() 39 | { 40 | _grabber.grabFrame(_screenshot); 41 | _screenshot.toRgb(_screenshot_rgb); 42 | 43 | emit sig_screenshot(_screenshot_rgb); 44 | } 45 | -------------------------------------------------------------------------------- /src/hyperion-dispmanx/DispmanxWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | // QT includes 3 | #include 4 | 5 | // Hyperion-Dispmanx includes 6 | #include 7 | 8 | class DispmanxWrapper : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, 13 | const VideoMode& videoMode, 14 | const unsigned cropLeft, const unsigned cropRight, 15 | const unsigned cropTop, const unsigned cropBottom, 16 | const unsigned updateRate_Hz); 17 | 18 | const Image & getScreenshot(); 19 | 20 | /// 21 | /// Starts the timed capturing of screenshots 22 | /// 23 | void start(); 24 | 25 | void stop(); 26 | 27 | signals: 28 | void sig_screenshot(const Image & screenshot); 29 | 30 | private slots: 31 | /// 32 | /// Performs a single screenshot capture and publishes the capture screenshot on the screenshot 33 | /// signal. 34 | /// 35 | void capture(); 36 | 37 | private: 38 | /// The QT timer to generate capture-publish events 39 | QTimer _timer; 40 | 41 | /// The grabber for creating screenshots 42 | DispmanxFrameGrabber _grabber; 43 | Image _screenshot_rgb; 44 | Image _screenshot; 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /src/hyperion-framebuffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Configure minimum CMAKE version 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # Set the project name 5 | project(hyperion-framebuffer) 6 | 7 | # find QT 8 | if(ENABLE_QT5) 9 | find_package(Qt5Widgets REQUIRED) 10 | else() 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork ) 12 | endif() 13 | 14 | include_directories( 15 | ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver 16 | ${QT_INCLUDES} 17 | ${PROTOBUF_INCLUDE_DIRS} 18 | ) 19 | 20 | set(Hyperion_FB_QT_HEADERS 21 | FramebufferWrapper.h 22 | ) 23 | 24 | set(Hyperion_FB_HEADERS 25 | ) 26 | 27 | set(Hyperion_FB_SOURCES 28 | hyperion-framebuffer.cpp 29 | FramebufferWrapper.cpp 30 | ) 31 | 32 | if(ENABLE_QT5) 33 | QT5_WRAP_CPP(Hyperion_FB_HEADERS_MOC ${Hyperion_FB_QT_HEADERS}) 34 | else() 35 | QT4_WRAP_CPP(Hyperion_FB_HEADERS_MOC ${Hyperion_FB_QT_HEADERS}) 36 | endif() 37 | 38 | add_executable( ${PROJECT_NAME} 39 | ${Hyperion_FB_HEADERS} 40 | ${Hyperion_FB_SOURCES} 41 | ${Hyperion_FB_HEADERS_MOC} 42 | ) 43 | 44 | target_link_libraries( ${PROJECT_NAME} 45 | getoptPlusPlus 46 | blackborder 47 | hyperion-utils 48 | protoserver 49 | framebuffer-grabber 50 | pthread 51 | ) 52 | 53 | if(ENABLE_QT5) 54 | qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) 55 | else() 56 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 57 | endif() 58 | 59 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 60 | -------------------------------------------------------------------------------- /src/hyperion-framebuffer/FramebufferWrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion-AmLogic includes 3 | #include "FramebufferWrapper.h" 4 | 5 | FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) : 6 | _timer(this), 7 | _grabber(device,grabWidth, grabHeight) 8 | { 9 | _timer.setSingleShot(false); 10 | _timer.setInterval(updateRate_Hz); 11 | 12 | // Connect capturing to the timeout signal of the timer 13 | connect(&_timer, SIGNAL(timeout()), this, SLOT(capture())); 14 | } 15 | 16 | const Image & FramebufferWrapper::getScreenshot() 17 | { 18 | capture(); 19 | return _screenshot; 20 | } 21 | 22 | void FramebufferWrapper::start() 23 | { 24 | _timer.start(); 25 | } 26 | 27 | void FramebufferWrapper::stop() 28 | { 29 | _timer.stop(); 30 | } 31 | 32 | void FramebufferWrapper::capture() 33 | { 34 | _grabber.grabFrame(_screenshot); 35 | 36 | emit sig_screenshot(_screenshot); 37 | } 38 | -------------------------------------------------------------------------------- /src/hyperion-framebuffer/FramebufferWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | // QT includes 3 | #include 4 | 5 | // Hyperion-Dispmanx includes 6 | #include 7 | 8 | class FramebufferWrapper : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | FramebufferWrapper(const std::string & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); 13 | 14 | const Image & getScreenshot(); 15 | 16 | /// 17 | /// Starts the timed capturing of screenshots 18 | /// 19 | void start(); 20 | 21 | void stop(); 22 | 23 | signals: 24 | void sig_screenshot(const Image & screenshot); 25 | 26 | private slots: 27 | /// 28 | /// Performs a single screenshot capture and publishes the capture screenshot on the screenshot signal. 29 | /// 30 | void capture(); 31 | 32 | private: 33 | /// The QT timer to generate capture-publish events 34 | QTimer _timer; 35 | 36 | /// The grabber for creating screenshots 37 | FramebufferFrameGrabber _grabber; 38 | 39 | // image buffers 40 | Image _screenshot; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /src/hyperion-osx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Configure minimum CMAKE version 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # Set the project name 5 | project(hyperion-osx) 6 | 7 | # find QT 8 | if(ENABLE_QT5) 9 | find_package(Qt5Widgets REQUIRED) 10 | else() 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork ) 12 | endif() 13 | 14 | include_directories( 15 | ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver 16 | ${QT_INCLUDES} 17 | ${PROTOBUF_INCLUDE_DIRS} 18 | ) 19 | 20 | set(Hyperion_OSX_QT_HEADERS 21 | OsxWrapper.h 22 | ) 23 | 24 | set(Hyperion_OSX_HEADERS 25 | ) 26 | 27 | set(Hyperion_OSX_SOURCES 28 | hyperion-osx.cpp 29 | OsxWrapper.cpp 30 | ) 31 | 32 | if(ENABLE_QT5) 33 | QT5_WRAP_CPP(Hyperion_OSX_HEADERS_MOC ${Hyperion_OSX_QT_HEADERS}) 34 | else() 35 | QT4_WRAP_CPP(Hyperion_OSX_HEADERS_MOC ${Hyperion_OSX_QT_HEADERS}) 36 | endif() 37 | 38 | add_executable( ${PROJECT_NAME} 39 | ${Hyperion_OSX_HEADERS} 40 | ${Hyperion_OSX_SOURCES} 41 | ${Hyperion_OSX_HEADERS_MOC} 42 | ) 43 | 44 | target_link_libraries( ${PROJECT_NAME} 45 | getoptPlusPlus 46 | blackborder 47 | hyperion-utils 48 | protoserver 49 | osx-grabber 50 | pthread 51 | ) 52 | 53 | if(ENABLE_QT5) 54 | qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) 55 | else() 56 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 57 | endif() 58 | 59 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 60 | 61 | -------------------------------------------------------------------------------- /src/hyperion-osx/OsxWrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion-AmLogic includes 3 | #include "OsxWrapper.h" 4 | 5 | OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) : 6 | _timer(this), 7 | _grabber(display,grabWidth, grabHeight) 8 | { 9 | _timer.setSingleShot(false); 10 | _timer.setInterval(updateRate_Hz); 11 | 12 | // Connect capturing to the timeout signal of the timer 13 | connect(&_timer, SIGNAL(timeout()), this, SLOT(capture())); 14 | } 15 | 16 | const Image & OsxWrapper::getScreenshot() 17 | { 18 | capture(); 19 | return _screenshot; 20 | } 21 | 22 | void OsxWrapper::start() 23 | { 24 | _timer.start(); 25 | } 26 | 27 | void OsxWrapper::stop() 28 | { 29 | _timer.stop(); 30 | } 31 | 32 | void OsxWrapper::capture() 33 | { 34 | _grabber.grabFrame(_screenshot); 35 | emit sig_screenshot(_screenshot); 36 | } 37 | -------------------------------------------------------------------------------- /src/hyperion-osx/OsxWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | // QT includes 3 | #include 4 | 5 | // Hyperion-Dispmanx includes 6 | #include 7 | 8 | class OsxWrapper : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); 13 | 14 | const Image & getScreenshot(); 15 | 16 | /// 17 | /// Starts the timed capturing of screenshots 18 | /// 19 | void start(); 20 | 21 | void stop(); 22 | 23 | signals: 24 | void sig_screenshot(const Image & screenshot); 25 | 26 | private slots: 27 | /// 28 | /// Performs a single screenshot capture and publishes the capture screenshot on the screenshot signal. 29 | /// 30 | void capture(); 31 | 32 | private: 33 | /// The QT timer to generate capture-publish events 34 | QTimer _timer; 35 | 36 | /// The grabber for creating screenshots 37 | OsxFrameGrabber _grabber; 38 | 39 | // image buffers 40 | Image _screenshot; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /src/hyperion-remote/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(hyperion-remote) 4 | 5 | # find Qt 6 | if(ENABLE_QT5) 7 | find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED) 8 | # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") 9 | # set(CMAKE_CXX_FLAGS "-fPIC") 10 | else() 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) 12 | endif() 13 | 14 | # The following I do not undrstand completely... 15 | # libQtCore.so uses some hardcoded library path inside which are incorrect after copying the file RPi file system 16 | # Therefor, an extra path is needed on which to find the required libraries 17 | LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) 18 | 19 | include_directories(${QT_INCLUDES}) 20 | 21 | set(hyperion-remote_HEADERS 22 | CustomParameter.h 23 | JsonConnection.h 24 | ColorTransformValues.h) 25 | 26 | set(hyperion-remote_SOURCES 27 | hyperion-remote.cpp 28 | JsonConnection.cpp) 29 | 30 | add_executable(${PROJECT_NAME} 31 | ${hyperion-remote_HEADERS} 32 | ${hyperion-remote_SOURCES}) 33 | 34 | target_link_libraries(${PROJECT_NAME} 35 | jsoncpp 36 | getoptPlusPlus 37 | ${QT_LIBRARIES}) 38 | 39 | if(ENABLE_QT5) 40 | qt5_use_modules(${PROJECT_NAME} Widgets Core Network) 41 | else() 42 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 43 | endif() 44 | 45 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 46 | 47 | -------------------------------------------------------------------------------- /src/hyperion-remote/ColorAdjustmentValues.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /// Simple structure to contain the values of a color transformation 4 | struct ColorAdjustmentValues 5 | { 6 | /// The value for the red color-channel 7 | int valueRed; 8 | /// The value for the green color-channel 9 | int valueGreen; 10 | /// The value for the blue color-channel 11 | int valueBlue; 12 | }; 13 | -------------------------------------------------------------------------------- /src/hyperion-remote/ColorCorrectionValues.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /// Simple structure to contain the values of a color transformation 4 | struct ColorCorrectionValues 5 | { 6 | /// The value for the red color-channel 7 | int valueRed; 8 | /// The value for the green color-channel 9 | int valueGreen; 10 | /// The value for the blue color-channel 11 | int valueBlue; 12 | }; 13 | -------------------------------------------------------------------------------- /src/hyperion-remote/ColorTransformValues.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /// Simple structure to contain the values of a color transformation 4 | struct ColorTransformValues 5 | { 6 | /// The value for the red color-channel 7 | double valueRed; 8 | /// The value for the green color-channel 9 | double valueGreen; 10 | /// The value for the blue color-channel 11 | double valueBlue; 12 | }; 13 | -------------------------------------------------------------------------------- /src/hyperion-v4l2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(hyperion-v4l2) 4 | 5 | # find Qt 6 | if(ENABLE_QT5) 7 | find_package(Qt5Widgets REQUIRED) 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") 9 | # set(CMAKE_CXX_FLAGS "-fPIC") 10 | else() 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) 12 | endif() 13 | 14 | 15 | include_directories( 16 | ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver 17 | ${PROTOBUF_INCLUDE_DIRS} 18 | ${QT_INCLUDES} 19 | ) 20 | 21 | set(Hyperion_V4L2_QT_HEADERS 22 | ScreenshotHandler.h 23 | ) 24 | 25 | set(Hyperion_V4L2_HEADERS 26 | VideoStandardParameter.h 27 | PixelFormatParameter.h 28 | ) 29 | 30 | set(Hyperion_V4L2_SOURCES 31 | hyperion-v4l2.cpp 32 | ScreenshotHandler.cpp 33 | ) 34 | if(ENABLE_QT5) 35 | QT5_WRAP_CPP(Hyperion_V4L2_MOC_SOURCES ${Hyperion_V4L2_QT_HEADERS}) 36 | else() 37 | QT4_WRAP_CPP(Hyperion_V4L2_MOC_SOURCES ${Hyperion_V4L2_QT_HEADERS}) 38 | endif() 39 | 40 | add_executable(${PROJECT_NAME} 41 | ${Hyperion_V4L2_HEADERS} 42 | ${Hyperion_V4L2_SOURCES} 43 | ${Hyperion_V4L2_QT_HEADERS} 44 | ${Hyperion_V4L2_MOC_SOURCES} 45 | ) 46 | 47 | target_link_libraries(${PROJECT_NAME} 48 | v4l2-grabber 49 | getoptPlusPlus 50 | blackborder 51 | hyperion-utils 52 | protoserver 53 | pthread 54 | ${QT_LIBRARIES} 55 | ) 56 | 57 | if(ENABLE_QT5) 58 | qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) 59 | else() 60 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 61 | endif() 62 | 63 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 64 | -------------------------------------------------------------------------------- /src/hyperion-v4l2/PixelFormatParameter.h: -------------------------------------------------------------------------------- 1 | // getoptPlusPLus includes 2 | #include 3 | 4 | // grabber includes 5 | #include 6 | 7 | using namespace vlofgren; 8 | 9 | /// Data parameter for the pixel format 10 | typedef vlofgren::PODParameter PixelFormatParameter; 11 | 12 | namespace vlofgren { 13 | /// Translates a string (as passed on the commandline) to a pixel format 14 | /// 15 | /// @param[in] s The string (as passed on the commandline) 16 | /// @return The pixel format 17 | /// @throws Parameter::ParameterRejected If the string did not result in a pixel format 18 | template<> 19 | PixelFormat PixelFormatParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) 20 | { 21 | QString input = QString::fromStdString(s).toLower(); 22 | 23 | if (input == "yuyv") 24 | { 25 | return PIXELFORMAT_YUYV; 26 | } 27 | else if (input == "uyvy") 28 | { 29 | return PIXELFORMAT_UYVY; 30 | } 31 | else if (input == "rgb32") 32 | { 33 | return PIXELFORMAT_RGB32; 34 | } 35 | else if (input == "no-change") 36 | { 37 | return PIXELFORMAT_NO_CHANGE; 38 | } 39 | 40 | throw Parameter::ParameterRejected("Invalid value for pixel format. Valid values are: YUYV, UYVY, RGB32, and NO-CHANGE"); 41 | return PIXELFORMAT_NO_CHANGE; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/hyperion-v4l2/ScreenshotHandler.cpp: -------------------------------------------------------------------------------- 1 | // Qt includes 2 | #include 3 | #include 4 | 5 | // hyperion-v4l2 includes 6 | #include "ScreenshotHandler.h" 7 | 8 | ScreenshotHandler::ScreenshotHandler(const std::string & filename) : 9 | _filename(filename) 10 | { 11 | } 12 | 13 | ScreenshotHandler::~ScreenshotHandler() 14 | { 15 | } 16 | 17 | void ScreenshotHandler::receiveImage(const Image & image) 18 | { 19 | // store as PNG 20 | QImage pngImage((const uint8_t *) image.memptr(), image.width(), image.height(), 3*image.width(), QImage::Format_RGB888); 21 | pngImage.save(_filename.c_str()); 22 | 23 | // Quit the application after the first image 24 | QCoreApplication::quit(); 25 | } 26 | -------------------------------------------------------------------------------- /src/hyperion-v4l2/ScreenshotHandler.h: -------------------------------------------------------------------------------- 1 | // Qt includes 2 | #include 3 | 4 | // hyperionincludes 5 | #include 6 | #include 7 | 8 | /// This class handles callbacks from the V4L2 grabber 9 | class ScreenshotHandler : public QObject 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | ScreenshotHandler(const std::string & filename); 15 | virtual ~ScreenshotHandler(); 16 | 17 | public slots: 18 | /// Handle a single image 19 | /// @param image The image to process 20 | void receiveImage(const Image & image); 21 | 22 | private: 23 | const std::string _filename; 24 | }; 25 | -------------------------------------------------------------------------------- /src/hyperion-v4l2/VideoStandardParameter.h: -------------------------------------------------------------------------------- 1 | // getoptPlusPLus includes 2 | #include 3 | 4 | // grabber includes 5 | #include 6 | 7 | using namespace vlofgren; 8 | 9 | /// Data parameter for the video standard 10 | typedef vlofgren::PODParameter VideoStandardParameter; 11 | 12 | namespace vlofgren { 13 | /// Translates a string (as passed on the commandline) to a color standard 14 | /// 15 | /// @param[in] s The string (as passed on the commandline) 16 | /// @return The color standard 17 | /// @throws Parameter::ParameterRejected If the string did not result in a video standard 18 | template<> 19 | VideoStandard VideoStandardParameter::validate(const std::string& s) throw (Parameter::ParameterRejected) 20 | { 21 | QString input = QString::fromStdString(s).toLower(); 22 | 23 | if (input == "pal") 24 | { 25 | return VIDEOSTANDARD_PAL; 26 | } 27 | else if (input == "ntsc") 28 | { 29 | return VIDEOSTANDARD_NTSC; 30 | } 31 | else if (input == "no-change") 32 | { 33 | return VIDEOSTANDARD_NO_CHANGE; 34 | } 35 | 36 | throw Parameter::ParameterRejected("Invalid value for video standard. Valid values are: PAL, NTSC, and NO-CHANGE"); 37 | return VIDEOSTANDARD_NO_CHANGE; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/hyperion-x11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Configure minimum CMAKE version 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # Set the project name 5 | project(hyperion-x11) 6 | 7 | # find QT 8 | if(ENABLE_QT5) 9 | find_package(Qt5Widgets REQUIRED) 10 | else() 11 | find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) 12 | endif() 13 | 14 | # Find X11 15 | find_package(X11 REQUIRED) 16 | 17 | include_directories( 18 | ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver 19 | ${QT_INCLUDES} 20 | ${X11_INCLUDES} 21 | ${PROTOBUF_INCLUDE_DIRS} 22 | ) 23 | 24 | set(Hyperion_X11_QT_HEADERS 25 | X11Wrapper.h) 26 | 27 | set(Hyperion_X11_HEADERS 28 | ) 29 | 30 | set(Hyperion_X11_SOURCES 31 | hyperion-x11.cpp 32 | X11Wrapper.cpp 33 | ) 34 | 35 | if(ENABLE_QT5) 36 | QT5_WRAP_CPP(Hyperion_X11_HEADERS_MOC ${Hyperion_X11_QT_HEADERS}) 37 | else() 38 | QT4_WRAP_CPP(Hyperion_X11_HEADERS_MOC ${Hyperion_X11_QT_HEADERS}) 39 | endif() 40 | 41 | 42 | add_executable(${PROJECT_NAME} 43 | ${Hyperion_X11_HEADERS} 44 | ${Hyperion_X11_SOURCES} 45 | ${Hyperion_X11_HEADERS_MOC} 46 | ) 47 | 48 | target_link_libraries(${PROJECT_NAME} 49 | getoptPlusPlus 50 | blackborder 51 | hyperion-utils 52 | protoserver 53 | x11-grabber 54 | ${X11_LIBRARIES} 55 | ${X11_Xrender_LIB} 56 | pthread 57 | ) 58 | 59 | if(ENABLE_QT5) 60 | qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) 61 | else() 62 | qt4_use_modules(${PROJECT_NAME} Core Gui Network ) 63 | endif() 64 | 65 | install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT ambilight ) 66 | -------------------------------------------------------------------------------- /src/hyperion-x11/X11Wrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hyperion-X11 includes 3 | #include "X11Wrapper.h" 4 | 5 | X11Wrapper::X11Wrapper(int grabInterval, bool useXGetImage, int cropLeft, int cropRight, int cropTop, int cropBottom, int horizontalPixelDecimation, int verticalPixelDecimation) : 6 | _timer(this), 7 | _grabber(useXGetImage, cropLeft, cropRight, cropTop, cropBottom, horizontalPixelDecimation, verticalPixelDecimation) 8 | { 9 | _timer.setSingleShot(false); 10 | _timer.setInterval(grabInterval); 11 | 12 | // Connect capturing to the timeout signal of the timer 13 | connect(&_timer, SIGNAL(timeout()), this, SLOT(capture())); 14 | } 15 | 16 | const Image & X11Wrapper::getScreenshot() 17 | { 18 | const Image & screenshot = _grabber.grab(); 19 | return screenshot; 20 | } 21 | 22 | void X11Wrapper::start() 23 | { 24 | _timer.start(); 25 | } 26 | 27 | void X11Wrapper::stop() 28 | { 29 | _timer.stop(); 30 | } 31 | 32 | bool X11Wrapper::displayInit() 33 | { 34 | return _grabber.Setup(); 35 | } 36 | 37 | void X11Wrapper::capture() 38 | { 39 | const Image & screenshot = _grabber.grab(); 40 | emit sig_screenshot(screenshot); 41 | } 42 | 43 | void X11Wrapper::setGrabbingMode(const GrabbingMode mode) 44 | { 45 | switch (mode) 46 | { 47 | case GRABBINGMODE_VIDEO: 48 | case GRABBINGMODE_PAUSE: 49 | case GRABBINGMODE_AUDIO: 50 | case GRABBINGMODE_PHOTO: 51 | case GRABBINGMODE_MENU: 52 | case GRABBINGMODE_INVALID: 53 | start(); 54 | break; 55 | case GRABBINGMODE_OFF: 56 | stop(); 57 | break; 58 | } 59 | } 60 | 61 | void X11Wrapper::setVideoMode(const VideoMode mode) 62 | { 63 | _grabber.setVideoMode(mode); 64 | } 65 | -------------------------------------------------------------------------------- /src/hyperion-x11/X11Wrapper.h: -------------------------------------------------------------------------------- 1 | 2 | // QT includes 3 | #include 4 | 5 | // Hyperion-X11 includes 6 | #include 7 | 8 | //Utils includes 9 | #include 10 | #include 11 | 12 | class X11Wrapper : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | X11Wrapper(int grabInterval, bool useXGetImage, int cropLeft, int cropRight, int cropTop, int cropBottom, int horizontalPixelDecimation, int verticalPixelDecimation); 17 | 18 | const Image & getScreenshot(); 19 | 20 | /// 21 | /// Starts the timed capturing of screenshots 22 | /// 23 | void start(); 24 | 25 | void stop(); 26 | 27 | bool displayInit(); 28 | 29 | signals: 30 | void sig_screenshot(const Image & screenshot); 31 | 32 | public slots: 33 | /// 34 | /// Set the grabbing mode 35 | /// @param[in] mode The new grabbing mode 36 | /// 37 | void setGrabbingMode(const GrabbingMode mode); 38 | 39 | /// 40 | /// Set the video mode (2D/3D) 41 | /// @param[in] mode The new video mode 42 | /// 43 | void setVideoMode(const VideoMode videoMode); 44 | 45 | private slots: 46 | /// 47 | /// Performs a single screenshot capture and publishes the capture screenshot on the screenshot 48 | /// signal. 49 | /// 50 | void capture(); 51 | 52 | private: 53 | /// The QT timer to generate capture-publish events 54 | QTimer _timer; 55 | 56 | /// The grabber for creating screenshots 57 | X11Grabber _grabber; 58 | }; 59 | -------------------------------------------------------------------------------- /src/hyperiond/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(hyperiond 3 | hyperiond.cpp) 4 | 5 | target_link_libraries(hyperiond 6 | getoptPlusPlus 7 | hyperion 8 | xbmcvideochecker 9 | effectengine 10 | jsonserver 11 | boblightserver 12 | protoserver 13 | ) 14 | if (ENABLE_QT5) 15 | target_link_libraries(hyperiond webconfig) 16 | endif () 17 | 18 | if (ENABLE_DISPMANX) 19 | target_link_libraries(hyperiond dispmanx-grabber) 20 | endif () 21 | 22 | if (ENABLE_FB) 23 | target_link_libraries(hyperiond framebuffer-grabber) 24 | endif () 25 | 26 | if (ENABLE_OSX) 27 | target_link_libraries(hyperiond osx-grabber) 28 | endif () 29 | 30 | if (ENABLE_V4L2) 31 | target_link_libraries(hyperiond v4l2-grabber) 32 | endif () 33 | 34 | if (ENABLE_OPENCV) 35 | target_link_libraries(hyperiond opencv-grabber) 36 | endif () 37 | 38 | if (ENABLE_AMLOGIC) 39 | target_link_libraries(hyperiond amlogic-grabber) 40 | endif () 41 | 42 | if (ENABLE_ZEROCONF) 43 | target_link_libraries(hyperiond bonjour) 44 | endif() 45 | 46 | install ( TARGETS hyperiond DESTINATION "bin" COMPONENT ambilight ) 47 | install ( DIRECTORY ${CMAKE_SOURCE_DIR}/effects DESTINATION "share/hyperion/" COMPONENT ambilight ) 48 | install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT ambilight ) 49 | install ( DIRECTORY ${CMAKE_SOURCE_DIR}/config DESTINATION "share/hyperion/" COMPONENT ambilight ) 50 | install ( DIRECTORY ${CMAKE_SOURCE_DIR}/assets/webconfig DESTINATION "share/hyperion/" COMPONENT ambilight ) 51 | -------------------------------------------------------------------------------- /test/TestHyperionPng.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | 5 | // HyperionPNG includes 6 | #include 7 | 8 | template 9 | void process(Hyperion_T& hyperion) 10 | { 11 | hyperion.setInputSize(64, 64); 12 | 13 | // Obtain reference to buffer 14 | RgbImage& image = hyperion.image(); 15 | 16 | // Write some data to the image 17 | std::cout << "Write data to buffer-image" << std::endl; 18 | for (unsigned y=0; y 4 | #include 5 | 6 | // Hyperion includes 7 | #include 8 | #include 9 | 10 | using namespace hyperion; 11 | 12 | int main() 13 | { 14 | std::string homeDir = getenv("RASPILIGHT_HOME"); 15 | 16 | const std::string schemaFile = homeDir + "/hyperion.schema.json"; 17 | const std::string configFile = homeDir + "/hyperion.config.json"; 18 | 19 | Json::Value config; 20 | if (JsonFactory::load(schemaFile, configFile, config) < 0) 21 | { 22 | std::cerr << "UNABLE TO LOAD CONFIGURATION" << std::endl; 23 | return -1; 24 | } 25 | 26 | const LedString ledString = Hyperion::createLedString(config["leds"], Hyperion::createColorOrder(config["device"])); 27 | 28 | const ColorRgb testColor = {64, 123, 12}; 29 | 30 | Image image(64, 64, testColor); 31 | ImageToLedsMap map(64, 64, 0, 0, ledString.leds()); 32 | 33 | std::vector ledColors(ledString.leds().size()); 34 | map.getMeanLedColor(image, ledColors); 35 | 36 | std::cout << "["; 37 | for (const ColorRgb & color : ledColors) 38 | { 39 | std::cout << color; 40 | } 41 | std::cout << "]" << std::endl; 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /test/TestRgbImage.cpp: -------------------------------------------------------------------------------- 1 | 2 | // STL includes 3 | #include 4 | 5 | // Utils includes 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int main() 13 | { 14 | std::cout << "Constructing image" << std::endl; 15 | int width = 64; 16 | int height = 64; 17 | Image image_rgb(width, height, ColorRgb::BLACK); 18 | Image image_bgr(image_rgb.width(), image_rgb.height(), ColorBgr::BLACK); 19 | 20 | std::cout << "Writing image" << std::endl; 21 | unsigned l = width * height; 22 | 23 | // BGR 24 | for (unsigned i=0; i