diff --git a/.gitignore b/.gitignore index 7f6019ed..fd2b546b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ CMakeCache.txt .directory *.pyc compile_commands.json + +# Autogenerated by flatbuffers +libsrc/flatbufserver/hyperion_reply_generated.h +libsrc/flatbufserver/hyperion_request_generated.h diff --git a/3RD_PARTY_LICENSES b/3RD_PARTY_LICENSES index 400e025d..76ea8ba1 100644 --- a/3RD_PARTY_LICENSES +++ b/3RD_PARTY_LICENSES @@ -1380,3 +1380,320 @@ Copyright (C) 2011 Olaf Lüke Redistribution and use in source and binary forms of this file, with or without modification, are permitted. + +====== +libcec +====== + +This file is part of the libCEC(R) library. + +libCEC(R) is Copyright (C) 2011-2020 Pulse-Eight Limited. All rights reserved. +libCEC(R) is a original work, containing original code. + +libCEC(R) is a trademark of Pulse-Eight Limited. + +This program is dual-licensed; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Alternatively, you can license this library under a commercial license, +please contact Pulse-Eight Licensing for more information. + +For more information contact: +Pulse-Eight Licensing + http://www.pulse-eight.com/ + http://www.pulse-eight.net/ + + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + diff --git a/CHANGELOG.md b/CHANGELOG.md index dbbf7482..85daa716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed -- webui: Works now with https port 443 (#923 with #924) +- webui: Works now with HTTPS port 443 (#923 with #924) ### Removed ## [2.0.0-alpha.7](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.0-alpha.7) - 2020-07-23 @@ -34,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * discover, getProperties, identify, store/restore state and power-on/off available for Philips-Hue, Nanoleaf, Yeelight, partially for Rs232 / USB (Hid) * New device capabilities are accessible via JSON-API * New REST-API wrapper class in support of network devices, e.g. Philips Hue, Nanoleaf and WLED - * Flexible ssdp-Discovery incl. RegEx matching and filtering + * Flexible SSDP-Discovery incl. RegEx matching and filtering - Documentation (#875) * Process workflow for LED-Devices * Documentation of device classes & methods @@ -85,7 +85,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Make logs look a bit more cleaner - Decrease compile time (#886) - Fix some data synchronization error (#890) -- Fix Qt screenhot crash (#889) +- Fix Qt screenshot crash (#889) - Fix crash on startup if no X server available (#892) - Fix RPC restart of Hyperion (#894) diff --git a/CompileHowto.md b/CompileHowto.md index 21686322..6eb2f0c1 100644 --- a/CompileHowto.md +++ b/CompileHowto.md @@ -25,14 +25,22 @@ wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/ ``` wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386 ``` -**Raspberry Pi v1 & ZERO** +**Raspberry Pi v1 & ZERO (Raspbian Stretch)** ``` wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf ``` -**Raspberry Pi 2 & 3** +**Raspberry Pi 2 & 3 (Raspbian Stretch)** ``` wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf ``` +**Raspberry Pi v1 & ZERO (Raspbian Buster)** +``` +wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf-buster +``` +**Raspberry Pi 2 & 3 (Raspbian Buster** +``` +wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf-buster +``` # The usual way diff --git a/assets/webconfig/js/content_grabber.js b/assets/webconfig/js/content_grabber.js index e5352d11..ad94831b 100644 --- a/assets/webconfig/js/content_grabber.js +++ b/assets/webconfig/js/content_grabber.js @@ -270,7 +270,7 @@ $(document).ready( function() { }); $('#btn_submit_v4l2').off().on('click',function() { - var v4l2Options = conf_editor_v4l2.getValue() + var v4l2Options = conf_editor_v4l2.getValue(); if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto') v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices; diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index b5fd0da0..8ba84eb1 100644 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -198,7 +198,7 @@ function initLanguageSelection() var langText = 'Please Select'; //Test, if language is supported by hyperion - langIdx = availLang.indexOf(langLocale) + var langIdx = availLang.indexOf(langLocale); if ( langIdx > -1 ) { langText = availLangText[langIdx]; diff --git a/assets/webconfig/js/wizard.js b/assets/webconfig/js/wizard.js index f7a6f33a..09a5cd14 100644 --- a/assets/webconfig/js/wizard.js +++ b/assets/webconfig/js/wizard.js @@ -762,7 +762,7 @@ async function discover_hue_bridges(){ // TODO: error case unhandled // res can be: false (timeout) or res.error (not found) if(res && !res.error){ - const r = res.info + const r = res.info; // Process devices returned by discovery console.log(r); @@ -1462,7 +1462,7 @@ async function discover_yeelight_lights(){ // TODO: error case unhandled // res can be: false (timeout) or res.error (not found) if(res && !res.error){ - const r = res.info + const r = res.info; // Process devices returned by discovery for(const device of r.devices) @@ -1554,7 +1554,7 @@ function assign_yeelight_lights(){ if (! models.includes (lights[lightid].model) ) { - var enabled = 'disabled' + var enabled = 'disabled'; options = ''; } @@ -1611,7 +1611,7 @@ function identify_yeelight_device(hostname, port){ // TODO: error case unhandled // res can be: false (timeout) or res.error (not found) if(res && !res.error){ - const r = res.info + //const r = res.info; } } diff --git a/bin/create_all_releases.sh b/bin/create_all_releases.sh index 0f489841..cf3991e1 100755 --- a/bin/create_all_releases.sh +++ b/bin/create_all_releases.sh @@ -10,9 +10,9 @@ make_release() PLATFORM=$2 shift 2 - rm -r build-${RELEASE} + rm -rf build-${RELEASE} mkdir -p build-${RELEASE} - rm -r deploy/${RELEASE} + rm -rf deploy/${RELEASE} mkdir -p deploy/${RELEASE} cd build-${RELEASE} diff --git a/bin/install_hyperion.sh b/bin/install_hyperion.sh deleted file mode 100755 index 5903e416..00000000 --- a/bin/install_hyperion.sh +++ /dev/null @@ -1,348 +0,0 @@ -#!/bin/sh -# Script for downloading and installing the latest Hyperion release - -# Make sure /sbin is on the path (for service to find sub scripts) -PATH="/sbin:$PATH" - -#Check which arguments are used -if [ "$1" = "HyperConInstall" ] || [ "$2" = "HyperConInstall" ]; then - HCInstall=1 -else HCInstall=0 -fi -if [ "$1" = "BETA" ] || [ "$2" = "BETA" ]; then - BETA=1 -else BETA=0 -fi - -#Check, if script is running as root -if [ $(id -u) != 0 ]; then - echo '---> Critical Error: Please run the script as root (sudo sh ./install_hyperion.sh) -> abort' - exit 1 -fi - -#Set welcome message -if [ $BETA -eq 1 ]; then - WMESSAGE="echo This script will update Hyperion to the latest BETA" -else WMESSAGE="echo This script will install/update Hyperion Ambient Light" -fi - -#Welcome message -echo '*******************************************************************************' -$WMESSAGE -echo 'Created by brindosch - hyperion-project.org - the official Hyperion source.' -echo '*******************************************************************************' - -# Find out if we are on OpenElec (Rasplex) / OSMC / Raspbian -OS_OPENELEC=`grep -m1 -c 'OpenELEC\|RasPlex\|LibreELEC' /etc/issue` -OS_LIBREELEC=`grep -m1 -c LibreELEC /etc/issue` -OS_RASPLEX=`grep -m1 -c RasPlex /etc/issue` -OS_OSMC=`grep -m1 -c OSMC /etc/issue` -OS_RASPBIAN=`grep -m1 -c 'Raspbian\|RetroPie' /etc/issue` - -# Find out which device this script runs on -CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710' /proc/cpuinfo` -CPU_IMX6=`grep -m1 -c i.MX6 /proc/cpuinfo` -CPU_WETEK=`grep -m1 -c Amlogic /proc/cpuinfo` -CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l` -# Check that we have a known configuration -if [ $CPU_RPI -ne 1 ] && [ $CPU_IMX6 -ne 1 ] && [ $CPU_WETEK -ne 1 ] && [ $CPU_X32X64 -ne 1 ]; then - echo '---> Critical Error: CPU information does not match any known releases -> abort' - exit 1 -fi - -#Check which RPi we are one (in case) -RPI_1=`grep -m1 -c BCM2708 /proc/cpuinfo` -RPI_2=`grep -m1 -c BCM2709 /proc/cpuinfo` -RPI_3=`grep -m1 -c BCM2710 /proc/cpuinfo` - -#Check, if year equals 1970 -DATE=$(date +"%Y") -if [ "$DATE" -le "2015" ]; then - echo "---> Critical Error: Please update your systemtime (Year of your system: ${DATE}) -> abort" - exit 1 -fi - -# check which init script we should use -USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm` -USE_INITCTL=`which /sbin/initctl | wc -l` -USE_SERVICE=`which /usr/sbin/service | wc -l` - -# Make sure that the boblight daemon is no longer running -BOBLIGHT_PROCNR=$(pidof boblightd | wc -l) -if [ $BOBLIGHT_PROCNR -eq 1 ]; then - echo '---> Critical Error: Found running instance of boblight. Please stop boblight via Kodi menu before installing hyperion -> abort' - exit 1 -fi - -#set service script path -SERVICEL="/usr/share/hyperion/services" - -# Stop hyperion daemon if it is running and set service path -echo '---> Stop Hyperion, if necessary' -if [ $OS_OPENELEC -eq 1 ]; then - killall hyperiond 2>/dev/null -elif [ $USE_INITCTL -eq 1 ]; then - /sbin/initctl stop hyperion 2>/dev/null - SERVICEP="/etc/init" -elif [ $USE_SYSTEMD -eq 1 ]; then - service hyperion stop 2>/dev/null - SERVICEP="/etc/systemd/system" - #many people installed with the official script and this just uses service, if both registered -> dead - /usr/sbin/service hyperion stop 2>/dev/null - #Bad workaround for Jessie (systemd) users that used the old official script for install - update-rc.d -f hyperion remove 2>/dev/null - rm /etc/init.d/hyperion 2>/dev/null -elif [ $USE_SERVICE -eq 1 ]; then - /usr/sbin/service hyperion stop 2>/dev/null - SERVICEP="/etc/init.d" -fi - -#Install dependencies for Hyperion and setup preperation -if [ $OS_OPENELEC -ne 1 ]; then - echo '---> Install/Update Hyperion dependencies (This may take a while)' - apt-get -qq update && apt-get -qq --yes install libqtcore4 libqtgui4 libqt4-network libusb-1.0-0 ca-certificates - mkdir /etc/hyperion 2>/dev/null -fi - -#Check, if dtparam=spi=on is in place (not for OPENELEC) -if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then - SPIOK=`grep '^\dtparam=spi=on' /boot/config.txt | wc -l` - if [ $SPIOK -ne 1 ]; then - echo '---> Raspberry Pi found, but SPI is not set, we write "dtparam=spi=on" to /boot/config.txt' - sed -i '$a dtparam=spi=on' /boot/config.txt - if [ $HCInstall -ne 1 ]; then - REBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtparam=spi=on to /boot/config.txt" - fi - fi -fi - -#Check, if dtparam=spi=on is in place (just for OPENELEC/LibreELEC -if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then - SPIOK=`grep '^\dtparam=spi=on' /flash/config.txt | wc -l` - if [ $SPIOK -ne 1 ]; then - mount -o remount,rw /flash - echo '---> RPi with OpenELEC/LibreELEC found, but SPI is not set, we write "dtparam=spi=on" to /flash/config.txt' - sed -i '$a dtparam=spi=on' /flash/config.txt - mount -o remount,ro /flash - if [ $HCInstall -ne 1 ]; then - REBOOTMESSAGE="echo Please reboot your OpenELEC/LibreELEC, we inserted dtparam=spi=on to /flash/config.txt" - fi - fi -fi - -# compatibility layer to move old configs to new config dir -if [ -f "/opt/hyperion/bin/hyperiond" ]; then - echo '---> Old installation found, move configs to /etc/hyperion/ and move hyperion to /usr/share/hyperion/' - mv /opt/hyperion/config/*.json /etc/hyperion 2>/dev/null - - sed -i "s|/opt/hyperion/effects||g; s|/usr/share/hyperion/effects||g" /etc/hyperion/*.json - CPO1=/etc/hyperion.config.json - CPO2=/opt/hyperion/config/hyperion.config.json - CPN=/etc/hyperion/hyperion.config.json - BPO=/opt/hyperion/bin/hyperiond - BPN=/usr/bin/hyperiond - if [ $USE_INITCTL -eq 1 ]; then - sed -i "s|$BPO|$BPN|g" $SERVICEP/hyperion.conf - sed -i "s|$CPO1|$CPN|g" $SERVICEP/hyperion.conf - sed -i "s|$CPO2|$CPN|g" $SERVICEP/hyperion.conf - initctl reload-configuration - elif [ $OS_OPENELEC -eq 1 ]; then - sleep 0 - elif [ $USE_SYSTEMD -eq 1 ]; then - sed -i "s|$BPO|$BPN|g" $SERVICEP/hyperion.service - sed -i "s|$CPO1|$CPN|g" $SERVICEP/hyperion.service - sed -i "s|$CPO2|$CPN|g" $SERVICEP/hyperion.service - systemctl -q daemon-reload - elif [ $USE_SERVICE -eq 1 ]; then - sed -i "s|$BPO|$BPN|g" $SERVICEP/hyperion - sed -i "s|$CPO1|$CPN|g" $SERVICEP/hyperion - sed -i "s|$CPO2|$CPN|g" $SERVICEP/hyperion - update-rc.d hyperion defaults 98 02 - fi -fi - -# Select the appropriate download path -if [ $BETA -eq 1 ]; then - HYPERION_ADDRESS=https://sourceforge.net/projects/hyperion-project/files/beta -else HYPERION_ADDRESS=https://sourceforge.net/projects/hyperion-project/files/release -fi -# Select the appropriate release -if [ $CPU_RPI -eq 1 ] && [ $OS_RASPLEX -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_rasplex.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_LIBREELEC -eq 1 ] && [ $RPI_1 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_le.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_LIBREELEC -eq 1 ] && [ $RPI_2 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2_le.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_LIBREELEC -eq 1 ] && [ $RPI_3 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3_le.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ] && [ $RPI_1 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_oe.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ] && [ $RPI_2 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2_oe.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ] && [ $RPI_3 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3_oe.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_OSMC -eq 1 ] && [ $RPI_1 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_osmc.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_OSMC -eq 1 ] && [ $RPI_2 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2_osmc.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $OS_OSMC -eq 1 ] && [ $RPI_3 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3_osmc.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $RPI_1 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $RPI_2 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2.tar.gz -elif [ $CPU_RPI -eq 1 ] && [ $RPI_3 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3.tar.gz -elif [ $CPU_IMX6 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_imx6.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-imx6.tar.gz -elif [ $CPU_WETEK -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_wetek.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz -elif [ $CPU_X32X64 -eq 1 ]; then - HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_x86x64.tar.gz - OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-x86x64.tar.gz -else - echo "---> Critical Error: Target platform unknown -> abort" - exit 1 -fi - -# Get and extract the Hyperion binaries -echo '---> Downloading the appropriate Hyperion release' -if [ $OS_OPENELEC -eq 1 ]; then - # OpenELEC has a readonly file system. Use alternative location - echo '---> Downloading Hyperion OpenELEC/LibreELEC release' - curl -# -L --get $HYPERION_RELEASE | tar -C /storage -xz - echo '---> Downloading Hyperion OpenELEC/LibreELEC dependencies' - curl -# -L --get $OE_DEPENDECIES | tar -C /storage/hyperion/bin -xz - #set the executen bit (failsave) - chmod +x -R /storage/hyperion/bin -else - BINSP=/usr/share/hyperion/bin - BINTP=/usr/bin - wget -nv $HYPERION_RELEASE -O - | tar -C /usr/share -xz - #set the executen bit (failsave) and move config to /etc/hyperion - chmod +x -R $BINSP - # create links to the binaries - ln -fs $BINSP/hyperiond $BINTP/hyperiond - ln -fs $BINSP/hyperion-remote $BINTP/hyperion-remote - ln -fs $BINSP/hyperion-v4l2 $BINTP/hyperion-v4l2 - ln -fs $BINSP/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null - ln -fs $BINSP/hyperion-x11 $BINTP/hyperion-x11 2>/dev/null - ln -fs $BINSP/hyperion-xcb $BINTP/hyperion-xcb 2>/dev/null - ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null -fi - -# Copy the service control configuration to /etc/init (-n to respect user modified scripts) -if [ $USE_INITCTL -eq 1 ]; then - echo '---> Installing initctl script' - cp -n $SERVICEL/hyperion.initctl.sh $SERVICEP/hyperion.conf 2>/dev/null - initctl reload-configuration -elif [ $OS_OPENELEC -eq 1 ]; then - #modify all old installs with a logfile output - sed -i 's|/dev/null|/storage/logfiles/hyperion.log|g' /storage/.config/autostart.sh 2>/dev/null - # only add to start script if hyperion is not present yet - mkdir /storage/logfiles 2>/dev/null - touch /storage/.config/autostart.sh 2>/dev/null - if [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperiond | wc -l` -eq 0 ]; then - echo '---> Adding Hyperion to OpenELEC/LibreELEC autostart.sh' - echo "/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /storage/logfiles/hyperion.log 2>&1 &" >> /storage/.config/autostart.sh - chmod +x /storage/.config/autostart.sh - fi - # only add hyperion-x11 to startup, if not found and x32x64 detected - if [ $CPU_X32X64 -eq 1 ] && [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperion-x11 | wc -l` -eq 0 ]; then - echo '---> Adding Hyperion-x11 to OpenELEC/LibreELEC autostart.sh' - echo "DISPLAY=:0.0 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-x11 /storage/logfiles/hyperion.log 2>&1 &" >> /storage/.config/autostart.sh - fi - # only add hyperion-xcb to startup, if not found and x32x64 detected - if [ $CPU_X32X64 -eq 1 ] && [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperion-xcb | wc -l` -eq 0 ]; then - echo '---> Adding Hyperion-xcb to OpenELEC/LibreELEC autostart.sh' - echo "DISPLAY=:0.0 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-xcb /storage/logfiles/hyperion.log 2>&1 &" >> /storage/.config/autostart.sh - fi -elif [ $USE_SYSTEMD -eq 1 ]; then - echo '---> Installing systemd script' - #place startup script for systemd and activate - cp -n $SERVICEL/hyperion.systemd.sh $SERVICEP/hyperion.service - systemctl -q enable hyperion.service - if [ $OS_OSMC -eq 1 ]; then - echo '---> Modify systemd script for OSMC usage' - # Wait until kodi is sarted - sed -i '/After = mediacenter.service/d' $SERVICEP/hyperion.service - sed -i '/Unit/a After = mediacenter.service' $SERVICEP/hyperion.service - systemctl -q daemon-reload - fi -elif [ $USE_SERVICE -eq 1 ]; then - echo '---> Installing startup script in init.d' - # place startup script in init.d and add it to upstart (-s to respect user modified scripts) - rm $SERVICEP/hyperion - cp $SERVICEL/hyperion.init.sh $SERVICEP/hyperion 2>/dev/null ; chmod +x $SERVICEP/hyperion - update-rc.d hyperion defaults 98 02 -fi - -#remove unwanted files/dirs -if [ $OS_OPENELEC -eq 1 ]; then - rm -r /storage/hyperion/services -else - rm -r /usr/share/hyperion/services - rm -r /opt/hyperion 2>/dev/null -fi - -#chown the /config/ dir and all configs inside for hypercon config upload for non-root logins -if [ $OS_OSMC -eq 1 ]; then - chown -R osmc:osmc /etc/hyperion -elif [ $OS_RASPBIAN -eq 1 ]; then - chown -R pi:pi /etc/hyperion -fi - -# Start the hyperion daemon -echo '---> Starting Hyperion' -if [ $OS_OPENELEC -eq 1 ]; then - /storage/.config/autostart.sh > /dev/null 2>&1 & -elif [ $USE_INITCTL -eq 1 ]; then - /sbin/initctl start hyperion -elif [ $USE_SERVICE -eq 1 ]; then - /usr/sbin/service hyperion start -elif [ $USE_SYSTEMD -eq 1 ]; then - service hyperion start -fi - -echo '*******************************************************************************' -echo 'Hyperion Installation/Update finished!' -echo 'Please download the latest HyperCon version to benefit from new features!' -echo 'To create a config, follow the HyperCon Guide at our Wiki (EN/DE)!' -echo 'Wiki: wiki.hyperion-project.org Webpage: www.hyperion-project.org' -$REBOOTMESSAGE -echo '*******************************************************************************' -## Force reboot and prevent prompt if spi is added during a HyperCon Install -if [ $HCInstall -eq 1 ] && [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ]; then - echo "Rebooting now, we added dtparam=spi=on to config.txt" - reboot - exit 0 -fi -#Prompt for reboot, if spi added to config.txt -if [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ]; then - while true - do - echo -n "---> Do you want to reboot your Raspberry Pi now? (y or n) :" - read CONFIRM - case $CONFIRM in - y|Y|YES|yes|Yes) break ;; - n|N|no|NO|No) - echo "---> No reboot - you entered \"$CONFIRM\"" - exit - ;; - *) echo "-> Please enter only y or n" - esac - done - echo "---> You entered \"$CONFIRM\". Rebooting now..." - reboot -fi - -exit 0 diff --git a/bin/remove_hyperion.sh b/bin/remove_hyperion.sh deleted file mode 100644 index 31e928b9..00000000 --- a/bin/remove_hyperion.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/sh -# Script to remove Hyperion and all services - -# Make sure /sbin is on the path (for service to find sub scripts) -PATH="/sbin:$PATH" - -#Check if HyperCon is logged in as root -if [ $(id -u) != 0 ] && [ "$1" = "HyperConRemove" ]; then - echo '---> Critical Error: Please connect as user "root" through HyperCon' - echo '---> We need admin privileges to remove your Hyperion! -> abort' - exit 1 -fi - -#Check, if script is running as root -if [ $(id -u) != 0 ]; then - echo '---> Critical Error: Please run the script as root (sudo sh ./remove_hyperion.sh)' - exit 1 -fi - -#Welcome message -echo '*******************************************************************************' -echo 'This script will remove Hyperion and its services' -echo '-----> Please BACKUP your hyperion.config.json if necessary <-----' -echo 'Created by brindosch - hyperion-project.org - the official Hyperion source.' -echo '*******************************************************************************' - -#Skip the prompt if HyperCon Remove -if [ "$1" = "" ]; then - #Prompt for confirmation to proceed - while true - do - echo -n "---> Do you really want to remove Hyperion and its services? (y or n) :" - read CONFIRM - case $CONFIRM in - y|Y|YES|yes|Yes) break ;; - n|N|no|NO|No) - echo "---> Aborting - you entered \"$CONFIRM\"" - exit - ;; - *) echo "-> Please enter only y or n" - esac - done - echo "---> You entered \"$CONFIRM\". Remove Hyperion!" -fi - -# Find out if we are on OpenElec or RasPlex -OS_OPENELEC=`grep -m1 -c 'OpenELEC\|RasPlex\|LibreELEC' /etc/issue` - -# check which init script we should use -USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm` -USE_INITCTL=`which /sbin/initctl | wc -l` -USE_SERVICE=`which /usr/sbin/service | wc -l` - -# set count for forwarder -SERVICEC=1 - -# Stop hyperion daemon if it is running -echo '---> Stop Hyperion, if necessary' -if [ $OS_OPENELEC -eq 1 ]; then - killall hyperiond 2>/dev/null -elif [ $USE_INITCTL -eq 1 ]; then - /sbin/initctl stop hyperion 2>/dev/null -elif [ $USE_SERVICE -eq 1 ]; then - /usr/sbin/service hyperion stop 2>/dev/null -elif [ $USE_SYSTEMD -eq 1 ]; then - service hyperion stop 2>/dev/null -fi - -#reset count -SERVICEC=`which /usr/sbin/service | wc -l` - -#Disabling and delete service files -if [ $USE_INITCTL -eq 1 ]; then - echo '---> Delete and disable Hyperion initctl script' - rm -v /etc/init/hyperion* 2>/dev/null - initctl reload-configuration -elif [ $OS_OPENELEC -eq 1 ]; then - # Remove Hyperion from OpenELEC autostart.sh - echo "---> Remove Hyperion from OpenELEC autostart.sh" - sed -i "/hyperiond/d" /storage/.config/autostart.sh 2>/dev/null - sed -i "/hyperion-x11/d" /storage/.config/autostart.sh 2>/dev/null - sed -i "/hyperion-xcb/d" /storage/.config/autostart.sh 2>/dev/null -elif [ $USE_SYSTEMD -eq 1 ]; then - # Delete and disable Hyperion systemd script - echo '---> Delete and disable Hyperion systemd script' - systemctl disable hyperion.service - rm -v /etc/systemd/system/hyperion* 2>/dev/null -elif [ $USE_SERVICE -eq 1 ]; then - # Delete and disable Hyperion init.d script - echo '---> Delete and disable Hyperion init.d script' - update-rc.d -f hyperion remove - rm /etc/init.d/hyperion* 2>/dev/null -fi - -# Delete Hyperion binaries -if [ $OS_OPENELEC -eq 1 ]; then - # Remove OpenELEC Hyperion binaries and configs - echo '---> Remove the OpenELEC Hyperion binaries and hyperion.config.json' - rm -rv /storage/hyperion 2>/dev/null - rm -v /storage/.config/hyperion.config.json 2>/dev/null -else - #Remove binaries on all distributions/systems (not OpenELEC) - echo "---> Remove links to the binaries" - rm -v /usr/bin/hyperiond 2>/dev/null - rm -v /usr/bin/hyperion-remote 2>/dev/null - rm -v /usr/bin/hyperion-v4l2 2>/dev/null - rm -v /usr/bin/hyperion-dispmanx 2>/dev/null - rm -v /usr/bin/hyperion-x11 2>/dev/null - rm -v /usr/bin/hyperion-xcb 2>/dev/null - rm -v /usr/bin/hyperion-aml 2>/dev/null - rm -v /etc/hyperion.config.json 2>/dev/null - echo "---> Remove binaries" - rm -rv /opt/hyperion 2>/dev/null - rm -rv /etc/hyperion 2>/dev/null - rm -rv /usr/share/hyperion 2>/dev/null -fi -echo '*******************************************************************************' -echo 'Hyperion successful removed!' -echo '*******************************************************************************' -exit 0 - diff --git a/bin/scripts/docker-compile.sh b/bin/scripts/docker-compile.sh index 06904548..1731a0b4 100644 --- a/bin/scripts/docker-compile.sh +++ b/bin/scripts/docker-compile.sh @@ -43,7 +43,7 @@ echo "######################################################## ## A script to compile Hyperion inside a docker container ## Requires installed Docker: https://www.docker.com/ ## Without arguments it will compile Hyperion for Debain Stretch (x64) or higher. -## Supports Raspberry Pi (armv6hf, armv7hf) cross compilation (Debian Stretch) and native compilation (Raspbian Stretch/Buster) +## Supports Raspberry Pi (armv6hf, armv7hf) cross compilation (Debian Stretch/Buster) and native compilation (Raspbian Stretch/Buster) ## ## Homepage: https://www.hyperion-project.org ## Forum: https://forum.hyperion-project.org @@ -51,7 +51,7 @@ echo "######################################################## # These are possible arguments to modify the script behaviour with their default values # # docker-compile.sh -h # Show this help message -# docker-compile.sh -t amd64 # The docker tag, one of amd64 | i386 | armv6hf | armv7hf | rpi-raspbian-stretch | rpi-raspbian-buster +# docker-compile.sh -t amd64 # The docker tag, one of amd64 | i386 | armv6hf | armv7hf | armv6hf-buster | armv7hf-buster | rpi-raspbian-stretch | rpi-raspbian-buster # docker-compile.sh -b Release # cmake Release or Debug build # docker-compile.sh -p true # If true build packages with CPack # More informations to docker tags at: https://hub.docker.com/r/hyperionproject/hyperion-ci/" @@ -73,7 +73,7 @@ if [ $BUILD_PACKAGES == "true" ]; then PACKAGES="package" fi -echo "---> Initilize with BUILD_TARGET=${BUILD_TARGET}, BUILD_TYPE=${BUILD_TYPE}, BUILD_PACKAGES=${BUILD_PACKAGES}" +echo "---> Initialize with BUILD_TARGET=${BUILD_TARGET}, BUILD_TYPE=${BUILD_TYPE}, BUILD_PACKAGES=${BUILD_PACKAGES}" # cleanup deploy folder, create folder for ownership sudo rm -fr $SCRIPT_PATH/deploy >/dev/null 2>&1 @@ -91,6 +91,7 @@ git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo # Target docker image # execute inside container all commands on bash echo "---> Startup docker..." +$DOCKER pull hyperionproject/hyperion-ci:$BUILD_TARGET $DOCKER run --rm \ -v "${SCRIPT_PATH}/deploy:/deploy" \ -v "${SCRIPT_PATH}/hyperion:/source:ro" \ diff --git a/docs/docs/en/addons/API.md b/docs/docs/en/addons/API.md index 13b9c44c..9a9a979b 100644 --- a/docs/docs/en/addons/API.md +++ b/docs/docs/en/addons/API.md @@ -4,7 +4,7 @@ Overview of the API. Get access to these functions by importing the `hapi` modul | Function | Returns | Comment | | ------------------------- | ------- | --------------------------------------------------------------------------------------------------- | | hapi.abort() | bool | Check if we should abort the script, True on abort request else false | -| hapi.log() | - | Print a log message to the Hyprion log. See [hapi.log()](#hapi-log) | +| hapi.log() | - | Print a log message to the Hyperion log. See [hapi.log()](#hapi-log) | | hapi.registerCallback() | - | Register a function with a callback function. See [hapi.registerCallback()](#hapi-registercallback) | | hapi.unregisterCallback() | - | Unregister a function from callback. See [hapi.unregisterCallback()](#hapi-unregistercallback) | | hapi.getComponentState() | int | Get current state of a component. See [hapi.getComponentState()](#hapi-getcomponentstate ) | @@ -70,7 +70,7 @@ hapi.registerCallback(ON_VISIBLE_PRIORITY_CHANGED, onVsibilePriorityChanged) ``` ### hapi.unregisterCallback() -You can als unregister a callbackType again. You can register and unregister as often you need it. Usually you won't need it, but for completion here it is! After unregister the connected function does no longer react upon callbacks +You can also unregister a callbackType again. You can register and unregister as often you need it. Usually you won't need it, but for completion here it is! After unregister the connected function does no longer react upon callbacks `hapi.unregisterCallback(callbackType)` | Argument | Type | Comment | | ------------ | ---- | ------------------------------------------------------------------------------------ | @@ -95,7 +95,7 @@ Set a Hyperion component to a new state. This method writes a debug message on e | @return | bool | True if the requested component was found else false | ### hapi.getSettings() -Get the current user settings data for your addon. The returned data contains all settings that has been transformed from json to python data types. See the table below how they are transformed. +Get the current user settings data for your addon. The returned data contains all settings that has been transformed from JSON to python data types. See the table below how they are transformed. `hapi.getSettings()` | Json | Python | | :-----: | :----: | @@ -107,7 +107,7 @@ Get the current user settings data for your addon. The returned data contains al | object | dict | **Basics** \ -The root data type is usually of type object which will be transformed to a python dict, so we use the dict syntax to get the value. The fallback paramter should be defined wisely, if the value is not found it will be used instead. +The root data type is usually of type object which will be transformed to a python dict, so we use the dict syntax to get the value. The fallback parameter should be defined wisely, if the value is not found it will be used instead. ``` python import hapi # Get a bool value of a dict diff --git a/docs/docs/en/addons/OurFirstAddon.md b/docs/docs/en/addons/OurFirstAddon.md index ca95d555..646d149b 100644 --- a/docs/docs/en/addons/OurFirstAddon.md +++ b/docs/docs/en/addons/OurFirstAddon.md @@ -6,11 +6,11 @@ You want to write an addon? You have no clue about everything? Perfect, the next ## Addon types Currently there are 2 types of Addons. * Service - * Modul + * Module A service addon runs usually the whole time (if enabled), it starts and stops with the execution of Hyperion. Additional it has settings that can be configured from the user to fit their needs. This can be an IP address to another service, a time to trigger, or anything else that you will discover from the Addon API -A modul provides utility methods which can be imported from a service addon to be used. Examples are Python packages from the PyPi repository like httplib2, which makes the developer life easier when working with http requests. Instead implementing everything on your own you can rely on the work of others with well tested modules from the Python community. You can also create modules on your own if you think the code can be reused in other service addons. +A module provides utility methods which can be imported from a service addon to be used. Examples are Python packages from the PyPi repository like httplib2, which makes the developer life easier when working with HTTP requests. Instead implementing everything on your own you can rely on the work of others with well tested modules from the Python community. You can also create modules on your own if you think the code can be reused in other service addons. ## Development setup All you need is: @@ -23,13 +23,13 @@ The follow files are part of an addon. | ------------------- | -------------------------------------- | --------------------------------------------------------------------------- | | service.py | [Python](https://www.python.org/) | Required for `service` addons. Entry point, this is where your code goes to | | addon.json | [JSON](http://www.json.org/) | The meta data file required for all addons | -| settingsSchema.json | [JSON Schema](http://json-schema.org/) | Required for `service` addons. Options ui. [Read more](/en/api/ui.md) | +| settingsSchema.json | [JSON Schema](http://json-schema.org/) | Required for `service` addons. Options UI. [Read more](/en/api/ui.md) | | lib | Folder | Required for `module` addons. Entry point for modules | ### Create a new service Addon To create a service addon you need to follow a simple structure. - - Naviagte to ~/.hyperion/addons (folder in your home directory) - - Think about a short "id", this id needs to be unqiue and should just contain letters (english), lowercase no whitespace Example: `kodicon` `plexcon` `timer` `cec` + - Navigate to ~/.hyperion/addons (folder in your home directory) + - Think about a short "id", this id needs to be unique and should just contain letters (English), lowercase no whitespace Example: `kodicon` `plexcon` `timer` `cec` - Create a folder with your id and prepend `service.`. Example: `service.kodicon` `service.timer` `service.cec` - Inside this folder create a file called `service.py`, this is where your addon code goes to - Create a file called `settingsSchema.json`, this will represent our options @@ -37,17 +37,17 @@ To create a service addon you need to follow a simple structure. - That's it! ::: tip -A prepared service playground addon can be downloaded from the repository. This shows the basic usage of the API but also how option ui works +A prepared service playground addon can be downloaded from the repository. This shows the basic usage of the API but also how option UI works ::: ### Metadata -The metadata file called addon.json is a description of your addon to declare name, version, dependencies, support url, sourcecode url and more. This file is parsed by Hyperion to provide users required informations and download updates accordingly. +The metadata file called addon.json is a description of your addon to declare name, version, dependencies, support URL, sourcecode URL and more. This file is parsed by Hyperion to provide users required informations and download updates accordingly. | Property | Type | Comment | | ------------ | ------ | ---------------------------------------------------------------------- | -| name | String | Userfriendly name of your addon | +| name | String | User friendly name of your addon | | description | String | What does this addon as a brief overview | -| id | String | The unqiue id | +| id | String | The unique id | | version | String | The current version of your addon. [Semver 2.0.0](https://semver.org/) | | category | Array | Add the addon to a category. Available `utility` | | dependencies | Object | You can depend on modules / a specific minimum Hyperion version. | @@ -76,12 +76,12 @@ Here a version for copy and paste ### Addon categories Addons can be assigned to a category for better sorting. Select the best matching - * **utility** A utility is usually a smaller addon, which does very basic tasks. It doesn't connect to another software. For example the Wake On Lan addon is a utility. + * **utility** A utility is usually a smaller addon, which does very basic tasks. It doesn't connect to another software. For example the Wake On LAN addon is a utility. * **integration** A integration addon interfaces with another software to listen for specific API events which triggers now actions on the Hyperion side or vice versa. Example is the Kodi addon * You can suggest new categories! ### Development -Enough preperation stuff, let's start! \ +Enough preparation stuff, let's start! \ It's highly recommended to work/read once through a Python tutorial which explains you the principals of Python if you are new to Python. * New to Python? No problem, here is a interactive tutorial where you can read, write and execute your first python scripts inside your browser [learnpython](https://www.learnpython.org/), available in 7 languages! - * Good beginner guide: [Python course EN](https://www.python-course.eu/python3_interactive.php). [Python Kurs DE](https://www.python-kurs.eu/python3_interaktiv.php). It's not necessary (nor possible) to understand everything, but the first pages are very helpfull as a start! \ No newline at end of file + * Good beginner guide: [Python course EN](https://www.python-course.eu/python3_interactive.php). [Python Kurs DE](https://www.python-kurs.eu/python3_interaktiv.php). It's not necessary (nor possible) to understand everything, but the first pages are very helpful as a start! diff --git a/docs/docs/en/api/Detect.md b/docs/docs/en/api/Detect.md index eb5904de..510ee6ee 100644 --- a/docs/docs/en/api/Detect.md +++ b/docs/docs/en/api/Detect.md @@ -35,7 +35,7 @@ Also known as [Apple Bonjour](https://en.wikipedia.org/wiki/Bonjour_(software)) * _hyperiond-json._tcp -> Hyperion JSON Server (TcpSocket) * _hyperiond-flatbuf._tcp -> Hyperion Flatbuffers server (Google Flatbuffers) -So you get the ip address, hostname and port of the system. Also the Hyperion instance name is part of it (before the @ for the full name). As this works realtime you have always an up2date list of available Hyperion servers right to your hand. So check your development environment if you have access to it. +So you get the IP address, hostname and port of the system. Also the Hyperion instance name is part of it (before the @ for the full name). As this works realtime you have always an up2date list of available Hyperion servers right to your hand. So check your development environment if you have access to it. ### TXT RECORD Each published entry contains at least the following informations at the txt field diff --git a/docs/docs/en/api/Guidelines.md b/docs/docs/en/api/Guidelines.md index bb85096c..497fe569 100644 --- a/docs/docs/en/api/Guidelines.md +++ b/docs/docs/en/api/Guidelines.md @@ -4,7 +4,7 @@ Improve the experience with Hyperion by following a rule set [[toc]] ## Priority Guidelines -The possiblities of priorities mixing and using is endless. But where are a lot of possibilities you require also some guidelines to reduce confusion on user and developer side and to get the best matching experience possible. +The possibilities of priorities mixing and using is endless. But where are a lot of possibilities you require also some guidelines to reduce confusion on user and developer side and to get the best matching experience possible. The user expects, that an Effect or Color should be higher in priority than capturing as you usually run them from remotes and not all time. While we have different capture/input methods, we follow also a specific priority chain to make sure that it fit's the most use cases out of the box. diff --git a/docs/docs/en/api/Ui.md b/docs/docs/en/api/Ui.md index 07bd05d0..bb345c39 100644 --- a/docs/docs/en/api/Ui.md +++ b/docs/docs/en/api/Ui.md @@ -2,7 +2,7 @@ We use a JSON schema to create a user-friendly GUI and validate the input to prevent wrong or unwanted data that will be consumed by your python file. Each python file requires a GUI schema. ::: tip -If you have never written JSON syntax, we reommend a short introduction. [Here](https://www.digitalocean.com/community/tutorials/an-introduction-to-json) and/or [Here (techinal)](http://www.json.org/) +If you have never written JSON syntax, we recommend a short introduction. [Here](https://www.digitalocean.com/community/tutorials/an-introduction-to-json) and/or [Here (technical)](http://www.json.org/) ::: [[toc]] @@ -49,7 +49,7 @@ The option `swirl_count` will be of type integer with title `edt_eff_swirl_count **Optional** * Add `"minimum" : 5` to force a minimum value in case it shouldn't be lower * Add `"maximum" : 9` to force a maximum value in case it shouldn't be higher - * Add `"step" : 2,` to define a alternate stepping of value. If not given, defaults to `1`. This doesn't prevent values which are "outside" of the step, it's more a helper if you use up/down keys and hugher or smaller steps are wanted. + * Add `"step" : 2,` to define a alternate stepping of value. If not given, defaults to `1`. This doesn't prevent values which are "outside" of the step, it's more a helper if you use up/down keys and higher or smaller steps are wanted. ### Number @@ -66,7 +66,7 @@ The option `swirl_spread` will be of type number (float) with title `edt_eff_swi **Optional** * Add `"minimum" : 5.0` to force a minimum value in case it shouldn't be lower * Add `"maximum" : 9.6` to force a maximum value in case it shouldn't be higher - * Add `"step" : 0.1,` to define a alternate stepping of value. If not given, defaults to `1.0`. This doesn't prevent values which are "outside" of the step, it's more a helper if you use up/down keys and hugher or smaller steps are wanted. + * Add `"step" : 0.1,` to define a alternate stepping of value. If not given, defaults to `1.0`. This doesn't prevent values which are "outside" of the step, it's more a helper if you use up/down keys and higher or smaller steps are wanted. ### Select Create a select element, where you can select one of the `enum` items. Default is required! @@ -149,7 +149,7 @@ Creates a RGBA colorpicker. Think twice brefore you provide a RGBA picker, the u The option `color` will be of type array (shown as RGBA colorpicker) with the title `edt_eff_color` ([Titles will be translated](#translation)). This colorpicker will be set to red with 50% alpha initial. Required to add a default color. ## More beautification -To organize your ui better and make it prettier we provide a set of additional keywords. +To organize your UI better and make it prettier we provide a set of additional keywords. ### Dependencies Hide/Show a specific option based on the value of another option @@ -204,7 +204,7 @@ You want a specific unit at the end of a field like "s", "ms" or "percent"? Just ``` This will add a "s" for seconds to the input field. Please note it will be also translated, so check the translation file if your unit is already available. Add a new one if required. -### Smooting control (only for effects) +### Smoothing control (only for effects) Since v2 effects are no longer smoothed, it is possible to enable and manipulate smoothing if required. Add the following to the schema. ``` json "smoothing-custom-settings":{ diff --git a/docs/docs/en/effects/API.md b/docs/docs/en/effects/API.md index e660dbe1..30e71a44 100644 --- a/docs/docs/en/effects/API.md +++ b/docs/docs/en/effects/API.md @@ -11,7 +11,7 @@ All available functions for usage. | hyperion.imageCRotate() | - | Rotates the coordinate system at the center (0,0) by the given angle. See [hyperion.imageCRotate()](#hyperion-imagecrotate) | | hyperion.imageCOffset() | - | Add a offset to the coordinate system. See [hyperion.imageCOffset()](#hyperion-imagecoffset) | | hyperion.imageCShear() | - | Shear the coordinate system. See [hyperion.imageCShear()](#hyperion-imagecshear) | -| hyperion.imageResetT() | - | Resets all coodination system modifications done with hyperion.imageCRotate(), hyperion.imageCOffset(), hyperion.imageCShear() | +| hyperion.imageResetT() | - | Resets all coordination system modifications done with hyperion.imageCRotate(), hyperion.imageCOffset(), hyperion.imageCShear() | | hyperion.imageMinSize() | - | See [hyperion.imageMinSize()](#hyperion-imageminsize)| | hyperion.abort() | Boolean | If true, hyperion requests an effect abort, used in a while loop to repeat effect calculations and writing | | hyperion.imageConicalGradient() | - | See [hyperion.imageConicalGradient()](#hyperion-imageconicalgradient) | @@ -25,7 +25,7 @@ All available functions for usage. | hyperion.imageSolidFill() | - | See [hyperion.imageSolidFill()](#hyperion-imagesolidfill) | | hyperion.imageShow() | - | Hyperion shows the image you created with other `hyperion.image*` functions before. This is always the last step after you created the image with other hyperion.image* function | | hyperion.imageSetPixel() | - | See [hyperion.imageSetPixel()](#hyperion-imagesetpixel) | -| hyperion.imageGetPixel() | Tuple | A [Python tuple](https://www.tutorialspoint.com/python/python_tuples.htm) rgb values for the requested position. See [hyperion.imageGetPixel()](#hyperion-imagegetpixel) | +| hyperion.imageGetPixel() | Tuple | A [Python tuple](https://www.tutorialspoint.com/python/python_tuples.htm) RGB values for the requested position. See [hyperion.imageGetPixel()](#hyperion-imagegetpixel) | | hyperion.imageSave() | Integer | Create a snapshot of the current effect image and returns an ID. To display the snapshot do `hyperion.imageShow(ID)`. Snapshots are the _current_ state of the picture | | hyperion.setColor() | - | Not recommended, read why! See [hyperion.setColor()](#hyperion-setcolor) | | hyperion.setImage() | - | hyperion.setImage(width, height, RGB_bytearray) | @@ -52,18 +52,18 @@ Rotates the coordinate system at the center which is 0 at the x-axis and 0 at th ### hyperion.imageCOffset() Add offset to the coordinate system at the x-axis and y-axis. ::: warning -Changes at the coordinate system results in weird behaviour of some shorter versions of other hyperion.image* drawing functions +Changes at the coordinate system results in weird behavior of some shorter versions of other hyperion.image* drawing functions ::: `hyperion.imageCOffset(offsetX, offsetY)` | Argument | Type | Comment | | -------- | ---------- | ----------------------------------------------------- | -| offsetX | Integer | Offset which is added to the coordiante system at the x-axis. Positive value moves to the right, negative to the left | -| offsetY | Integer | Offset which is added to the coordiante system at the y-axis. Positive value moves to the right, negative to the left | +| offsetX | Integer | Offset which is added to the coordinate system at the x-axis. Positive value moves to the right, negative to the left | +| offsetY | Integer | Offset which is added to the coordinate system at the y-axis. Positive value moves to the right, negative to the left | ### hyperion.imageCShear() Shears the coordinate system at the vertical and horizontal. More info to shearing here: [Shear Mapping](https://en.wikipedia.org/wiki/Shear_mapping) ::: warning -Changes at the coordinate system results in weird behaviour of some shorter versions of other hyperion.image* drawing functions +Changes at the coordinate system results in weird behavior of some shorter versions of other hyperion.image* drawing functions ::: `hyperion.imageCShear(sh, sv)` | Argument | Type | Comment | @@ -83,7 +83,7 @@ Draws a conical gradient on the image, all arguments are required. Add the argum | centerX | Integer | Defines the center of the gradient at the x-axis. For the center of the picture use `hyperion.imageWidth()*0.5`, don't forget to surround it with int() or round() | | centerY | Integer | Defines the center of the gradient at the y-axis. For the center of the picture use `hyperion.imageHeight()*0.5`, don't forget to surround it with int() or round() | | angle | Integer | Defines the angle from `0` to `360`. Used to rotate the gradient at the center point. | -| bytearray | ByteArray | bytearray of (position,red,green,blue,alpha,position,red,green,blue,alpha,...). Could be repeated as often you need it, all values have ranges from 0 to 255. The position is a point where the red green blue values are assigned.
**Example:** `bytearray([0,255,0,0,255,255,0,255,0,255])` - this is a gradient wich starts at 0 with color 255,0,0 and alpha 255 and ends at position 255 with color 0,255,0 and alpha 255. The colors in between are interpolation, so this example is a color shift from red to green from 0° to 360°. | +| bytearray | ByteArray | bytearray of (position,red,green,blue,alpha,position,red,green,blue,alpha,...). Could be repeated as often you need it, all values have ranges from 0 to 255. The position is a point where the red green blue values are assigned.
**Example:** `bytearray([0,255,0,0,255,255,0,255,0,255])` - this is a gradient which starts at 0 with color 255,0,0 and alpha 255 and ends at position 255 with color 0,255,0 and alpha 255. The colors in between are interpolation, so this example is a color shift from red to green from 0° to 360°. | ::: tip Shorter versions of hyperion.imageConicalGradient() `hyperion.imageConicalGradient(centerX, centerY, angle, bytearray)` -> startX and startY are 0 and the width/height is max. -> Entire image @@ -105,7 +105,7 @@ Short description at QT Docs: [Radial Gradient](http://doc.qt.io/qt-5/qradialgra | focalX | Integer | Defines the focal point at the x-axis | | focalY | Integer | Defines the focal point at the y-axis | |focalRadius| Integer | Defines the radius of the focal point | -| bytearray | ByteArray | bytearray of (position,red,green,blue,position,red,green,blue,...). Could be repeated as often you need it, all values have ranges from 0 to 255. The position is a point where the red green blue values are assigned
**Example:** `bytearray([0,255,0,0,255,0,255,0])` - this is a gradient wich starts at 0 with color 255,0,0 and ends at position 255 with color 0,255,0. The colors in between are interpolation, so this example is a color shift from red to green. | +| bytearray | ByteArray | bytearray of (position,red,green,blue,position,red,green,blue,...). Could be repeated as often you need it, all values have ranges from 0 to 255. The position is a point where the red green blue values are assigned
**Example:** `bytearray([0,255,0,0,255,0,255,0])` - this is a gradient which starts at 0 with color 255,0,0 and ends at position 255 with color 0,255,0. The colors in between are interpolation, so this example is a color shift from red to green. | | spread | Integer | Defines the spread method outside the gradient. Available spread modes are:
`0` -> The area is filled with the closest stop color
`1` -> The gradient is reflected outside the gradient area
`2` -> The gradient is repeated outside the gradient area
Please note that outside means _inside_ the rectangle but outside of the gradient start and end points, so if these points are the same, you don't see the spread mode. A picture to the spread modes can you find here: [Spread modes](http://doc.qt.io/qt-5/qradialgradient.html#details) | ::: tip Shorter versions of hyperion.imageRadialGradient() @@ -128,7 +128,7 @@ Short description at QT Docs: [Linear Gradient](http://doc.qt.io/qt-5/qlineargra | startY | Integer | Defines the start at the y-axis for the gradient. | | endX | Integer | Defines the end at the x-axis for the gradient. | | endY | Integer | Defines the end at the y-axis for the gradient. | -| bytearray | ByteArray | bytearray of (position,red,green,blue,alpha,position,red,green,blue,alpha,...). Could be repeated as often you need it, all values have ranges from 0 to 255. The position is a point where the red green blue values are assigned.
**Example:** `bytearray([0,255,0,0,255,255,0,255,0,127])` this is a gradient wich starts at 0 with color 255,0,0 and alpha 255 and ends at position 255 with color 0,255,0 and alpha 127. The colors in between are interpolation, so this example is a color shift from red to green. | +| bytearray | ByteArray | bytearray of (position,red,green,blue,alpha,position,red,green,blue,alpha,...). Could be repeated as often you need it, all values have ranges from 0 to 255. The position is a point where the red green blue values are assigned.
**Example:** `bytearray([0,255,0,0,255,255,0,255,0,127])` this is a gradient which starts at 0 with color 255,0,0 and alpha 255 and ends at position 255 with color 0,255,0 and alpha 127. The colors in between are interpolation, so this example is a color shift from red to green. | | spread | Integer | Defines the spread method outside the gradient. Available spread modes are:
`0` -> The area is filled with the closest stop color
`1` -> The gradient is reflected outside the gradient area
`2` -> The gradient is repeated outside the gradient area
Please note that outside means _inside_ the rectangle but outside of the gradient start and end points, so if these points are the same, you don't see the spread mode. A picture to the spread modes can you find here: [Spread modes](http://doc.qt.io/qt-5/qlineargradient.html#details) | ::: tip Shorter versions of hyperion.imageLinearGradient() @@ -144,7 +144,7 @@ Draws a line at the image. All arguments are required, exception a for alpha. Ad | startY | Integer | start point at the y-axis. Relates to `hyperion.imageHeight()` | | endX | Integer | end point at the x-axis. Relates to `hyperion.imageWidth()` | | endY | Integer | end point at the y-axis. Relates to `hyperion.imageHeight()` | -| thick | Integer | Thickness of the line, should be calcualted based on image height or width. But at least one Pixel. Example: `max(int(0.1*hyperion.imageHeight(),1)` is 10% of the image height. | +| thick | Integer | Thickness of the line, should be calculated based on image height or width. But at least one Pixel. Example: `max(int(0.1*hyperion.imageHeight(),1)` is 10% of the image height. | | r | Integer | red color from `0` to `255` | | g | Integer | green color from `0` to `255` | | b | Integer | blue color from `0` to `255` | @@ -161,7 +161,7 @@ Draws a point/dot at the image. All arguments are required, exception a for alph | --------- | ---------- | ----------------------------------------------------- | | x | Integer | point position at the x-axis. Relates to `hyperion.imageWidth()` | | y | Integer | point position at the y-axis. Relates to `hyperion.imageHeight()` | -| thick | Integer | Thickness of the point in pixel, should be calcualted based on image height or width. But at least one Pixel. Example: `max(int(0.1*hyperion.imageHeight(),1)` is 10% of the image height. | +| thick | Integer | Thickness of the point in pixel, should be calculated based on image height or width. But at least one Pixel. Example: `max(int(0.1*hyperion.imageHeight(),1)` is 10% of the image height. | | r | Integer | red color from `0` to `255` | | g | Integer | green color from `0` to `255` | | b | Integer | blue color from `0` to `255` | @@ -263,14 +263,14 @@ Get a color of a specific pixel position. All arguments are required. Add the ar ### hyperion.setColor() -Set a single color to all leds by adding `hyperion.setColor(255,0,0)`, all leds will be red. But it is also possible to send a bytearray of rgb values. Each rgb value in this bytearray represents one led. +Set a single color to all leds by adding `hyperion.setColor(255,0,0)`, all leds will be red. But it is also possible to send a bytearray of RGB values. Each RGB value in this bytearray represents one led. - **Example 1:** `hyperion.setColor(bytearray([255,0,0]))` The first led will be red - **Example 2:** `hyperion.setColor(bytearray([255,0,0,0,255,0]))` The first led will be red, the second is green - **Example 3:** `hyperion.setColor(bytearray([255,0,0,0,255,0,255,255,255]))` The first led will be red, the second is green, the third is white - You usually assign to all leds a color, therefore you need to know how much leds the user currently have. Get it with `hyperion.ledCount` ::: warning hyperion.setColor() - - hyperion.setColor() funtion is not recommended to assign led colors, it doesn't work together with **`hyperion.image*`** functions + - hyperion.setColor() function is not recommended to assign led colors, it doesn't work together with **`hyperion.image*`** functions - You don't know where is top/left/right/bottom and it doesn't work with matrix layouts! - Please consider to use the **`hyperion.image*`** functions instead to create amazing effects that scales with the user setup ::: \ No newline at end of file diff --git a/docs/docs/en/effects/OurFirstEffect.md b/docs/docs/en/effects/OurFirstEffect.md index a40a5ba2..de26b883 100644 --- a/docs/docs/en/effects/OurFirstEffect.md +++ b/docs/docs/en/effects/OurFirstEffect.md @@ -1,10 +1,10 @@ # Our first Effect Let's create together our first effect! \ -Target of this effect is to show the general structure of an effect, make you confident with the api and workflow. +Target of this effect is to show the general structure of an effect, make you confident with the API and workflow. ## Requirements * An installed and running Hyperion. You need access to the filesystem where Hyperion has been installed. - * Texteditor (of your liking, i would recommend [Visual Studio Code](https://code.visualstudio.com/)) + * Text editor (of your liking, i would recommend [Visual Studio Code](https://code.visualstudio.com/)) * Navigate to the "custom-effects" folder of your Hyperion installation (Inside .hyperion folder of your home directory) * **Configure a led matrix layout at "LED Hardware"-section at the web configuration to 10x10 LEDs** @@ -44,7 +44,7 @@ Let's talk about what we have done here - The `neweffect.json` contains the configuration for our effect. - The `name` property is the effect name which is displayed at the effect list and could be freely defined. - The `script` property points to the python file it should start. - - The `args` property contains options and their values, for examaple a color, speed and so on. We leave this empty for the moment. + - The `args` property contains options and their values, for example a color, speed and so on. We leave this empty for the moment. **After you added this file to your custom-effects folder, you need to restart Hyperion once** diff --git a/docs/docs/en/effects/README.md b/docs/docs/en/effects/README.md index 2bac2c2e..963e773e 100644 --- a/docs/docs/en/effects/README.md +++ b/docs/docs/en/effects/README.md @@ -1,5 +1,5 @@ # Effect development -Hyperion provides a powerfull API to write your own effects, along with possible options and user interface to tune them. +Hyperion provides a powerful API to write your own effects, along with possible options and user interface to tune them. [[toc]] @@ -9,4 +9,4 @@ An effect has 3 different files. | :-------------------: | :-----------------------------------: | :-----------------------------------------------------------------------------------: | | neweffect.py | [Python](https://www.python.org) | The heart of the effect | | neweffect.json | [JSON](http://www.json.org) | Contains options for the python file, which makes it configurable | -| neweffect.schema.json | [JSON Schema](http://json-schema.org) | Creates the options ui and is used to validate user input. [Read more](/en/api/ui.md) | \ No newline at end of file +| neweffect.schema.json | [JSON Schema](http://json-schema.org) | Creates the options UI and is used to validate user input. [Read more](/en/api/ui.md) | \ No newline at end of file diff --git a/docs/docs/en/json/Authorization.md b/docs/docs/en/json/Authorization.md index 59213bad..3d0dbf3f 100644 --- a/docs/docs/en/json/Authorization.md +++ b/docs/docs/en/json/Authorization.md @@ -88,9 +88,9 @@ If you want to get the most comfortable way for your application to authenticate * Wait for the response, the user needs to accept the request from the webconfiguration * -> On success you get a UUID token which is now your personal app token * -> On error you won't get a token, in this case the user denied the request or it timed out (180s). - * Now you are able to access the api, your access can be revoked by the user at any time, but will last for current connected sessions. + * Now you are able to access the API, your access can be revoked by the user at any time, but will last for current connected sessions. -Requesting a token is easy, just send the follwing command, make sure to add a sufficient comment. The "id" field has 5 random chars created by yourself. And add a meaningful comment. +Requesting a token is easy, just send the following command, make sure to add a sufficient comment. The "id" field has 5 random chars created by yourself. And add a meaningful comment. ``` json { "command" : "authorize", diff --git a/docs/docs/en/json/Control.md b/docs/docs/en/json/Control.md index b5e6b707..29074bf8 100644 --- a/docs/docs/en/json/Control.md +++ b/docs/docs/en/json/Control.md @@ -1,8 +1,8 @@ # Control -You can control Hyperion by sending specific json messages. Or get a image and led colors stream of the current active source priority. +You can control Hyperion by sending specific JSON messages. Or get a image and led colors stream of the current active source priority. ::: tip -The `tan` property is supported, but ommited. +The `tan` property is supported, but omitted. ::: [[toc]] @@ -133,7 +133,7 @@ Clear a priority, usually used to revert these: [set color](#set-color), [set ef } ``` ::: warning -When you clear all, you clear all effects and colors independet who set it! We recommend to provide a list of possible clear targets instead based on the priority list +When you clear all, you clear all effects and colors independent who set it! We recommend to provide a list of possible clear targets instead based on the priority list ::: ### Adjustments @@ -333,7 +333,7 @@ You can request a live image stream (when the current source priority can delive "subcommand":"imagestream-start" } ``` -You will receive "ledcolors-imagestream-update" messages with a bas64 encoded image. +You will receive "ledcolors-imagestream-update" messages with a base64 encoded image. Stop the stream by sending ``` json { @@ -386,4 +386,4 @@ You need now the plugin id. Example: `service.kodi`. "id":"service.kodi" } ``` -You will get a response of your action. `plugin-start` or `plugin-stop` with success true/false. \ No newline at end of file +You will get a response of your action. `plugin-start` or `plugin-stop` with success true/false. diff --git a/docs/docs/en/json/README.md b/docs/docs/en/json/README.md index c9bb6635..5af982bf 100644 --- a/docs/docs/en/json/README.md +++ b/docs/docs/en/json/README.md @@ -1,5 +1,5 @@ # JSON RPC Introduction -The JSON-RPC povide lot's of possiblities to interact with Hyperion. You could get information about Hyperion and it's states and trigger certain actions based on these informations or just out of the wild. +The JSON-RPC provide lot's of possibilities to interact with Hyperion. You could get information about Hyperion and it's states and trigger certain actions based on these informations or just out of the wild. [[toc]] @@ -7,7 +7,7 @@ The JSON-RPC povide lot's of possiblities to interact with Hyperion. You could g JSON is a standardized message format [JSON.org](http://www.json.org/) and is supported by lot's of programming languages, which is perfect to transmit and process informations. While it's not the smartest in traffic size, it can be read by humans. ### Sending JSON -Hyperion requires a special formatted json message to process it. `command` is always required, while `tan` is optinal. The tan is a integer you could freely define. It is part of the response so you could easy filter for it in case you need it (Might be very rarely). +Hyperion requires a special formatted JSON message to process it. `command` is always required, while `tan` is optional. The tan is a integer you could freely define. It is part of the response so you could easy filter for it in case you need it (Might be very rarely). ``` json { "command" : "YourCommand", diff --git a/docs/docs/en/json/ServerInfo.md b/docs/docs/en/json/ServerInfo.md index 11c20344..a1e04762 100644 --- a/docs/docs/en/json/ServerInfo.md +++ b/docs/docs/en/json/ServerInfo.md @@ -87,7 +87,7 @@ You can subscribe to future data updates. Read more about [Adjustment updates](/ ``` ### Effect list -An array of effects where each object is one effect, ususally you just use the `name` to create a list for the user. You could filter between user created effects and provided effects by checking the effect `file` string. In case it begins with `:` it's a provided effect. If the path begins with `/`, it's a user created effect. Could be used to list the user effects earlier than the provided effects and to keep the overview. +An array of effects where each object is one effect, usually you just use the `name` to create a list for the user. You could filter between user created effects and provided effects by checking the effect `file` string. In case it begins with `:` it's a provided effect. If the path begins with `/`, it's a user created effect. Could be used to list the user effects earlier than the provided effects and to keep the overview. See also [set Effect](/en/json/control#set-effect) ::: tip Subscribe You can subscribe to future data updates. Read more about [Effect updates](/en/json/subscribe#effects-updates) @@ -155,7 +155,7 @@ Overview of the registered/active sources. Each object is a source. * visible: If "true" this source is displayed and will be pushed to the led device. The `visible:true`-source is always the first entry! * componentId: A string belongs to a specific component. [See available components](/en/json/control#components-ids-explained) * origin: The external setter of this source "NameOfRemote@IP". If not given it's `System` (from Hyperion). - * owner: Contains additional information realted to the componentId. If it's an effect, the effect name is shown here. If it's usb capture it shows the capture device. If it's platform capture you get the name of it (While we use different capture implementations on different hardware (dispmanx/x11/amlogic/...)). + * owner: Contains additional information related to the componentId. If it's an effect, the effect name is shown here. If it's USB capture it shows the capture device. If it's platform capture you get the name of it (While we use different capture implementations on different hardware (dispmanx/x11/amlogic/...)). * priority: The priority of this source. * value: Just available if source is a color AND color data is available (active = false has usually no data). Outputs the color in RGB and HSL. * duration_ms: Actual duration in ms until this priority is deleted. Just available if source is color or effect AND a specific duration higher than `0` is set (because 0 is endless). diff --git a/docs/docs/en/json/Subscribe.md b/docs/docs/en/json/Subscribe.md index a2b3d292..e9ce0d4d 100644 --- a/docs/docs/en/json/Subscribe.md +++ b/docs/docs/en/json/Subscribe.md @@ -67,7 +67,7 @@ You can subscribe to session updates (Found with Bonjour/Zeroconf/Ahavi). These } ``` These updates aren't incremental, so they contain always all found entries. -Example response with 2 http server sessions (_hyperiond-http._tcp) +Example response with 2 HTTP server sessions (_hyperiond-http._tcp) ``` json { "command":"sessions-update", diff --git a/docs/docs/en/user/Configuration.md b/docs/docs/en/user/Configuration.md index 22374360..6a631483 100644 --- a/docs/docs/en/user/Configuration.md +++ b/docs/docs/en/user/Configuration.md @@ -2,7 +2,7 @@ Hyperion is fully configurable via web browser. The interface is fully responsive and created with touch devices in mind. ## Web Configuration -Open the web configuration by typing the ip address of your device and the port 8090 in your browser. The installation script will show you the addess, if you don't know it. \ +Open the web configuration by typing the IP address of your device and the port 8090 in your browser. The installation script will show you the address, if you don't know it. \ **Example:** `http://192.168.0.20:8090` ### Dashboard @@ -27,7 +27,7 @@ Open the web configuration by typing the ip address of your device and the port * The **Component status** shows always the latest state (enabled/disabled) of the components ::: tip Hashtag navigation -The web configuration supports hashtags for sitenames, so you could directly open a specfic page by calling the hashtag. **Example:**`http://192.168.0.20:8090/#remote` - will open the remote control page. +The web configuration supports hashtags for sitenames, so you could directly open a specific page by calling the hashtag. **Example:**`http://192.168.0.20:8090/#remote` - will open the remote control page. ::: ### Configuration diff --git a/docs/docs/en/user/HyperBian.md b/docs/docs/en/user/HyperBian.md index b5317b03..305de19d 100644 --- a/docs/docs/en/user/HyperBian.md +++ b/docs/docs/en/user/HyperBian.md @@ -1,7 +1,7 @@ # HyperBian Is a ready to use image for your Raspberry Pi. Based on the original Raspberry Pi Foundation image "Raspbian lite". Hyperion is already pre installed. So simply 1. Download -2. Burn image on sd +2. Burn image on SD 3. Power on your Pi 4. Visit with your Browser `http://IpOfYourPi:8090` for configuration @@ -9,16 +9,16 @@ Is a ready to use image for your Raspberry Pi. Based on the original Raspberry P ## Requirements * SD card with at least 2GB size * Raspberry Pi - * Linux/Mac/Windows + sd card read/writer + * Linux/Mac/Windows + SD card read/writer ## Installation * Download the image here: [HyperBian Download](https://github.com/Hyperion-Project/HyperBian/releases) * Extract HyperBian-XXXX.img out of the HyperBian.zip - * Burn the extracted HyperBian-XXXX.img to your sdcard. Below 3 instructions for the specific system + * Burn the extracted HyperBian-XXXX.img to your SD card. Below 3 instructions for the specific system * On Windows: [INSTALLING OPERATING SYSTEM IMAGES USING WINDOWS](https://www.raspberrypi.org/documentation/installation/installing-images/windows.md) * On Mac: [INSTALLING OPERATING SYSTEM IMAGES ON MAC OS](https://www.raspberrypi.org/documentation/installation/installing-images/mac.md) * On Linux: [INSTALLING OPERATING SYSTEM IMAGES ON LINUX](https://www.raspberrypi.org/documentation/installation/installing-images/linux.md) - * In case your Raspberry Pi has WLAN or you want to use a WLAN stick, you could pre-configure the WLAN SSID and password before you plugin the sd in your Pi. See [HyperBian WLAN](#hyperbian-wlan) + * In case your Raspberry Pi has WLAN or you want to use a WLAN stick, you could pre-configure the WLAN SSID and password before you plugin the SD in your Pi. See [HyperBian WLAN](#hyperbian-wlan) * Optional: Enable SSH [HyperBian SSH](#HyperBian-SSH) ::: tip @@ -26,9 +26,9 @@ As a image is already outdated the moment you create it. We update it once a wee ::: ### HyperBian WLAN -In case you want to use WLAN with your Raspberry Pi, you can include the wlan ssid and password after you burned the HyperBian-XXXX.img to your sdcard for auto configuration on first boot. -Open the sdcard with a file explorer. It's called "boot". - - Create a new texfile +In case you want to use WLAN with your Raspberry Pi, you can include the WLAN SSID and password after you burned the HyperBian-XXXX.img to your SD card for auto configuration on first boot. +Open the SD card with a file explorer. It's called "boot". + - Create a new text file - Rename it to "wpa_supplicant.conf" diff --git a/docs/docs/en/user/LedDevices.md b/docs/docs/en/user/LedDevices.md index dda4c2e7..73c150f3 100644 --- a/docs/docs/en/user/LedDevices.md +++ b/docs/docs/en/user/LedDevices.md @@ -14,7 +14,7 @@ Applicable for all led hardware implementations \ Each LED hardware has specific settings which are explained here ### SPI -Are 4 wire leds which can be powered via SPI of a Raspberry Pi or an Ardunio (which is usb connected to your computer/HTPC/Pi) +Are 4 wire leds which can be powered via SPI of a Raspberry Pi or an Arduino (which is USB connected to your computer/HTPC/Pi) #### apa102 APA 102. These LEDs are known for a good color spectrum (converting a data signal to the wanted color). @@ -85,7 +85,7 @@ Hyperion cannot be held liable for any foreseeable, or unforeseeable, negative o * To use the Philips Hue Entertainment API, the bridge must use at least API version 1.22! * Only one Entertainment group / area can be active at one time on a single Hue Bridge! -##### Multiple and / or none orignal Hue bridges +##### Multiple and / or none original Hue bridges * Automatic detection will only find the first available bridge. * If your bridge wasn't found or was found, but not the one you want to use, manually enter the desired bridge IP address and click the "retry" icon / button next to the IP entry field. @@ -102,7 +102,7 @@ Hyperion cannot be held liable for any foreseeable, or unforeseeable, negative o * With the `Signal detection timeout on black` option, you can control how long all lamps are set to black, before the Entertainment API stops and the previous lamp state will be recovered. * Set the ms value higher, so longer dark scenes in movies will not stop the Entertainment API. * The Entertainment API automatically restarts when color information other than black is available to send. - * Some grabbers do not provide real black, but rather dark gray, so black = 0 never occurs. With the option `Signal detection brightness minimum` you can set the minimum brightness which is considered black. The range can be set from 0 = 0% to 1 = 100%, e.g. 0,005 = 0.5%. If 0 doesn' work for your setup, increase this value in 0,005 steps. It's like the thresholds for USB Capture. + * Some grabbers do not provide real black, but rather dark gray, so black = 0 never occurs. With the option `Signal detection brightness minimum` you can set the minimum brightness which is considered black. The range can be set from 0 = 0% to 1 = 100%, e.g. 0,005 = 0.5%. If 0 doesn't' work for your setup, increase this value in 0,005 steps. It's like the thresholds for USB Capture. ##### Brightness *Settings may be removed in future releases* * Set / leave `brightness factor` back to 1 (default) - classic low brightness bug is fixed @@ -112,11 +112,11 @@ Hyperion cannot be held liable for any foreseeable, or unforeseeable, negative o * The brightness factor is a multiplier for the input brightness, means E.g. 50% input brightness * brightness factor (e.g. 1,5) = new 75% brightness. * __Be warned__: If you change the brightness factor / minimum / maximum to a value other than the default value, the color rendering will also change!!! - E.g. Dark / Black will apear as a deep dark blue, if you raise the minimum brightness, because the deepes color inside the hue light system is a deep blue, because black is not a color, it's only off. + E.g. Dark / Black will appear as a deep dark blue, if you raise the minimum brightness, because the deepest color inside the hue light system is a deep blue, because black is not a color, it's only off. __AND__ you can miss the entire Entertainment API experience ;) ::: warning Fast uncontrolled colors / flickering - * The colorinformation for each lamp, depends on the input signal from your grabber source, the defined screen position to use for the lamp (like any other led configuration) and the used capture framerate! + * The color information for each lamp, depends on the input signal from your grabber source, the defined screen position to use for the lamp (like any other led configuration) and the used capture framerate! * Input signals with noise and other image disturbances can cause this effect of rapidly changing colors / flickering. For more information on how to reduce this problem, see the next tip: ::: @@ -140,8 +140,8 @@ Hyperion cannot be held liable for any foreseeable, or unforeseeable, negative o ##### Configuration Tips & Tricks * Use the Philips Hue wizard at the web configuration for configuration (available at led hardware section)! * Color calibration is not required, you can keep the default values. - * If the bightness is to low for you and Hyperion is already at 100% you can higher the brightness factor at the web configuration -> LED hardware - * Brightness componsation influences the brightness across different color (Adjust at the color section) + * If the brightness is to low for you and Hyperion is already at 100% you can higher the brightness factor at the web configuration -> LED hardware + * Brightness compensation influences the brightness across different color (Adjust at the color section) * To enable/disable the bridge control from Hyperion, disable Hyperion or just the led hardware component. The previous lamp state will be recovered #### atmoorb diff --git a/docs/docs/en/user/advanced/Advanced.md b/docs/docs/en/user/advanced/Advanced.md index 44a5b102..d44a7678 100644 --- a/docs/docs/en/user/advanced/Advanced.md +++ b/docs/docs/en/user/advanced/Advanced.md @@ -55,7 +55,7 @@ Now with three LEDs ### Additional properties -You may connected different led stripe charges with different rgb byte orders. You can overwrite the global rgb byte order by adding a `colorOrder` property to all leds that require a different one. +You may connected different led stripe charges with different RGB byte orders. You can overwrite the global RGB byte order by adding a `colorOrder` property to all leds that require a different one. ``` json { "hmax": 0.2, @@ -77,7 +77,7 @@ You may connected different led stripe charges with different rgb byte orders. Y "vmin": 0.7 } ``` -In this example the first led will be `gbr`, the other leds will be assigned to the global rgb order that has been defined at the led hardware section. +In this example the first led will be `gbr`, the other leds will be assigned to the global RGB order that has been defined at the led hardware section. ### Edit with Web Configuration While editing these values in a local texteditor is a little bit weird, you could edit them at the web configuration! @@ -92,7 +92,7 @@ Explain the differences between the available modes for blackbar detection. * **Default:** 3 scanlines in each direction (X Y) - fastest detection * **Classic:** The original implementation - lower cpu time (legacy for RPi 1) just scan the top one third of the picture which leads to a slow detection and trouble with TV channel logo. - * **OSD:** Based on the default mode - not that effectiv but prevents border switching which may caused of OSD overlays (program infos and volume bar). + * **OSD:** Based on the default mode - not that effective but prevents border switching which may caused of OSD overlays (program infos and volume bar). ## Gamma Curve @@ -131,7 +131,7 @@ If a path name contains spaces, surround it with `“`. ::: ### hyperion-remote -hyperion-remote is a command line tool which translates given arguments to json commands and sends them to the Hyperion JSON-RPC. Easy to use for scripts. It supports nearly all commands that Hyperion provides. +hyperion-remote is a command line tool which translates given arguments to JSON commands and sends them to the Hyperion JSON-RPC. Easy to use for scripts. It supports nearly all commands that Hyperion provides. ``` sh # Get a list of all available commands @@ -169,7 +169,7 @@ Hyperion remote will search for a Hyperion server automatically. So you can even ### hyperion-capture We deliver also stand alone capture apps right in your Hyperion directory. They are called hyperion-dispmanx, hyperion-osx, hyperion-x11, hyperion-amlogic, hyperion-framebuffer, hyperion-qt. Depending on your platform you have more or less. -All these application can be started independent from Hyperion and all of these have slightly different options. They communitcate with the flatbuffer interface of Hyperion. So let's start one of them! In this example i use dispmanx for Raspberry Pi, so let us check the available options. +All these application can be started independent from Hyperion and all of these have slightly different options. They communicate with the flatbuffer interface of Hyperion. So let's start one of them! In this example i use dispmanx for Raspberry Pi, so let us check the available options. ``` sh hyprion-dispmanx -h diff --git a/docs/docs/en/user/advanced/Support.md b/docs/docs/en/user/advanced/Support.md index 48ae2065..c25befe6 100644 --- a/docs/docs/en/user/advanced/Support.md +++ b/docs/docs/en/user/advanced/Support.md @@ -2,7 +2,7 @@ In case you need support or you found a bug it's all about informations that you need to deliver. ## Usual request -For this pupose and to save a lot of time we included a report creation and upload function into the web configuration. +For this purpose and to save a lot of time we included a report creation and upload function into the web configuration. So visit your web configuration and click on System -> Log. Now you click on the button "Upload report for support request". > Image of report tool @@ -20,7 +20,7 @@ Debugging segmentation faults requires a bunch of work, if we don't own your har * Tell gdb where "hyperiond" is located, usually at /usr/share/hyperion/bin/hyperiond. Prepend "file" to the path. So type into terminal something like that and press enter: `file /usr/share/hyperion/bin/hyperiond` * gdb should tell you now that the binary has been loaded with it's symbols etc * Now type in `run` and press enter, this will start Hyperion. Now you can use Hyperion as usual, repeat the steps you did to create a segmentation fault. - * A segmentation fault happend, when Hyperion stops responding and you see something like this as last message at the terminal: `Thread 1 "hyperiond" received signal SIGSEGV, Segmentation fault.` + * A segmentation fault happened, when Hyperion stops responding and you see something like this as last message at the terminal: `Thread 1 "hyperiond" received signal SIGSEGV, Segmentation fault.` * Now type in `backtrace` and press enter, add the backtrace to your support request thread at our forum. [Hyperion Project Forum](https://forum.hyperion-project.org) * To quit gdb press enter and type in `quit`, you can start Hyperion again with `sudo service hyperiond start`. It's not recommended to use "Debug" Hyperion builds in production, just install the "Release" version again. diff --git a/include/api/API.h b/include/api/API.h index 492cb11c..dd92b2a9 100644 --- a/include/api/API.h +++ b/include/api/API.h @@ -46,14 +46,14 @@ public: /// @param localConnection Is this a local network connection? Use utils/NetOrigin to check that /// @param parent Parent QObject /// - API(Logger *log, const bool &localConnection, QObject *parent); + API(Logger *log, bool localConnection, QObject *parent); protected: /// /// @brief Initialize the API /// This call is REQUIRED! /// - void init(void); + void init(); /// /// @brief Set a single color @@ -62,7 +62,7 @@ protected: /// @param[in] timeout_ms The time the leds are set to the given color [ms] /// @param[in] origin The setter /// - void setColor(const int &priority, const std::vector &ledColors, const int &timeout_ms = -1, const QString &origin = "API", const hyperion::Components &callerComp = hyperion::COMP_INVALID); + void setColor(int priority, const std::vector &ledColors, int timeout_ms = -1, const QString &origin = "API", hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set a image @@ -72,7 +72,7 @@ protected: /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// @return True on success /// - bool setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + bool setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Clear a priority in the Muxer, if -1 all priorities are cleared @@ -81,7 +81,7 @@ protected: /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// @return True on success /// - bool clearPriority(const int &priority, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + bool clearPriority(int priority, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set a new component state @@ -91,21 +91,21 @@ protected: /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// @ return True on success /// - bool setComponentState(const QString &comp, bool &compState, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + bool setComponentState(const QString &comp, bool &compState, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set a ledToImageMapping type /// @param type mapping type string /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// - void setLedMappingType(const int &type, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + void setLedMappingType(int type, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set the 2D/3D modes type /// @param mode The VideoMode /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// - void setVideoMode(const VideoMode &mode, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + void setVideoMode(VideoMode mode, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set an effect @@ -113,21 +113,21 @@ protected: /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// REQUIRED dat fields: effectName, priority, duration, origin /// - void setEffect(const EffectCmdData &dat, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + void setEffect(const EffectCmdData &dat, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set source auto select enabled or disabled /// @param sate The new state /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// - void setSourceAutoSelect(const bool state, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + void setSourceAutoSelect(bool state, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Set the visible priority to given priority /// @param priority The priority to set /// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF /// - void setVisiblePriority(const int &priority, const hyperion::Components &callerComp = hyperion::COMP_INVALID); + void setVisiblePriority(int priority, hyperion::Components callerComp = hyperion::COMP_INVALID); /// /// @brief Register a input or update the meta data of a previous register call @@ -138,21 +138,21 @@ protected: /// @param[in] owner Specific owner string, might be empty /// @param[in] callerComp The component that call this (e.g. PROTO/FLAT) /// - void registerInput(const int &priority, const hyperion::Components &component, const QString &origin, const QString &owner, const hyperion::Components &callerComp); + void registerInput(int priority, hyperion::Components component, const QString &origin, const QString &owner, hyperion::Components callerComp); /// /// @brief Revoke a registerInput() call by priority. We maintain all registered priorities in this scope /// ATTENTION: This is MANDATORY if you change (priority change) or stop(clear/timeout) DURING lifetime. If this class destructs it's not needed /// @param priority The priority to unregister /// - void unregisterInput(const int &priority); + void unregisterInput(int priority); /// /// @brief Handle the instance switching /// @param inst The requested instance /// @return True on success else false /// - bool setHyperionInstance(const quint8 &inst); + bool setHyperionInstance(quint8 inst); /// /// @brief Get all contrable components and their state @@ -169,19 +169,19 @@ protected: /// @brief Get all instances data /// @return The instance data /// - QVector getAllInstanceData(void); + QVector getAllInstanceData(); /// /// @brief Start instance /// @param index The instance index /// - void startInstance(const quint8 &index); + void startInstance(quint8 index); /// /// @brief Stop instance /// @param index The instance index /// - void stopInstance(const quint8 &index); + void stopInstance(quint8 index); ////////////////////////////////// /// AUTH / ADMINISTRATION METHODS @@ -193,7 +193,7 @@ protected: /// @param replyMsg The reply Msg /// @return False with reply /// - bool deleteInstance(const quint8 &index, QString &replyMsg); + bool deleteInstance(quint8 index, QString &replyMsg); /// /// @brief Create instance. Requires ADMIN ACCESS @@ -208,7 +208,7 @@ protected: /// @param name With given name /// @return False with reply /// - QString setInstanceName(const quint8 &index, const QString &name); + QString setInstanceName(quint8 index, const QString &name); /// /// @brief Delete an effect. Requires ADMIN ACCESS @@ -292,7 +292,7 @@ protected: /// @param id The id fo the request /// @param accept True when it should be accepted, else false /// @return True on success - bool handlePendingTokenRequest(const QString &id, const bool accept); + bool handlePendingTokenRequest(const QString &id, bool accept); /// /// @brief Get the current List of Tokens. Requires ADMIN ACCESS @@ -379,7 +379,7 @@ signals: /// @param comment The comment that was part of the request /// @param id The id that was part of the request /// - void onTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id); + void onTokenResponse(bool success, const QString &token, const QString &comment, const QString &id); private slots: /// @@ -396,7 +396,7 @@ private slots: /// @param comment The comment that was part of the request /// @param id The id that was part of the request /// - void checkTokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id); + void checkTokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id); private: void stopDataConnectionss(); diff --git a/include/api/JsonAPI.h b/include/api/JsonAPI.h index 7ae8c9da..f8365554 100644 --- a/include/api/JsonAPI.h +++ b/include/api/JsonAPI.h @@ -30,7 +30,7 @@ public: /// @param localConnection True when the sender has origin home network /// @param noListener if true, this instance won't listen for hyperion push events /// - JsonAPI(QString peerAddress, Logger *log, const bool &localConnection, QObject *parent, bool noListener = false); + JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener = false); /// /// Handle an incoming JSON message @@ -42,7 +42,7 @@ public: /// /// @brief Initialization steps /// - void initialize(void); + void initialize(); public slots: /// @@ -77,7 +77,7 @@ private slots: /// @param comment The comment that was part of the request /// @param id The id that was part of the request /// - void handleTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id); + void handleTokenResponse(bool success, const QString &token, const QString &comment, const QString &id); /// /// @brief Handle whenever the state of a instance (HyperionIManager) changes according to enum instanceState @@ -85,7 +85,7 @@ private slots: /// @param instance The index of instance /// @param name The name of the instance, just available with H_CREATED /// - void handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name = QString()); + void handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name = QString()); signals: /// @@ -131,151 +131,151 @@ private: /// @param forced indicate if it was a forced switch by system /// @return true on success. false if not found /// - bool handleInstanceSwitch(const quint8 &instance = 0, const bool &forced = false); + bool handleInstanceSwitch(quint8 instance = 0, bool forced = false); /// /// Handle an incoming JSON Color message /// /// @param message the incoming message /// - void handleColorCommand(const QJsonObject &message, const QString &command, const int tan); + void handleColorCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Image message /// /// @param message the incoming message /// - void handleImageCommand(const QJsonObject &message, const QString &command, const int tan); + void handleImageCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Effect message /// /// @param message the incoming message /// - void handleEffectCommand(const QJsonObject &message, const QString &command, const int tan); + void handleEffectCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Effect message (Write JSON Effect) /// /// @param message the incoming message /// - void handleCreateEffectCommand(const QJsonObject &message, const QString &command, const int tan); + void handleCreateEffectCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Effect message (Delete JSON Effect) /// /// @param message the incoming message /// - void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, const int tan); + void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON System info message /// /// @param message the incoming message /// - void handleSysInfoCommand(const QJsonObject &message, const QString &command, const int tan); + void handleSysInfoCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Server info message /// /// @param message the incoming message /// - void handleServerInfoCommand(const QJsonObject &message, const QString &command, const int tan); + void handleServerInfoCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Clear message /// /// @param message the incoming message /// - void handleClearCommand(const QJsonObject &message, const QString &command, const int tan); + void handleClearCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Clearall message /// /// @param message the incoming message /// - void handleClearallCommand(const QJsonObject &message, const QString &command, const int tan); + void handleClearallCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Adjustment message /// /// @param message the incoming message /// - void handleAdjustmentCommand(const QJsonObject &message, const QString &command, const int tan); + void handleAdjustmentCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON SourceSelect message /// /// @param message the incoming message /// - void handleSourceSelectCommand(const QJsonObject &message, const QString &command, const int tan); + void handleSourceSelectCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON GetConfig message and check subcommand /// /// @param message the incoming message /// - void handleConfigCommand(const QJsonObject &message, const QString &command, const int tan); + void handleConfigCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON GetSchema message from handleConfigCommand() /// /// @param message the incoming message /// - void handleSchemaGetCommand(const QJsonObject &message, const QString &command, const int tan); + void handleSchemaGetCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON SetConfig message from handleConfigCommand() /// /// @param message the incoming message /// - void handleConfigSetCommand(const QJsonObject &message, const QString &command, const int tan); + void handleConfigSetCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON Component State message /// /// @param message the incoming message /// - void handleComponentStateCommand(const QJsonObject &message, const QString &command, const int tan); + void handleComponentStateCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON Led Colors message /// /// @param message the incoming message /// - void handleLedColorsCommand(const QJsonObject &message, const QString &command, const int tan); + void handleLedColorsCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON Logging message /// /// @param message the incoming message /// - void handleLoggingCommand(const QJsonObject &message, const QString &command, const int tan); + void handleLoggingCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON Processing message /// /// @param message the incoming message /// - void handleProcessingCommand(const QJsonObject &message, const QString &command, const int tan); + void handleProcessingCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON VideoMode message /// /// @param message the incoming message /// - void handleVideoModeCommand(const QJsonObject &message, const QString &command, const int tan); + void handleVideoModeCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON plugin message /// /// @param message the incoming message /// - void handleAuthorizeCommand(const QJsonObject &message, const QString &command, const int tan); + void handleAuthorizeCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON instance message /// /// @param message the incoming message /// - void handleInstanceCommand(const QJsonObject &message, const QString &command, const int tan); + void handleInstanceCommand(const QJsonObject &message, const QString &command, int tan); /// Handle an incoming JSON Led Device message /// /// @param message the incoming message /// - void handleLedDeviceCommand(const QJsonObject &message, const QString &command, const int tan); + void handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan); /// /// Handle an incoming JSON message of unknown type @@ -285,22 +285,22 @@ private: /// /// Send a standard reply indicating success /// - void sendSuccessReply(const QString &command = "", const int tan = 0); + void sendSuccessReply(const QString &command = "", int tan = 0); /// /// Send a standard reply indicating success with data /// - void sendSuccessDataReply(const QJsonDocument &doc, const QString &command = "", const int &tan = 0); + void sendSuccessDataReply(const QJsonDocument &doc, const QString &command = "", int tan = 0); /// /// Send an error message back to the client /// /// @param error String describing the error /// - void sendErrorReply(const QString &error, const QString &command = "", const int tan = 0); + void sendErrorReply(const QString &error, const QString &command = "", int tan = 0); /// /// @brief Kill all signal/slot connections to stop possible data emitter /// - void stopDataConnections(void); + void stopDataConnections(); }; diff --git a/include/api/JsonCB.h b/include/api/JsonCB.h index 95229bce..e5a19c58 100644 --- a/include/api/JsonCB.h +++ b/include/api/JsonCB.h @@ -35,7 +35,7 @@ public: /// @param unsubscribe Revert subscription /// @return True on success, false if not found /// - bool subscribeFor(const QString& cmd, const bool & unsubscribe = false); + bool subscribeFor(const QString& cmd, bool unsubscribe = false); /// /// @brief Get all possible commands to subscribe for @@ -52,7 +52,7 @@ public: /// /// @brief Reset subscriptions, disconnect all signals /// - void resetSubscriptions(void); + void resetSubscriptions(); /// /// @brief Re-apply all current subs to a new Hyperion instance, the connections to the old instance will be dropped @@ -70,7 +70,7 @@ private slots: /// /// @brief handle component state changes /// - void handleComponentState(const hyperion::Components comp, const bool state); + void handleComponentState(hyperion::Components comp, bool state); #ifdef ENABLE_AVAHI /// /// @brief handle emits from bonjour wrapper @@ -86,7 +86,7 @@ private slots: /// /// @brief Handle imageToLedsMapping updates /// - void handleImageToLedsMappingChange(const int& mappingType); + void handleImageToLedsMappingChange(int mappingType); /// /// @brief Handle the adjustment update @@ -97,7 +97,7 @@ private slots: /// @brief Handle video mode change /// @param mode The new videoMode /// - void handleVideoModeChange(const VideoMode& mode); + void handleVideoModeChange(VideoMode mode); /// /// @brief Handle effect list change @@ -109,14 +109,14 @@ private slots: /// @param type The settings type from enum /// @param data The data as QJsonDocument /// - void handleSettingsChange(const settings::type& type, const QJsonDocument& data); + void handleSettingsChange(settings::type type, const QJsonDocument& data); /// /// @brief Handle led config specific updates (required for led color streaming with positional display) /// @param type The settings type from enum /// @param data The data as QJsonDocument /// - void handleLedsConfigChange(const settings::type& type, const QJsonDocument& data); + void handleLedsConfigChange(settings::type type, const QJsonDocument& data); /// /// @brief Handle Hyperion instance manager change diff --git a/include/blackborder/BlackBorderProcessor.h b/include/blackborder/BlackBorderProcessor.h index 2f7b3436..752c9f9e 100644 --- a/include/blackborder/BlackBorderProcessor.h +++ b/include/blackborder/BlackBorderProcessor.h @@ -24,7 +24,7 @@ namespace hyperion Q_OBJECT public: BlackBorderProcessor(Hyperion* hyperion, QObject* parent); - ~BlackBorderProcessor(); + ~BlackBorderProcessor() override; /// /// Return the current (detected) border /// @return The current border @@ -48,7 +48,7 @@ namespace hyperion /// It's not possible to enable bb from this method, if the user requsted a disable! /// @param disable The new state /// - void setHardDisable(const bool& disable); + void setHardDisable(bool disable); /// /// Processes the image. This performs detecion of black-border on the given image and @@ -99,12 +99,12 @@ namespace hyperion /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); /// /// @brief Handle component state changes, it's not possible for BB to be enabled, when a hardDisable is active /// - void handleCompStateChangeRequest(const hyperion::Components component, bool enable); + void handleCompStateChangeRequest(hyperion::Components component, bool enable); private: /// Hyperion instance diff --git a/include/boblightserver/BoblightServer.h b/include/boblightserver/BoblightServer.h index 6e5bb450..153177e1 100644 --- a/include/boblightserver/BoblightServer.h +++ b/include/boblightserver/BoblightServer.h @@ -32,7 +32,7 @@ public: /// @param port port number on which to start listening for connections /// BoblightServer(Hyperion* hyperion, const QJsonDocument& config); - ~BoblightServer(); + ~BoblightServer() override; /// /// @return the port number on which this TCP listens for incoming connections @@ -41,7 +41,7 @@ public: /// @return true if server is active (bind to a port) /// - bool active(); + bool active() const; public slots: /// @@ -54,14 +54,14 @@ public slots: /// void stop(); - void compStateChangeRequest(const hyperion::Components component, bool enable); + void compStateChangeRequest(hyperion::Components component, bool enable); /// /// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); private slots: /// diff --git a/include/bonjour/bonjourservicebrowser.h b/include/bonjour/bonjourservicebrowser.h index 948fdb9f..6c6874c7 100644 --- a/include/bonjour/bonjourservicebrowser.h +++ b/include/bonjour/bonjourservicebrowser.h @@ -44,7 +44,7 @@ class BonjourServiceBrowser : public QObject Q_OBJECT public: BonjourServiceBrowser(QObject *parent = 0); - ~BonjourServiceBrowser(); + ~BonjourServiceBrowser() override; void browseForServiceType(const QString &serviceType); inline QList currentRecords() const { return bonjourRecords; } inline QString serviceType() const { return browsingType; } diff --git a/include/bonjour/bonjourserviceregister.h b/include/bonjour/bonjourserviceregister.h index 1893e954..d656dd08 100644 --- a/include/bonjour/bonjourserviceregister.h +++ b/include/bonjour/bonjourserviceregister.h @@ -45,13 +45,13 @@ class BonjourServiceRegister : public QObject Q_OBJECT public: BonjourServiceRegister(QObject *parent = 0); - ~BonjourServiceRegister(); + ~BonjourServiceRegister() override; - void registerService(const QString& service, const int& port); - void registerService(const BonjourRecord &record, quint16 servicePort, std::vector> txt = std::vector>()); - inline BonjourRecord registeredRecord() const {return finalRecord; } + void registerService(const QString& service, int port); + void registerService(const BonjourRecord &record, quint16 servicePort, const std::vector>& txt = {}); + inline BonjourRecord registeredRecord() const { return finalRecord; } - const quint16 & getPort() { return _port; }; + quint16 getPort() const { return _port; } signals: void error(DNSServiceErrorType error); @@ -69,8 +69,8 @@ private: QSocketNotifier *bonjourSocket; BonjourRecord finalRecord; - // current port - quint16 _port = 0; + // current port + quint16 _port = 0; }; #endif // BONJOURSERVICEREGISTER_H diff --git a/include/bonjour/bonjourserviceresolver.h b/include/bonjour/bonjourserviceresolver.h index ed10e1ba..5ff1ebcb 100644 --- a/include/bonjour/bonjourserviceresolver.h +++ b/include/bonjour/bonjourserviceresolver.h @@ -44,8 +44,8 @@ class BonjourServiceResolver : public QObject { Q_OBJECT public: - BonjourServiceResolver(QObject *parent); - ~BonjourServiceResolver(); + BonjourServiceResolver(QObject *parent); + ~BonjourServiceResolver() override; bool resolveBonjourRecord(const BonjourRecord &record); diff --git a/include/commandline/ColorOption.h b/include/commandline/ColorOption.h index 1814143c..a2ec42e3 100644 --- a/include/commandline/ColorOption.h +++ b/include/commandline/ColorOption.h @@ -12,6 +12,7 @@ class ColorOption: public Option { protected: QColor _color; + public: ColorOption(const QString &name, const QString &description = QString(), @@ -31,9 +32,8 @@ public: : Option(other) {} - virtual bool validate(Parser & parser, QString & value) override; - QColor getColor(Parser &parser) - { return _color; } + bool validate(Parser & parser, QString & value) override; + QColor getColor(Parser &parser) const { return _color; } }; } diff --git a/include/commandline/ColorsOption.h b/include/commandline/ColorsOption.h index eafe1b07..299d44bf 100644 --- a/include/commandline/ColorsOption.h +++ b/include/commandline/ColorsOption.h @@ -12,6 +12,7 @@ class ColorsOption: public Option { protected: QList _colors; + public: ColorsOption(const QString &name, const QString &description = QString(), @@ -20,6 +21,7 @@ public: ) : Option(name, description, valueName, defaultValue) {} + ColorsOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), @@ -27,13 +29,13 @@ public: ) : Option(names, description, valueName, defaultValue) {} + ColorsOption(const QCommandLineOption &other) : Option(other) {} virtual bool validate(Parser & parser, QString & value) override; - QList &getColors(Parser &parser) - { return _colors; } + QList getColors(Parser &parser) const { return _colors; } }; } diff --git a/include/commandline/ImageOption.h b/include/commandline/ImageOption.h index 535d501e..83c3768c 100644 --- a/include/commandline/ImageOption.h +++ b/include/commandline/ImageOption.h @@ -12,6 +12,7 @@ class ImageOption: public Option { protected: QImage _image; + public: ImageOption(const QString &name, const QString &description = QString(), @@ -20,6 +21,7 @@ public: ) : Option(name, description, valueName, defaultValue) {} + ImageOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), @@ -27,13 +29,13 @@ public: ) : Option(names, description, valueName, defaultValue) {} + ImageOption(const QCommandLineOption &other) : Option(other) {} - virtual bool validate(Parser & parser, QString & value) override; - QImage &getImage(Parser &parser) - { return _image; } + bool validate(Parser & parser, QString & value) override; + QImage& getImage(Parser &parser) { return _image; } }; } diff --git a/include/commandline/IntOption.h b/include/commandline/IntOption.h index 2f59fae3..806bf0bb 100644 --- a/include/commandline/IntOption.h +++ b/include/commandline/IntOption.h @@ -12,6 +12,7 @@ class IntOption: public ValidatorOption { protected: int _int; + public: IntOption(const QString &name, const QString &description = QString(), @@ -19,18 +20,26 @@ public: const QString &defaultValue = QString(), int minimum = std::numeric_limits::min(), int maximum = std::numeric_limits::max()) : ValidatorOption(name, description, valueName, defaultValue) - { setValidator(new QIntValidator(minimum, maximum)); } + { + setValidator(new QIntValidator(minimum, maximum)); + } + IntOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString(), int minimum = std::numeric_limits::min(), int maximum = std::numeric_limits::max()) : ValidatorOption(names, description, valueName, defaultValue) - { setValidator(new QIntValidator(minimum, maximum)); } + { + setValidator(new QIntValidator(minimum, maximum)); + } + IntOption(const QCommandLineOption &other, int minimum = std::numeric_limits::min(), int maximum = std::numeric_limits::max()) : ValidatorOption(other) - { setValidator(new QIntValidator(minimum, maximum)); } + { + setValidator(new QIntValidator(minimum, maximum)); + } int getInt(Parser &parser, bool *ok = 0, int base = 10); int *getIntPtr(Parser &parser, bool *ok = 0, int base = 10); diff --git a/include/commandline/Option.h b/include/commandline/Option.h index 43ab70ee..b84526fa 100644 --- a/include/commandline/Option.h +++ b/include/commandline/Option.h @@ -26,13 +26,12 @@ public: ); Option(const QCommandLineOption &other); - virtual ~Option() = default; virtual bool validate(Parser &parser, QString &value); - QString name(); - QString getError(); - QString value(Parser &parser); - const char* getCString(Parser &parser); + QString name() const; + QString getError() const; + QString value(Parser &parser) const; + const char* getCString(Parser &parser) const; protected: QString _error; diff --git a/include/commandline/Parser.h b/include/commandline/Parser.h index 7b1a806e..b315787e 100644 --- a/include/commandline/Parser.h +++ b/include/commandline/Parser.h @@ -93,76 +93,108 @@ public: return *option; } - Parser(QString description=QString()) + Parser(const QString& description = QString()) { - if(description.size())setApplicationDescription(description); + if(description.size()) + setApplicationDescription(description); }; - + QCommandLineOption addHelpOption() { return _parser.addHelpOption(); }; - + bool addOption(Option &option); bool addOption(Option *option); void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString()) { _parser.addPositionalArgument(name, description, syntax); }; - + QCommandLineOption addVersionOption() - { + { return _parser.addVersionOption(); }; - - QString applicationDescription() const - { return _parser.applicationDescription(); } - - void clearPositionalArguments() - { _parser.clearPositionalArguments(); } - - QString helpText() const - { return _parser.helpText(); } - - bool isSet(const QString &name) const - { return _parser.isSet(name); } - - bool isSet(const Option &option) const - { return _parser.isSet(option); } - - bool isSet(const Option *option) const - { return _parser.isSet(*option); } - - QStringList optionNames() const - { return _parser.optionNames(); } - - QStringList positionalArguments() const - { return _parser.positionalArguments(); } - - void setApplicationDescription(const QString &description) - { _parser.setApplicationDescription(description); } - - void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode) - { _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); } - - void showHelp(int exitCode = 0) - { _parser.showHelp(exitCode); } - - QStringList unknownOptionNames() const - { return _parser.unknownOptionNames(); } - - QString value(const QString &optionName) const - { return _parser.value(optionName); } - - QString value(const Option &option) const - { return _parser.value(option); } - - QStringList values(const QString &optionName) const - { return _parser.values(optionName); } - - QStringList values(const Option &option) const - { return _parser.values(option); } + QString applicationDescription() const + { + return _parser.applicationDescription(); + } + + void clearPositionalArguments() + { + _parser.clearPositionalArguments(); + } + + QString helpText() const + { + return _parser.helpText(); + } + + bool isSet(const QString &name) const + { + return _parser.isSet(name); + } + + bool isSet(const Option &option) const + { + return _parser.isSet(option); + } + + bool isSet(const Option *option) const + { + return _parser.isSet(*option); + } + + QStringList optionNames() const + { + return _parser.optionNames(); + } + + QStringList positionalArguments() const + { + return _parser.positionalArguments(); + } + + void setApplicationDescription(const QString &description) + { + _parser.setApplicationDescription(description); + } + + void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode) + { + _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); + } + + void showHelp(int exitCode = 0) + { + _parser.showHelp(exitCode); + } + + QStringList unknownOptionNames() const + { + return _parser.unknownOptionNames(); + } + + QString value(const QString &optionName) const + { + return _parser.value(optionName); + } + + QString value(const Option &option) const + { + return _parser.value(option); + } + + QStringList values(const QString &optionName) const + { + return _parser.values(optionName); + } + + QStringList values(const Option &option) const + { + return _parser.values(option); + } }; } diff --git a/include/commandline/RegularExpressionOption.h b/include/commandline/RegularExpressionOption.h index 36094754..0ba3dbb1 100644 --- a/include/commandline/RegularExpressionOption.h +++ b/include/commandline/RegularExpressionOption.h @@ -17,12 +17,14 @@ public: const QString &defaultValue = QString()) : ValidatorOption(name, description, valueName, defaultValue) {} + RegularExpressionOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString()) : ValidatorOption(names, description, valueName, defaultValue) {} + RegularExpressionOption(const QCommandLineOption &other) : ValidatorOption(other) {} @@ -33,18 +35,26 @@ public: const QString &defaultValue = QString(), const QRegularExpression &expression = QRegularExpression()) : ValidatorOption(name, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(expression)); } + { + setValidator(new QRegularExpressionValidator(expression)); + } + RegularExpressionOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString(), const QRegularExpression &expression = QRegularExpression()) : ValidatorOption(names, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(expression)); } + { + setValidator(new QRegularExpressionValidator(expression)); + } + RegularExpressionOption(const QCommandLineOption &other, const QRegularExpression &expression = QRegularExpression()) : ValidatorOption(other) - { setValidator(new QRegularExpressionValidator(expression)); } + { + setValidator(new QRegularExpressionValidator(expression)); + } RegularExpressionOption(const QString &name, const QString &description = QString(), @@ -52,18 +62,26 @@ public: const QString &defaultValue = QString(), const QString &expression = QString()) : ValidatorOption(name, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); } + { + setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); + } + RegularExpressionOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), const QString &defaultValue = QString(), const QString &expression = QString()) : ValidatorOption(names, description, valueName, defaultValue) - { setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); } + { + setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); + } + RegularExpressionOption(const QCommandLineOption &other, const QString &expression = QString()) : ValidatorOption(other) - { setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); } + { + setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); + } }; } diff --git a/include/commandline/SwitchOption.h b/include/commandline/SwitchOption.h index 54060c51..b23393d1 100644 --- a/include/commandline/SwitchOption.h +++ b/include/commandline/SwitchOption.h @@ -30,8 +30,6 @@ public: : Option(other), _switches(switches) {} - virtual ~SwitchOption() {} - const QMap &getSwitches() const { return _switches; } virtual bool validate(Parser &parser, QString &switch_) override { return hasSwitch(switch_); } bool hasSwitch(const QString &switch_) { return _switches.contains(switch_.toLower()); } diff --git a/include/commandline/ValidatorOption.h b/include/commandline/ValidatorOption.h index c7349ccf..ae618fa5 100644 --- a/include/commandline/ValidatorOption.h +++ b/include/commandline/ValidatorOption.h @@ -13,6 +13,7 @@ class ValidatorOption: public Option protected: const QValidator *validator; virtual void setValidator(const QValidator *validator); + public: ValidatorOption(const QString &name, const QString &description = QString(), @@ -21,6 +22,7 @@ public: const QValidator *validator = nullptr) : Option(name, description, valueName, defaultValue), validator(validator) {} + ValidatorOption(const QStringList &names, const QString &description = QString(), const QString &valueName = QString(), @@ -28,6 +30,7 @@ public: const QValidator *validator = nullptr) : Option(names, description, valueName, defaultValue), validator(validator) {} + ValidatorOption(const QCommandLineOption &other, const QValidator *validator = nullptr) : Option(other), validator(validator) diff --git a/include/db/AuthTable.h b/include/db/AuthTable.h index 13508850..ae5918b6 100644 --- a/include/db/AuthTable.h +++ b/include/db/AuthTable.h @@ -29,7 +29,6 @@ public: // create table columns createTable(QStringList()<<"user TEXT"<<"password BLOB"<<"token BLOB"<<"salt BLOB"<<"comment TEXT"<<"id TEXT"<<"created_at TEXT"<<"last_use TEXT"); }; - ~AuthTable(){}; /// /// @brief Create a user record, if called on a existing user the auth is recreated diff --git a/include/db/DBManager.h b/include/db/DBManager.h index 724a3ae7..8ea6761f 100644 --- a/include/db/DBManager.h +++ b/include/db/DBManager.h @@ -27,7 +27,7 @@ class DBManager : public QObject public: DBManager(QObject* parent = nullptr); - ~DBManager(); + ~DBManager() override; /// set root path void setRootPath(const QString& rootPath); diff --git a/include/db/InstanceTable.h b/include/db/InstanceTable.h index 52f4a280..aff7d73f 100644 --- a/include/db/InstanceTable.h +++ b/include/db/InstanceTable.h @@ -27,9 +27,7 @@ public: // start/create the first Hyperion instance index 0 createInstance(); - }; - ~InstanceTable(){}; /// /// @brief Create a new Hyperion instance entry, the name needs to be unique @@ -71,7 +69,7 @@ public: /// @param inst The id that has been assigned /// @return True on success else false /// - inline bool deleteInstance(const quint8& inst) + inline bool deleteInstance(quint8 inst) { VectorPair cond; cond.append(CPair("instance",inst)); @@ -91,7 +89,7 @@ public: /// @param name The new name of the instance /// @return True on success else false (instance not found) /// - inline bool saveName(const quint8& inst, const QString& name) + inline bool saveName(quint8 inst, const QString& name) { VectorPair fcond; fcond.append(CPair("friendly_name",name)); @@ -119,7 +117,7 @@ public: /// @param justEnabled return just enabled instances if true /// @return The found instances /// - inline QVector getAllInstances(const bool& justEnabled = false) + inline QVector getAllInstances(bool justEnabled = false) { QVector results; getRecords(results, QStringList(), QStringList() << "instance ASC"); @@ -143,7 +141,7 @@ public: /// @param[in] user The user id /// @return true on success else false /// - inline bool instanceExist(const quint8& inst) + inline bool instanceExist(quint8 inst) { VectorPair cond; cond.append(CPair("instance",inst)); @@ -155,7 +153,7 @@ public: /// @param index The index to search for /// @return The name of this index, may return NOT FOUND if not found /// - inline const QString getNamebyIndex(const quint8 index) + inline const QString getNamebyIndex(quint8 index) { QVariantMap results; VectorPair cond; @@ -170,7 +168,7 @@ public: /// @brief Update 'last_use' timestamp /// @param inst The instance to update /// - inline void setLastUse(const quint8& inst) + inline void setLastUse(quint8 inst) { VectorPair cond; cond.append(CPair("instance", inst)); @@ -184,7 +182,7 @@ public: /// @param inst The instance to update /// @param newState True when enabled else false /// - inline void setEnable(const quint8& inst, const bool& newState) + inline void setEnable(quint8 inst, bool newState) { VectorPair cond; cond.append(CPair("instance", inst)); @@ -198,7 +196,7 @@ public: /// @param inst The instance to get /// @return True when enabled else false /// - inline bool isEnabled(const quint8& inst) + inline bool isEnabled(quint8 inst) { VectorPair cond; cond.append(CPair("instance", inst)); diff --git a/include/db/MetaTable.h b/include/db/MetaTable.h index e23d1ac8..acc27d03 100644 --- a/include/db/MetaTable.h +++ b/include/db/MetaTable.h @@ -23,13 +23,12 @@ public: setTable("meta"); createTable(QStringList()<<"uuid TEXT"<<"created_at TEXT"); }; - ~MetaTable(){}; /// /// @brief Get the uuid, if the uuid is not set it will be created /// @return The uuid /// - inline const QString getUUID() + inline QString getUUID() const { QVector results; getRecords(results, QStringList() << "uuid"); diff --git a/include/db/SettingsTable.h b/include/db/SettingsTable.h index 3a3028e0..19bf1054 100644 --- a/include/db/SettingsTable.h +++ b/include/db/SettingsTable.h @@ -15,7 +15,7 @@ class SettingsTable : public DBManager public: /// construct wrapper with settings table - SettingsTable(const quint8& instance, QObject* parent = nullptr) + SettingsTable(quint8 instance, QObject* parent = nullptr) : DBManager(parent) , _hyperion_inst(instance) { @@ -23,7 +23,6 @@ public: // create table columns createTable(QStringList()<<"type TEXT"<<"config TEXT"<<"hyperion_inst INTEGER"<<"updated_at TEXT"); }; - ~SettingsTable(){}; /// /// @brief Create or update a settings record diff --git a/include/effectengine/Effect.h b/include/effectengine/Effect.h index 4cc0a029..778f158b 100644 --- a/include/effectengine/Effect.h +++ b/include/effectengine/Effect.h @@ -38,23 +38,23 @@ public: , const QJsonObject &args = QJsonObject() , const QString &imageData = "" ); - virtual ~Effect(); + ~Effect() override; - virtual void run(); + void run() override; - int getPriority() const { return _priority; }; + int getPriority() const { return _priority; } /// /// @brief Set manual interuption to true, /// Note: DO NOT USE QThread::interuption! /// - void requestInterruption() { _interupt = true; }; + void requestInterruption() { _interupt = true; } /// /// @brief Check if the interuption flag has been set /// @return The flag state /// - bool isInterruptionRequested() { return _interupt; }; + bool isInterruptionRequested() { return _interupt; } QString getScript() const { return _script; } QString getName() const { return _name; } @@ -64,8 +64,8 @@ public: QJsonObject getArgs() const { return _args; } signals: - void setInput(const int priority, const std::vector &ledColors, const int timeout_ms, const bool &clearEffect); - void setInputImage(const int priority, const Image &image, const int timeout_ms, const bool &clearEffect); + void setInput(int priority, const std::vector &ledColors, int timeout_ms, bool clearEffect); + void setInputImage(int priority, const Image &image, int timeout_ms, bool clearEffect); private: diff --git a/include/effectengine/EffectEngine.h b/include/effectengine/EffectEngine.h index e657d523..0288a1ac 100644 --- a/include/effectengine/EffectEngine.h +++ b/include/effectengine/EffectEngine.h @@ -27,17 +27,17 @@ class EffectEngine : public QObject public: EffectEngine(Hyperion * hyperion); - virtual ~EffectEngine(); + ~EffectEngine() override; - const std::list & getEffects() const { return _availableEffects; }; + std::list getEffects() const { return _availableEffects; } - const std::list & getActiveEffects(); + std::list getActiveEffects() const; /// /// Get available schemas from EffectFileHandler /// @return all schemas /// - const std::list & getEffectSchemas(); + std::list getEffectSchemas() const; /// /// @brief Save an effect with EffectFileHandler @@ -115,8 +115,6 @@ private: std::list _activeEffects; - std::list _availableActiveEffects; - std::list _cachedActiveEffects; Logger * _log; diff --git a/include/effectengine/EffectFileHandler.h b/include/effectengine/EffectFileHandler.h index 8fbf72f3..428a8712 100644 --- a/include/effectengine/EffectFileHandler.h +++ b/include/effectengine/EffectFileHandler.h @@ -20,12 +20,12 @@ public: /// /// @brief Get all available effects /// - const std::list & getEffects() const { return _availableEffects; }; + std::list getEffects() const { return _availableEffects; } /// /// @brief Get all available schemas /// - const std::list & getEffectSchemas() { return _effectSchemas; }; + std::list getEffectSchemas() const { return _effectSchemas; } /// /// @brief Save an effect @@ -47,7 +47,7 @@ public slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); signals: /// diff --git a/include/flatbufserver/FlatBufferConnection.h b/include/flatbufserver/FlatBufferConnection.h index 51fe4f2a..1234d7b6 100644 --- a/include/flatbufserver/FlatBufferConnection.h +++ b/include/flatbufserver/FlatBufferConnection.h @@ -35,15 +35,15 @@ public: /// @param address The address of the Hyperion server (for example "192.168.0.32:19444) /// @param skipReply If true skip reply /// - FlatBufferConnection(const QString& origin, const QString & address, const int& priority, const bool& skipReply); + FlatBufferConnection(const QString& origin, const QString & address, int priority, bool skipReply); /// /// @brief Destructor /// - ~FlatBufferConnection(); + ~FlatBufferConnection() override; /// @brief Do not read reply messages from Hyperion if set to true - void setSkipReply(const bool& skip); + void setSkipReply(bool skip); /// /// @brief Register a new priority with given origin @@ -100,7 +100,7 @@ signals: /// /// @brief emits when a new videoMode was requested from flatbuf client /// - void setVideoMode(const VideoMode videoMode); + void setVideoMode(VideoMode videoMode); private: diff --git a/include/flatbufserver/FlatBufferServer.h b/include/flatbufserver/FlatBufferServer.h index f06a76d1..c5390c52 100644 --- a/include/flatbufserver/FlatBufferServer.h +++ b/include/flatbufserver/FlatBufferServer.h @@ -21,7 +21,7 @@ class FlatBufferServer : public QObject Q_OBJECT public: FlatBufferServer(const QJsonDocument& config, QObject* parent = nullptr); - ~FlatBufferServer(); + ~FlatBufferServer() override; public slots: /// @@ -29,7 +29,7 @@ public slots: /// @param type The type from enum /// @param config The configuration /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); void initServer(); diff --git a/include/grabber/AmlogicGrabber.h b/include/grabber/AmlogicGrabber.h index fee7bc37..dc2d8b79 100644 --- a/include/grabber/AmlogicGrabber.h +++ b/include/grabber/AmlogicGrabber.h @@ -17,7 +17,7 @@ public: /// @param[in] width The width of the captured screenshot /// @param[in] height The heigth of the captured screenshot /// - AmlogicGrabber(const unsigned width, const unsigned height); + AmlogicGrabber(unsigned width, unsigned height); ~AmlogicGrabber() override; /// diff --git a/include/grabber/AmlogicWrapper.h b/include/grabber/AmlogicWrapper.h index 5a8378f6..c0f22d98 100644 --- a/include/grabber/AmlogicWrapper.h +++ b/include/grabber/AmlogicWrapper.h @@ -18,7 +18,7 @@ public: /// @param[in] grabWidth The width of the grabbed image [pixels] /// @param[in] grabHeight The height of the grabbed images [pixels] /// - AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight); + AmlogicWrapper(unsigned grabWidth, unsigned grabHeight); public slots: /// diff --git a/include/grabber/DispmanxFrameGrabber.h b/include/grabber/DispmanxFrameGrabber.h index 949f8887..61b106a1 100644 --- a/include/grabber/DispmanxFrameGrabber.h +++ b/include/grabber/DispmanxFrameGrabber.h @@ -26,7 +26,7 @@ public: /// @param[in] width The width of the captured screenshot /// @param[in] height The heigth of the captured screenshot /// - DispmanxFrameGrabber(const unsigned width, const unsigned height); + DispmanxFrameGrabber(unsigned width, unsigned height); ~DispmanxFrameGrabber() override; @@ -50,7 +50,7 @@ private: /// /// @param vc_flags The snapshot grabbing mask /// - void setFlags(const int vc_flags); + void setFlags(int vc_flags); /// /// @brief free _vc_resource and captureBuffer diff --git a/include/grabber/DispmanxWrapper.h b/include/grabber/DispmanxWrapper.h index d0975ffc..b3b24d6d 100644 --- a/include/grabber/DispmanxWrapper.h +++ b/include/grabber/DispmanxWrapper.h @@ -20,7 +20,7 @@ public: /// @param[in] grabHeight The height of the grabbed images [pixels] /// @param[in] updateRate_Hz The image grab rate [Hz] /// - DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); + DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz); public slots: /// diff --git a/include/grabber/FramebufferFrameGrabber.h b/include/grabber/FramebufferFrameGrabber.h index e688961a..a3daa409 100644 --- a/include/grabber/FramebufferFrameGrabber.h +++ b/include/grabber/FramebufferFrameGrabber.h @@ -17,7 +17,7 @@ public: /// @param[in] width The width of the captured screenshot /// @param[in] height The heigth of the captured screenshot /// - FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height); + FramebufferFrameGrabber(const QString & device, unsigned width, unsigned height); /// /// Captures a single snapshot of the display and writes the data to the given image. The diff --git a/include/grabber/FramebufferWrapper.h b/include/grabber/FramebufferWrapper.h index 34ee545b..0a59f1d6 100644 --- a/include/grabber/FramebufferWrapper.h +++ b/include/grabber/FramebufferWrapper.h @@ -20,7 +20,7 @@ public: /// @param[in] grabHeight The height of the grabbed images [pixels] /// @param[in] updateRate_Hz The image grab rate [Hz] /// - FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); + FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz); public slots: /// diff --git a/include/grabber/OsxFrameGrabber.h b/include/grabber/OsxFrameGrabber.h index 2694734c..1aa5ee0d 100644 --- a/include/grabber/OsxFrameGrabber.h +++ b/include/grabber/OsxFrameGrabber.h @@ -24,7 +24,7 @@ public: /// @param[in] width The width of the captured screenshot /// @param[in] height The heigth of the captured screenshot /// - OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height); + OsxFrameGrabber(unsigned display, unsigned width, unsigned height); ~OsxFrameGrabber() override; /// diff --git a/include/grabber/OsxWrapper.h b/include/grabber/OsxWrapper.h index 88e401b1..94b28827 100644 --- a/include/grabber/OsxWrapper.h +++ b/include/grabber/OsxWrapper.h @@ -20,7 +20,7 @@ public: /// @param[in] grabHeight The height of the grabbed images [pixels] /// @param[in] updateRate_Hz The image grab rate [Hz] /// - OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); + OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz); public slots: /// diff --git a/include/grabber/QtGrabber.h b/include/grabber/QtGrabber.h index 8863c36e..b53c72a0 100644 --- a/include/grabber/QtGrabber.h +++ b/include/grabber/QtGrabber.h @@ -75,7 +75,7 @@ private: /// /// @brief Is called whenever we need new screen dimension calculations based on window geometry /// - int updateScreenDimensions(const bool& force); + int updateScreenDimensions(bool force); /// /// @brief free the _screen pointer diff --git a/include/grabber/QtWrapper.h b/include/grabber/QtWrapper.h index a6da25e3..4d32625c 100644 --- a/include/grabber/QtWrapper.h +++ b/include/grabber/QtWrapper.h @@ -19,7 +19,7 @@ public: /// @param[in] pixelDecimation Decimation factor for image [pixels] /// @param[in] updateRate_Hz The image grab rate [Hz] /// - QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz); + QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, unsigned updateRate_Hz); public slots: /// diff --git a/include/grabber/V4L2Grabber.h b/include/grabber/V4L2Grabber.h index 6e7b684a..894317d3 100644 --- a/include/grabber/V4L2Grabber.h +++ b/include/grabber/V4L2Grabber.h @@ -62,13 +62,13 @@ public: ); ~V4L2Grabber() override; - QRectF getSignalDetectionOffset() + QRectF getSignalDetectionOffset() const { return QRectF(_x_frac_min, _y_frac_min, _x_frac_max, _y_frac_max); } - bool getSignalDetectionEnabled() { return _signalDetectionEnabled; } - bool getCecDetectionEnabled() { return _cecDetectionEnabled; } + bool getSignalDetectionEnabled() const { return _signalDetectionEnabled; } + bool getCecDetectionEnabled() const { return _cecDetectionEnabled; } int grabFrame(Image &); @@ -128,27 +128,27 @@ public: /// /// @brief overwrite Grabber.h implementation /// - QStringList getV4L2devices() override; + QStringList getV4L2devices() const override; /// /// @brief overwrite Grabber.h implementation /// - QString getV4L2deviceName(QString devicePath) override; + QString getV4L2deviceName(const QString& devicePath) const override; /// /// @brief overwrite Grabber.h implementation /// - QMultiMap getV4L2deviceInputs(QString devicePath) override; + QMultiMap getV4L2deviceInputs(const QString& devicePath) const override; /// /// @brief overwrite Grabber.h implementation /// - QStringList getResolutions(QString devicePath) override; + QStringList getResolutions(const QString& devicePath) const override; /// /// @brief overwrite Grabber.h implementation /// - QStringList getFramerates(QString devicePath) override; + QStringList getFramerates(const QString& devicePath) const override; public slots: @@ -169,6 +169,7 @@ private: void getV4Ldevices(); bool init(); + void uninit(); bool open_device(); @@ -250,12 +251,13 @@ private: private: QString _deviceName; - std::map _v4lDevices; - QMap _deviceProperties; - VideoStandard _videoStandard; - io_method _ioMethod; - int _fileDescriptor; - std::vector _buffers; + std::map _v4lDevices; + QMap _deviceProperties; + + VideoStandard _videoStandard; + io_method _ioMethod; + int _fileDescriptor; + std::vector _buffers; PixelFormat _pixelFormat; int _pixelDecimation; diff --git a/include/grabber/V4L2Wrapper.h b/include/grabber/V4L2Wrapper.h index 9238d55c..78474fd6 100644 --- a/include/grabber/V4L2Wrapper.h +++ b/include/grabber/V4L2Wrapper.h @@ -18,8 +18,8 @@ public: int pixelDecimation ); ~V4L2Wrapper() override; - bool getSignalDetectionEnable(); - bool getCecDetectionEnable(); + bool getSignalDetectionEnable() const; + bool getCecDetectionEnable() const; public slots: bool start() override; @@ -30,9 +30,9 @@ public slots: void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax); void setSignalDetectionEnable(bool enable); void setCecDetectionEnable(bool enable); - void setDeviceVideoStandard(QString device, VideoStandard videoStandard); + void setDeviceVideoStandard(const QString& device, VideoStandard videoStandard); void handleCecEvent(CECEvent event); - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) override; + void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override; private slots: void newFrame(const Image & image); diff --git a/include/grabber/VideoStandard.h b/include/grabber/VideoStandard.h index 5b22f8f6..adcf43be 100644 --- a/include/grabber/VideoStandard.h +++ b/include/grabber/VideoStandard.h @@ -10,20 +10,20 @@ enum class VideoStandard { NO_CHANGE }; -inline VideoStandard parseVideoStandard(QString videoStandard) +inline VideoStandard parseVideoStandard(const QString& videoStandard) { // convert to lower case - videoStandard = videoStandard.toLower(); + QString standard = videoStandard.toLower(); - if (videoStandard == "pal") + if (standard == "pal") { return VideoStandard::PAL; } - else if (videoStandard == "ntsc") + else if (standard == "ntsc") { return VideoStandard::NTSC; } - else if (videoStandard == "secam") + else if (standard == "secam") { return VideoStandard::SECAM; } diff --git a/include/grabber/X11Wrapper.h b/include/grabber/X11Wrapper.h index 84d3b267..b876d828 100644 --- a/include/grabber/X11Wrapper.h +++ b/include/grabber/X11Wrapper.h @@ -24,7 +24,7 @@ public: /// @param[in] grabHeight The height of the grabbed images [pixels] /// @param[in] updateRate_Hz The image grab rate [Hz] /// - X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz); + X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, unsigned updateRate_Hz); /// /// Destructor of this framebuffer frame grabber. Releases any claimed resources. diff --git a/include/hyperion/AuthManager.h b/include/hyperion/AuthManager.h index 89ed6a88..41906465 100644 --- a/include/hyperion/AuthManager.h +++ b/include/hyperion/AuthManager.h @@ -38,25 +38,25 @@ public: /// @brief Get the unique id (imported from removed class 'Stats') /// @return The unique id /// - const QString &getID() { return _uuid; }; + QString getID() const { return _uuid; } /// /// @brief Check authorization is required according to the user setting /// @return True if authorization required else false /// - const bool &isAuthRequired() { return _authRequired; }; + bool isAuthRequired() const { return _authRequired; } /// /// @brief Check if authorization is required for local network connections /// @return True if authorization required else false /// - const bool &isLocalAuthRequired() { return _localAuthRequired; }; + bool isLocalAuthRequired() const { return _localAuthRequired; } /// /// @brief Check if authorization is required for local network connections for admin access /// @return True if authorization required else false /// - const bool &isLocalAdminAuthRequired() { return _localAdminAuthRequired; }; + bool isLocalAdminAuthRequired() const { return _localAdminAuthRequired; } /// /// @brief Reset Hyperion user @@ -68,18 +68,18 @@ public: /// @brief Check if user auth is temporary blocked due to failed attempts /// @return True on blocked and no further Auth requests will be accepted /// - bool isUserAuthBlocked() { return (_userAuthAttempts.length() >= 10); }; + bool isUserAuthBlocked() const { return (_userAuthAttempts.length() >= 10); } /// /// @brief Check if token auth is temporary blocked due to failed attempts /// @return True on blocked and no further Auth requests will be accepted /// - bool isTokenAuthBlocked() { return (_tokenAuthAttempts.length() >= 25); }; + bool isTokenAuthBlocked() const { return (_tokenAuthAttempts.length() >= 25); } /// Pointer of this instance static AuthManager *manager; /// Get Pointer of this instance - static AuthManager *getInstance() { return manager; }; + static AuthManager *getInstance() { return manager; } public slots: @@ -158,32 +158,32 @@ public slots: /// @param id The id of the request /// @param accept The accept or deny the request /// - void handlePendingTokenRequest(const QString &id, const bool &accept); + void handlePendingTokenRequest(const QString &id, bool accept); /// /// @brief Get pending requests /// @return All pending requests /// - QVector getPendingRequests(); + QVector getPendingRequests() const; /// /// @brief Get the current valid token for user. Make sure this call is allowed! /// @param usr the defined user /// @return The token /// - const QString getUserToken(const QString &usr = "Hyperion"); + QString getUserToken(const QString &usr = "Hyperion") const; /// /// @brief Get all available token entries /// - QVector getTokenList(); + QVector getTokenList() const; /// /// @brief Handle settings update from Hyperion Settingsmanager emit /// @param type settings type from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type &type, const QJsonDocument &config); + void handleSettingsUpdate(settings::type type, const QJsonDocument &config); signals: /// @@ -201,7 +201,7 @@ signals: /// @param comment The comment that was part of the request /// @param id The id that was part of the request /// - void tokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id); + void tokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id); /// /// @brief Emits whenever the token list changes @@ -214,7 +214,7 @@ private: /// @brief Increment counter for token/user auth /// @param user If true we increment USER auth instead of token /// - void setAuthBlock(const bool &user = false); + void setAuthBlock(bool user = false); /// Database interface for auth table AuthTable *_authTable; diff --git a/include/hyperion/BGEffectHandler.h b/include/hyperion/BGEffectHandler.h index 9dc6563c..b5504212 100644 --- a/include/hyperion/BGEffectHandler.h +++ b/include/hyperion/BGEffectHandler.h @@ -29,7 +29,7 @@ private slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) + void handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::BGEFFECT) { diff --git a/include/hyperion/CaptureCont.h b/include/hyperion/CaptureCont.h index 139f4295..93e63eab 100644 --- a/include/hyperion/CaptureCont.h +++ b/include/hyperion/CaptureCont.h @@ -18,8 +18,8 @@ class CaptureCont : public QObject public: CaptureCont(Hyperion* hyperion); - void setSystemCaptureEnable(const bool& enable); - void setV4LCaptureEnable(const bool& enable); + void setSystemCaptureEnable(bool enable); + void setV4LCaptureEnable(bool enable); private slots: /// @@ -27,14 +27,14 @@ private slots: /// @param component The component from enum /// @param enable The new state /// - void handleCompStateChangeRequest(const hyperion::Components component, bool enable); + void handleCompStateChangeRequest(hyperion::Components component, bool enable); /// /// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); /// /// @brief forward system image diff --git a/include/hyperion/ComponentRegister.h b/include/hyperion/ComponentRegister.h index d8d0ee57..9512923d 100644 --- a/include/hyperion/ComponentRegister.h +++ b/include/hyperion/ComponentRegister.h @@ -20,17 +20,17 @@ class ComponentRegister : public QObject public: ComponentRegister(Hyperion* hyperion); - ~ComponentRegister(); + ~ComponentRegister() override; /// /// @brief Check if a component is currently enabled /// @param comp The component from enum /// @return True if component is running else false. Not found is -1 /// - int isComponentEnabled(const hyperion::Components& comp) const; + int isComponentEnabled(hyperion::Components comp) const; /// contains all components and their state - std::map getRegister() const { return _componentStates; }; + std::map getRegister() const { return _componentStates; } signals: /// @@ -38,7 +38,7 @@ signals: /// @param comp The component /// @param state The new state of the component /// - void updatedComponentState(const hyperion::Components comp, const bool state); + void updatedComponentState(hyperion::Components comp, bool state); public slots: /// @@ -46,13 +46,13 @@ public slots: /// @param comp The component /// @param state The new state of the component /// - void setNewComponentState(const hyperion::Components comp, const bool activated); + void setNewComponentState(hyperion::Components comp, bool activated); private slots: /// /// @brief Handle COMP_ALL changes from Hyperion->compStateChangeRequest /// - void handleCompStateChangeRequest(const hyperion::Components comps, const bool activated); + void handleCompStateChangeRequest(hyperion::Components comps, bool activated); private: /// Hyperion instance diff --git a/include/hyperion/Grabber.h b/include/hyperion/Grabber.h index 0dc948f5..d198842e 100644 --- a/include/hyperion/Grabber.h +++ b/include/hyperion/Grabber.h @@ -22,7 +22,7 @@ class Grabber : public QObject Q_OBJECT public: - Grabber(QString grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0); + Grabber(const QString& grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0); /// /// Set the video mode (2D/3D) @@ -119,35 +119,35 @@ public: /// @brief Get a list of all available V4L devices /// @return List of all available V4L devices on success else empty List /// - virtual QStringList getV4L2devices() { return QStringList(); } + virtual QStringList getV4L2devices() const { return QStringList(); } /// /// @brief Get the V4L device name /// @param devicePath The device path /// @return The name of the V4L device on success else empty String /// - virtual QString getV4L2deviceName(QString devicePath) { return QString(); } + virtual QString getV4L2deviceName(const QString& /*devicePath*/) const { return QString(); } /// /// @brief Get a name/index pair of supported device inputs /// @param devicePath The device path /// @return multi pair of name/index on success else empty pair /// - virtual QMultiMap getV4L2deviceInputs(QString devicePath) { return QMultiMap(); } + virtual QMultiMap getV4L2deviceInputs(const QString& /*devicePath*/) const { return QMultiMap(); } /// /// @brief Get a list of supported device resolutions /// @param devicePath The device path /// @return List of resolutions on success else empty List /// - virtual QStringList getResolutions(QString devicePath) { return QStringList(); } + virtual QStringList getResolutions(const QString& /*devicePath*/) const { return QStringList(); } /// /// @brief Get a list of supported device framerates /// @param devicePath The device path /// @return List of framerates on success else empty List /// - virtual QStringList getFramerates(QString devicePath) { return QStringList(); } + virtual QStringList getFramerates(const QString& devicePath) const { return QStringList(); } protected: ImageResampler _imageResampler; diff --git a/include/hyperion/GrabberWrapper.h b/include/hyperion/GrabberWrapper.h index d190a997..dd1880f0 100644 --- a/include/hyperion/GrabberWrapper.h +++ b/include/hyperion/GrabberWrapper.h @@ -29,9 +29,9 @@ class GrabberWrapper : public QObject { Q_OBJECT public: - GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz = 0); + GrabberWrapper(const QString& grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz = 0); - virtual ~GrabberWrapper(); + ~GrabberWrapper() override; static GrabberWrapper* instance; static GrabberWrapper* getInstance(){ return instance; } @@ -60,35 +60,35 @@ public: /// @brief Get a list of all available V4L devices /// @return List of all available V4L devices on success else empty List /// - virtual QStringList getV4L2devices(); + virtual QStringList getV4L2devices() const; /// /// @brief Get the V4L device name /// @param devicePath The device path /// @return The name of the V4L device on success else empty String /// - virtual QString getV4L2deviceName(QString devicePath); + virtual QString getV4L2deviceName(const QString& devicePath) const; /// /// @brief Get a name/index pair of supported device inputs /// @param devicePath The device path /// @return multi pair of name/index on success else empty pair /// - virtual QMultiMap getV4L2deviceInputs(QString devicePath); + virtual QMultiMap getV4L2deviceInputs(const QString& devicePath) const; /// /// @brief Get a list of supported device resolutions /// @param devicePath The device path /// @return List of resolutions on success else empty List /// - virtual QStringList getResolutions(QString devicePath); + virtual QStringList getResolutions(const QString& devicePath) const; /// /// @brief Get a list of supported device framerates /// @param devicePath The device path /// @return List of framerates on success else empty List /// - virtual QStringList getFramerates(QString devicePath); + virtual QStringList getFramerates(const QString& devicePath) const; static QStringList availableGrabbers(); @@ -122,7 +122,7 @@ public slots: /// Set the video mode (2D/3D) /// @param[in] mode The new video mode /// - virtual void setVideoMode(const VideoMode& videoMode); + virtual void setVideoMode(VideoMode videoMode); /// /// Set the crop values @@ -138,7 +138,7 @@ public slots: /// @param type settingyType from enum /// @param config configuration object /// - virtual void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config); signals: /// @@ -149,7 +149,7 @@ signals: private slots: /// @brief Handle a source request event from Hyperion. /// Will start and stop grabber based on active listeners count - void handleSourceRequest(const hyperion::Components& component, const int hyperionInd, const bool listen); + void handleSourceRequest(hyperion::Components component, int hyperionInd, bool listen); /// /// @brief Update Update capture rate diff --git a/include/hyperion/Hyperion.h b/include/hyperion/Hyperion.h index ae321ed1..09d8be6b 100644 --- a/include/hyperion/Hyperion.h +++ b/include/hyperion/Hyperion.h @@ -120,7 +120,7 @@ public slots: /// @param[in] owner Specific owner string, might be empty /// @param[in] smooth_cfg The smooth id to use /// - void registerInput(const int priority, const hyperion::Components& component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = 0); + void registerInput(int priority, hyperion::Components component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = 0); /// /// @brief Update the current color of a priority (prev registered with registerInput()) @@ -131,7 +131,7 @@ public slots: /// @param clearEffect Should be true when NOT called from an effect /// @return True on success, false when priority is not found /// - bool setInput(const int priority, const std::vector& ledColors, const int timeout_ms = -1, const bool& clearEffect = true); + bool setInput(int priority, const std::vector& ledColors, int timeout_ms = -1, bool clearEffect = true); /// /// @brief Update the current image of a priority (prev registered with registerInput()) @@ -142,7 +142,7 @@ public slots: /// @param clearEffect Should be true when NOT called from an effect /// @return True on success, false when priority is not found /// - bool setInputImage(const int priority, const Image& image, const int64_t timeout_ms = -1, const bool& clearEffect = true); + bool setInputImage(int priority, const Image& image, int64_t timeout_ms = -1, bool clearEffect = true); /// /// Writes a single color to all the leds for the given time and priority @@ -155,20 +155,20 @@ public slots: /// @param[in] origin The setter /// @param clearEffect Should be true when NOT called from an effect /// - void setColor(const int priority, const std::vector &ledColors, const int timeout_ms = -1, const QString& origin = "System" ,bool clearEffects = true); + void setColor(int priority, const std::vector &ledColors, int timeout_ms = -1, const QString& origin = "System" ,bool clearEffects = true); /// /// @brief Set the given priority to inactive /// @param priority The priority /// @return True on success false if not found /// - bool setInputInactive(const quint8& priority); + bool setInputInactive(quint8 priority); /// /// Returns the list with unique adjustment identifiers /// @return The list with adjustment identifiers /// - const QStringList & getAdjustmentIds() const; + QStringList getAdjustmentIds() const; /// /// Returns the ColorAdjustment with the given identifier @@ -187,7 +187,7 @@ public slots: /// @param[in] forceClearAll Force the clear /// @return True on success else false (not found) /// - bool clear(const int priority, bool forceClearAll=false); + bool clear(int priority, bool forceClearAll=false); /// ############# // EFFECTENGINE @@ -233,15 +233,15 @@ public slots: /// Get the list of available effects /// @return The list of available effects - const std::list &getEffects() const; + std::list getEffects() const; /// Get the list of active effects /// @return The list of active effects - const std::list &getActiveEffects() const; + std::list getActiveEffects() const; /// Get the list of available effect schema files /// @return The list of available effect schema files - const std::list &getEffectSchemas() const; + std::list getEffectSchemas() const; /// ############# /// PRIORITYMUXER @@ -255,18 +255,18 @@ public slots: /// @brief enable/disable automatic/priorized source selection /// @param state The new state /// - void setSourceAutoSelect(const bool state); + void setSourceAutoSelect(bool state); /// /// @brief set current input source to visible /// @param priority the priority channel which should be vidible /// @return true if success, false on error /// - bool setVisiblePriority(const int& priority); + bool setVisiblePriority(int priority); /// gets current state of automatic/priorized source selection /// @return the state - bool sourceAutoSelectEnabled(); + bool sourceAutoSelectEnabled() const; /// /// Returns the current priority @@ -280,7 +280,7 @@ public slots: /// /// @return bool /// - bool isCurrentPriority(const int priority) const; + bool isCurrentPriority(int priority) const; /// /// Returns a list of all registered priorities @@ -296,7 +296,7 @@ public slots: /// /// @return The information of the given, a not found priority will return lowest priority as fallback /// - InputInfo getPriorityInfo(const int priority) const; + InputInfo getPriorityInfo(int priority) const; /// ############# /// SETTINGSMANAGER @@ -305,11 +305,11 @@ public slots: /// @param type The settingsType from enum /// @return Data Document /// - QJsonDocument getSetting(const settings::type& type) const; + QJsonDocument getSetting(settings::type type) const; /// gets the current json config object from SettingsManager /// @return json config - const QJsonObject& getQJsonConfig() const; + QJsonObject getQJsonConfig() const; /// /// @brief Save a complete json config @@ -317,7 +317,7 @@ public slots: /// @param correct If true will correct json against schema before save /// @return True on success else false /// - bool saveSettings(QJsonObject config, const bool& correct = false); + bool saveSettings(const QJsonObject& config, bool correct = false); /// ############ /// COMPONENTREGISTER @@ -332,7 +332,7 @@ public slots: /// @param[in] component The component from enum /// @param[in] state The state of the component [true | false] /// - void setNewComponentState(const hyperion::Components& component, const bool& state); + void setNewComponentState(hyperion::Components component, bool state); /// /// @brief Get a list of all contrable components and their current state @@ -345,16 +345,16 @@ public slots: /// @param The component to test /// @return Component state /// - int isComponentEnabled(const hyperion::Components& comp); + int isComponentEnabled(hyperion::Components comp) const; /// sets the methode how image is maped to leds at ImageProcessor - void setLedMappingType(const int& mappingType); + void setLedMappingType(int mappingType); /// /// Set the video mode (2D/3D) /// @param[in] mode The new video mode /// - void setVideoMode(const VideoMode& mode); + void setVideoMode(VideoMode mode); /// /// @brief Init after thread start @@ -383,13 +383,13 @@ signals: /// @param component The component from enum /// @param enabled The new state of the component /// - void compStateChangeRequest(const hyperion::Components component, bool enabled); + void compStateChangeRequest(hyperion::Components component, bool enabled); /// /// @brief Emits whenever the imageToLedsMapping has changed /// @param mappingType The new mapping type /// - void imageToLedsMappingChanged(const int& mappingType); + void imageToLedsMappingChanged(int mappingType); /// /// @brief Emits whenever the visible priority delivers a image which is applied in update() @@ -402,27 +402,27 @@ signals: void forwardJsonMessage(QJsonObject); /// Signal which is emitted, when a new system proto image should be forwarded - void forwardSystemProtoMessage(const QString, const Image); + void forwardSystemProtoMessage(const QString&, const Image&); /// Signal which is emitted, when a new V4l proto image should be forwarded - void forwardV4lProtoMessage(const QString, const Image); + void forwardV4lProtoMessage(const QString&, const Image&); /// /// @brief Is emitted from clients who request a videoMode change /// - void videoMode(const VideoMode& mode); + void videoMode(VideoMode mode); /// /// @brief A new videoMode was requested (called from Daemon!) /// - void newVideoMode(const VideoMode& mode); + void newVideoMode(VideoMode mode); /// /// @brief Emits whenever a config part changed. SIGNAL PIPE helper for SettingsManager -> HyperionDaemon /// @param type The settings type from enum /// @param data The data as QJsonDocument /// - void settingsChanged(const settings::type& type, const QJsonDocument& data); + void settingsChanged(settings::type type, const QJsonDocument& data); /// /// @brief Emits whenever the adjustments have been updated @@ -459,19 +459,19 @@ private slots: /// @brief Handle whenever the visible component changed /// @param comp The new component /// - void handleVisibleComponentChanged(const hyperion::Components& comp); + void handleVisibleComponentChanged(hyperion::Components comp); /// /// @brief Apply settings updates for LEDS and COLOR /// @param type The type from enum /// @param config The configuration /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); /// /// @brief Apply new videoMode from Daemon to _currVideoMode /// - void handleNewVideoMode(const VideoMode& mode) { _currVideoMode = mode; } + void handleNewVideoMode(VideoMode mode) { _currVideoMode = mode; } private: friend class HyperionDaemon; @@ -481,7 +481,7 @@ private: /// @brief Constructs the Hyperion instance, just accessible for HyperionIManager /// @param instance The instance index /// - Hyperion(const quint8& instance); + Hyperion(quint8 instance); /// instance index const quint8 _instIndex; diff --git a/include/hyperion/HyperionIManager.h b/include/hyperion/HyperionIManager.h index 4943ca73..73b86654 100644 --- a/include/hyperion/HyperionIManager.h +++ b/include/hyperion/HyperionIManager.h @@ -38,19 +38,19 @@ public slots: /// @param inst The instance to check /// @return True when running else false /// - bool IsInstanceRunning(const quint8& inst) { return _runningInstances.contains(inst); } + bool IsInstanceRunning(quint8 inst) const { return _runningInstances.contains(inst); } /// /// @brief Get a Hyperion instance by index /// @param intance the index /// @return Hyperion instance, if index is not found returns instance 0 /// - Hyperion* getHyperionInstance(const quint8& instance = 0); + Hyperion* getHyperionInstance(quint8 instance = 0); /// /// @brief Get instance data of all instaces in db + running state /// - const QVector getInstanceData(); + QVector getInstanceData() const; /// /// @brief Start a Hyperion instance @@ -58,20 +58,20 @@ public slots: /// @param block If true return when thread has been started /// @return Return true on success, false if not found in db /// - bool startInstance(const quint8& inst, const bool& block = false); + bool startInstance(quint8 inst, bool block = false); /// /// @brief Stop a Hyperion instance /// @param instance Instance index /// @return Return true on success, false if not found in db /// - bool stopInstance(const quint8& inst); + bool stopInstance(quint8 inst); /// /// @brief Toggle the state of all Hyperion instances /// @param pause If true all instances toggle to pause, else to resume /// - void toggleStateAllInstances(const bool& pause = false); + void toggleStateAllInstances(bool pause = false); /// /// @brief Create a new Hyperion instance entry in db @@ -79,14 +79,14 @@ public slots: /// @param start If true it will be started after creation (async) /// @return Return true on success false if name is already in use or a db error occurred /// - bool createInstance(const QString& name, const bool& start = false); + bool createInstance(const QString& name, bool start = false); /// /// @brief Delete Hyperion instance entry in db. Cleanup also all associated table data for this instance /// @param inst The instance index /// @return Return true on success, false if not found or not allowed /// - bool deleteInstance(const quint8& inst); + bool deleteInstance(quint8 inst); /// /// @brief Assign a new name to the given instance @@ -94,7 +94,7 @@ public slots: /// @param name The instance name index /// @return Return true on success, false if not found /// - bool saveName(const quint8& inst, const QString& name); + bool saveName(quint8 inst, const QString& name); signals: /// @@ -103,7 +103,7 @@ signals: /// @param instance The index of instance /// @param name The name of the instance, just available with H_CREATED /// - void instanceStateChanged(const InstanceState& state, const quint8& instance, const QString& name = QString()); + void instanceStateChanged(InstanceState state, quint8 instance, const QString& name = QString()); /// /// @brief Emits whenever something changes, the lazy version of instanceStateChanged (- H_ON_STOP) + saveName() emit @@ -118,7 +118,7 @@ signals: /// /// @brief PIPE videoMode back to Hyperion /// - void newVideoMode(const VideoMode& mode); + void newVideoMode(VideoMode mode); /////////////////////////////////////// /// FROM HYPERION TO HYPERIONDAEMON /// @@ -127,17 +127,17 @@ signals: /// /// @brief PIPE settings events from Hyperion /// - void settingsChanged(const settings::type& type, const QJsonDocument& data); + void settingsChanged(settings::type type, const QJsonDocument& data); /// /// @brief PIPE videoMode request changes from Hyperion to HyperionDaemon /// - void requestVideoMode(const VideoMode& mode); + void requestVideoMode(VideoMode mode); /// /// @brief PIPE component state changes from Hyperion to HyperionDaemon /// - void compStateChangeRequest(const hyperion::Components component, bool enable); + void compStateChangeRequest(hyperion::Components component, bool enable); private slots: /// @@ -172,7 +172,7 @@ private: /// @brief check if a instance is allowed for management. Instance 0 represents the root instance /// @apram inst The instance to check /// - bool isInstAllowed(const quint8& inst) { return (inst > 0); } + bool isInstAllowed(quint8 inst) const { return (inst > 0); } private: Logger* _log; diff --git a/include/hyperion/ImageProcessor.h b/include/hyperion/ImageProcessor.h index 2afaba4f..5c6f2e46 100644 --- a/include/hyperion/ImageProcessor.h +++ b/include/hyperion/ImageProcessor.h @@ -36,7 +36,7 @@ public: /// ImageProcessor(const LedString& ledString, Hyperion* hyperion); - ~ImageProcessor(); + ~ImageProcessor() override; /// /// Specifies the width and height of 'incomming' images. This will resize the buffer-image to @@ -46,7 +46,7 @@ public: /// @param[in] width The new width of the buffer-image /// @param[in] height The new height of the buffer-image /// - void setSize(const unsigned width, const unsigned height); + void setSize(unsigned width, unsigned height); /// /// @brief Update the led string (eg on settings change) @@ -54,15 +54,15 @@ public: void setLedString(const LedString& ledString); /// Returns starte of black border detector - bool blackBorderDetectorEnabled(); + bool blackBorderDetectorEnabled() const; /// Returns the current _userMappingType, this may not be the current applied type! - const int & getUserLedMappingType() { return _userMappingType; }; + int getUserLedMappingType() const { return _userMappingType; } /// Returns the current _mappingType - const int & ledMappingType() { return _mappingType; }; + int ledMappingType() const { return _mappingType; } - static int mappingTypeToInt(QString mappingType); + static int mappingTypeToInt(const QString& mappingType); static QString mappingTypeToStr(int mappingType); /// @@ -215,7 +215,7 @@ private: } private slots: - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); private: Logger * _log; diff --git a/include/hyperion/ImageToLedsMap.h b/include/hyperion/ImageToLedsMap.h index 971f501f..ade94b8d 100644 --- a/include/hyperion/ImageToLedsMap.h +++ b/include/hyperion/ImageToLedsMap.h @@ -57,8 +57,8 @@ namespace hyperion /// unsigned height() const; - unsigned horizontalBorder() const { return _horizontalBorder; }; - unsigned verticalBorder() const { return _verticalBorder; }; + unsigned horizontalBorder() const { return _horizontalBorder; } + unsigned verticalBorder() const { return _verticalBorder; } /// /// Determines the mean color for each led using the mapping the image given diff --git a/include/hyperion/LedString.h b/include/hyperion/LedString.h index 4756bee3..afd41666 100644 --- a/include/hyperion/LedString.h +++ b/include/hyperion/LedString.h @@ -20,7 +20,7 @@ enum class ColorOrder ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR }; -inline QString colorOrderToString(const ColorOrder colorOrder) +inline QString colorOrderToString(ColorOrder colorOrder) { switch (colorOrder) { diff --git a/include/hyperion/MessageForwarder.h b/include/hyperion/MessageForwarder.h index 7c0ceb4c..be4fd4db 100644 --- a/include/hyperion/MessageForwarder.h +++ b/include/hyperion/MessageForwarder.h @@ -34,10 +34,10 @@ class MessageForwarder : public QObject Q_OBJECT public: MessageForwarder(Hyperion* hyperion); - ~MessageForwarder(); + ~MessageForwarder() override; - void addJsonSlave(QString slave); - void addFlatbufferSlave(QString slave); + void addJsonSlave(const QString& slave); + void addFlatbufferSlave(const QString& slave); private slots: /// @@ -45,20 +45,20 @@ private slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type &type, const QJsonDocument &config); + void handleSettingsUpdate(settings::type type, const QJsonDocument &config); /// /// @brief Handle component state change MessageForwarder /// @param component The component from enum /// @param enable The new state /// - void handleCompStateChangeRequest(const hyperion::Components component, bool enable); + void handleCompStateChangeRequest(hyperion::Components component, bool enable); /// /// @brief Handle priority updates from Priority Muxer /// @param priority The new visible priority /// - void handlePriorityChanges(const quint8 &priority); + void handlePriorityChanges(quint8 priority); /// /// @brief Forward message to all json slaves diff --git a/include/hyperion/MultiColorAdjustment.h b/include/hyperion/MultiColorAdjustment.h index df101122..3db3f47e 100644 --- a/include/hyperion/MultiColorAdjustment.h +++ b/include/hyperion/MultiColorAdjustment.h @@ -16,7 +16,7 @@ class MultiColorAdjustment { public: - MultiColorAdjustment(const unsigned ledCnt); + MultiColorAdjustment(unsigned ledCnt); ~MultiColorAdjustment(); /** @@ -26,7 +26,7 @@ public: */ void addAdjustment(ColorAdjustment * adjustment); - void setAdjustmentForLed(const QString& id, const unsigned startLed, unsigned endLed); + void setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed); bool verifyAdjustments() const; @@ -36,7 +36,7 @@ public: /// Returns the identifier of all the unique ColorAdjustment /// /// @return The list with unique id's of the ColorAdjustment - const QStringList & getAdjustmentIds(); + QStringList getAdjustmentIds() const; /// /// Returns the pointer to the ColorAdjustment with the given id diff --git a/include/hyperion/PriorityMuxer.h b/include/hyperion/PriorityMuxer.h index 7546b857..fb444628 100644 --- a/include/hyperion/PriorityMuxer.h +++ b/include/hyperion/PriorityMuxer.h @@ -68,20 +68,20 @@ public: /// /// Destructor /// - ~PriorityMuxer(); + ~PriorityMuxer() override; /// /// @brief Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend /// @param enable The new state /// - void setEnable(const bool& enable); + void setEnable(bool enable); /// @brief Enable or disable auto source selection /// @param enable True if it should be enabled else false /// @param update True to update _currentPriority - INTERNAL usage. /// @return True if changed has been applied, false if the state is unchanged /// - bool setSourceAutoSelectEnabled(const bool& enabel, const bool& update = true); + bool setSourceAutoSelectEnabled(bool enabel, bool update = true); /// /// @brief Get the state of source auto selection @@ -94,13 +94,13 @@ public: /// @param priority The /// @return True on success, false if priority not found /// - bool setPriority(const uint8_t priority); + bool setPriority(uint8_t priority); /// /// @brief Update all ledColos with min length of >= 1 to fit the new led length /// @param[in] ledCount The count of leds /// - void updateLedColorsLength(const int& ledCount); + void updateLedColorsLength(int ledCount); /// /// Returns the current priority @@ -114,7 +114,7 @@ public: /// @param priority The priority channel /// @return True if the priority channel exists else false /// - bool hasPriority(const int priority) const; + bool hasPriority(int priority) const; /// /// Returns the number of active priorities @@ -131,7 +131,7 @@ public: /// /// @return The information for the specified priority channel /// - const InputInfo getInputInfo(const int priority) const; + InputInfo getInputInfo(int priority) const; /// /// @brief Register a new input by priority, the priority is not active (timeout -100 isn't muxer recognized) until you start to update the data with setInput() @@ -142,7 +142,7 @@ public: /// @param[in] owner Speicifc owner string, might be empty /// @param[in] smooth_cfg The smooth id to use /// - void registerInput(const int priority, const hyperion::Components& component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = SMOOTHING_MODE_DEFAULT); + void registerInput(int priority, hyperion::Components component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = SMOOTHING_MODE_DEFAULT); /// /// @brief Update the current color of a priority (prev registered with registerInput()) @@ -151,7 +151,7 @@ public: /// @param timeout_ms The new timeout (defaults to -1 endless) /// @return True on success, false when priority is not found /// - bool setInput(const int priority, const std::vector& ledColors, int64_t timeout_ms = -1); + bool setInput(int priority, const std::vector& ledColors, int64_t timeout_ms = -1); /// /// @brief Update the current image of a priority (prev registered with registerInput()) @@ -160,14 +160,14 @@ public: /// @param timeout_ms The new timeout (defaults to -1 endless) /// @return True on success, false when priority is not found /// - bool setInputImage(const int priority, const Image& image, int64_t timeout_ms = -1); + bool setInputImage(int priority, const Image& image, int64_t timeout_ms = -1); /// /// @brief Set the given priority to inactive /// @param priority The priority /// @return True on success false if not found /// - bool setInputInactive(const quint8& priority); + bool setInputInactive(quint8 priority); /// /// Clears the specified priority channel and update _currentPriority on success @@ -175,7 +175,7 @@ public: /// @param[in] priority The priority of the channel to clear /// @return True if priority has been cleared else false (not found) /// - bool clearInput(const uint8_t priority); + bool clearInput(uint8_t priority); /// /// Clears all priority channels @@ -185,7 +185,7 @@ public: /// /// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes) /// - void queuePush(void){ emit timeRunner(); }; + void queuePush() { emit timeRunner(); } signals: /// @@ -198,38 +198,38 @@ signals: /// @param priority The priority which has changed /// @param state If true it was added else it was removed! /// - void priorityChanged(const quint8& priority, const bool& state); + void priorityChanged(quint8 priority, bool state); /// /// @brief Emits whenever the visible priority has changed /// @param priority The new visible priority /// - void visiblePriorityChanged(const quint8& priority); + void visiblePriorityChanged(quint8 priority); /// /// @brief Emits whenever the current visible component changed /// @param comp The new component /// - void visibleComponentChanged(const hyperion::Components& comp); + void visibleComponentChanged(hyperion::Components comp); /// /// @brief Emits whenever a priority changes active state /// @param priority The priority who changed the active state /// @param state The new state, state true = active else false /// - void activeStateChanged(const quint8& priority, const bool& state); + void activeStateChanged(quint8 priority, bool state); /// /// @brief Emits whenever the auto selection state has been changed /// @param state The new state of auto selection; True enabled else false /// - void autoSelectChanged(const bool& state); + void autoSelectChanged(bool state); /// /// @brief Emits whenever something changes which influences the priorities listing /// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1 /// - void prioritiesChanged(void); + void prioritiesChanged(); /// /// internal used signal to resolve treading issues with timer @@ -246,14 +246,14 @@ private slots: /// Updates the current time. Channels with a configured time out will be checked and cleared if /// required. /// - void setCurrentTime(void); + void setCurrentTime(); private: /// /// @brief Get the component of the given priority /// @return The component /// - hyperion::Components getComponentOfPriority(const int& priority); + hyperion::Components getComponentOfPriority(int priority) const; /// Logger instance Logger* _log; diff --git a/include/hyperion/SettingsManager.h b/include/hyperion/SettingsManager.h index d14a31d6..d20e3afb 100644 --- a/include/hyperion/SettingsManager.h +++ b/include/hyperion/SettingsManager.h @@ -21,7 +21,7 @@ public: /// @params instance Instance index of HyperionInstanceManager /// @params parent The parent hyperion instance /// - SettingsManager(const quint8& instance, QObject* parent = nullptr); + SettingsManager(quint8 instance, QObject* parent = nullptr); /// /// @brief Save a complete json config @@ -29,20 +29,20 @@ public: /// @param correct If true will correct json against schema before save /// @return True on success else false /// - bool saveSettings(QJsonObject config, const bool& correct = false); + bool saveSettings(QJsonObject config, bool correct = false); /// /// @brief get a single setting json from config /// @param type The settings::type from enum /// @return The requested json data as QJsonDocument /// - const QJsonDocument getSetting(const settings::type& type); + QJsonDocument getSetting(settings::type type) const; /// /// @brief get the full settings object of this instance (with global settings) /// @return The requested json /// - const QJsonObject & getSettings() { return _qconfig; }; + const QJsonObject & getSettings() const { return _qconfig; }; signals: /// @@ -50,7 +50,7 @@ signals: /// @param type The settings type from enum /// @param data The data as QJsonDocument /// - void settingsChanged(const settings::type& type, const QJsonDocument& data); + void settingsChanged(settings::type type, const QJsonDocument& data); private: /// diff --git a/include/jsonserver/JsonServer.h b/include/jsonserver/JsonServer.h index 19b1e374..21407d6a 100644 --- a/include/jsonserver/JsonServer.h +++ b/include/jsonserver/JsonServer.h @@ -29,7 +29,7 @@ public: /// @param The configuration /// JsonServer(const QJsonDocument& config); - ~JsonServer(); + ~JsonServer() override; /// /// @return the port number on which this TCP listens for incoming connections @@ -46,7 +46,7 @@ private slots: /// /// Slot which is called when a client closes a connection /// - void closedConnection(void); + void closedConnection(); public slots: /// @@ -54,7 +54,7 @@ public slots: /// @param type settings type from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); private: /// The TCP server object diff --git a/include/leddevice/LedDeviceFactory.h b/include/leddevice/LedDeviceFactory.h index ea7be292..43dc5987 100644 --- a/include/leddevice/LedDeviceFactory.h +++ b/include/leddevice/LedDeviceFactory.h @@ -1,8 +1,8 @@ #ifndef LEDEVICEFACTORY_H #define LEDEVICEFACTORY_H -// LedDevice includes -#include +class LedDevice; +class QJsonObject; /// /// The LedDeviceFactory is responsible for constructing 'LedDevices' @@ -10,7 +10,6 @@ class LedDeviceFactory { public: - /// /// Constructs a LedDevice based on the given configuration /// diff --git a/include/leddevice/LedDeviceWrapper.h b/include/leddevice/LedDeviceWrapper.h index 8fa3244e..0413d03e 100644 --- a/include/leddevice/LedDeviceWrapper.h +++ b/include/leddevice/LedDeviceWrapper.h @@ -33,7 +33,7 @@ public: /// @brief Get all available device schemas /// @return device schemas /// - static const QJsonObject getLedDeviceSchemas(); + static QJsonObject getLedDeviceSchemas(); /// /// @brief add all device constructors to the map @@ -50,22 +50,22 @@ public: /// @brief Get the current latch time of the ledDevice /// @ return latch time in ms /// - int getLatchTime(); + int getLatchTime() const; /// /// @brief Get the current active ledDevice type /// - QString getActiveDeviceType(); + QString getActiveDeviceType() const; /// /// @brief Return the last enable state /// - bool enabled(); + bool enabled() const; /// /// @brief Get the current colorOrder from device /// - QString getColorOrder(); + QString getColorOrder() const; /// /// @brief Get the number of LEDs from device @@ -78,7 +78,7 @@ public slots: /// @param component The comp from enum /// @param state The new state /// - void handleComponentState(const hyperion::Components component, const bool state); + void handleComponentState(hyperion::Components component, bool state); signals: /// diff --git a/include/protoserver/ProtoServer.h b/include/protoserver/ProtoServer.h index 0e18181e..b722dbc4 100644 --- a/include/protoserver/ProtoServer.h +++ b/include/protoserver/ProtoServer.h @@ -30,7 +30,7 @@ public slots: /// @param type The type from enum /// @param config The configuration /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); void initServer(); diff --git a/include/python/PythonInit.h b/include/python/PythonInit.h index 97b0cb16..d3d5ce47 100644 --- a/include/python/PythonInit.h +++ b/include/python/PythonInit.h @@ -7,7 +7,7 @@ class PythonInit { private: friend class HyperionDaemon; - + PythonInit(); ~PythonInit(); }; diff --git a/include/ssdp/SSDPDiscover.h b/include/ssdp/SSDPDiscover.h index 290a7690..f4ad94de 100644 --- a/include/ssdp/SSDPDiscover.h +++ b/include/ssdp/SSDPDiscover.h @@ -58,7 +58,7 @@ public: /// @param timeout_ms The timeout in ms /// @return The address+port of web-server or empty if timed out /// - const QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", const int &timeout_ms = 3000); + QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", int timeout_ms = 3000); /// /// @brief Discover services via ssdp. @@ -89,13 +89,6 @@ public: /// int discoverServices(const QString &searchTarget="ssdp:all", const QString &key="LOCATION"); - /// - /// @brief Get services discovered during discoverServices() - /// - /// @return Map of discovered services - /// - const QMap getServicesDiscovered () { return _services; } - /// /// @brief Get services discovered during discoverServices(). /// @@ -122,7 +115,7 @@ public: /// /// @return Discovered services as JSON-document /// - QJsonArray getServicesDiscoveredJson(); + QJsonArray getServicesDiscoveredJson() const; /// /// @brief Set the ssdp discovery address (HOST) diff --git a/include/ssdp/SSDPHandler.h b/include/ssdp/SSDPHandler.h index 99fdbdfe..dc20bd29 100644 --- a/include/ssdp/SSDPHandler.h +++ b/include/ssdp/SSDPHandler.h @@ -16,11 +16,12 @@ class QNetworkConfigurationManager; /// UPnP 1.0: spec: http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.0.pdf /// -class SSDPHandler : public SSDPServer{ +class SSDPHandler : public SSDPServer +{ Q_OBJECT public: - SSDPHandler(WebServer* webserver, const quint16& flatBufPort, const quint16& jsonServerPort, const QString &name, QObject * parent = nullptr); - ~SSDPHandler(); + SSDPHandler(WebServer* webserver, quint16 flatBufPort, quint16 jsonServerPort, const QString &name, QObject * parent = nullptr); + ~SSDPHandler() override; /// /// @brief Sends BYE BYE and stop server @@ -37,14 +38,14 @@ public slots: /// @brief get state changes from webserver /// @param newState true for started and false for stopped /// - void handleWebServerStateChange(const bool newState); + void handleWebServerStateChange(bool newState); /// /// @brief Handle settings update from Hyperion Settingsmanager emit /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); private: /// @@ -72,7 +73,7 @@ private: /// @brief Send alive/byebye message based on _deviceList /// @param alive When true send alive, else byebye /// - void sendAnnounceList(const bool alive); + void sendAnnounceList(bool alive); private slots: /// @@ -82,7 +83,7 @@ private slots: /// @param address The ip of the caller /// @param port The port of the caller /// - void handleMSearchRequest(const QString& target, const QString& mx, const QString address, const quint16 & port); + void handleMSearchRequest(const QString& target, const QString& mx, const QString address, quint16 port); /// /// @brief Handle changes in the network configuration diff --git a/include/ssdp/SSDPServer.h b/include/ssdp/SSDPServer.h index 983c9414..9cff55d4 100644 --- a/include/ssdp/SSDPServer.h +++ b/include/ssdp/SSDPServer.h @@ -7,7 +7,8 @@ class QUdpSocket; /// /// @brief The SSDP Server sends and receives (parses) SSDP requests /// -class SSDPServer : public QObject { +class SSDPServer : public QObject +{ Q_OBJECT public: @@ -17,7 +18,7 @@ public: /// @param parent The parent object /// SSDPServer(QObject* parent = nullptr); - virtual ~SSDPServer(); + ~SSDPServer() override; /// /// @brief Prepare server after thread start @@ -41,7 +42,7 @@ public: /// @param senderIp Ip address of the sender /// @param senderPort The port of the sender /// - void sendMSearchResponse(const QString& st, const QString& senderIp, const quint16& senderPort); + void sendMSearchResponse(const QString& st, const QString& senderIp, quint16 senderPort); /// /// @brief Send ByeBye notification (on SSDP stop) (repeated 3 times) @@ -76,22 +77,22 @@ public: /// /// @brief set new flatbuffer server port /// - void setFlatBufPort(const quint16& port) { _fbsPort = QString::number(port); }; + void setFlatBufPort(quint16 port) { _fbsPort = QString::number(port); }; /// /// @brief Get current flatbuffer server port /// - quint16 getFlatBufPort() { return _fbsPort.toInt(); }; + quint16 getFlatBufPort() const { return _fbsPort.toInt(); }; /// /// @brief set new jsonserver server port /// - void setJsonServerPort(const quint16& port) { _jssPort = QString::number(port); }; + void setJsonServerPort(quint16 port) { _jssPort = QString::number(port); }; /// /// @brief get new jsonserver server port /// - quint16 getJsonServerPort() { return _jssPort.toInt(); }; + quint16 getJsonServerPort() const { return _jssPort.toInt(); }; /// /// @brief set new hyperion name @@ -101,7 +102,7 @@ public: /// /// @brief get hyperion name /// - QString getHyperionName() { return _name; }; + QString getHyperionName() const { return _name; }; signals: @@ -112,7 +113,7 @@ signals: /// @param address The ip of the caller /// @param port The port of the caller /// - void msearchRequestReceived(const QString& target, const QString& mx, const QString address, const quint16 & port); + void msearchRequestReceived(const QString& target, const QString& mx, const QString address, quint16 port); private: Logger* _log; diff --git a/include/utils/ColorArgb.h b/include/utils/ColorArgb.h index 43c32a9e..c14a2ba2 100644 --- a/include/utils/ColorArgb.h +++ b/include/utils/ColorArgb.h @@ -6,7 +6,6 @@ struct ColorArgb { - /// The alpha mask channel uint8_t alpha; @@ -18,20 +17,19 @@ struct ColorArgb uint8_t blue; /// 'Black' RgbColor (255, 0, 0, 0) - static ColorArgb BLACK; + static const ColorArgb BLACK; /// 'Red' RgbColor (255, 255, 0, 0) - static ColorArgb RED; + static const ColorArgb RED; /// 'Green' RgbColor (255, 0, 255, 0) - static ColorArgb GREEN; + static const ColorArgb GREEN; /// 'Blue' RgbColor (255, 0, 0, 255) - static ColorArgb BLUE; + static const ColorArgb BLUE; /// 'Yellow' RgbColor (255, 255, 255, 0) - static ColorArgb YELLOW; + static const ColorArgb YELLOW; /// 'White' RgbColor (255, 255, 255, 255) - static ColorArgb WHITE; + static const ColorArgb WHITE; }; - /// Assert to ensure that the size of the structure is 'only' 3 bytes static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB"); @@ -44,6 +42,12 @@ static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB"); /// inline std::ostream& operator<<(std::ostream& os, const ColorArgb& color) { - os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; + os << "{" + << color.alpha << "," + << color.red << "," + << color.green << "," + << color.blue + << "}"; + return os; } diff --git a/include/utils/ColorBgr.h b/include/utils/ColorBgr.h index 5cc19bb7..30f2bae9 100644 --- a/include/utils/ColorBgr.h +++ b/include/utils/ColorBgr.h @@ -17,18 +17,19 @@ struct ColorBgr /// The red color channel uint8_t red; + /// 'Black' RgbColor (0, 0, 0) - static ColorBgr BLACK; + static const ColorBgr BLACK; /// 'Red' RgbColor (255, 0, 0) - static ColorBgr RED; + static const ColorBgr RED; /// 'Green' RgbColor (0, 255, 0) - static ColorBgr GREEN; + static const ColorBgr GREEN; /// 'Blue' RgbColor (0, 0, 255) - static ColorBgr BLUE; + static const ColorBgr BLUE; /// 'Yellow' RgbColor (255, 255, 0) - static ColorBgr YELLOW; + static const ColorBgr YELLOW; /// 'White' RgbColor (255, 255, 255) - static ColorBgr WHITE; + static const ColorBgr WHITE; }; /// Assert to ensure that the size of the structure is 'only' 3 bytes @@ -43,19 +44,33 @@ static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorBgr"); /// inline std::ostream& operator<<(std::ostream& os, const ColorBgr& color) { - os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; + os << "{" + << color.red << "," + << color.green << "," + << color.blue + << "}"; + return os; } +/// Compare operator to check if a color is 'equal' to another color +inline bool operator==(const ColorBgr & lhs, const ColorBgr & rhs) +{ + return (lhs.red == rhs.red) && + (lhs.green == rhs.green) && + (lhs.blue == rhs.blue); +} /// Compare operator to check if a color is 'smaller' than another color inline bool operator<(const ColorBgr & lhs, const ColorBgr & rhs) { - return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue); + return (lhs.red < rhs.red) && + (lhs.green < rhs.green) && + (lhs.blue < rhs.blue); } /// Compare operator to check if a color is 'smaller' than or 'equal' to another color inline bool operator<=(const ColorBgr & lhs, const ColorBgr & rhs) { - return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue); + return lhs < rhs || lhs == rhs; } diff --git a/include/utils/ColorRgb.h b/include/utils/ColorRgb.h index 0ec41c71..7d4bba28 100644 --- a/include/utils/ColorRgb.h +++ b/include/utils/ColorRgb.h @@ -20,17 +20,17 @@ struct ColorRgb uint8_t blue; /// 'Black' RgbColor (0, 0, 0) - static ColorRgb BLACK; + static const ColorRgb BLACK; /// 'Red' RgbColor (255, 0, 0) - static ColorRgb RED; + static const ColorRgb RED; /// 'Green' RgbColor (0, 255, 0) - static ColorRgb GREEN; + static const ColorRgb GREEN; /// 'Blue' RgbColor (0, 0, 255) - static ColorRgb BLUE; + static const ColorRgb BLUE; /// 'Yellow' RgbColor (255, 255, 0) - static ColorRgb YELLOW; + static const ColorRgb YELLOW; /// 'White' RgbColor (255, 255, 255) - static ColorRgb WHITE; + static const ColorRgb WHITE; }; /// Assert to ensure that the size of the structure is 'only' 3 bytes @@ -45,7 +45,12 @@ static_assert(sizeof(ColorRgb) == 3, "Incorrect size of ColorRgb"); /// inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color) { - os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; + os << "{" + << color.red << "," + << color.green << "," + << color.blue + << "}"; + return os; } @@ -58,30 +63,51 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color) /// inline QTextStream& operator<<(QTextStream &os, const ColorRgb& color) { - os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; + os << "{" + << color.red << "," + << color.green << "," + << color.blue + << "}"; + return os; } +/// Compare operator to check if a color is 'equal' to another color +inline bool operator==(const ColorRgb & lhs, const ColorRgb & rhs) +{ + return lhs.red == rhs.red && + lhs.green == rhs.green && + lhs.blue == rhs.blue; +} + /// Compare operator to check if a color is 'smaller' than another color inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs) { - return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue); + return lhs.red < rhs.red && + lhs.green < rhs.green && + lhs.blue < rhs.blue; +} + +/// Compare operator to check if a color is 'not equal' to another color +inline bool operator!=(const ColorRgb & lhs, const ColorRgb & rhs) +{ + return !(lhs == rhs); } /// Compare operator to check if a color is 'smaller' than or 'equal' to another color inline bool operator<=(const ColorRgb & lhs, const ColorRgb & rhs) { - return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue); + return lhs < rhs || lhs == rhs; } /// Compare operator to check if a color is 'greater' to another color inline bool operator>(const ColorRgb & lhs, const ColorRgb & rhs) { - return (lhs.red > rhs.red) && (lhs.green > rhs.green) && (lhs.blue > rhs.blue); + return !(lhs < rhs) && lhs != rhs; } /// Compare operator to check if a color is 'greater' than or 'equal' to another color inline bool operator>=(const ColorRgb & lhs, const ColorRgb & rhs) { - return (lhs.red >= rhs.red) && (lhs.green >= rhs.green) && (lhs.blue >= rhs.blue); + return lhs > rhs || lhs == rhs; } diff --git a/include/utils/ColorRgba.h b/include/utils/ColorRgba.h index e02cc796..63afdc5a 100644 --- a/include/utils/ColorRgba.h +++ b/include/utils/ColorRgba.h @@ -6,7 +6,6 @@ struct ColorRgba { - /// The red color channel uint8_t red; /// The green color channel @@ -18,20 +17,19 @@ struct ColorRgba uint8_t alpha; /// 'Black' RgbColor (0, 0, 0, 255) - static ColorRgba BLACK; + static const ColorRgba BLACK; /// 'Red' RgbColor (255, 0, 0, 255) - static ColorRgba RED; + static const ColorRgba RED; /// 'Green' RgbColor (0, 255, 0, 255) - static ColorRgba GREEN; + static const ColorRgba GREEN; /// 'Blue' RgbColor (0, 0, 255, 255) - static ColorRgba BLUE; + static const ColorRgba BLUE; /// 'Yellow' RgbColor (255, 255, 0, 255) - static ColorRgba YELLOW; + static const ColorRgba YELLOW; /// 'White' RgbColor (255, 255, 255, 255 - static ColorRgba WHITE; + static const ColorRgba WHITE; }; - /// Assert to ensure that the size of the structure is 'only' 3 bytes static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB"); @@ -44,6 +42,12 @@ static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB"); /// inline std::ostream& operator<<(std::ostream& os, const ColorRgba& color) { - os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}"; + os << "{" + << color.alpha << "," + << color.red << "," + << color.green << "," + << color.blue + << "}"; + return os; } diff --git a/include/utils/ColorRgbw.h b/include/utils/ColorRgbw.h index 9316f94f..c8ba82fc 100644 --- a/include/utils/ColorRgbw.h +++ b/include/utils/ColorRgbw.h @@ -20,17 +20,17 @@ struct ColorRgbw uint8_t white; /// 'Black' RgbColor (0, 0, 0, 0) - static ColorRgbw BLACK; + static const ColorRgbw BLACK; /// 'Red' RgbColor (255, 0, 0, 0) - static ColorRgbw RED; + static const ColorRgbw RED; /// 'Green' RgbColor (0, 255, 0, 0) - static ColorRgbw GREEN; + static const ColorRgbw GREEN; /// 'Blue' RgbColor (0, 0, 255, 0) - static ColorRgbw BLUE; + static const ColorRgbw BLUE; /// 'Yellow' RgbColor (255, 255, 0, 0) - static ColorRgbw YELLOW; + static const ColorRgbw YELLOW; /// 'White' RgbColor (0, 0, 0, 255) - static ColorRgbw WHITE; + static const ColorRgbw WHITE; }; /// Assert to ensure that the size of the structure is 'only' 4 bytes @@ -45,19 +45,36 @@ static_assert(sizeof(ColorRgbw) == 4, "Incorrect size of ColorRgbw"); /// inline std::ostream& operator<<(std::ostream& os, const ColorRgbw& color) { - os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "," << unsigned(color.white) << "}"; + os << "{" + << color.red << "," + << color.green << "," + << color.blue << "," + << color.white << + "}"; + return os; } +/// Compare operator to check if a color is 'equal' than another color +inline bool operator==(const ColorRgbw & lhs, const ColorRgbw & rhs) +{ + return lhs.red == rhs.red && + lhs.green == rhs.green && + lhs.blue == rhs.blue && + lhs.white == rhs.white; +} /// Compare operator to check if a color is 'smaller' than another color inline bool operator<(const ColorRgbw & lhs, const ColorRgbw & rhs) { - return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue) && (lhs.white < rhs.white); + return lhs.red < rhs.red && + lhs.green < rhs.green && + lhs.blue < rhs.blue && + lhs.white < rhs.white; } /// Compare operator to check if a color is 'smaller' than or 'equal' to another color inline bool operator<=(const ColorRgbw & lhs, const ColorRgbw & rhs) { - return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue) && (lhs.white < rhs.white); + return lhs < rhs || lhs == rhs; } diff --git a/include/utils/ColorSys.h b/include/utils/ColorSys.h index b094a0d6..7aa1a065 100644 --- a/include/utils/ColorSys.h +++ b/include/utils/ColorSys.h @@ -65,4 +65,15 @@ public: /// number and scaled between 0 and 360 /// static void hsv2rgb(uint16_t hue, uint8_t saturation, uint8_t value, uint8_t & red, uint8_t & green, uint8_t & blue); + + /// + /// Translates a YUV (luminance, chrominance, chrominance) color to an RGB (red, green, blue) color + /// + /// @param[in] y The luminance YUV-component + /// @param[in] u The chrominance YUV-component + /// @param[in] v The chrominance YUV-component + /// @param[out] red The red RGB-component + /// @param[out] green The green RGB-component + /// @param[out] blue The blue RGB-component + static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b); }; diff --git a/include/utils/Components.h b/include/utils/Components.h index ca70a2d6..9910d7e8 100644 --- a/include/utils/Components.h +++ b/include/utils/Components.h @@ -67,22 +67,22 @@ inline const char* componentToIdString(Components c) } } -inline Components stringToComponent(QString component) +inline Components stringToComponent(const QString& component) { - component = component.toUpper(); - if (component == "ALL") return COMP_ALL; - if (component == "SMOOTHING") return COMP_SMOOTHING; - if (component == "BLACKBORDER") return COMP_BLACKBORDER; - if (component == "FORWARDER") return COMP_FORWARDER; - if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER; - if (component == "GRABBER") return COMP_GRABBER; - if (component == "V4L") return COMP_V4L; - if (component == "COLOR") return COMP_COLOR; - if (component == "EFFECT") return COMP_EFFECT; - if (component == "IMAGE") return COMP_IMAGE; - if (component == "LEDDEVICE") return COMP_LEDDEVICE; - if (component == "FLATBUFSERVER") return COMP_FLATBUFSERVER; - if (component == "PROTOSERVER") return COMP_PROTOSERVER; + const QString cmp = component.toUpper(); + if (cmp == "ALL") return COMP_ALL; + if (cmp == "SMOOTHING") return COMP_SMOOTHING; + if (cmp == "BLACKBORDER") return COMP_BLACKBORDER; + if (cmp == "FORWARDER") return COMP_FORWARDER; + if (cmp == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER; + if (cmp == "GRABBER") return COMP_GRABBER; + if (cmp == "V4L") return COMP_V4L; + if (cmp == "COLOR") return COMP_COLOR; + if (cmp == "EFFECT") return COMP_EFFECT; + if (cmp == "IMAGE") return COMP_IMAGE; + if (cmp == "LEDDEVICE") return COMP_LEDDEVICE; + if (cmp == "FLATBUFSERVER") return COMP_FLATBUFSERVER; + if (cmp == "PROTOSERVER") return COMP_PROTOSERVER; return COMP_INVALID; } diff --git a/include/utils/FileUtils.h b/include/utils/FileUtils.h index ee26f3d2..7bf5db8b 100644 --- a/include/utils/FileUtils.h +++ b/include/utils/FileUtils.h @@ -10,8 +10,8 @@ namespace FileUtils { - QString getBaseName(QString sourceFile); - QString getDirName(QString sourceFile); + QString getBaseName(const QString& sourceFile); + QString getDirName(const QString& sourceFile); /// /// @brief remove directory recursive given by path diff --git a/include/utils/GlobalSignals.h b/include/utils/GlobalSignals.h index b5525c21..213ab955 100644 --- a/include/utils/GlobalSignals.h +++ b/include/utils/GlobalSignals.h @@ -20,6 +20,7 @@ public: static GlobalSignals instance; return & instance; } + private: GlobalSignals() = default; @@ -54,7 +55,7 @@ signals: /// @param[in] owner Specific owner string, might be empty /// @param[in] smooth_cfg The smooth id to use /// - void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "External", const QString& owner = "", unsigned smooth_cfg = 0); + void registerGlobalInput(int priority, hyperion::Components component, const QString& origin = "External", const QString& owner = "", unsigned smooth_cfg = 0); /// /// @brief PIPE the clear command for the global priority channel over HyperionDaemon to Hyperion class @@ -70,7 +71,7 @@ signals: /// @param[in] timeout_ms The timeout in milliseconds /// @param clearEffect Should be true when NOT called from an effect /// - void setGlobalImage(const int priority, const Image& image, const int timeout_ms, const bool& clearEffect = true); + void setGlobalImage(int priority, const Image& image, int timeout_ms, bool clearEffect = true); /// /// @brief PIPE external color message over HyperionDaemon to Hyperion class @@ -80,7 +81,7 @@ signals: /// @param[in] origin The setter /// @param clearEffect Should be true when NOT called from an effect /// - void setGlobalColor(const int priority, const std::vector &ledColor, const int timeout_ms, const QString& origin = "External" ,bool clearEffects = true); + void setGlobalColor(int priority, const std::vector &ledColor, int timeout_ms, const QString& origin = "External" ,bool clearEffects = true); /////////////////////////////////////// //////////// FROM HYPERION //////////// @@ -98,6 +99,6 @@ signals: /// @param hyperionInd The Hyperion instance index as identifier /// @param listen True when listening, else false /// - void requestSource(const hyperion::Components& component, const int hyperionInd, const bool listen); + void requestSource(hyperion::Components component, int hyperionInd, bool listen); }; diff --git a/include/utils/Image.h b/include/utils/Image.h index 3a33fa4d..a0722040 100644 --- a/include/utils/Image.h +++ b/include/utils/Image.h @@ -15,7 +15,7 @@ public: { } - Image(const unsigned width, const unsigned height) : + Image(unsigned width, unsigned height) : Image(width, height, Pixel_T()) { @@ -28,7 +28,7 @@ public: /// @param height The height of the image /// @param background The color of the image /// - Image(const unsigned width, const unsigned height, const Pixel_T background) : + Image(unsigned width, unsigned height, const Pixel_T background) : _d_ptr(new ImageData(width, height, background)) { } @@ -93,12 +93,12 @@ public: return _d_ptr->height(); } - uint8_t red(const unsigned pixel) const + uint8_t red(unsigned pixel) const { return _d_ptr->red(pixel); } - uint8_t green(const unsigned pixel) const + uint8_t green(unsigned pixel) const { return _d_ptr->green(pixel); } @@ -111,7 +111,7 @@ public: /// /// @return const reference to specified pixel /// - uint8_t blue(const unsigned pixel) const + uint8_t blue(unsigned pixel) const { return _d_ptr->blue(pixel); } @@ -121,7 +121,7 @@ public: /// /// @param x The x index /// @param y The y index - const Pixel_T& operator()(const unsigned x, const unsigned y) const + const Pixel_T& operator()(unsigned x, unsigned y) const { return _d_ptr->operator()(x, y); } @@ -129,7 +129,7 @@ public: /// /// @return reference to specified pixel /// - Pixel_T& operator()(const unsigned x, const unsigned y) + Pixel_T& operator()(unsigned x, unsigned y) { return _d_ptr->operator()(x, y); } @@ -137,7 +137,7 @@ public: /// Resize the image /// @param width The width of the image /// @param height The height of the image - void resize(const unsigned width, const unsigned height) + void resize(unsigned width, unsigned height) { _d_ptr->resize(width, height); } @@ -198,7 +198,7 @@ private: /// /// @return The index into the underlying data-vector /// - inline unsigned toIndex(const unsigned x, const unsigned y) const + inline unsigned toIndex(unsigned x, unsigned y) const { return _d_ptr->toIndex(x, y); } diff --git a/include/utils/ImageData.h b/include/utils/ImageData.h index ea15c0df..fa0a3399 100644 --- a/include/utils/ImageData.h +++ b/include/utils/ImageData.h @@ -24,7 +24,7 @@ class ImageData : public QSharedData public: typedef Pixel_T pixel_type; - ImageData(const unsigned width, const unsigned height, const Pixel_T background) : + ImageData(unsigned width, unsigned height, const Pixel_T background) : _width(width), _height(height), _pixels(new Pixel_T[width * height + 1]) @@ -84,32 +84,32 @@ public: return _height; } - uint8_t red(const unsigned pixel) const + uint8_t red(unsigned pixel) const { return (_pixels + pixel)->red; } - uint8_t green(const unsigned pixel) const + uint8_t green(unsigned pixel) const { return (_pixels + pixel)->green; } - uint8_t blue(const unsigned pixel) const + uint8_t blue(unsigned pixel) const { return (_pixels + pixel)->blue; } - const Pixel_T& operator()(const unsigned x, const unsigned y) const + const Pixel_T& operator()(unsigned x, unsigned y) const { return _pixels[toIndex(x,y)]; } - Pixel_T& operator()(const unsigned x, const unsigned y) + Pixel_T& operator()(unsigned x, unsigned y) { return _pixels[toIndex(x,y)]; } - void resize(const unsigned width, const unsigned height) + void resize(unsigned width, unsigned height) { if (width == _width && height == _height) return; @@ -167,7 +167,7 @@ public: } private: - inline unsigned toIndex(const unsigned x, const unsigned y) const + inline unsigned toIndex(unsigned x, unsigned y) const { return y * _width + x; } diff --git a/include/utils/ImageResampler.h b/include/utils/ImageResampler.h index 847db2bb..62adb2b9 100644 --- a/include/utils/ImageResampler.h +++ b/include/utils/ImageResampler.h @@ -12,22 +12,11 @@ public: ~ImageResampler(); void setHorizontalPixelDecimation(int decimator); - void setVerticalPixelDecimation(int decimator); - - void setCropping(int cropLeft, - int cropRight, - int cropTop, - int cropBottom); - + void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom); void setVideoMode(VideoMode mode); - void processImage(const uint8_t * data, int width, int height, int lineLength, PixelFormat pixelFormat, Image & outputImage) const; -private: - static inline uint8_t clamp(int x); - static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b); - private: int _horizontalDecimation; int _verticalDecimation; @@ -37,3 +26,4 @@ private: int _cropBottom; VideoMode _videoMode; }; + diff --git a/include/utils/JsonUtils.h b/include/utils/JsonUtils.h index c35f8c4f..694e279f 100644 --- a/include/utils/JsonUtils.h +++ b/include/utils/JsonUtils.h @@ -5,7 +5,7 @@ #include #include -namespace JsonUtils{ +namespace JsonUtils { /// /// @brief read a json file and get the parsed result on success /// @param[in] path The file path to read diff --git a/include/utils/Logger.h b/include/utils/Logger.h index c6b60670..21d6e764 100644 --- a/include/utils/Logger.h +++ b/include/utils/Logger.h @@ -67,7 +67,7 @@ public: void Message(LogLevel level, const char* sourceFile, const char* func, unsigned int line, const char* fmt, ...); void setMinLevel(LogLevel level) { _minLevel = static_cast(level); } - LogLevel getMinLevel() { return static_cast(int(_minLevel)); } + LogLevel getMinLevel() const { return static_cast(int(_minLevel)); } QString getName() const { return _name; } QString getAppName() const { return _appname; } @@ -76,7 +76,7 @@ signals: protected: Logger(const QString & name="", LogLevel minLevel = INFO); - ~Logger(); + ~Logger() override; private: void write(const Logger::T_LOG_MESSAGE & message); diff --git a/include/utils/NetOrigin.h b/include/utils/NetOrigin.h index a23fcbdc..b82238fd 100644 --- a/include/utils/NetOrigin.h +++ b/include/utils/NetOrigin.h @@ -42,7 +42,7 @@ private slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); private: Logger* _log; diff --git a/include/utils/PixelFormat.h b/include/utils/PixelFormat.h index eecd4464..a60a20f4 100644 --- a/include/utils/PixelFormat.h +++ b/include/utils/PixelFormat.h @@ -18,37 +18,37 @@ enum class PixelFormat { NO_CHANGE }; -inline PixelFormat parsePixelFormat(QString pixelFormat) +inline PixelFormat parsePixelFormat(const QString& pixelFormat) { // convert to lower case - pixelFormat = pixelFormat.toLower(); + QString format = pixelFormat.toLower(); - if (pixelFormat.compare("yuyv") ) + if (format.compare("yuyv") ) { return PixelFormat::YUYV; } - else if (pixelFormat.compare("uyvy") ) + else if (format.compare("uyvy") ) { return PixelFormat::UYVY; } - else if (pixelFormat.compare("bgr16") ) + else if (format.compare("bgr16") ) { return PixelFormat::BGR16; } - else if (pixelFormat.compare("bgr24") ) + else if (format.compare("bgr24") ) { return PixelFormat::BGR24; } - else if (pixelFormat.compare("rgb32") ) + else if (format.compare("rgb32") ) { return PixelFormat::RGB32; } - else if (pixelFormat.compare("bgr32") ) + else if (format.compare("bgr32") ) { return PixelFormat::BGR32; } #ifdef HAVE_JPEG_DECODER - else if (pixelFormat.compare("mjpeg") ) + else if (format.compare("mjpeg") ) { return PixelFormat::MJPEG; } diff --git a/include/utils/Profiler.h b/include/utils/Profiler.h index 96aec725..e478385f 100644 --- a/include/utils/Profiler.h +++ b/include/utils/Profiler.h @@ -30,15 +30,14 @@ For more profiler function see the macros listed below #define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__); #define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__);} } - class Profiler { public: Profiler(const char* sourceFile, const char* func, unsigned int line); ~Profiler(); - static void TimerStart(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line); - static void TimerGetTime(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line); + static void TimerStart(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line); + static void TimerGetTime(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line); private: static void initLogger(); diff --git a/include/utils/RgbToRgbw.h b/include/utils/RgbToRgbw.h index 0c6c9aee..0bcd6f46 100644 --- a/include/utils/RgbToRgbw.h +++ b/include/utils/RgbToRgbw.h @@ -14,7 +14,6 @@ namespace RGBW { WHITE_OFF }; - WhiteAlgorithm stringToWhiteAlgorithm(QString str); - void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm); - + WhiteAlgorithm stringToWhiteAlgorithm(const QString& str); + void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm); } diff --git a/include/utils/SysInfo.h b/include/utils/SysInfo.h index eb632e69..c8dca5d7 100644 --- a/include/utils/SysInfo.h +++ b/include/utils/SysInfo.h @@ -5,7 +5,6 @@ class SysInfo : public QObject { - public: struct HyperionSysInfo { diff --git a/include/utils/VideoMode.h b/include/utils/VideoMode.h index b4500dfc..e9359d99 100644 --- a/include/utils/VideoMode.h +++ b/include/utils/VideoMode.h @@ -12,16 +12,16 @@ enum class VideoMode VIDEO_3DTAB }; -inline VideoMode parse3DMode(QString videoMode) +inline VideoMode parse3DMode(const QString& videoMode) { // convert to upper case - videoMode = videoMode.toUpper(); + const QString vm = videoMode.toUpper(); - if (videoMode == "3DTAB") + if (vm == "3DTAB") { return VideoMode::VIDEO_3DTAB; } - else if (videoMode == "3DSBS") + else if (vm == "3DSBS") { return VideoMode::VIDEO_3DSBS; } diff --git a/include/utils/hyperion.h b/include/utils/hyperion.h index 42337465..e930a71a 100644 --- a/include/utils/hyperion.h +++ b/include/utils/hyperion.h @@ -71,7 +71,7 @@ namespace hyperion { return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness, brightnessComp); } - RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, const int defaultR, const int defaultG, const int defaultB) + RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, int defaultR, int defaultG, int defaultB) { const QJsonArray& channelConfig = colorConfig[channelName].toArray(); return RgbChannelAdjustment( @@ -101,7 +101,7 @@ namespace hyperion { return adjustment; } - MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const QJsonObject & colorConfig) + MultiColorAdjustment * createLedColorsAdjustment(unsigned ledCnt, const QJsonObject & colorConfig) { // Create the result, the transforms are added to this MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt); diff --git a/include/utils/jsonschema/QJsonSchemaChecker.h b/include/utils/jsonschema/QJsonSchemaChecker.h index d7fa5cbf..60525997 100644 --- a/include/utils/jsonschema/QJsonSchemaChecker.h +++ b/include/utils/jsonschema/QJsonSchemaChecker.h @@ -57,7 +57,7 @@ public: /// /// @return A list of error messages /// - const QStringList & getMessages() const; + QStringList getMessages() const; private: /// diff --git a/include/utils/jsonschema/QJsonUtils.h b/include/utils/jsonschema/QJsonUtils.h index 6c4f56bd..1cd74a8a 100644 --- a/include/utils/jsonschema/QJsonUtils.h +++ b/include/utils/jsonschema/QJsonUtils.h @@ -19,14 +19,14 @@ public: { if (path.first() == "[root]") path.removeFirst(); - + for (QStringList::iterator it = path.begin(); it != path.end(); ++it) { QString current = *it; if (current.left(1) == ".") *it = current.mid(1, current.size()-1); } - + if (!value.isEmpty()) modifyValue(value, result, path, newValue, propertyName); else if (newValue != QJsonValue::Null && !propertyName.isEmpty()) @@ -78,17 +78,17 @@ private: { QJsonObject result; QJsonObject obj = schema.toObject(); - + if (obj.find("type") != obj.end() && obj.find("type").value().isString()) { QJsonValue ret = QJsonValue::Null; - + if (obj.find("type").value().toString() == "object" && ( obj.find("required").value().toBool() || ignoreRequired ) ) ret = createValue(obj["properties"], ignoreRequired); else if (obj.find("type").value().toString() == "array" && ( obj.find("required").value().toBool() || ignoreRequired ) ) { QJsonArray array; - + if (obj.find("default") != obj.end()) ret = obj.find("default").value(); else @@ -103,7 +103,7 @@ private: else if ( obj.find("required").value().toBool() || ignoreRequired ) if (obj.find("default") != obj.end()) ret = obj.find("default").value(); - + return ret; } else @@ -133,7 +133,7 @@ private: { QJsonValue retEmpty; retEmpty = createValue(attributeValue.toObject()["items"], ignoreRequired); - + if (!retEmpty.toObject().isEmpty()) array.append(retEmpty); result[attribute] = array; @@ -234,7 +234,7 @@ private: subValue = newValue; else continue; - + if (!subValue.toObject().isEmpty()) json_array.append(subValue); else if (newValue != QJsonValue::Null && arrayLevel != -1) diff --git a/include/utils/settings.h b/include/utils/settings.h index d8e25678..175a2df1 100644 --- a/include/utils/settings.h +++ b/include/utils/settings.h @@ -37,7 +37,7 @@ namespace settings { /// @param type The settings::type from enum /// @return The settings type as string /// - inline QString typeToString(const type& type) + inline QString typeToString(type type) { switch (type) { diff --git a/include/webserver/WebServer.h b/include/webserver/WebServer.h index ca15519e..abcf0409 100644 --- a/include/webserver/WebServer.h +++ b/include/webserver/WebServer.h @@ -28,11 +28,12 @@ openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ -subj /CN=hyperion-project.org */ -class WebServer : public QObject { +class WebServer : public QObject +{ Q_OBJECT public: - WebServer (const QJsonDocument& config, const bool& useSsl, QObject * parent = 0); + WebServer (const QJsonDocument& config, bool useSsl, QObject * parent = 0); ~WebServer () override; @@ -44,12 +45,12 @@ signals: /// @emits whenever server is started or stopped (to sync with SSDPHandler) /// @param newState True when started, false when stopped /// - void stateChange(const bool newState); + void stateChange(bool newState); /// /// @brief Emits whenever the port changes (doesn't compare prev <> now) /// - void portChanged(const quint16& port); + void portChanged(quint16 port); public slots: /// @@ -57,7 +58,7 @@ public slots: /// void initServer(); - void onServerStopped (void); + void onServerStopped (); void onServerStarted (quint16 port); void onServerError (QString msg); @@ -66,7 +67,7 @@ public slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); /// /// @brief Set a new description, if empty the description is NotFound for clients diff --git a/libsrc/api/API.cpp b/libsrc/api/API.cpp index 52b19cc6..298ad334 100644 --- a/libsrc/api/API.cpp +++ b/libsrc/api/API.cpp @@ -33,7 +33,7 @@ using namespace hyperion; -API::API(Logger *log, const bool &localConnection, QObject *parent) +API::API(Logger *log, bool localConnection, QObject *parent) : QObject(parent) { qRegisterMetaType("int64_t"); @@ -59,7 +59,7 @@ API::API(Logger *log, const bool &localConnection, QObject *parent) connect(_authManager, &AuthManager::tokenResponse, this, &API::checkTokenResponse); } -void API::init(void) +void API::init() { bool apiAuthRequired = _authManager->isAuthRequired(); @@ -82,7 +82,7 @@ void API::init(void) } } -void API::setColor(const int &priority, const std::vector &ledColors, const int &timeout_ms, const QString &origin, const hyperion::Components &callerComp) +void API::setColor(int priority, const std::vector &ledColors, int timeout_ms, const QString &origin, hyperion::Components callerComp) { std::vector fledColors; if (ledColors.size() % 3 == 0) @@ -95,7 +95,7 @@ void API::setColor(const int &priority, const std::vector &ledColors, c } } -bool API::setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, const hyperion::Components &callerComp) +bool API::setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, hyperion::Components callerComp) { // truncate name length data.imgName.truncate(16); @@ -174,7 +174,7 @@ bool API::setImage(ImageCmdData &data, hyperion::Components comp, QString &reply return true; } -bool API::clearPriority(const int &priority, QString &replyMsg, const hyperion::Components &callerComp) +bool API::clearPriority(int priority, QString &replyMsg, hyperion::Components callerComp) { if (priority < 0 || (priority > 0 && priority < 254)) { @@ -188,7 +188,7 @@ bool API::clearPriority(const int &priority, QString &replyMsg, const hyperion:: return true; } -bool API::setComponentState(const QString &comp, bool &compState, QString &replyMsg, const hyperion::Components &callerComp) +bool API::setComponentState(const QString &comp, bool &compState, QString &replyMsg, hyperion::Components callerComp) { Components component = stringToComponent(comp); @@ -201,17 +201,17 @@ bool API::setComponentState(const QString &comp, bool &compState, QString &reply return false; } -void API::setLedMappingType(const int &type, const hyperion::Components &callerComp) +void API::setLedMappingType(int type, hyperion::Components callerComp) { QMetaObject::invokeMethod(_hyperion, "setLedMappingType", Qt::QueuedConnection, Q_ARG(int, type)); } -void API::setVideoMode(const VideoMode &mode, const hyperion::Components &callerComp) +void API::setVideoMode(VideoMode mode, hyperion::Components callerComp) { QMetaObject::invokeMethod(_hyperion, "setVideoMode", Qt::QueuedConnection, Q_ARG(VideoMode, mode)); } -void API::setEffect(const EffectCmdData &dat, const hyperion::Components &callerComp) +void API::setEffect(const EffectCmdData &dat, hyperion::Components callerComp) { if (!dat.args.isEmpty()) { @@ -223,17 +223,17 @@ void API::setEffect(const EffectCmdData &dat, const hyperion::Components &caller } } -void API::setSourceAutoSelect(const bool state, const hyperion::Components &callerComp) +void API::setSourceAutoSelect(bool state, hyperion::Components callerComp) { QMetaObject::invokeMethod(_hyperion, "setSourceAutoSelect", Qt::QueuedConnection, Q_ARG(bool, state)); } -void API::setVisiblePriority(const int &priority, const hyperion::Components &callerComp) +void API::setVisiblePriority(int priority, hyperion::Components callerComp) { QMetaObject::invokeMethod(_hyperion, "setVisiblePriority", Qt::QueuedConnection, Q_ARG(int, priority)); } -void API::registerInput(const int &priority, const hyperion::Components &component, const QString &origin, const QString &owner, const hyperion::Components &callerComp) +void API::registerInput(int priority, hyperion::Components component, const QString &origin, const QString &owner, hyperion::Components callerComp) { if (_activeRegisters.count(priority)) _activeRegisters.erase(priority); @@ -243,13 +243,13 @@ void API::registerInput(const int &priority, const hyperion::Components &compone QMetaObject::invokeMethod(_hyperion, "registerInput", Qt::QueuedConnection, Q_ARG(int, priority), Q_ARG(hyperion::Components, component), Q_ARG(QString, origin), Q_ARG(QString, owner)); } -void API::unregisterInput(const int &priority) +void API::unregisterInput(int priority) { if (_activeRegisters.count(priority)) _activeRegisters.erase(priority); } -bool API::setHyperionInstance(const quint8 &inst) +bool API::setHyperionInstance(quint8 inst) { if (_currInstanceIndex == inst) return true; @@ -278,19 +278,19 @@ bool API::isHyperionEnabled() return res > 0; } -QVector API::getAllInstanceData(void) +QVector API::getAllInstanceData() { QVector vec; QMetaObject::invokeMethod(_instanceManager, "getInstanceData", Qt::DirectConnection, Q_RETURN_ARG(QVector, vec)); return vec; } -void API::startInstance(const quint8 &index) +void API::startInstance(quint8 index) { QMetaObject::invokeMethod(_instanceManager, "startInstance", Qt::QueuedConnection, Q_ARG(quint8, index)); } -void API::stopInstance(const quint8 &index) +void API::stopInstance(quint8 index) { QMetaObject::invokeMethod(_instanceManager, "stopInstance", Qt::QueuedConnection, Q_ARG(quint8, index)); } @@ -302,7 +302,7 @@ void API::requestActiveRegister(QObject *callerInstance) // QMetaObject::invokeMethod(ApiSync::getInstance(), "answerActiveRegister", Qt::QueuedConnection, Q_ARG(QObject *, callerInstance), Q_ARG(MapRegister, _activeRegisters)); } -bool API::deleteInstance(const quint8 &index, QString &replyMsg) +bool API::deleteInstance(quint8 index, QString &replyMsg) { if (_adminAuthorized) { @@ -327,7 +327,7 @@ QString API::createInstance(const QString &name) return NO_AUTH; } -QString API::setInstanceName(const quint8 &index, const QString &name) +QString API::setInstanceName(quint8 index, const QString &name) { if (_adminAuthorized) { @@ -417,7 +417,7 @@ void API::cancelNewTokenRequest(const QString &comment, const QString &id) QMetaObject::invokeMethod(_authManager, "cancelNewTokenRequest", Qt::QueuedConnection, Q_ARG(QObject *, this), Q_ARG(QString, comment), Q_ARG(QString, id)); } -bool API::handlePendingTokenRequest(const QString &id, const bool accept) +bool API::handlePendingTokenRequest(const QString &id, bool accept) { if (!_adminAuthorized) return false; @@ -503,7 +503,7 @@ void API::logout() stopDataConnectionss(); } -void API::checkTokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id) +void API::checkTokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id) { if (this == caller) emit onTokenResponse(success, token, comment, id); diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index 5f98a4b2..ce54731a 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -47,7 +47,7 @@ using namespace hyperion; -JsonAPI::JsonAPI(QString peerAddress, Logger *log, const bool &localConnection, QObject *parent, bool noListener) +JsonAPI::JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener) : API(log, localConnection, parent) /* , _authManager(AuthManager::getInstance()) // moved to API , _authorized(false) @@ -79,7 +79,7 @@ JsonAPI::JsonAPI(QString peerAddress, Logger *log, const bool &localConnection, Q_INIT_RESOURCE(JSONRPC_schemas); } -void JsonAPI::initialize(void) +void JsonAPI::initialize() { // init API, REQUIRED! API::init(); @@ -100,7 +100,7 @@ void JsonAPI::initialize(void) connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage); } -bool JsonAPI::handleInstanceSwitch(const quint8 &inst, const bool &forced) +bool JsonAPI::handleInstanceSwitch(quint8 inst, bool forced) { if (API::setHyperionInstance(inst)) { @@ -211,7 +211,7 @@ proceed: handleNotImplemented(); } -void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &command, int tan) { emit forwardJsonMessage(message); int priority = message["priority"].toInt(); @@ -230,7 +230,7 @@ void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &comm sendSuccessReply(command, tan); } -void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &command, int tan) { emit forwardJsonMessage(message); @@ -254,7 +254,7 @@ void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &comm sendSuccessReply(command, tan); } -void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &command, int tan) { emit forwardJsonMessage(message); @@ -272,19 +272,19 @@ void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &com sendSuccessReply(command, tan); } -void JsonAPI::handleCreateEffectCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleCreateEffectCommand(const QJsonObject &message, const QString &command, int tan) { const QString resultMsg = API::saveEffect(message); resultMsg.isEmpty() ? sendSuccessReply(command, tan) : sendErrorReply(resultMsg, command, tan); } -void JsonAPI::handleDeleteEffectCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleDeleteEffectCommand(const QJsonObject &message, const QString &command, int tan) { const QString res = API::deleteEffect(message["name"].toString()); res.isEmpty() ? sendSuccessReply(command, tan) : sendErrorReply(res, command, tan); } -void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, const int tan) +void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, int tan) { // create result QJsonObject result; @@ -319,7 +319,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, emit callbackMessage(result); } -void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString &command, int tan) { QJsonObject info; @@ -494,7 +494,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString #if defined(ENABLE_V4L2) QJsonArray availableV4L2devices; - for (auto devicePath : GrabberWrapper::getInstance()->getV4L2devices()) + for (const auto& devicePath : GrabberWrapper::getInstance()->getV4L2devices()) { QJsonObject device; device["device"] = devicePath; @@ -714,7 +714,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString } } -void JsonAPI::handleClearCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleClearCommand(const QJsonObject &message, const QString &command, int tan) { emit forwardJsonMessage(message); int priority = message["priority"].toInt(); @@ -728,7 +728,7 @@ void JsonAPI::handleClearCommand(const QJsonObject &message, const QString &comm sendSuccessReply(command, tan); } -void JsonAPI::handleClearallCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleClearallCommand(const QJsonObject &message, const QString &command, int tan) { emit forwardJsonMessage(message); QString replyMsg; @@ -736,7 +736,7 @@ void JsonAPI::handleClearallCommand(const QJsonObject &message, const QString &c sendSuccessReply(command, tan); } -void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString &command, int tan) { const QJsonObject &adjustment = message["adjustment"].toObject(); @@ -822,7 +822,7 @@ void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString sendSuccessReply(command, tan); } -void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const QString &command, int tan) { if (message.contains("auto")) { @@ -840,7 +840,7 @@ void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const QStrin sendSuccessReply(command, tan); } -void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &command, int tan) { QString subcommand = message["subcommand"].toString(""); QString full_command = command + "-" + subcommand; @@ -884,7 +884,7 @@ void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &com } } -void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString &command, int tan) { if (message.contains("config")) { @@ -899,7 +899,7 @@ void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString & } } -void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &command, int tan) { // create result QJsonObject schemaJson, alldevices, properties; @@ -962,7 +962,7 @@ void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString & sendSuccessDataReply(QJsonDocument(schemaJson), command, tan); } -void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QString &command, int tan) { const QJsonObject &componentState = message["componentstate"].toObject(); QString comp = componentState["component"].toString("invalid"); @@ -977,7 +977,7 @@ void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QStr sendSuccessReply(command, tan); } -void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &command, int tan) { // create result QString subcommand = message["subcommand"].toString(""); @@ -1036,7 +1036,7 @@ void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString & sendSuccessReply(command + "-" + subcommand, tan); } -void JsonAPI::handleLoggingCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleLoggingCommand(const QJsonObject &message, const QString &command, int tan) { // create result QString subcommand = message["subcommand"].toString(""); @@ -1078,19 +1078,19 @@ void JsonAPI::handleLoggingCommand(const QJsonObject &message, const QString &co } } -void JsonAPI::handleProcessingCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleProcessingCommand(const QJsonObject &message, const QString &command, int tan) { API::setLedMappingType(ImageProcessor::mappingTypeToInt(message["mappingType"].toString("multicolor_mean"))); sendSuccessReply(command, tan); } -void JsonAPI::handleVideoModeCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleVideoModeCommand(const QJsonObject &message, const QString &command, int tan) { API::setVideoMode(parse3DMode(message["videoMode"].toString("2D"))); sendSuccessReply(command, tan); } -void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &command, int tan) { const QString &subc = message["subcommand"].toString().trimmed(); const QString &id = message["id"].toString().trimmed(); @@ -1326,7 +1326,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString & } } -void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, int tan) { const QString &subc = message["subcommand"].toString(); const quint8 &inst = message["instance"].toInt(); @@ -1396,7 +1396,7 @@ void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &c } } -void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &command, const int tan) +void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan) { Debug(_log, "message: [%s]", QString(QJsonDocument(message).toJson(QJsonDocument::Compact)).toUtf8().constData() ); @@ -1457,7 +1457,7 @@ void JsonAPI::handleNotImplemented() sendErrorReply("Command not implemented"); } -void JsonAPI::sendSuccessReply(const QString &command, const int tan) +void JsonAPI::sendSuccessReply(const QString &command, int tan) { // create reply QJsonObject reply; @@ -1469,7 +1469,7 @@ void JsonAPI::sendSuccessReply(const QString &command, const int tan) emit callbackMessage(reply); } -void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, const int &tan) +void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, int tan) { QJsonObject reply; reply["success"] = true; @@ -1483,7 +1483,7 @@ void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &comm emit callbackMessage(reply); } -void JsonAPI::sendErrorReply(const QString &error, const QString &command, const int tan) +void JsonAPI::sendErrorReply(const QString &error, const QString &command, int tan) { // create reply QJsonObject reply; @@ -1581,7 +1581,7 @@ void JsonAPI::newPendingTokenRequest(const QString &id, const QString &comment) sendSuccessDataReply(QJsonDocument(obj), "authorize-tokenRequest", 1); } -void JsonAPI::handleTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id) +void JsonAPI::handleTokenResponse(bool success, const QString &token, const QString &comment, const QString &id) { const QString cmd = "authorize-requestToken"; QJsonObject result; @@ -1595,7 +1595,7 @@ void JsonAPI::handleTokenResponse(const bool &success, const QString &token, con sendErrorReply("Token request timeout or denied", cmd, 5); } -void JsonAPI::handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name) +void JsonAPI::handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name) { switch (state) { @@ -1610,7 +1610,7 @@ void JsonAPI::handleInstanceStateChange(const InstanceState &state, const quint8 } } -void JsonAPI::stopDataConnections(void) +void JsonAPI::stopDataConnections() { LoggerManager::getInstance()->disconnect(); _streaming_logging_activated = false; diff --git a/libsrc/api/JsonCB.cpp b/libsrc/api/JsonCB.cpp index 880cce34..9c48debb 100644 --- a/libsrc/api/JsonCB.cpp +++ b/libsrc/api/JsonCB.cpp @@ -42,7 +42,7 @@ JsonCB::JsonCB(QObject* parent) << "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "leds-update" << "instance-update" << "token-update"; } -bool JsonCB::subscribeFor(const QString& type, const bool & unsubscribe) +bool JsonCB::subscribeFor(const QString& type, bool unsubscribe) { if(!_availableCommands.contains(type)) return false; @@ -189,7 +189,7 @@ void JsonCB::doCallback(const QString& cmd, const QVariant& data) emit newCallback(obj); } -void JsonCB::handleComponentState(const hyperion::Components comp, const bool state) +void JsonCB::handleComponentState(hyperion::Components comp, bool state) { QJsonObject data; data["name"] = componentToIdString(comp); @@ -279,7 +279,7 @@ void JsonCB::handlePriorityUpdate() doCallback("priorities-update", QVariant(data)); } -void JsonCB::handleImageToLedsMappingChange(const int& mappingType) +void JsonCB::handleImageToLedsMappingChange(int mappingType) { QJsonObject data; data["imageToLedMappingType"] = ImageProcessor::mappingTypeToStr(mappingType); @@ -357,7 +357,7 @@ void JsonCB::handleAdjustmentChange() doCallback("adjustment-update", QVariant(adjustmentArray)); } -void JsonCB::handleVideoModeChange(const VideoMode& mode) +void JsonCB::handleVideoModeChange(VideoMode mode) { QJsonObject data; data["videomode"] = QString(videoMode2String(mode)); @@ -382,7 +382,7 @@ void JsonCB::handleEffectListChange() doCallback("effects-update", QVariant(effects)); } -void JsonCB::handleSettingsChange(const settings::type& type, const QJsonDocument& data) +void JsonCB::handleSettingsChange(settings::type type, const QJsonDocument& data) { QJsonObject dat; if(data.isObject()) @@ -393,7 +393,7 @@ void JsonCB::handleSettingsChange(const settings::type& type, const QJsonDocumen doCallback("settings-update", QVariant(dat)); } -void JsonCB::handleLedsConfigChange(const settings::type& type, const QJsonDocument& data) +void JsonCB::handleLedsConfigChange(settings::type type, const QJsonDocument& data) { if(type == settings::LEDS) { diff --git a/libsrc/blackborder/BlackBorderProcessor.cpp b/libsrc/blackborder/BlackBorderProcessor.cpp index 5f68b370..76092913 100644 --- a/libsrc/blackborder/BlackBorderProcessor.cpp +++ b/libsrc/blackborder/BlackBorderProcessor.cpp @@ -40,7 +40,7 @@ BlackBorderProcessor::~BlackBorderProcessor() delete _detector; } -void BlackBorderProcessor::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void BlackBorderProcessor::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::BLACKBORDER) { @@ -68,7 +68,7 @@ void BlackBorderProcessor::handleSettingsUpdate(const settings::type& type, cons } } -void BlackBorderProcessor::handleCompStateChangeRequest(const hyperion::Components component, bool enable) +void BlackBorderProcessor::handleCompStateChangeRequest(hyperion::Components component, bool enable) { if(component == hyperion::COMP_BLACKBORDER) { @@ -88,8 +88,8 @@ void BlackBorderProcessor::handleCompStateChangeRequest(const hyperion::Componen } } -void BlackBorderProcessor::setHardDisable(const bool& disable) { - +void BlackBorderProcessor::setHardDisable(bool disable) +{ if (disable) { _enabled = false; diff --git a/libsrc/boblightserver/BoblightClientConnection.cpp b/libsrc/boblightserver/BoblightClientConnection.cpp index d051d579..485f2b52 100644 --- a/libsrc/boblightserver/BoblightClientConnection.cpp +++ b/libsrc/boblightserver/BoblightClientConnection.cpp @@ -23,7 +23,7 @@ // project includes #include "BoblightClientConnection.h" -BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocket *socket, const int priority) +BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocket *socket, int priority) : QObject() , _locale(QLocale::C) , _socket(socket) diff --git a/libsrc/boblightserver/BoblightClientConnection.h b/libsrc/boblightserver/BoblightClientConnection.h index 6b6d8cd9..54b89efc 100644 --- a/libsrc/boblightserver/BoblightClientConnection.h +++ b/libsrc/boblightserver/BoblightClientConnection.h @@ -25,7 +25,7 @@ public: /// @param socket The Socket object for this connection /// @param hyperion The Hyperion server /// - BoblightClientConnection(Hyperion* hyperion, QTcpSocket * socket, const int priority); + BoblightClientConnection(Hyperion* hyperion, QTcpSocket * socket, int priority); /// /// Destructor diff --git a/libsrc/boblightserver/BoblightServer.cpp b/libsrc/boblightserver/BoblightServer.cpp index 59b4fa57..3495671e 100644 --- a/libsrc/boblightserver/BoblightServer.cpp +++ b/libsrc/boblightserver/BoblightServer.cpp @@ -67,12 +67,12 @@ void BoblightServer::stop() _hyperion->setNewComponentState(COMP_BOBLIGHTSERVER, _server->isListening()); } -bool BoblightServer::active() +bool BoblightServer::active() const { return _server->isListening(); } -void BoblightServer::compStateChangeRequest(const hyperion::Components component, bool enable) +void BoblightServer::compStateChangeRequest(hyperion::Components component, bool enable) { if (component == COMP_BOBLIGHTSERVER) { @@ -114,7 +114,7 @@ void BoblightServer::closedConnection(BoblightClientConnection *connection) connection->deleteLater(); } -void BoblightServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void BoblightServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::BOBLSERVER) { diff --git a/libsrc/bonjour/bonjourserviceregister.cpp b/libsrc/bonjour/bonjourserviceregister.cpp index 4e473432..b10c7ec3 100644 --- a/libsrc/bonjour/bonjourserviceregister.cpp +++ b/libsrc/bonjour/bonjourserviceregister.cpp @@ -51,7 +51,7 @@ BonjourServiceRegister::~BonjourServiceRegister() } } -void BonjourServiceRegister::registerService(const QString& service, const int& port) +void BonjourServiceRegister::registerService(const QString& service, int port) { _port = port; // zeroconf $configname@$hostname:port @@ -65,7 +65,7 @@ void BonjourServiceRegister::registerService(const QString& service, const int& ); } -void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort, std::vector> txt) +void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort, const std::vector>& txt) { if (dnssref) { diff --git a/libsrc/commandline/Option.cpp b/libsrc/commandline/Option.cpp index 4b25ad9d..21a191a9 100644 --- a/libsrc/commandline/Option.cpp +++ b/libsrc/commandline/Option.cpp @@ -11,7 +11,6 @@ Option::Option(const QStringList &names, const QString &description, const QStri : QCommandLineOption(names, description, valueName, defaultValue) {} - bool Option::validate(Parser & parser, QString &value) { /* By default everything is accepted */ @@ -22,22 +21,22 @@ Option::Option(const QCommandLineOption &other) : QCommandLineOption(other) {} -QString Option::value(Parser &parser) +QString Option::value(Parser &parser) const { return parser.value(*this); } -QString Option::name() +QString Option::name() const { return this->names().last(); } -QString Option::getError() +QString Option::getError() const { return this->_error; } -const char* Option::getCString(Parser &parser) +const char* Option::getCString(Parser &parser) const { return value(parser).toLocal8Bit().constData(); } diff --git a/libsrc/effectengine/EffectEngine.cpp b/libsrc/effectengine/EffectEngine.cpp index f8f839bb..ea404903 100644 --- a/libsrc/effectengine/EffectEngine.cpp +++ b/libsrc/effectengine/EffectEngine.cpp @@ -61,9 +61,9 @@ QString EffectEngine::deleteEffect(const QString& effectName) return _effectFileHandler->deleteEffect(effectName); } -const std::list &EffectEngine::getActiveEffects() +std::list EffectEngine::getActiveEffects() const { - _availableActiveEffects.clear(); + std::list availableActiveEffects; for (Effect * effect : _activeEffects) { @@ -73,13 +73,13 @@ const std::list &EffectEngine::getActiveEffects() activeEffectDefinition.priority = effect->getPriority(); activeEffectDefinition.timeout = effect->getTimeout(); activeEffectDefinition.args = effect->getArgs(); - _availableActiveEffects.push_back(activeEffectDefinition); + availableActiveEffects.push_back(activeEffectDefinition); } - return _availableActiveEffects; + return availableActiveEffects; } -const std::list & EffectEngine::getEffectSchemas() +std::list EffectEngine::getEffectSchemas() const { return _effectFileHandler->getEffectSchemas(); } diff --git a/libsrc/effectengine/EffectFileHandler.cpp b/libsrc/effectengine/EffectFileHandler.cpp index 4425a484..98ea45c2 100644 --- a/libsrc/effectengine/EffectFileHandler.cpp +++ b/libsrc/effectengine/EffectFileHandler.cpp @@ -48,7 +48,7 @@ EffectFileHandler::EffectFileHandler(const QString& rootPath, const QJsonDocumen handleSettingsUpdate(settings::EFFECTS, effectConfig); } -void EffectFileHandler::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void EffectFileHandler::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::EFFECTS) { diff --git a/libsrc/flatbufserver/CMakeLists.txt b/libsrc/flatbufserver/CMakeLists.txt index 48a31dd8..0076572d 100644 --- a/libsrc/flatbufserver/CMakeLists.txt +++ b/libsrc/flatbufserver/CMakeLists.txt @@ -19,10 +19,9 @@ set(Flatbuffer_FBS ${CURRENT_SOURCE_DIR}/hyperion_reply.fbs ${CURRENT_SOURCE_DIR}/hyperion_request.fbs ) - FOREACH(FBS_FILE ${Flatbuffer_FBS}) - compile_flattbuffer_schema(${FBS_FILE} ${CMAKE_CURRENT_BINARY_DIR}) - ENDFOREACH(FBS_FILE) + compile_flattbuffer_schema(${FBS_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) +ENDFOREACH(FBS_FILE) # let cmake know about new generated source files set_source_files_properties( diff --git a/libsrc/flatbufserver/FlatBufferClient.cpp b/libsrc/flatbufserver/FlatBufferClient.cpp index 7816e01b..d5d21cdc 100644 --- a/libsrc/flatbufserver/FlatBufferClient.cpp +++ b/libsrc/flatbufserver/FlatBufferClient.cpp @@ -6,7 +6,7 @@ #include #include -FlatBufferClient::FlatBufferClient(QTcpSocket* socket, const int &timeout, QObject *parent) +FlatBufferClient::FlatBufferClient(QTcpSocket* socket, int timeout, QObject *parent) : QObject(parent) , _log(Logger::getInstance("FLATBUFSERVER")) , _socket(socket) @@ -104,7 +104,7 @@ void FlatBufferClient::handleColorCommand(const hyperionnet::Color *colorReq) sendSuccessReply(); } -void FlatBufferClient::registationRequired(const int priority) +void FlatBufferClient::registationRequired(int priority) { if (_priority == priority) { diff --git a/libsrc/flatbufserver/FlatBufferClient.h b/libsrc/flatbufserver/FlatBufferClient.h index e0416e68..9ac82645 100644 --- a/libsrc/flatbufserver/FlatBufferClient.h +++ b/libsrc/flatbufserver/FlatBufferClient.h @@ -30,28 +30,28 @@ public: /// @param timeout The timeout when a client is automatically disconnected and the priority unregistered /// @param parent The parent /// - explicit FlatBufferClient(QTcpSocket* socket, const int &timeout, QObject *parent = nullptr); + explicit FlatBufferClient(QTcpSocket* socket, int timeout, QObject *parent = nullptr); signals: /// /// @brief forward register data to HyperionDaemon /// - void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "FlatBuffer", const QString& owner = "", unsigned smooth_cfg = 0); + void registerGlobalInput(int priority, hyperion::Components component, const QString& origin = "FlatBuffer", const QString& owner = "", unsigned smooth_cfg = 0); /// /// @brief Forward clear command to HyperionDaemon /// - void clearGlobalInput(const int priority, bool forceClearAll=false); + void clearGlobalInput(int priority, bool forceClearAll=false); /// /// @brief forward prepared image to HyperionDaemon /// - const bool setGlobalInputImage(const int priority, const Image& image, const int timeout_ms, const bool& clearEffect = false); + bool setGlobalInputImage(int priority, const Image& image, int timeout_ms, bool clearEffect = false); /// /// @brief Forward requested color /// - void setGlobalInputColor(const int priority, const std::vector &ledColor, const int timeout_ms, const QString& origin = "FlatBuffer" ,bool clearEffects = true); + void setGlobalInputColor(int priority, const std::vector &ledColor, int timeout_ms, const QString& origin = "FlatBuffer" ,bool clearEffects = true); /// /// @brief Emits whenever the client disconnected @@ -62,7 +62,7 @@ public slots: /// /// @brief Requests a registration from the client /// - void registationRequired(const int priority); + void registationRequired(int priority); /// /// @brief close the socket and call disconnected() diff --git a/libsrc/flatbufserver/FlatBufferConnection.cpp b/libsrc/flatbufserver/FlatBufferConnection.cpp index 3e39ebde..6c81bc78 100644 --- a/libsrc/flatbufserver/FlatBufferConnection.cpp +++ b/libsrc/flatbufserver/FlatBufferConnection.cpp @@ -11,7 +11,7 @@ #include "hyperion_reply_generated.h" #include "hyperion_request_generated.h" -FlatBufferConnection::FlatBufferConnection(const QString& origin, const QString & address, const int& priority, const bool& skipReply) +FlatBufferConnection::FlatBufferConnection(const QString& origin, const QString & address, int priority, bool skipReply) : _socket() , _origin(origin) , _priority(priority) @@ -85,7 +85,7 @@ void FlatBufferConnection::readData() } } -void FlatBufferConnection::setSkipReply(const bool& skip) +void FlatBufferConnection::setSkipReply(bool skip) { if(skip) disconnect(&_socket, &QTcpSocket::readyRead, 0, 0); diff --git a/libsrc/flatbufserver/FlatBufferServer.cpp b/libsrc/flatbufserver/FlatBufferServer.cpp index 3c9d15d4..a9661066 100644 --- a/libsrc/flatbufserver/FlatBufferServer.cpp +++ b/libsrc/flatbufserver/FlatBufferServer.cpp @@ -35,7 +35,7 @@ void FlatBufferServer::initServer() handleSettingsUpdate(settings::FLATBUFSERVER, _config); } -void FlatBufferServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void FlatBufferServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::FLATBUFSERVER) { diff --git a/libsrc/grabber/amlogic/AmlogicGrabber.cpp b/libsrc/grabber/amlogic/AmlogicGrabber.cpp index f3fe7a54..34d531d0 100644 --- a/libsrc/grabber/amlogic/AmlogicGrabber.cpp +++ b/libsrc/grabber/amlogic/AmlogicGrabber.cpp @@ -20,7 +20,7 @@ #define VIDEO_DEVICE "/dev/amvideo" #define CAPTURE_DEVICE "/dev/amvideocap0" -AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height) +AmlogicGrabber::AmlogicGrabber(unsigned width, unsigned height) : Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160 , _captureDev(-1) , _videoDev(-1) diff --git a/libsrc/grabber/amlogic/AmlogicWrapper.cpp b/libsrc/grabber/amlogic/AmlogicWrapper.cpp index 49028229..a330bdd8 100644 --- a/libsrc/grabber/amlogic/AmlogicWrapper.cpp +++ b/libsrc/grabber/amlogic/AmlogicWrapper.cpp @@ -1,6 +1,6 @@ #include -AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight) +AmlogicWrapper::AmlogicWrapper(unsigned grabWidth, unsigned grabHeight) : GrabberWrapper("AmLogic", &_grabber, grabWidth, grabHeight) , _grabber(grabWidth, grabHeight) {} diff --git a/libsrc/grabber/amlogic/IonBuffer.h b/libsrc/grabber/amlogic/IonBuffer.h index 9764fa4c..362d0ed7 100644 --- a/libsrc/grabber/amlogic/IonBuffer.h +++ b/libsrc/grabber/amlogic/IonBuffer.h @@ -65,8 +65,6 @@ public: return physicalAddress; } - - IonBuffer(size_t bufferSize) : bufferSize(bufferSize) { diff --git a/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp b/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp index 7e7ec9b5..709168c5 100644 --- a/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp +++ b/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp @@ -6,7 +6,7 @@ // Local includes #include "grabber/DispmanxFrameGrabber.h" -DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height) +DispmanxFrameGrabber::DispmanxFrameGrabber(unsigned width, unsigned height) : Grabber("DISPMANXGRABBER", 0, 0) , _vc_display(0) , _vc_resource(0) @@ -84,7 +84,7 @@ bool DispmanxFrameGrabber::setWidthHeight(int width, int height) return false; } -void DispmanxFrameGrabber::setFlags(const int vc_flags) +void DispmanxFrameGrabber::setFlags(int vc_flags) { _vc_flags = vc_flags; } diff --git a/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp b/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp index f30d161a..87c7f143 100644 --- a/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp +++ b/libsrc/grabber/dispmanx/DispmanxFrameGrabberMock.cpp @@ -30,7 +30,7 @@ int vc_dispmanx_display_get_info(int, DISPMANX_MODEINFO_T *vc_info) return 0; } -DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int,int width,int height, uint32_t *) +DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int, int width, int height, uint32_t *) { return new DISPMANX_RESOURCE(width,height); } @@ -61,12 +61,12 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags) { __bcm_frame_counter = 0; } - + ColorRgba color[4] = {ColorRgba::RED, ColorRgba::BLUE, ColorRgba::GREEN, ColorRgba::WHITE}; if (__bcm_frame_counter < 25) { color[0] = ColorRgba::WHITE; - color[1] = ColorRgba::RED; +0 color[1] = ColorRgba::RED; color[2] = ColorRgba::BLUE; color[3] = ColorRgba::GREEN; } @@ -95,7 +95,7 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags) if (x < w/2 && y < h/2) id = 1; if (x < w/2 && y >= h/2) id = 2; if (x >= w/2 && y < h/2) id = 3; - + resource->memptr()[y*w + x] = color[id]; } } diff --git a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp index d6b472e8..b37c1b7e 100644 --- a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp +++ b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp @@ -1,6 +1,6 @@ #include -DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) +DispmanxWrapper::DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz) : GrabberWrapper("Dispmanx", &_grabber, grabWidth, grabHeight, updateRate_Hz) , _grabber(grabWidth, grabHeight) { diff --git a/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp b/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp index 26fea04c..db4580c9 100644 --- a/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp +++ b/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp @@ -13,7 +13,7 @@ // Local includes #include -FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height) +FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, unsigned width, unsigned height) : Grabber("FRAMEBUFFERGRABBER", width, height) , _fbDevice() { diff --git a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp index 4a88bbee..7b4cf095 100644 --- a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp +++ b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp @@ -1,6 +1,6 @@ #include -FramebufferWrapper::FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) +FramebufferWrapper::FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz) : GrabberWrapper("FrameBuffer", &_grabber, grabWidth, grabHeight, updateRate_Hz) , _grabber(device, grabWidth, grabHeight) {} diff --git a/libsrc/grabber/osx/OsxFrameGrabber.cpp b/libsrc/grabber/osx/OsxFrameGrabber.cpp index 7929899f..69a8a705 100644 --- a/libsrc/grabber/osx/OsxFrameGrabber.cpp +++ b/libsrc/grabber/osx/OsxFrameGrabber.cpp @@ -5,7 +5,7 @@ // Local includes #include -OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height) +OsxFrameGrabber::OsxFrameGrabber(unsigned display, unsigned width, unsigned height) : Grabber("OSXGRABBER", width, height) , _screenIndex(100) { diff --git a/libsrc/grabber/osx/OsxFrameGrabberMock.cpp b/libsrc/grabber/osx/OsxFrameGrabberMock.cpp index 501bcefc..5de645ec 100644 --- a/libsrc/grabber/osx/OsxFrameGrabberMock.cpp +++ b/libsrc/grabber/osx/OsxFrameGrabberMock.cpp @@ -30,7 +30,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image) { __osx_frame_counter = 0; } - + ColorRgb color[4] = {ColorRgb::RED, ColorRgb::BLUE, ColorRgb::GREEN, ColorRgb::WHITE}; if (__osx_frame_counter < 25) { @@ -55,7 +55,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image) } unsigned w = image->width(); unsigned h = image->height(); - + for (unsigned y=0; y= h/2) id = 2; if (x >= w/2 && y < h/2) id = 3; - + image->memptr()[y*w + x] = color[id]; } } - + return image; } diff --git a/libsrc/grabber/osx/OsxWrapper.cpp b/libsrc/grabber/osx/OsxWrapper.cpp index 6324532c..2a0666f9 100644 --- a/libsrc/grabber/osx/OsxWrapper.cpp +++ b/libsrc/grabber/osx/OsxWrapper.cpp @@ -1,6 +1,6 @@ #include -OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) +OsxWrapper::OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz) : GrabberWrapper("OSX FrameGrabber", &_grabber, grabWidth, grabHeight, updateRate_Hz) , _grabber(display, grabWidth, grabHeight) {} diff --git a/libsrc/grabber/qt/QtGrabber.cpp b/libsrc/grabber/qt/QtGrabber.cpp index 75803f27..aca6092d 100644 --- a/libsrc/grabber/qt/QtGrabber.cpp +++ b/libsrc/grabber/qt/QtGrabber.cpp @@ -116,7 +116,7 @@ int QtGrabber::grabFrame(Image & image) return 0; } -int QtGrabber::updateScreenDimensions(const bool& force) +int QtGrabber::updateScreenDimensions(bool force) { if(!_screen) return -1; diff --git a/libsrc/grabber/qt/QtWrapper.cpp b/libsrc/grabber/qt/QtWrapper.cpp index 6326711c..2d525198 100644 --- a/libsrc/grabber/qt/QtWrapper.cpp +++ b/libsrc/grabber/qt/QtWrapper.cpp @@ -1,6 +1,6 @@ #include -QtWrapper::QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz) +QtWrapper::QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, unsigned updateRate_Hz) : GrabberWrapper("Qt", &_grabber, 0, 0, updateRate_Hz) , _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation, display) {} diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index e1536fff..fce3f348 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -31,10 +31,10 @@ #endif V4L2Grabber::V4L2Grabber(const QString & device - , const unsigned width - , const unsigned height - , const unsigned fps - , const unsigned input + , unsigned width + , unsigned height + , unsigned fps + , unsigned input , VideoStandard videoStandard , PixelFormat pixelFormat , int pixelDecimation @@ -1368,7 +1368,7 @@ bool V4L2Grabber::setFramerate(int fps) return false; } -QStringList V4L2Grabber::getV4L2devices() +QStringList V4L2Grabber::getV4L2devices() const { QStringList result = QStringList(); for (auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it) @@ -1378,22 +1378,22 @@ QStringList V4L2Grabber::getV4L2devices() return result; } -QString V4L2Grabber::getV4L2deviceName(QString devicePath) +QString V4L2Grabber::getV4L2deviceName(const QString& devicePath) const { return _deviceProperties.value(devicePath).name; } -QMultiMap V4L2Grabber::getV4L2deviceInputs(QString devicePath) +QMultiMap V4L2Grabber::getV4L2deviceInputs(const QString& devicePath) const { return _deviceProperties.value(devicePath).inputs; } -QStringList V4L2Grabber::getResolutions(QString devicePath) +QStringList V4L2Grabber::getResolutions(const QString& devicePath) const { return _deviceProperties.value(devicePath).resolutions; } -QStringList V4L2Grabber::getFramerates(QString devicePath) +QStringList V4L2Grabber::getFramerates(const QString& devicePath) const { return _deviceProperties.value(devicePath).framerates; } diff --git a/libsrc/grabber/v4l2/V4L2Wrapper.cpp b/libsrc/grabber/v4l2/V4L2Wrapper.cpp index 6824ce0e..98207df0 100644 --- a/libsrc/grabber/v4l2/V4L2Wrapper.cpp +++ b/libsrc/grabber/v4l2/V4L2Wrapper.cpp @@ -6,10 +6,10 @@ #include V4L2Wrapper::V4L2Wrapper(const QString &device, - const unsigned grabWidth, - const unsigned grabHeight, - const unsigned fps, - const unsigned input, + unsigned grabWidth, + unsigned grabHeight, + unsigned fps, + unsigned input, VideoStandard videoStandard, PixelFormat pixelFormat, int pixelDecimation ) @@ -85,7 +85,7 @@ void V4L2Wrapper::setSignalDetectionEnable(bool enable) _grabber.setSignalDetectionEnable(enable); } -bool V4L2Wrapper::getSignalDetectionEnable() +bool V4L2Wrapper::getSignalDetectionEnable() const { return _grabber.getSignalDetectionEnabled(); } @@ -95,12 +95,12 @@ void V4L2Wrapper::setCecDetectionEnable(bool enable) _grabber.setCecDetectionEnable(enable); } -bool V4L2Wrapper::getCecDetectionEnable() +bool V4L2Wrapper::getCecDetectionEnable() const { return _grabber.getCecDetectionEnabled(); } -void V4L2Wrapper::setDeviceVideoStandard(QString device, VideoStandard videoStandard) +void V4L2Wrapper::setDeviceVideoStandard(const QString& device, VideoStandard videoStandard) { _grabber.setDeviceVideoStandard(device, videoStandard); } @@ -110,7 +110,7 @@ void V4L2Wrapper::handleCecEvent(CECEvent event) _grabber.handleCecEvent(event); } -void V4L2Wrapper::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void V4L2Wrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::V4L2 && _grabberName.startsWith("V4L")) { diff --git a/libsrc/grabber/x11/X11Wrapper.cpp b/libsrc/grabber/x11/X11Wrapper.cpp index f44d4952..a02e3627 100644 --- a/libsrc/grabber/x11/X11Wrapper.cpp +++ b/libsrc/grabber/x11/X11Wrapper.cpp @@ -1,6 +1,6 @@ #include -X11Wrapper::X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz) +X11Wrapper::X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, unsigned updateRate_Hz) : GrabberWrapper("X11", &_grabber, 0, 0, updateRate_Hz) , _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation) , _init(false) diff --git a/libsrc/grabber/xcb/XcbGrabber.cpp b/libsrc/grabber/xcb/XcbGrabber.cpp index 76f05cea..275a6156 100644 --- a/libsrc/grabber/xcb/XcbGrabber.cpp +++ b/libsrc/grabber/xcb/XcbGrabber.cpp @@ -86,7 +86,7 @@ void XcbGrabber::setupResources() if(_XcbShmAvailable) { _shminfo = xcb_generate_id(_connection); - int id = shmget(IPC_PRIVATE, _width * _height * 4, IPC_CREAT | 0777); + int id = shmget(IPC_PRIVATE, size_t(_width) * size_t(_height) * 4, IPC_CREAT | 0777); _shmData = static_cast(shmat(id, nullptr, 0)); xcb_shm_attach(_connection, _shminfo, id, 0); } diff --git a/libsrc/hyperion/AuthManager.cpp b/libsrc/hyperion/AuthManager.cpp index c9197873..996291d0 100644 --- a/libsrc/hyperion/AuthManager.cpp +++ b/libsrc/hyperion/AuthManager.cpp @@ -61,7 +61,7 @@ AuthManager::AuthDefinition AuthManager::createToken(const QString &comment) return def; } -QVector AuthManager::getTokenList() +QVector AuthManager::getTokenList() const { QVector vector = _authTable->getTokenList(); QVector finalVec; @@ -79,13 +79,13 @@ QVector AuthManager::getTokenList() return finalVec; } -const QString AuthManager::getUserToken(const QString &usr) +QString AuthManager::getUserToken(const QString &usr) const { QString tok = _authTable->getUserToken(usr); return QString(_authTable->getUserToken(usr)); } -void AuthManager::setAuthBlock(const bool &user) +void AuthManager::setAuthBlock(bool user) { // current timestamp +10 minutes if (user) @@ -172,7 +172,7 @@ void AuthManager::cancelNewTokenRequest(QObject *caller, const QString &comment, } } -void AuthManager::handlePendingTokenRequest(const QString &id, const bool &accept) +void AuthManager::handlePendingTokenRequest(const QString &id, bool accept) { if (_pendingRequests.contains(id)) { @@ -192,7 +192,7 @@ void AuthManager::handlePendingTokenRequest(const QString &id, const bool &accep } } -QVector AuthManager::getPendingRequests() +QVector AuthManager::getPendingRequests() const { QVector finalVec; for (const auto &entry : _pendingRequests) @@ -226,7 +226,7 @@ bool AuthManager::deleteToken(const QString &id) return false; } -void AuthManager::handleSettingsUpdate(const settings::type &type, const QJsonDocument &config) +void AuthManager::handleSettingsUpdate(settings::type type, const QJsonDocument &config) { if (type == settings::NETWORK) { diff --git a/libsrc/hyperion/CaptureCont.cpp b/libsrc/hyperion/CaptureCont.cpp index 9f12a485..7389f37d 100644 --- a/libsrc/hyperion/CaptureCont.cpp +++ b/libsrc/hyperion/CaptureCont.cpp @@ -63,7 +63,7 @@ void CaptureCont::handleSystemImage(const QString& name, const Image& _hyperion->setInputImage(_systemCaptPrio, image); } -void CaptureCont::setSystemCaptureEnable(const bool& enable) +void CaptureCont::setSystemCaptureEnable(bool enable) { if(_systemCaptEnabled != enable) { @@ -86,7 +86,7 @@ void CaptureCont::setSystemCaptureEnable(const bool& enable) } } -void CaptureCont::setV4LCaptureEnable(const bool& enable) +void CaptureCont::setV4LCaptureEnable(bool enable) { if(_v4lCaptEnabled != enable) { @@ -109,7 +109,7 @@ void CaptureCont::setV4LCaptureEnable(const bool& enable) } } -void CaptureCont::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void CaptureCont::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::INSTCAPTURE) { @@ -130,7 +130,7 @@ void CaptureCont::handleSettingsUpdate(const settings::type& type, const QJsonDo } } -void CaptureCont::handleCompStateChangeRequest(const hyperion::Components component, bool enable) +void CaptureCont::handleCompStateChangeRequest(hyperion::Components component, bool enable) { if(component == hyperion::COMP_GRABBER) { diff --git a/libsrc/hyperion/ComponentRegister.cpp b/libsrc/hyperion/ComponentRegister.cpp index 5a38a6bd..56d3e430 100644 --- a/libsrc/hyperion/ComponentRegister.cpp +++ b/libsrc/hyperion/ComponentRegister.cpp @@ -24,12 +24,12 @@ ComponentRegister::~ComponentRegister() { } -int ComponentRegister::isComponentEnabled(const hyperion::Components& comp) const +int ComponentRegister::isComponentEnabled(hyperion::Components comp) const { return (_componentStates.count(comp)) ? _componentStates.at(comp) : -1; } -void ComponentRegister::setNewComponentState(const hyperion::Components comp, const bool activated) +void ComponentRegister::setNewComponentState(hyperion::Components comp, bool activated) { if(_componentStates[comp] != activated) { @@ -40,7 +40,7 @@ void ComponentRegister::setNewComponentState(const hyperion::Components comp, co } } -void ComponentRegister::handleCompStateChangeRequest(const hyperion::Components comps, const bool activated) +void ComponentRegister::handleCompStateChangeRequest(hyperion::Components comps, bool activated) { if(comps == COMP_ALL && !_inProgress) { diff --git a/libsrc/hyperion/Grabber.cpp b/libsrc/hyperion/Grabber.cpp index c0954043..85633ff1 100644 --- a/libsrc/hyperion/Grabber.cpp +++ b/libsrc/hyperion/Grabber.cpp @@ -1,7 +1,6 @@ #include - -Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom) +Grabber::Grabber(const QString& grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom) : _imageResampler() , _useImageResampler(true) , _videoMode(VideoMode::VIDEO_2D) diff --git a/libsrc/hyperion/GrabberWrapper.cpp b/libsrc/hyperion/GrabberWrapper.cpp index 42f02364..c91cf1bd 100644 --- a/libsrc/hyperion/GrabberWrapper.cpp +++ b/libsrc/hyperion/GrabberWrapper.cpp @@ -11,7 +11,7 @@ GrabberWrapper* GrabberWrapper::instance = nullptr; -GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz) +GrabberWrapper::GrabberWrapper(const QString& grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz) : _grabberName(grabberName) , _timer(new QTimer(this)) , _updateInterval_ms(1000/updateRate_Hz) @@ -39,7 +39,6 @@ GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned GrabberWrapper::~GrabberWrapper() { - stop(); Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName)); } @@ -105,7 +104,7 @@ QStringList GrabberWrapper::availableGrabbers() return grabbers; } -void GrabberWrapper::setVideoMode(const VideoMode& mode) +void GrabberWrapper::setVideoMode(VideoMode mode) { if (_ggrabber != nullptr) { @@ -134,7 +133,7 @@ void GrabberWrapper::updateTimer(int interval) } } -void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void GrabberWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::SYSTEMCAPTURE && !_grabberName.startsWith("V4L")) { @@ -165,7 +164,7 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso } } -void GrabberWrapper::handleSourceRequest(const hyperion::Components& component, const int hyperionInd, const bool listen) +void GrabberWrapper::handleSourceRequest(hyperion::Components component, int hyperionInd, bool listen) { if(component == hyperion::Components::COMP_GRABBER && !_grabberName.startsWith("V4L")) { @@ -202,7 +201,7 @@ void GrabberWrapper::tryStart() } } -QStringList GrabberWrapper::getV4L2devices() +QStringList GrabberWrapper::getV4L2devices() const { if(_grabberName.startsWith("V4L")) return _ggrabber->getV4L2devices(); @@ -210,7 +209,7 @@ QStringList GrabberWrapper::getV4L2devices() return QStringList(); } -QString GrabberWrapper::getV4L2deviceName(QString devicePath) +QString GrabberWrapper::getV4L2deviceName(const QString& devicePath) const { if(_grabberName.startsWith("V4L")) return _ggrabber->getV4L2deviceName(devicePath); @@ -218,7 +217,7 @@ QString GrabberWrapper::getV4L2deviceName(QString devicePath) return QString(); } -QMultiMap GrabberWrapper::getV4L2deviceInputs(QString devicePath) +QMultiMap GrabberWrapper::getV4L2deviceInputs(const QString& devicePath) const { if(_grabberName.startsWith("V4L")) return _ggrabber->getV4L2deviceInputs(devicePath); @@ -226,7 +225,7 @@ QMultiMap GrabberWrapper::getV4L2deviceInputs(QString devicePath) return QMultiMap(); } -QStringList GrabberWrapper::getResolutions(QString devicePath) +QStringList GrabberWrapper::getResolutions(const QString& devicePath) const { if(_grabberName.startsWith("V4L")) return _ggrabber->getResolutions(devicePath); @@ -234,7 +233,7 @@ QStringList GrabberWrapper::getResolutions(QString devicePath) return QStringList(); } -QStringList GrabberWrapper::getFramerates(QString devicePath) +QStringList GrabberWrapper::getFramerates(const QString& devicePath) const { if(_grabberName.startsWith("V4L")) return _ggrabber->getFramerates(devicePath); diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index 71008115..90de57c5 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -39,7 +39,7 @@ // Boblight #include -Hyperion::Hyperion(const quint8& instance) +Hyperion::Hyperion(quint8 instance) : QObject() , _instIndex(instance) , _settingsManager(new SettingsManager(instance, this)) @@ -166,7 +166,7 @@ void Hyperion::freeObjects() delete _ledDeviceWrapper; } -void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void Hyperion::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { // std::cout << "Hyperion::handleSettingsUpdate" << std::endl; // std::cout << config.toJson().toStdString() << std::endl; @@ -250,12 +250,12 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum update(); } -QJsonDocument Hyperion::getSetting(const settings::type& type) const +QJsonDocument Hyperion::getSetting(settings::type type) const { return _settingsManager->getSetting(type); } -bool Hyperion::saveSettings(QJsonObject config, const bool& correct) +bool Hyperion::saveSettings(const QJsonObject& config, bool correct) { return _settingsManager->saveSettings(config, correct); } @@ -280,22 +280,22 @@ unsigned Hyperion::getLedCount() const return _ledString.leds().size(); } -void Hyperion::setSourceAutoSelect(const bool state) +void Hyperion::setSourceAutoSelect(bool state) { _muxer.setSourceAutoSelectEnabled(state); } -bool Hyperion::setVisiblePriority(const int& priority) +bool Hyperion::setVisiblePriority(int priority) { return _muxer.setPriority(priority); } -bool Hyperion::sourceAutoSelectEnabled() +bool Hyperion::sourceAutoSelectEnabled() const { return _muxer.isSourceAutoSelectEnabled(); } -void Hyperion::setNewComponentState(const hyperion::Components& component, const bool& state) +void Hyperion::setNewComponentState(hyperion::Components component, bool state) { _componentRegister.setNewComponentState(component, state); } @@ -305,17 +305,17 @@ std::map Hyperion::getAllComponents() const return _componentRegister.getRegister(); } -int Hyperion::isComponentEnabled(const hyperion::Components &comp) +int Hyperion::isComponentEnabled(hyperion::Components comp) const { return _componentRegister.isComponentEnabled(comp); } -void Hyperion::registerInput(const int priority, const hyperion::Components& component, const QString& origin, const QString& owner, unsigned smooth_cfg) +void Hyperion::registerInput(int priority, hyperion::Components component, const QString& origin, const QString& owner, unsigned smooth_cfg) { _muxer.registerInput(priority, component, origin, owner, smooth_cfg); } -bool Hyperion::setInput(const int priority, const std::vector& ledColors, int timeout_ms, const bool& clearEffect) +bool Hyperion::setInput(int priority, const std::vector& ledColors, int timeout_ms, bool clearEffect) { if(_muxer.setInput(priority, ledColors, timeout_ms)) { @@ -334,7 +334,7 @@ bool Hyperion::setInput(const int priority, const std::vector& ledColo return false; } -bool Hyperion::setInputImage(const int priority, const Image& image, int64_t timeout_ms, const bool& clearEffect) +bool Hyperion::setInputImage(int priority, const Image& image, int64_t timeout_ms, bool clearEffect) { if (!_muxer.hasPriority(priority)) { @@ -359,12 +359,12 @@ bool Hyperion::setInputImage(const int priority, const Image& image, i return false; } -bool Hyperion::setInputInactive(const quint8& priority) +bool Hyperion::setInputInactive(quint8 priority) { return _muxer.setInputInactive(priority); } -void Hyperion::setColor(const int priority, const std::vector &ledColors, const int timeout_ms, const QString &origin, bool clearEffects) +void Hyperion::setColor(int priority, const std::vector &ledColors, int timeout_ms, const QString &origin, bool clearEffects) { // clear effect if this call does not come from an effect if (clearEffects) @@ -396,7 +396,7 @@ end: _muxer.queuePush(); } -const QStringList & Hyperion::getAdjustmentIds() const +QStringList Hyperion::getAdjustmentIds() const { return _raw2ledAdjustment->getAdjustmentIds(); } @@ -412,7 +412,7 @@ void Hyperion::adjustmentsUpdated() update(); } -bool Hyperion::clear(const int priority, bool forceClearAll) +bool Hyperion::clear(int priority, bool forceClearAll) { if (priority < 0) { @@ -439,7 +439,7 @@ int Hyperion::getCurrentPriority() const return _muxer.getCurrentPriority(); } -bool Hyperion::isCurrentPriority(const int priority) const +bool Hyperion::isCurrentPriority(int priority) const { return getCurrentPriority() == priority; } @@ -449,7 +449,7 @@ QList Hyperion::getActivePriorities() const return _muxer.getPriorities(); } -Hyperion::InputInfo Hyperion::getPriorityInfo(const int priority) const +Hyperion::InputInfo Hyperion::getPriorityInfo(int priority) const { return _muxer.getInputInfo(priority); } @@ -464,22 +464,22 @@ QString Hyperion::deleteEffect(const QString& effectName) return _effectEngine->deleteEffect(effectName); } -const std::list & Hyperion::getEffects() const +std::list Hyperion::getEffects() const { return _effectEngine->getEffects(); } -const std::list & Hyperion::getActiveEffects() const +std::list Hyperion::getActiveEffects() const { return _effectEngine->getActiveEffects(); } -const std::list & Hyperion::getEffectSchemas() const +std::list Hyperion::getEffectSchemas() const { return _effectEngine->getEffectSchemas(); } -const QJsonObject& Hyperion::getQJsonConfig() const +QJsonObject Hyperion::getQJsonConfig() const { return _settingsManager->getSettings(); } @@ -494,7 +494,7 @@ int Hyperion::setEffect(const QString &effectName, const QJsonObject &args, int return _effectEngine->runEffect(effectName, args, priority, timeout, pythonScript, origin, 0, imageData); } -void Hyperion::setLedMappingType(const int& mappingType) +void Hyperion::setLedMappingType(int mappingType) { if(mappingType != _imageProcessor->getUserLedMappingType()) { @@ -508,7 +508,7 @@ int Hyperion::getLedMappingType() const return _imageProcessor->getUserLedMappingType(); } -void Hyperion::setVideoMode(const VideoMode& mode) +void Hyperion::setVideoMode(VideoMode mode) { emit videoMode(mode); } @@ -523,7 +523,7 @@ QString Hyperion::getActiveDeviceType() const return _ledDeviceWrapper->getActiveDeviceType(); } -void Hyperion::handleVisibleComponentChanged(const hyperion::Components &comp) +void Hyperion::handleVisibleComponentChanged(hyperion::Components comp) { _imageProcessor->setBlackbarDetectDisable((comp == hyperion::COMP_EFFECT)); _imageProcessor->setHardLedMappingType((comp == hyperion::COMP_EFFECT) ? 0 : -1); diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index 83e190bc..255055e8 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -19,7 +19,7 @@ HyperionIManager::HyperionIManager(const QString& rootPath, QObject* parent) qRegisterMetaType("InstanceState"); } -Hyperion* HyperionIManager::getHyperionInstance(const quint8& instance) +Hyperion* HyperionIManager::getHyperionInstance(quint8 instance) { if(_runningInstances.contains(instance)) return _runningInstances.value(instance); @@ -28,7 +28,7 @@ Hyperion* HyperionIManager::getHyperionInstance(const quint8& instance) return _runningInstances.value(0); } -const QVector HyperionIManager::getInstanceData() +QVector HyperionIManager::getInstanceData() const { QVector instances = _instanceTable->getAllInstances(); for( auto & entry : instances) @@ -57,7 +57,7 @@ void HyperionIManager::stopAll() } } -void HyperionIManager::toggleStateAllInstances(const bool& pause) +void HyperionIManager::toggleStateAllInstances(bool pause) { // copy the instances due to loop corruption, even with .erase() return next iter QMap instCopy = _runningInstances; @@ -67,7 +67,7 @@ void HyperionIManager::toggleStateAllInstances(const bool& pause) } } -bool HyperionIManager::startInstance(const quint8& inst, const bool& block) +bool HyperionIManager::startInstance(quint8 inst, bool block) { if(_instanceTable->instanceExist(inst)) { @@ -113,7 +113,7 @@ bool HyperionIManager::startInstance(const quint8& inst, const bool& block) return false; } -bool HyperionIManager::stopInstance(const quint8& inst) +bool HyperionIManager::stopInstance(quint8 inst) { // inst 0 can't be stopped if(!isInstAllowed(inst)) @@ -140,7 +140,7 @@ bool HyperionIManager::stopInstance(const quint8& inst) return false; } -bool HyperionIManager::createInstance(const QString& name, const bool& start) +bool HyperionIManager::createInstance(const QString& name, bool start) { quint8 inst; if(_instanceTable->createInstance(name, inst)) @@ -156,7 +156,7 @@ bool HyperionIManager::createInstance(const QString& name, const bool& start) return false; } -bool HyperionIManager::deleteInstance(const quint8& inst) +bool HyperionIManager::deleteInstance(quint8 inst) { // inst 0 can't be deleted if(!isInstAllowed(inst)) @@ -176,7 +176,7 @@ bool HyperionIManager::deleteInstance(const quint8& inst) return false; } -bool HyperionIManager::saveName(const quint8& inst, const QString& name) +bool HyperionIManager::saveName(quint8 inst, const QString& name) { if(_instanceTable->saveName(inst, name)) { @@ -189,7 +189,7 @@ bool HyperionIManager::saveName(const quint8& inst, const QString& name) void HyperionIManager::handleFinished() { Hyperion* hyperion = qobject_cast(sender()); - const quint8 & instance = hyperion->getInstanceIndex(); + quint8 instance = hyperion->getInstanceIndex(); Info(_log,"Hyperion instance '%s' has been stopped", QSTRING_CSTR(_instanceTable->getNamebyIndex(instance))); @@ -203,7 +203,7 @@ void HyperionIManager::handleFinished() void HyperionIManager::handleStarted() { Hyperion* hyperion = qobject_cast(sender()); - const quint8 & instance = hyperion->getInstanceIndex(); + quint8 instance = hyperion->getInstanceIndex(); Info(_log,"Hyperion instance '%s' has been started", QSTRING_CSTR(_instanceTable->getNamebyIndex(instance))); diff --git a/libsrc/hyperion/ImageProcessor.cpp b/libsrc/hyperion/ImageProcessor.cpp index 82a85a2d..cf47425c 100644 --- a/libsrc/hyperion/ImageProcessor.cpp +++ b/libsrc/hyperion/ImageProcessor.cpp @@ -10,7 +10,7 @@ using namespace hyperion; // global transform method -int ImageProcessor::mappingTypeToInt(QString mappingType) +int ImageProcessor::mappingTypeToInt(const QString& mappingType) { if (mappingType == "unicolor_mean" ) return 1; @@ -48,7 +48,7 @@ ImageProcessor::~ImageProcessor() delete _imageToLeds; } -void ImageProcessor::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void ImageProcessor::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::COLOR) { @@ -61,7 +61,7 @@ void ImageProcessor::handleSettingsUpdate(const settings::type& type, const QJso } } -void ImageProcessor::setSize(const unsigned width, const unsigned height) +void ImageProcessor::setSize(unsigned width, unsigned height) { // Check if the existing buffer-image is already the correct dimensions if (_imageToLeds && _imageToLeds->width() == width && _imageToLeds->height() == height) @@ -99,7 +99,7 @@ void ImageProcessor::setBlackbarDetectDisable(bool enable) _borderProcessor->setHardDisable(enable); } -bool ImageProcessor::blackBorderDetectorEnabled() +bool ImageProcessor::blackBorderDetectorEnabled() const { return _borderProcessor->enabled(); } diff --git a/libsrc/hyperion/ImageToLedsMap.cpp b/libsrc/hyperion/ImageToLedsMap.cpp index 61c62088..caebe20b 100644 --- a/libsrc/hyperion/ImageToLedsMap.cpp +++ b/libsrc/hyperion/ImageToLedsMap.cpp @@ -3,10 +3,10 @@ using namespace hyperion; ImageToLedsMap::ImageToLedsMap( - const unsigned width, - const unsigned height, - const unsigned horizontalBorder, - const unsigned verticalBorder, + unsigned width, + unsigned height, + unsigned horizontalBorder, + unsigned verticalBorder, const std::vector& leds) : _width(width) , _height(height) diff --git a/libsrc/hyperion/LinearColorSmoothing.cpp b/libsrc/hyperion/LinearColorSmoothing.cpp index 3d5b943f..1583f61e 100644 --- a/libsrc/hyperion/LinearColorSmoothing.cpp +++ b/libsrc/hyperion/LinearColorSmoothing.cpp @@ -43,7 +43,7 @@ LinearColorSmoothing::LinearColorSmoothing(const QJsonDocument& config, Hyperion connect(_timer, &QTimer::timeout, this, &LinearColorSmoothing::updateLeds); } -void LinearColorSmoothing::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void LinearColorSmoothing::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::SMOOTHING) { @@ -198,7 +198,7 @@ void LinearColorSmoothing::clearQueuedColors() _targetValues.clear(); } -void LinearColorSmoothing::componentStateChange(const hyperion::Components component, const bool state) +void LinearColorSmoothing::componentStateChange(hyperion::Components component, bool state) { _writeToLedsEnable = state; if(component == hyperion::COMP_LEDDEVICE) @@ -254,7 +254,7 @@ unsigned LinearColorSmoothing::updateConfig(unsigned cfgID, int settlingTime_ms, return updatedCfgID; } -bool LinearColorSmoothing::selectConfig(unsigned cfg, const bool& force) +bool LinearColorSmoothing::selectConfig(unsigned cfg, bool force) { if (_currentConfigId == cfg && !force) { diff --git a/libsrc/hyperion/LinearColorSmoothing.h b/libsrc/hyperion/LinearColorSmoothing.h index ed0990ce..c3472999 100644 --- a/libsrc/hyperion/LinearColorSmoothing.h +++ b/libsrc/hyperion/LinearColorSmoothing.h @@ -74,7 +74,7 @@ public: /// /// @return On success return else false (and falls back to cfg 0) /// - bool selectConfig(unsigned cfg, const bool& force = false); + bool selectConfig(unsigned cfg, bool force = false); public slots: /// @@ -82,7 +82,7 @@ public slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); private slots: /// Timer callback which writes updated led values to the led device @@ -93,7 +93,7 @@ private slots: /// @param component The component /// @param state The requested state /// - void componentStateChange(const hyperion::Components component, const bool state); + void componentStateChange(hyperion::Components component, bool state); private: diff --git a/libsrc/hyperion/MessageForwarder.cpp b/libsrc/hyperion/MessageForwarder.cpp index a22d8366..5dc2385c 100644 --- a/libsrc/hyperion/MessageForwarder.cpp +++ b/libsrc/hyperion/MessageForwarder.cpp @@ -43,7 +43,7 @@ MessageForwarder::~MessageForwarder() delete _forwardClients.takeFirst(); } -void MessageForwarder::handleSettingsUpdate(const settings::type &type, const QJsonDocument &config) +void MessageForwarder::handleSettingsUpdate(settings::type type, const QJsonDocument &config) { if(type == settings::NETFORWARD) { @@ -95,7 +95,7 @@ void MessageForwarder::handleSettingsUpdate(const settings::type &type, const QJ } } -void MessageForwarder::handleCompStateChangeRequest(const hyperion::Components component, bool enable) +void MessageForwarder::handleCompStateChangeRequest(hyperion::Components component, bool enable) { if (component == hyperion::COMP_FORWARDER && _forwarder_enabled != enable) { @@ -106,7 +106,7 @@ void MessageForwarder::handleCompStateChangeRequest(const hyperion::Components c } } -void MessageForwarder::handlePriorityChanges(const quint8 &priority) +void MessageForwarder::handlePriorityChanges(quint8 priority) { const QJsonObject obj = _hyperion->getSetting(settings::NETFORWARD).object(); if (priority != 0 && _forwarder_enabled && obj["enable"].toBool()) @@ -156,7 +156,7 @@ void MessageForwarder::handlePriorityChanges(const quint8 &priority) } } -void MessageForwarder::addJsonSlave(QString slave) +void MessageForwarder::addJsonSlave(const QString& slave) { QStringList parts = slave.split(":"); if (parts.size() != 2) @@ -185,7 +185,7 @@ void MessageForwarder::addJsonSlave(QString slave) _jsonSlaves << slave; } -void MessageForwarder::addFlatbufferSlave(QString slave) +void MessageForwarder::addFlatbufferSlave(const QString& slave) { QStringList parts = slave.split(":"); if (parts.size() != 2) diff --git a/libsrc/hyperion/MultiColorAdjustment.cpp b/libsrc/hyperion/MultiColorAdjustment.cpp index 1a9ed9ca..2ceb370e 100644 --- a/libsrc/hyperion/MultiColorAdjustment.cpp +++ b/libsrc/hyperion/MultiColorAdjustment.cpp @@ -2,7 +2,7 @@ #include #include -MultiColorAdjustment::MultiColorAdjustment(const unsigned ledCnt) +MultiColorAdjustment::MultiColorAdjustment(unsigned ledCnt) : _ledAdjustments(ledCnt, nullptr) , _log(Logger::getInstance("ADJUSTMENT")) { @@ -25,7 +25,7 @@ void MultiColorAdjustment::addAdjustment(ColorAdjustment * adjustment) _adjustment.push_back(adjustment); } -void MultiColorAdjustment::setAdjustmentForLed(const QString& id, const unsigned startLed, unsigned endLed) +void MultiColorAdjustment::setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed) { // abort if(startLed > endLed) @@ -67,7 +67,7 @@ bool MultiColorAdjustment::verifyAdjustments() const return ok; } -const QStringList & MultiColorAdjustment::getAdjustmentIds() +QStringList MultiColorAdjustment::getAdjustmentIds() const { return _adjustmentIds; } diff --git a/libsrc/hyperion/PriorityMuxer.cpp b/libsrc/hyperion/PriorityMuxer.cpp index fd53a41d..b029434c 100644 --- a/libsrc/hyperion/PriorityMuxer.cpp +++ b/libsrc/hyperion/PriorityMuxer.cpp @@ -55,12 +55,12 @@ PriorityMuxer::~PriorityMuxer() { } -void PriorityMuxer::setEnable(const bool& enable) +void PriorityMuxer::setEnable(bool enable) { enable ? _updateTimer->start() : _updateTimer->stop(); } -bool PriorityMuxer::setSourceAutoSelectEnabled(const bool& enable, const bool& update) +bool PriorityMuxer::setSourceAutoSelectEnabled(bool enable, bool update) { if(_sourceAutoSelectEnabled != enable) { @@ -84,7 +84,7 @@ bool PriorityMuxer::setSourceAutoSelectEnabled(const bool& enable, const bool& u return false; } -bool PriorityMuxer::setPriority(const uint8_t priority) +bool PriorityMuxer::setPriority(uint8_t priority) { if(_activeInputs.contains(priority)) { @@ -96,7 +96,7 @@ bool PriorityMuxer::setPriority(const uint8_t priority) return false; } -void PriorityMuxer::updateLedColorsLength(const int& ledCount) +void PriorityMuxer::updateLedColorsLength(int ledCount) { for (auto infoIt = _activeInputs.begin(); infoIt != _activeInputs.end();) { @@ -113,12 +113,12 @@ QList PriorityMuxer::getPriorities() const return _activeInputs.keys(); } -bool PriorityMuxer::hasPriority(const int priority) const +bool PriorityMuxer::hasPriority(int priority) const { return (priority == PriorityMuxer::LOWEST_PRIORITY) ? true : _activeInputs.contains(priority); } -const PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(const int priority) const +PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(int priority) const { auto elemIt = _activeInputs.find(priority); if (elemIt == _activeInputs.end()) @@ -133,12 +133,12 @@ const PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(const int priority) c return elemIt.value(); } -hyperion::Components PriorityMuxer::getComponentOfPriority(const int &priority) +hyperion::Components PriorityMuxer::getComponentOfPriority(int priority) const { return _activeInputs[priority].componentId; } -void PriorityMuxer::registerInput(const int priority, const hyperion::Components& component, const QString& origin, const QString& owner, unsigned smooth_cfg) +void PriorityMuxer::registerInput(int priority, hyperion::Components component, const QString& origin, const QString& owner, unsigned smooth_cfg) { // detect new registers bool newInput = false; @@ -162,7 +162,7 @@ void PriorityMuxer::registerInput(const int priority, const hyperion::Components } } -bool PriorityMuxer::setInput(const int priority, const std::vector& ledColors, int64_t timeout_ms) +bool PriorityMuxer::setInput(int priority, const std::vector& ledColors, int64_t timeout_ms) { if(!_activeInputs.contains(priority)) { @@ -202,7 +202,7 @@ bool PriorityMuxer::setInput(const int priority, const std::vector& le return true; } -bool PriorityMuxer::setInputImage(const int priority, const Image& image, int64_t timeout_ms) +bool PriorityMuxer::setInputImage(int priority, const Image& image, int64_t timeout_ms) { if(!_activeInputs.contains(priority)) { @@ -242,13 +242,13 @@ bool PriorityMuxer::setInputImage(const int priority, const Image& ima return true; } -bool PriorityMuxer::setInputInactive(const quint8& priority) +bool PriorityMuxer::setInputInactive(quint8 priority) { Image image; return setInputImage(priority, image, -100); } -bool PriorityMuxer::clearInput(const uint8_t priority) +bool PriorityMuxer::clearInput(uint8_t priority) { if (priority < PriorityMuxer::LOWEST_PRIORITY && _activeInputs.remove(priority)) { @@ -283,7 +283,7 @@ void PriorityMuxer::clearAll(bool forceClearAll) } } -void PriorityMuxer::setCurrentTime(void) +void PriorityMuxer::setCurrentTime() { const int64_t now = QDateTime::currentMSecsSinceEpoch(); int newPriority; diff --git a/libsrc/hyperion/SettingsManager.cpp b/libsrc/hyperion/SettingsManager.cpp index 153ffb4d..2f4bcc8e 100644 --- a/libsrc/hyperion/SettingsManager.cpp +++ b/libsrc/hyperion/SettingsManager.cpp @@ -14,7 +14,7 @@ QJsonObject SettingsManager::schemaJson; -SettingsManager::SettingsManager(const quint8& instance, QObject* parent) +SettingsManager::SettingsManager(quint8 instance, QObject* parent) : QObject(parent) , _log(Logger::getInstance("SETTINGSMGR")) , _sTable(new SettingsTable(instance, this)) @@ -107,12 +107,12 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent) Debug(_log,"Settings database initialized"); } -const QJsonDocument SettingsManager::getSetting(const settings::type& type) +QJsonDocument SettingsManager::getSetting(settings::type type) const { return _sTable->getSettingsRecord(settings::typeToString(type)); } -bool SettingsManager::saveSettings(QJsonObject config, const bool& correct) +bool SettingsManager::saveSettings(QJsonObject config, bool correct) { // optional data upgrades e.g. imported legacy/older configs // handleConfigUpgrade(config); @@ -130,7 +130,7 @@ bool SettingsManager::saveSettings(QJsonObject config, const bool& correct) Warning(_log,"Fixing json data!"); config = schemaChecker.getAutoCorrectedConfig(config); - for (auto & schemaError : schemaChecker.getMessages()) + for (const auto & schemaError : schemaChecker.getMessages()) Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError)); } diff --git a/libsrc/jsonserver/JsonClientConnection.cpp b/libsrc/jsonserver/JsonClientConnection.cpp index 959ec20a..e6457277 100644 --- a/libsrc/jsonserver/JsonClientConnection.cpp +++ b/libsrc/jsonserver/JsonClientConnection.cpp @@ -6,7 +6,7 @@ #include #include -JsonClientConnection::JsonClientConnection(QTcpSocket *socket, const bool& localConnection) +JsonClientConnection::JsonClientConnection(QTcpSocket *socket, bool localConnection) : QObject() , _socket(socket) , _receiveBuffer() @@ -53,7 +53,7 @@ qint64 JsonClientConnection::sendMessage(QJsonObject message) return _socket->write(data.data(), data.size()); } -void JsonClientConnection::disconnected(void) +void JsonClientConnection::disconnected() { emit connectionClosed(); } diff --git a/libsrc/jsonserver/JsonClientConnection.h b/libsrc/jsonserver/JsonClientConnection.h index 267e495d..81886884 100644 --- a/libsrc/jsonserver/JsonClientConnection.h +++ b/libsrc/jsonserver/JsonClientConnection.h @@ -23,7 +23,7 @@ public: /// Constructor /// @param socket The Socket object for this connection /// - JsonClientConnection(QTcpSocket * socket, const bool& localConnection); + JsonClientConnection(QTcpSocket * socket, bool localConnection); signals: void connectionClosed(); diff --git a/libsrc/jsonserver/JsonServer.cpp b/libsrc/jsonserver/JsonServer.cpp index b97bfe9d..2ee9986b 100644 --- a/libsrc/jsonserver/JsonServer.cpp +++ b/libsrc/jsonserver/JsonServer.cpp @@ -73,7 +73,7 @@ void JsonServer::stop() Info(_log, "Stopped"); } -void JsonServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void JsonServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::JSONSERVER) { @@ -113,7 +113,7 @@ void JsonServer::newConnection() } } -void JsonServer::closedConnection(void) +void JsonServer::closedConnection() { JsonClientConnection* connection = qobject_cast(sender()); Debug(_log, "Connection closed"); diff --git a/libsrc/leddevice/LedDeviceTemplate.h b/libsrc/leddevice/LedDeviceTemplate.h index 6096c30c..de4c5614 100644 --- a/libsrc/leddevice/LedDeviceTemplate.h +++ b/libsrc/leddevice/LedDeviceTemplate.h @@ -35,21 +35,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -57,7 +57,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/LedDeviceWrapper.cpp b/libsrc/leddevice/LedDeviceWrapper.cpp index 06be1325..f03dce46 100644 --- a/libsrc/leddevice/LedDeviceWrapper.cpp +++ b/libsrc/leddevice/LedDeviceWrapper.cpp @@ -67,7 +67,7 @@ void LedDeviceWrapper::createLedDevice(const QJsonObject& config) thread->start(); } -const QJsonObject LedDeviceWrapper::getLedDeviceSchemas() +QJsonObject LedDeviceWrapper::getLedDeviceSchemas() { // make sure the resources are loaded (they may be left out after static linking) Q_INIT_RESOURCE(LedDeviceSchemas); @@ -118,21 +118,21 @@ const LedDeviceRegistry& LedDeviceWrapper::getDeviceMap() return _ledDeviceMap; } -int LedDeviceWrapper::getLatchTime() +int LedDeviceWrapper::getLatchTime() const { int value = 0; QMetaObject::invokeMethod(_ledDevice, "getLatchTime", Qt::BlockingQueuedConnection, Q_RETURN_ARG(int, value)); return value; } -QString LedDeviceWrapper::getActiveDeviceType() +QString LedDeviceWrapper::getActiveDeviceType() const { QString value = 0; QMetaObject::invokeMethod(_ledDevice, "getActiveDeviceType", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value)); return value; } -QString LedDeviceWrapper::getColorOrder() +QString LedDeviceWrapper::getColorOrder() const { QString value; QMetaObject::invokeMethod(_ledDevice, "getColorOrder", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value)); @@ -146,12 +146,12 @@ unsigned int LedDeviceWrapper::getLedCount() const return value; } -bool LedDeviceWrapper::enabled() +bool LedDeviceWrapper::enabled() const { return _enabled; } -void LedDeviceWrapper::handleComponentState(const hyperion::Components component, const bool state) +void LedDeviceWrapper::handleComponentState(hyperion::Components component, bool state) { if(component == hyperion::COMP_LEDDEVICE) { diff --git a/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h b/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h index 83010098..769c0d46 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h +++ b/libsrc/leddevice/dev_hid/LedDeviceHyperionUsbasp.h @@ -43,14 +43,14 @@ public: /// /// Destructor of the LedDevice; closes the output device if it is open /// - virtual ~LedDeviceHyperionUsbasp() override; + ~LedDeviceHyperionUsbasp() override; public slots: /// /// Closes the output device. /// Includes switching-off the device and stopping refreshes /// - virtual int close() override; + int close() override; protected: /// @@ -67,7 +67,7 @@ protected: /// /// @return Zero on success else negative /// - virtual int write(const std::vector& ledValues) override; + int write(const std::vector& ledValues) override; /// /// Test if the device is a Hyperion Usbasp device diff --git a/libsrc/leddevice/dev_hid/LedDeviceLightpack.h b/libsrc/leddevice/dev_hid/LedDeviceLightpack.h index bf197bda..1e6a03f5 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceLightpack.h +++ b/libsrc/leddevice/dev_hid/LedDeviceLightpack.h @@ -34,7 +34,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceLightpack() override; + ~LedDeviceLightpack() override; /// /// @brief Constructs the LED-device @@ -50,28 +50,28 @@ public: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -100,7 +100,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h b/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h index 256c3d7b..6ad69d56 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h +++ b/libsrc/leddevice/dev_hid/LedDeviceMultiLightpack.h @@ -31,7 +31,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceMultiLightpack() override; + ~LedDeviceMultiLightpack() override; /// /// @brief Constructs the LED-device @@ -49,28 +49,28 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Writes the RGB-Color values to the LEDs. diff --git a/libsrc/leddevice/dev_hid/LedDevicePaintpack.h b/libsrc/leddevice/dev_hid/LedDevicePaintpack.h index 95c7cc99..09b4735a 100644 --- a/libsrc/leddevice/dev_hid/LedDevicePaintpack.h +++ b/libsrc/leddevice/dev_hid/LedDevicePaintpack.h @@ -34,7 +34,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEPAINTTPACK_H diff --git a/libsrc/leddevice/dev_hid/LedDeviceRawHID.h b/libsrc/leddevice/dev_hid/LedDeviceRawHID.h index df409b75..1891a6fe 100644 --- a/libsrc/leddevice/dev_hid/LedDeviceRawHID.h +++ b/libsrc/leddevice/dev_hid/LedDeviceRawHID.h @@ -37,7 +37,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -45,7 +45,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICERAWHID_H diff --git a/libsrc/leddevice/dev_hid/ProviderHID.cpp b/libsrc/leddevice/dev_hid/ProviderHID.cpp index 8387b343..503be8a8 100644 --- a/libsrc/leddevice/dev_hid/ProviderHID.cpp +++ b/libsrc/leddevice/dev_hid/ProviderHID.cpp @@ -123,7 +123,7 @@ int ProviderHID::close() return retval; } -int ProviderHID::writeBytes(const unsigned size, const uint8_t * data) +int ProviderHID::writeBytes(unsigned size, const uint8_t * data) { if (_blockedForDelay) { return 0; @@ -157,28 +157,30 @@ int ProviderHID::writeBytes(const unsigned size, const uint8_t * data) else{ ret = hid_write(_deviceHandle, ledData, size + 1); } - + // Handle first error - if(ret < 0){ + if(ret < 0) + { Error(_log,"Failed to write to HID device."); // Try again - if(_useFeature){ + if(_useFeature) + { ret = hid_send_feature_report(_deviceHandle, ledData, size + 1); } - else{ + else + { ret = hid_write(_deviceHandle, ledData, size + 1); } // Writing failed again, device might have disconnected if(ret < 0){ Error(_log,"Failed to write to HID device."); - + hid_close(_deviceHandle); _deviceHandle = nullptr; } } - return ret; } diff --git a/libsrc/leddevice/dev_hid/ProviderHID.h b/libsrc/leddevice/dev_hid/ProviderHID.h index 40200f96..0183a80b 100644 --- a/libsrc/leddevice/dev_hid/ProviderHID.h +++ b/libsrc/leddevice/dev_hid/ProviderHID.h @@ -26,14 +26,14 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~ProviderHID() override; + ~ProviderHID() override; /// /// @brief Discover HIB (USB) devices available (for configuration). /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; protected: @@ -43,21 +43,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Write the given bytes to the HID-device @@ -66,7 +66,7 @@ protected: /// @param[in] data The data /// @return Zero on success, else negative /// - int writeBytes(const unsigned size, const uint8_t *data); + int writeBytes(unsigned size, const uint8_t *data); // HID VID and PID unsigned short _VendorId; diff --git a/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h b/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h index 17706a3c..3f1a9bb6 100644 --- a/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h +++ b/libsrc/leddevice/dev_net/LedDeviceAtmoOrb.h @@ -33,7 +33,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceAtmoOrb() override; + ~LedDeviceAtmoOrb() override; /// /// @brief Constructs the LED-device @@ -51,21 +51,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -73,7 +73,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp index 04c78832..75b6a4f9 100644 --- a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.cpp @@ -144,7 +144,7 @@ int LedDeviceFadeCandy::close() return retval; } -bool LedDeviceFadeCandy::isConnected() +bool LedDeviceFadeCandy::isConnected() const { bool connected = false; if ( _client != nullptr ) @@ -197,7 +197,7 @@ int LedDeviceFadeCandy::transferData() return -2; } -int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg) +int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, const QByteArray& msg) { if ( isConnected() ) { diff --git a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h index 4f8a3613..c4a7490a 100644 --- a/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h +++ b/libsrc/leddevice/dev_net/LedDeviceFadeCandy.h @@ -62,21 +62,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -84,7 +84,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: @@ -106,7 +106,7 @@ private: /// /// @return True, if connection established /// - bool isConnected(); + bool isConnected() const; /// /// @brief Transfer current opc_data buffer to opc server @@ -122,7 +122,7 @@ private: /// @param[in] commandId id of command /// @param[in] msg the sysEx message /// @return amount bytes written, -1 if failed - int sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg); + int sendSysEx(uint8_t systemId, uint8_t commandId, const QByteArray& msg); /// /// @brief Sends the configuration to fadecandy cserver diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp index b442a499..706d59b3 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp @@ -335,7 +335,7 @@ bool LedDeviceNanoleaf::initLedsConfiguration() return isInitOK; } -bool LedDeviceNanoleaf::initRestAPI(const QString &hostname, const int port, const QString &token ) +bool LedDeviceNanoleaf::initRestAPI(const QString &hostname, int port, const QString &token ) { bool isInitOK = false; @@ -506,7 +506,7 @@ bool LedDeviceNanoleaf::powerOff() return true; } -QString LedDeviceNanoleaf::getOnOffRequest (bool isOn ) const +QString LedDeviceNanoleaf::getOnOffRequest(bool isOn) const { QString state = isOn ? STATE_VALUE_TRUE : STATE_VALUE_FALSE; return QString( "{\"%1\":{\"%2\":%3}}" ).arg(STATE_ON, STATE_ONOFF_VALUE, state); @@ -607,7 +607,7 @@ int LedDeviceNanoleaf::write(const std::vector & ledValues) return retVal; } -std::string LedDeviceNanoleaf:: uint8_vector_to_hex_string( const std::vector& buffer ) const +std::string LedDeviceNanoleaf::uint8_vector_to_hex_string(const std::vector& buffer) const { std::stringstream ss; ss << std::hex << std::setfill('0'); diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h index 02c1a90f..7386c96e 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h @@ -37,7 +37,7 @@ public: /// /// @brief Destructor of the LED-device /// - virtual ~LedDeviceNanoleaf() override; + ~LedDeviceNanoleaf() override; /// /// @brief Constructs the LED-device @@ -51,7 +51,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get the Nanoleaf device's resource properties @@ -68,7 +68,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the Nanoleaf device to identify it. @@ -83,7 +83,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; protected: @@ -100,7 +100,7 @@ protected: /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -108,21 +108,21 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative ////// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Power-/turn on the Nanoleaf device. /// /// @brief Store the device's original state. /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; private: @@ -135,7 +135,7 @@ private: /// /// @return True, if success /// - bool initRestAPI(const QString &hostname, const int port, const QString &token ); + bool initRestAPI(const QString &hostname, int port, const QString &token ); /// /// @brief Get Nanoleaf device details and configuration diff --git a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp index a5f1ee23..c2fa61a5 100644 --- a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp +++ b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp @@ -342,7 +342,7 @@ bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig) return isInitOK; } -bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, const int port, const QString &token ) +bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token) { bool isInitOK = false; @@ -398,12 +398,12 @@ int LedDevicePhilipsHueBridge::close() return retval; } -const int *LedDevicePhilipsHueBridge::getCiphersuites() +const int *LedDevicePhilipsHueBridge::getCiphersuites() const { return SSL_CIPHERSUITES; } -void LedDevicePhilipsHueBridge::log(const char* msg, const char* type, ...) +void LedDevicePhilipsHueBridge::log(const char* msg, const char* type, ...) const { const size_t max_val_length = 1024; char val[max_val_length]; @@ -539,17 +539,17 @@ void LedDevicePhilipsHueBridge::setGroupMap(const QJsonDocument &doc) } } -const QMap& LedDevicePhilipsHueBridge::getLightMap(void) +QMap LedDevicePhilipsHueBridge::getLightMap() const { return _lightsMap; } -const QMap& LedDevicePhilipsHueBridge::getGroupMap(void) +QMap LedDevicePhilipsHueBridge::getGroupMap() const { return _groupsMap; } -QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) +QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) const { QString groupName; if( _groupsMap.contains( groupId ) ) @@ -564,7 +564,7 @@ QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) return groupName; } -QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) +QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) const { QJsonArray groupLights; // search user groupid inside _groupsMap and create light if found @@ -594,13 +594,13 @@ QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) return groupLights; } -bool LedDevicePhilipsHueBridge::checkApiError(const QJsonDocument &response ) +bool LedDevicePhilipsHueBridge::checkApiError(const QJsonDocument &response) { bool apiError = false; QString errorReason; QString strJson(response.toJson(QJsonDocument::Compact)); - DebugIf(verbose, _log, "Reply: [%s]", strJson.toUtf8().constData() ); + DebugIf(verbose, _log, "Reply: [%s]", strJson.toUtf8().constData()); QVariantList rspList = response.toVariant().toList(); if ( !rspList.isEmpty() ) @@ -637,13 +637,13 @@ QJsonDocument LedDevicePhilipsHueBridge::post(const QString& route, const QStrin return response.getBody(); } -void LedDevicePhilipsHueBridge::setLightState(const unsigned int lightId, const QString &state) +void LedDevicePhilipsHueBridge::setLightState(unsigned int lightId, const QString &state) { DebugIf( verbose, _log, "SetLightState [%u]: %s", lightId, QSTRING_CSTR(state) ); post( QString("%1/%2/%3").arg( API_LIGHTS ).arg( lightId ).arg( API_STATE ), state ); } -QJsonDocument LedDevicePhilipsHueBridge::getGroupState(const unsigned int groupId) +QJsonDocument LedDevicePhilipsHueBridge::getGroupState(unsigned int groupId) { _restApi->setPath( QString("%1/%2").arg( API_GROUPS ).arg( groupId ) ); httpResponse response = _restApi->get(); @@ -651,13 +651,13 @@ QJsonDocument LedDevicePhilipsHueBridge::getGroupState(const unsigned int groupI return response.getBody(); } -QJsonDocument LedDevicePhilipsHueBridge::setGroupState(const unsigned int groupId, bool state) +QJsonDocument LedDevicePhilipsHueBridge::setGroupState(unsigned int groupId, bool state) { QString active = state ? API_STREAM_ACTIVE_VALUE_TRUE : API_STREAM_ACTIVE_VALUE_FALSE; return post( QString("%1/%2").arg( API_GROUPS ).arg( groupId ), QString("{\"%1\":{\"%2\":%3}}").arg( API_STREAM, API_STREAM_ACTIVE, active ) ); } -bool LedDevicePhilipsHueBridge::isStreamOwner(const QString &streamOwner) +bool LedDevicePhilipsHueBridge::isStreamOwner(const QString &streamOwner) const { return ( streamOwner != "" && streamOwner == _username ); } @@ -1245,13 +1245,13 @@ bool LedDevicePhilipsHue::setStreamGroupState(bool state) return false; } -QByteArray LedDevicePhilipsHue::prepareStreamData() +QByteArray LedDevicePhilipsHue::prepareStreamData() const { QByteArray msg; msg.reserve(static_cast(sizeof(HEADER) + sizeof(PAYLOAD_PER_LIGHT) * _lights.size())); msg.append((const char*)HEADER, sizeof(HEADER)); - for (PhilipsHueLight& light : _lights) + for (const PhilipsHueLight& light : _lights) { CiColor lightC = light.getColor(); quint64 R = lightC.x * 0xffff; diff --git a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h index d18709ed..baac3cdd 100644 --- a/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h +++ b/libsrc/leddevice/dev_net/LedDevicePhilipsHue.h @@ -197,7 +197,7 @@ public: /// /// @return True, if success /// - bool initRestAPI(const QString &hostname, const int port, const QString &token ); + bool initRestAPI(const QString &hostname, int port, const QString &token ); /// /// @param route the route of the POST request. @@ -208,13 +208,13 @@ public: void setLightState(unsigned int lightId = 0, const QString &state = ""); - const QMap& getLightMap(); + QMap getLightMap() const; - const QMap& getGroupMap(); + QMap getGroupMap() const; - QString getGroupName(quint16 groupId = 0); + QString getGroupName(quint16 groupId = 0) const; - QJsonArray getGroupLights(quint16 groupId = 0); + QJsonArray getGroupLights(quint16 groupId = 0) const; @@ -226,21 +226,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the Hue-Bridge device and its SSL-connection /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open(void) override; + int open() override; /// /// @brief Closes the Hue-Bridge device and its SSL-connection /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Check, if Hue API response indicate error @@ -264,12 +264,12 @@ protected: QJsonDocument getGroupState( unsigned int groupId ); QJsonDocument setGroupState( unsigned int groupId, bool state); - bool isStreamOwner(const QString &streamOwner); + bool isStreamOwner(const QString &streamOwner) const; bool initMaps(); - void log(const char* msg, const char* type, ...); + void log(const char* msg, const char* type, ...) const; - const int * getCiphersuites() override; + const int * getCiphersuites() const override; private: @@ -316,7 +316,7 @@ public: /// /// @brief Destructor of the LED-device /// - virtual ~LedDevicePhilipsHue(); + ~LedDevicePhilipsHue(); /// /// @brief Constructs the LED-device @@ -331,7 +331,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get the Hue Bridge device's resource properties @@ -348,7 +348,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the device to identify it. @@ -357,7 +357,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; /// /// @brief Get the number of LEDs supported by the device. @@ -378,7 +378,7 @@ public slots: /// /// Includes switching-off the device and stopping refreshes. /// - virtual void stop() override; + void stop() override; protected: @@ -388,21 +388,21 @@ protected: /// @param deviceConfig Device's configuration in JSON /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -410,7 +410,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector& ledValues) override; + int write(const std::vector& ledValues) override; /// /// @brief Switch the LEDs on. @@ -421,7 +421,7 @@ protected: /// /// @return True if success /// - //virtual bool switchOn() override; + //bool switchOn() override; /// /// @brief Switch the LEDs off. @@ -432,7 +432,7 @@ protected: /// /// @return True, if success /// - virtual bool switchOff() override; + bool switchOff() override; /// /// @brief Power-/turn on the LED-device. @@ -441,7 +441,7 @@ protected: /// /// @return True, if success /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the LED-device. @@ -451,7 +451,7 @@ protected: /// /// @return True, if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Store the device's original state. @@ -460,7 +460,7 @@ protected: /// /// @return True if success /// - virtual bool storeState() override; + bool storeState() override; /// /// @brief Restore the device's original state. @@ -470,7 +470,7 @@ protected: /// /// @return True, if success /// - virtual bool restoreState() override; + bool restoreState() override; private slots: @@ -515,7 +515,7 @@ private: void stopBlackTimeoutTimer(); - QByteArray prepareStreamData(); + QByteArray prepareStreamData() const; /// bool _switchOffOnBlack; diff --git a/libsrc/leddevice/dev_net/LedDeviceTpm2net.h b/libsrc/leddevice/dev_net/LedDeviceTpm2net.h index 70338f7c..3d07ee17 100644 --- a/libsrc/leddevice/dev_net/LedDeviceTpm2net.h +++ b/libsrc/leddevice/dev_net/LedDeviceTpm2net.h @@ -34,7 +34,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; int _tpm2_max; int _tpm2ByteCount; diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.cpp b/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.cpp index 93ce87ce..f0a68596 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.cpp @@ -39,7 +39,7 @@ bool LedDeviceUdpArtNet::init(const QJsonObject &deviceConfig) } // populates the headers -void LedDeviceUdpArtNet::prepare(const unsigned this_universe, const unsigned this_sequence, unsigned this_dmxChannelCount) +void LedDeviceUdpArtNet::prepare(unsigned this_universe, unsigned this_sequence, unsigned this_dmxChannelCount) { // WTF? why do the specs say: // "This value should be an even number in the range 2 – 512. " diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h b/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h index f48ad508..6687a916 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpArtNet.h @@ -67,7 +67,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -75,12 +75,12 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Generate Art-Net communication header /// - void prepare(const unsigned this_universe, const unsigned this_sequence, const unsigned this_dmxChannelCount); + void prepare(unsigned this_universe, unsigned this_sequence, unsigned this_dmxChannelCount); artnet_packet_t artnet_packet; uint8_t _artnet_seq = 1; diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpE131.cpp b/libsrc/leddevice/dev_net/LedDeviceUdpE131.cpp index 3e1c053b..e3a6f4de 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpE131.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceUdpE131.cpp @@ -71,7 +71,7 @@ bool LedDeviceUdpE131::init(const QJsonObject &deviceConfig) } // populates the headers -void LedDeviceUdpE131::prepare(const unsigned this_universe, const unsigned this_dmxChannelCount) +void LedDeviceUdpE131::prepare(unsigned this_universe, unsigned this_dmxChannelCount) { memset(e131_packet.raw, 0, sizeof(e131_packet.raw)); diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpE131.h b/libsrc/leddevice/dev_net/LedDeviceUdpE131.h index 35836895..13c3c6ea 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpE131.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpE131.h @@ -112,7 +112,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -120,12 +120,12 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Generate E1.31 communication header /// - void prepare(const unsigned this_universe, const unsigned this_dmxChannelCount); + void prepare(unsigned this_universe, unsigned this_dmxChannelCount); e131_packet_t e131_packet; uint8_t _e131_seq = 0; diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpH801.h b/libsrc/leddevice/dev_net/LedDeviceUdpH801.h index 9a106e01..c0897a73 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpH801.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpH801.h @@ -35,7 +35,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -43,7 +43,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; QList _ids; QByteArray _message; diff --git a/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h b/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h index 7cdb8595..5fe89d46 100644 --- a/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h +++ b/libsrc/leddevice/dev_net/LedDeviceUdpRaw.h @@ -34,7 +34,7 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEUDPRAW_H diff --git a/libsrc/leddevice/dev_net/LedDeviceWled.cpp b/libsrc/leddevice/dev_net/LedDeviceWled.cpp index 3fab9b12..64b5fec0 100644 --- a/libsrc/leddevice/dev_net/LedDeviceWled.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceWled.cpp @@ -104,7 +104,7 @@ bool LedDeviceWled::init(const QJsonObject &deviceConfig) return isInitOK; } -bool LedDeviceWled::initRestAPI(const QString &hostname, const int port ) +bool LedDeviceWled::initRestAPI(const QString &hostname, int port) { Debug(_log, ""); bool isInitOK = false; @@ -121,7 +121,7 @@ bool LedDeviceWled::initRestAPI(const QString &hostname, const int port ) return isInitOK; } -QString LedDeviceWled::getOnOffRequest (bool isOn ) const +QString LedDeviceWled::getOnOffRequest(bool isOn) const { QString state = isOn ? STATE_VALUE_TRUE : STATE_VALUE_FALSE; return QString( "{\"%1\":%2}" ).arg( STATE_ON, state); diff --git a/libsrc/leddevice/dev_net/LedDeviceWled.h b/libsrc/leddevice/dev_net/LedDeviceWled.h index 172f62d0..bc195ff8 100644 --- a/libsrc/leddevice/dev_net/LedDeviceWled.h +++ b/libsrc/leddevice/dev_net/LedDeviceWled.h @@ -25,7 +25,7 @@ public: /// /// @brief Destructor of the WLED-device /// - virtual ~LedDeviceWled() override; + ~LedDeviceWled() override; /// /// @brief Constructs the WLED-device @@ -39,7 +39,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get the WLED device's resource properties @@ -55,7 +55,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the WLED device to identify it. @@ -69,7 +69,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; protected: @@ -79,7 +79,7 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -87,21 +87,21 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Power-/turn on the WLED device. /// /// @brief Store the device's original state. /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the WLED device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; private: @@ -112,7 +112,7 @@ private: /// @param[in] port /// @return True, if success /// - bool initRestAPI(const QString &hostname, const int port ); + bool initRestAPI(const QString &hostname, int port ); /// /// @brief Get command to power WLED-device on or off diff --git a/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp b/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp index 8019654c..602c6d5f 100644 --- a/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceYeelight.cpp @@ -234,12 +234,12 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul if ( ! _tcpSocket->waitForBytesWritten(WRITE_TIMEOUT.count()) ) { QString errorReason = QString ("(%1) %2").arg(_tcpSocket->error()).arg( _tcpSocket->errorString()); - log ( 2, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason)); + log ( 2, "Error:", "bytesWritten: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason)); this->setInError ( errorReason ); } else { - log ( 3, "Success:", "Bytes written [%d]", bytesWritten ); + log ( 3, "Success:", "Bytes written [%ll]", bytesWritten ); // Avoid to overrun the Yeelight Command Quota qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _lastWriteTime; @@ -247,7 +247,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul if ( elapsedTime < _waitTimeQuota ) { int waitTime = _waitTimeQuota; - log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %dms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota); + log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %llms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota); // Wait time (in ms) before doing next write to not overrun Yeelight command quota std::this_thread::sleep_for(std::chrono::milliseconds(_waitTimeQuota)); @@ -258,7 +258,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul { do { - log ( 3, "Reading:", "Bytes available [%d]", _tcpSocket->bytesAvailable() ); + log ( 3, "Reading:", "Bytes available [%ll]", _tcpSocket->bytesAvailable() ); while ( _tcpSocket->canReadLine() ) { QByteArray response = _tcpSocket->readLine(); @@ -338,7 +338,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command ) { int error = _tcpStreamSocket->error(); QString errorReason = QString ("(%1) %2").arg(error).arg( _tcpStreamSocket->errorString()); - log ( 1, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason)); + log ( 1, "Error:", "bytesWritten: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason)); if ( error == QAbstractSocket::RemoteHostClosedError ) { @@ -353,7 +353,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command ) } else { - log ( 3, "Success:", "Bytes written [%d]", bytesWritten ); + log ( 3, "Success:", "Bytes written [%ll]", bytesWritten ); rc = true; } } @@ -572,7 +572,7 @@ bool YeelightLight::identify() return rc; } -bool YeelightLight::isInMusicMode( bool deviceCheck) +bool YeelightLight::isInMusicMode(bool deviceCheck) { bool inMusicMode = false; @@ -896,7 +896,7 @@ bool YeelightLight::setColorHSV(const ColorRgb &colorRGB) } -void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int duration ) +void YeelightLight::setTransitionEffect(YeelightLight::API_EFFECT effect, int duration) { if( effect != _transitionEffect ) { @@ -911,7 +911,7 @@ void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int } -void YeelightLight::setBrightnessConfig (int min, int max, bool switchoff, int extraTime, double factor ) +void YeelightLight::setBrightnessConfig(int min, int max, bool switchoff, int extraTime, double factor) { _brightnessMin = min; _isBrightnessSwitchOffMinimum = switchoff; @@ -944,7 +944,7 @@ bool YeelightLight::setMusicMode(bool on, const QHostAddress &hostAddress, int p return rc; } -void YeelightLight::log(const int logLevel, const char* msg, const char* type, ...) +void YeelightLight::log(int logLevel, const char* msg, const char* type, ...) { if ( logLevel <= _debugLevel) { diff --git a/libsrc/leddevice/dev_net/LedDeviceYeelight.h b/libsrc/leddevice/dev_net/LedDeviceYeelight.h index f70a9e13..850f3a65 100644 --- a/libsrc/leddevice/dev_net/LedDeviceYeelight.h +++ b/libsrc/leddevice/dev_net/LedDeviceYeelight.h @@ -49,16 +49,14 @@ public: API_NOTIFICATION, }; - explicit YeelightResponse() {} - - API_REPLY error() { return _error;} + API_REPLY error() const { return _error;} void setError(const YeelightResponse::API_REPLY replyType) { _error = replyType; } QJsonArray getResult() const { return _resultArray; } void setResult(const QJsonArray &result) { _resultArray = result; } int getErrorCode() const { return _errorCode; } - void setErrorCode(const int &errorCode) { _errorCode = errorCode; _error = API_ERROR;} + void setErrorCode(int errorCode) { _errorCode = errorCode; _error = API_ERROR;} QString getErrorReason() const { return _errorReason; } void setErrorReason(const QString &errorReason) { _errorReason = errorReason; } @@ -79,7 +77,6 @@ class YeelightLight { public: - enum API_EFFECT{ API_EFFECT_SMOOTH, API_EFFECT_SUDDEN @@ -281,7 +278,7 @@ public: /// /// @return True, if success /// - virtual bool restoreState(); + bool restoreState(); /// /// @brief Check, if light was originally powered on before hyperion color streaming started.. @@ -353,7 +350,7 @@ private: /// @param[in] type log message text /// @param[in] ... variable input to log message text /// /// - void log(const int logLevel,const char* msg, const char* type, ...); + void log(int logLevel,const char* msg, const char* type, ...); Logger* _log; int _debugLevel; @@ -428,7 +425,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceYeelight() override; + ~LedDeviceYeelight() override; /// /// @brief Constructs the LED-device @@ -443,7 +440,7 @@ public: /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Get a Yeelight device's resource properties @@ -459,7 +456,7 @@ public: /// @param[in] params Parameters to query device /// @return A JSON structure holding the device's properties /// - virtual QJsonObject getProperties(const QJsonObject& params) override; + QJsonObject getProperties(const QJsonObject& params) override; /// /// @brief Send an update to the Yeelight device to identify it. @@ -474,7 +471,7 @@ public: /// /// @param[in] params Parameters to address device /// - virtual void identify(const QJsonObject& params) override; + void identify(const QJsonObject& params) override; protected: @@ -484,21 +481,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -506,21 +503,21 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// @brief Power-/turn on the Nanoleaf device. /// /// @brief Store the device's original state. /// - virtual bool powerOn() override; + bool powerOn() override; /// /// @brief Power-/turn off the Nanoleaf device. /// /// @return True if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Store the device's original state. @@ -529,7 +526,7 @@ protected: /// /// @return True if success /// - virtual bool storeState() override; + bool storeState() override; /// /// @brief Restore the device's original state. @@ -539,7 +536,7 @@ protected: /// /// @return True, if success /// - virtual bool restoreState() override; + bool restoreState() override; private: diff --git a/libsrc/leddevice/dev_net/ProviderRestApi.cpp b/libsrc/leddevice/dev_net/ProviderRestApi.cpp index d40a2d7d..5ad71e90 100644 --- a/libsrc/leddevice/dev_net/ProviderRestApi.cpp +++ b/libsrc/leddevice/dev_net/ProviderRestApi.cpp @@ -16,7 +16,7 @@ const QChar ONE_SLASH = '/'; } //End of constants -ProviderRestApi::ProviderRestApi(const QString &host, const int &port, const QString &basePath) +ProviderRestApi::ProviderRestApi(const QString &host, int port, const QString &basePath) :_log(Logger::getInstance("LEDDEVICE")) ,_networkManager(nullptr) ,_scheme("http") @@ -31,7 +31,7 @@ ProviderRestApi::ProviderRestApi(const QString &host, const int &port, const QSt _basePath = basePath; } -ProviderRestApi::ProviderRestApi(const QString &host, const int &port) +ProviderRestApi::ProviderRestApi(const QString &host, int port) : ProviderRestApi(host, port, "") {} ProviderRestApi::ProviderRestApi() diff --git a/libsrc/leddevice/dev_net/ProviderRestApi.h b/libsrc/leddevice/dev_net/ProviderRestApi.h index 6dd7479b..5a66bb20 100644 --- a/libsrc/leddevice/dev_net/ProviderRestApi.h +++ b/libsrc/leddevice/dev_net/ProviderRestApi.h @@ -28,7 +28,7 @@ public: void setErrorReason(const QString &errorReason) { _errorReason = errorReason; } int getHttpStatusCode() const { return _httpStatusCode; } - void setHttpStatusCode(const int httpStatusCode) { _httpStatusCode = httpStatusCode; } + void setHttpStatusCode(int httpStatusCode) { _httpStatusCode = httpStatusCode; } QNetworkReply::NetworkError getNetworkReplyError() const { return _networkReplyError; } void setNetworkReplyError (const QNetworkReply::NetworkError networkReplyError) { _networkReplyError = networkReplyError; } @@ -77,7 +77,7 @@ public: /// @param[in] host /// @param[in] port /// - explicit ProviderRestApi(const QString &host, const int &port); + explicit ProviderRestApi(const QString &host, int port); /// /// @brief Constructor of the REST-API wrapper @@ -86,7 +86,7 @@ public: /// @param[in] port /// @param[in] API base-path /// - explicit ProviderRestApi(const QString &host, const int &port, const QString &basePath); + explicit ProviderRestApi(const QString &host, int port, const QString &basePath); /// /// @brief Destructor of the REST-API wrapper diff --git a/libsrc/leddevice/dev_net/ProviderUdp.cpp b/libsrc/leddevice/dev_net/ProviderUdp.cpp index 7274a5fc..5f0fe052 100644 --- a/libsrc/leddevice/dev_net/ProviderUdp.cpp +++ b/libsrc/leddevice/dev_net/ProviderUdp.cpp @@ -125,7 +125,7 @@ int ProviderUdp::close() return retval; } -int ProviderUdp::writeBytes(const unsigned size, const uint8_t * data) +int ProviderUdp::writeBytes(unsigned size, const uint8_t * data) { qint64 retVal = _udpSocket->writeDatagram((const char *)data,size,_address,_port); diff --git a/libsrc/leddevice/dev_net/ProviderUdp.h b/libsrc/leddevice/dev_net/ProviderUdp.h index e2ae8b85..c2ba64a1 100644 --- a/libsrc/leddevice/dev_net/ProviderUdp.h +++ b/libsrc/leddevice/dev_net/ProviderUdp.h @@ -26,7 +26,7 @@ public: /// /// @brief Destructor of the UDP LED-device /// - virtual ~ProviderUdp() override; + ~ProviderUdp() override; protected: @@ -36,21 +36,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the UDP device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the given bytes/bits to the UDP-device and sleeps the latch time to ensure that the @@ -61,7 +61,7 @@ protected: /// /// @return Zero on success, else negative /// - int writeBytes(const unsigned size, const uint8_t *data); + int writeBytes(unsigned size, const uint8_t *data); /// QUdpSocket * _udpSocket; diff --git a/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp b/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp index 0b4ae3d1..cfdfde80 100644 --- a/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp +++ b/libsrc/leddevice/dev_net/ProviderUdpSSL.cpp @@ -181,7 +181,7 @@ void ProviderUdpSSL::closeSSLConnection() } } -const int *ProviderUdpSSL::getCiphersuites() +const int *ProviderUdpSSL::getCiphersuites() const { return mbedtls_ssl_list_ciphersuites(); } @@ -456,7 +456,7 @@ void ProviderUdpSSL::freeSSLConnection() } } -void ProviderUdpSSL::writeBytes(const unsigned size, const unsigned char * data) +void ProviderUdpSSL::writeBytes(unsigned size, const unsigned char * data) { if( _stopConnection ) return; diff --git a/libsrc/leddevice/dev_net/ProviderUdpSSL.h b/libsrc/leddevice/dev_net/ProviderUdpSSL.h index ea28c37f..f4b58593 100644 --- a/libsrc/leddevice/dev_net/ProviderUdpSSL.h +++ b/libsrc/leddevice/dev_net/ProviderUdpSSL.h @@ -66,7 +66,7 @@ public: /// /// @brief Destructor of the LED-device /// - virtual ~ProviderUdpSSL() override; + ~ProviderUdpSSL() override; protected: @@ -76,21 +76,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success#endif // PROVIDERUDP_H /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Initialise device's network details @@ -106,14 +106,14 @@ protected: /// @param[in] size The length of the data /// @param[in] data The data /// - void writeBytes(const unsigned size, const uint8_t *data); + void writeBytes(unsigned size, const uint8_t *data); /// /// get ciphersuites list from mbedtls_ssl_list_ciphersuites /// /// @return const int * array /// - virtual const int * getCiphersuites(); + virtual const int * getCiphersuites() const; void sslLog(const QString &msg, const char* errorType = "debug"); void sslLog(const char* msg, const char* errorType = "debug"); diff --git a/libsrc/leddevice/dev_other/LedDeviceFile.h b/libsrc/leddevice/dev_other/LedDeviceFile.h index d5a6ae22..95017007 100644 --- a/libsrc/leddevice/dev_other/LedDeviceFile.h +++ b/libsrc/leddevice/dev_other/LedDeviceFile.h @@ -26,7 +26,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceFile() override; + ~LedDeviceFile() override; /// /// @brief Constructs the LED-device @@ -43,21 +43,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -65,7 +65,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// The outputstream QFile* _file; diff --git a/libsrc/leddevice/dev_other/LedDevicePiBlaster.h b/libsrc/leddevice/dev_other/LedDevicePiBlaster.h index 5ece8737..4d6b0732 100644 --- a/libsrc/leddevice/dev_other/LedDevicePiBlaster.h +++ b/libsrc/leddevice/dev_other/LedDevicePiBlaster.h @@ -20,7 +20,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDevicePiBlaster() override; + ~LedDevicePiBlaster() override; /// /// @brief Constructs the LED-device @@ -43,14 +43,14 @@ protected: /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; private: diff --git a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp index 281f32cd..35275f86 100644 --- a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp +++ b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp @@ -127,7 +127,7 @@ int LedDeviceWS281x::write(const std::vector &ledValues) Rgb_to_Rgbw(color, &_temp_rgbw, _whiteAlgorithm); } - _led_string.channel[_channel].leds[idx++] = + _led_string.channel[_channel].leds[idx++] = ((uint32_t)_temp_rgbw.white << 24) + ((uint32_t)_temp_rgbw.red << 16) + ((uint32_t)_temp_rgbw.green << 8) + _temp_rgbw.blue; } @@ -135,6 +135,6 @@ int LedDeviceWS281x::write(const std::vector &ledValues) { _led_string.channel[_channel].leds[idx++] = 0; } - + return ws2811_render(&_led_string) ? -1 : 0; } diff --git a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h index 5ac4b76f..033005d8 100644 --- a/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h +++ b/libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.h @@ -22,7 +22,7 @@ public: /// /// @brief Destructor of the LedDevice /// - virtual ~LedDeviceWS281x() override; + ~LedDeviceWS281x() override; /// /// @brief Destructor of the LedDevice @@ -37,21 +37,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the output device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -59,7 +59,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/leddevice/dev_serial/LedDeviceAdalight.h b/libsrc/leddevice/dev_serial/LedDeviceAdalight.h index 38a522b1..f7df1601 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceAdalight.h +++ b/libsrc/leddevice/dev_serial/LedDeviceAdalight.h @@ -35,7 +35,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -43,7 +43,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const short _headerSize; bool _ligthBerryAPA102Mode; diff --git a/libsrc/leddevice/dev_serial/LedDeviceAtmo.h b/libsrc/leddevice/dev_serial/LedDeviceAtmo.h index 9aa13e94..0bb316d9 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceAtmo.h +++ b/libsrc/leddevice/dev_serial/LedDeviceAtmo.h @@ -30,7 +30,7 @@ private: /// /// @param[in] deviceConfig the JSON device configuration /// @return True, if success - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -38,7 +38,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICEATMO_H diff --git a/libsrc/leddevice/dev_serial/LedDeviceDMX.h b/libsrc/leddevice/dev_serial/LedDeviceDMX.h index 717432f6..ee7050f0 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceDMX.h +++ b/libsrc/leddevice/dev_serial/LedDeviceDMX.h @@ -24,7 +24,7 @@ public: /// @param[in] deviceConfig Device's configuration as JSON-Object /// @return LedDevice constructed static LedDevice* construct(const QJsonObject &deviceConfig); - + private: /// @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; int _dmxDeviceType = 0; int _dmxStart = 1; diff --git a/libsrc/leddevice/dev_serial/LedDeviceKarate.h b/libsrc/leddevice/dev_serial/LedDeviceKarate.h index b09d892d..f0b4329c 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceKarate.h +++ b/libsrc/leddevice/dev_serial/LedDeviceKarate.h @@ -34,14 +34,14 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// @brief Writes the RGB-Color values to the LEDs. /// /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICEKARATE_H diff --git a/libsrc/leddevice/dev_serial/LedDeviceSedu.h b/libsrc/leddevice/dev_serial/LedDeviceSedu.h index f59da2f2..9853c558 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceSedu.h +++ b/libsrc/leddevice/dev_serial/LedDeviceSedu.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICESEDU_H diff --git a/libsrc/leddevice/dev_serial/LedDeviceTpm2.h b/libsrc/leddevice/dev_serial/LedDeviceTpm2.h index a53b0a66..179b97e5 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceTpm2.h +++ b/libsrc/leddevice/dev_serial/LedDeviceTpm2.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector &ledValues) override; + int write(const std::vector &ledValues) override; }; #endif // LEDEVICETPM2_H diff --git a/libsrc/leddevice/dev_serial/ProviderRs232.cpp b/libsrc/leddevice/dev_serial/ProviderRs232.cpp index 885748a6..64c56cce 100644 --- a/libsrc/leddevice/dev_serial/ProviderRs232.cpp +++ b/libsrc/leddevice/dev_serial/ProviderRs232.cpp @@ -110,7 +110,7 @@ bool ProviderRs232::powerOff() return rc; } -bool ProviderRs232::tryOpen(const int delayAfterConnect_ms) +bool ProviderRs232::tryOpen(int delayAfterConnect_ms) { if (_deviceName.isEmpty() || _rs232Port.portName().isEmpty()) { diff --git a/libsrc/leddevice/dev_serial/ProviderRs232.h b/libsrc/leddevice/dev_serial/ProviderRs232.h index 1c618e9d..d4fbee24 100644 --- a/libsrc/leddevice/dev_serial/ProviderRs232.h +++ b/libsrc/leddevice/dev_serial/ProviderRs232.h @@ -24,7 +24,7 @@ public: /// /// @brief Destructor of the UDP LED-device /// - virtual ~ProviderRs232() override; + ~ProviderRs232() override; protected: @@ -34,21 +34,21 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Closes the UDP device. /// /// @return Zero on success (i.e. device is closed), else negative /// - virtual int close() override; + int close() override; /// /// @brief Power-/turn off a RS232-device @@ -57,21 +57,21 @@ protected: /// /// @return True, if success /// - virtual bool powerOff() override; + bool powerOff() override; /// /// @brief Discover first devices of a serial device available (for configuration) /// /// @return A string of the device found /// - virtual QString discoverFirst() override; + QString discoverFirst() override; /// /// @brief Discover RS232 serial devices available (for configuration). /// /// @return A JSON structure holding a list of devices found /// - virtual QJsonObject discover() override; + QJsonObject discover() override; /// /// @brief Write the given bytes to the RS232-device @@ -96,7 +96,7 @@ protected slots: /// /// @param errorMsg The error message to be logged /// - virtual void setInError( const QString& errorMsg) override; + void setInError( const QString& errorMsg) override; private: @@ -105,7 +105,7 @@ private: /// /// @return True,if on success /// - bool tryOpen(const int delayAfterConnect_ms); + bool tryOpen(int delayAfterConnect_ms); /// Try to auto-discover device name? bool _isAutoDeviceName; diff --git a/libsrc/leddevice/dev_spi/LedDeviceAPA102.h b/libsrc/leddevice/dev_spi/LedDeviceAPA102.h index 527a2114..712ed75d 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceAPA102.h +++ b/libsrc/leddevice/dev_spi/LedDeviceAPA102.h @@ -34,7 +34,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -42,7 +42,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEAPA102_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceAPA104.h b/libsrc/leddevice/dev_spi/LedDeviceAPA104.h index 2c70494b..cca986f7 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceAPA104.h +++ b/libsrc/leddevice/dev_spi/LedDeviceAPA104.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const int SPI_BYTES_PER_COLOUR; const int SPI_FRAME_END_LATCH_BYTES; diff --git a/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h b/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h index 65a11741..0e04d506 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h +++ b/libsrc/leddevice/dev_spi/LedDeviceLpd6803.h @@ -41,7 +41,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -49,7 +49,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICELPD6803_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h b/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h index 5460759f..c81668ee 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h +++ b/libsrc/leddevice/dev_spi/LedDeviceLpd8806.h @@ -103,7 +103,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -111,7 +111,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICELPD8806_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceP9813.h b/libsrc/leddevice/dev_spi/LedDeviceP9813.h index 675d2505..d8c794d9 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceP9813.h +++ b/libsrc/leddevice/dev_spi/LedDeviceP9813.h @@ -32,7 +32,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -40,7 +40,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; /// /// Calculates the required checksum for one LED diff --git a/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h b/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h index c1aac7d5..095163a0 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h +++ b/libsrc/leddevice/dev_spi/LedDeviceSk6812SPI.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; RGBW::WhiteAlgorithm _whiteAlgorithm; diff --git a/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h b/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h index 480a4dbb..5c63e160 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h +++ b/libsrc/leddevice/dev_spi/LedDeviceSk6822SPI.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const int SPI_BYTES_PER_COLOUR; const int SPI_BYTES_WAIT_TIME; diff --git a/libsrc/leddevice/dev_spi/LedDeviceWs2801.h b/libsrc/leddevice/dev_spi/LedDeviceWs2801.h index f8398c71..a8bc31d8 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceWs2801.h +++ b/libsrc/leddevice/dev_spi/LedDeviceWs2801.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; }; #endif // LEDEVICEWS2801_H diff --git a/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h b/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h index ae03039a..5fe039ac 100644 --- a/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h +++ b/libsrc/leddevice/dev_spi/LedDeviceWs2812SPI.h @@ -33,7 +33,7 @@ private: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -41,7 +41,7 @@ private: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; const int SPI_BYTES_PER_COLOUR; const int SPI_FRAME_END_LATCH_BYTES; diff --git a/libsrc/leddevice/dev_spi/ProviderSpi.cpp b/libsrc/leddevice/dev_spi/ProviderSpi.cpp index abc2d79d..44619791 100644 --- a/libsrc/leddevice/dev_spi/ProviderSpi.cpp +++ b/libsrc/leddevice/dev_spi/ProviderSpi.cpp @@ -124,7 +124,7 @@ int ProviderSpi::close() return retval; } -int ProviderSpi::writeBytes(const unsigned size, const uint8_t * data) +int ProviderSpi::writeBytes(unsigned size, const uint8_t * data) { if (_fid < 0) { diff --git a/libsrc/leddevice/dev_spi/ProviderSpi.h b/libsrc/leddevice/dev_spi/ProviderSpi.h index c5fc7911..e3956b72 100644 --- a/libsrc/leddevice/dev_spi/ProviderSpi.h +++ b/libsrc/leddevice/dev_spi/ProviderSpi.h @@ -22,26 +22,26 @@ public: /// /// @param deviceConfig the json device config /// @return true if success - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// Destructor of the LedDevice; closes the output device if it is open /// - virtual ~ProviderSpi() override; + ~ProviderSpi() override; /// /// Opens and configures the output device /// /// @return Zero on succes else negative /// - int open() override; + int open() override; public slots: /// /// Closes the output device. /// Includes switching-off the device and stopping refreshes /// - virtual int close() override; + int close() override; protected: /// @@ -53,7 +53,7 @@ protected: /// /// @return Zero on success, else negative /// - int writeBytes(const unsigned size, const uint8_t *data); + int writeBytes(unsigned size, const uint8_t *data); /// The name of the output device QString _deviceName; diff --git a/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h b/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h index a6f42118..a7c05a2f 100644 --- a/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h +++ b/libsrc/leddevice/dev_tinker/LedDeviceTinkerforge.h @@ -23,7 +23,7 @@ public: /// explicit LedDeviceTinkerforge(const QJsonObject &deviceConfig); - virtual ~LedDeviceTinkerforge() override; + ~LedDeviceTinkerforge() override; /// /// @brief Constructs the LED-device @@ -40,14 +40,14 @@ protected: /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// - virtual bool init(const QJsonObject &deviceConfig) override; + bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens a connection to the master bricklet and the led strip bricklet. /// /// @return Zero on success (i.e. device is ready), else negative /// - virtual int open() override; + int open() override; /// /// @brief Writes the RGB-Color values to the LEDs. @@ -55,7 +55,7 @@ protected: /// @param[in] ledValues The RGB-color per LED /// @return Zero on success, else negative /// - virtual int write(const std::vector & ledValues) override; + int write(const std::vector & ledValues) override; private: diff --git a/libsrc/protoserver/ProtoClientConnection.cpp b/libsrc/protoserver/ProtoClientConnection.cpp index e148d07f..d7098545 100644 --- a/libsrc/protoserver/ProtoClientConnection.cpp +++ b/libsrc/protoserver/ProtoClientConnection.cpp @@ -9,7 +9,7 @@ // TODO Remove this class if third-party apps have been migrated (eg. Hyperion Android Grabber, Windows Screen grabber etc.) -ProtoClientConnection::ProtoClientConnection(QTcpSocket* socket, const int &timeout, QObject *parent) +ProtoClientConnection::ProtoClientConnection(QTcpSocket* socket, int timeout, QObject *parent) : QObject(parent) , _log(Logger::getInstance("PROTOSERVER")) , _socket(socket) diff --git a/libsrc/protoserver/ProtoClientConnection.h b/libsrc/protoserver/ProtoClientConnection.h index e1083a59..6d8ce378 100644 --- a/libsrc/protoserver/ProtoClientConnection.h +++ b/libsrc/protoserver/ProtoClientConnection.h @@ -30,28 +30,28 @@ public: /// @param timeout The timeout when a client is automatically disconnected and the priority unregistered /// @param parent The parent /// - explicit ProtoClientConnection(QTcpSocket* socket, const int &timeout, QObject *parent); + explicit ProtoClientConnection(QTcpSocket* socket, int timeout, QObject *parent); signals: /// /// @brief forward register data to HyperionDaemon /// - void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "ProtoBuffer", const QString& owner = "", unsigned smooth_cfg = 0); + void registerGlobalInput(int priority, hyperion::Components component, const QString& origin = "ProtoBuffer", const QString& owner = "", unsigned smooth_cfg = 0); /// /// @brief Forward clear command to HyperionDaemon /// - void clearGlobalInput(const int priority, bool forceClearAll=false); + void clearGlobalInput(int priority, bool forceClearAll=false); /// /// @brief forward prepared image to HyperionDaemon /// - const bool setGlobalInputImage(const int priority, const Image& image, const int timeout_ms, const bool& clearEffect = false); + bool setGlobalInputImage(int priority, const Image& image, int timeout_ms, bool clearEffect = false); /// /// @brief Forward requested color /// - void setGlobalInputColor(const int priority, const std::vector &ledColor, const int timeout_ms, const QString& origin = "ProtoBuffer" ,bool clearEffects = true); + void setGlobalInputColor(int priority, const std::vector &ledColor, int timeout_ms, const QString& origin = "ProtoBuffer" ,bool clearEffects = true); /// /// @brief Emits whenever the client disconnected @@ -62,7 +62,7 @@ public slots: /// /// @brief Requests a registration from the client /// - void registationRequired(const int priority) { if (_priority == priority) _priority = -1; }; + void registationRequired(int priority) { if (_priority == priority) _priority = -1; }; /// /// @brief close the socket and call disconnected() diff --git a/libsrc/protoserver/ProtoServer.cpp b/libsrc/protoserver/ProtoServer.cpp index 154dc012..7bfc2954 100644 --- a/libsrc/protoserver/ProtoServer.cpp +++ b/libsrc/protoserver/ProtoServer.cpp @@ -35,7 +35,7 @@ void ProtoServer::initServer() handleSettingsUpdate(settings::PROTOSERVER, _config); } -void ProtoServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void ProtoServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::PROTOSERVER) { diff --git a/libsrc/ssdp/SSDPDiscover.cpp b/libsrc/ssdp/SSDPDiscover.cpp index d1e1ee50..712e2f32 100644 --- a/libsrc/ssdp/SSDPDiscover.cpp +++ b/libsrc/ssdp/SSDPDiscover.cpp @@ -49,7 +49,7 @@ void SSDPDiscover::searchForService(const QString& st) sendSearch(st); } -const QString SSDPDiscover::getFirstService(const searchType& type, const QString& st, const int& timeout_ms) +QString SSDPDiscover::getFirstService(const searchType& type, const QString& st, int timeout_ms) { _searchTarget = st; _services.clear(); @@ -271,11 +271,11 @@ int SSDPDiscover::discoverServices(const QString& searchTarget, const QString& k if ( _skipDupKeys ) { - _services.insert(mapKey, service); + _services.replace(mapKey, service); } else { - _services.insertMulti(mapKey, service); + _services.insert(mapKey, service); } } } @@ -296,11 +296,11 @@ int SSDPDiscover::discoverServices(const QString& searchTarget, const QString& k return rc; } -QJsonArray SSDPDiscover::getServicesDiscoveredJson() +QJsonArray SSDPDiscover::getServicesDiscoveredJson() const { QJsonArray result; - QMap::iterator i; + QMap::const_iterator i; for (i = _services.begin(); i != _services.end(); ++i) { //Debug(_log, "Device discovered at [%s]", QSTRING_CSTR( i.key() )); @@ -338,7 +338,7 @@ QJsonArray SSDPDiscover::getServicesDiscoveredJson() } QJsonObject objOther; - QMap ::iterator o; + QMap ::const_iterator o; for (o = i.value().otherHeaders.begin(); o != i.value().otherHeaders.end(); ++o) { objOther.insert(o.key().toLower(), o.value()); diff --git a/libsrc/ssdp/SSDPHandler.cpp b/libsrc/ssdp/SSDPHandler.cpp index f08101e0..48189fb1 100644 --- a/libsrc/ssdp/SSDPHandler.cpp +++ b/libsrc/ssdp/SSDPHandler.cpp @@ -15,7 +15,7 @@ static const QString SSDP_HYPERION_ST("urn:hyperion-project.org:device:basic:1"); -SSDPHandler::SSDPHandler(WebServer* webserver, const quint16& flatBufPort, const quint16& jsonServerPort, const QString& name, QObject * parent) +SSDPHandler::SSDPHandler(WebServer* webserver, quint16 flatBufPort, quint16 jsonServerPort, const QString& name, QObject * parent) : SSDPServer(parent) , _webserver(webserver) , _localAddress() @@ -73,7 +73,7 @@ void SSDPHandler::stopServer() SSDPServer::stop(); } -void SSDPHandler::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void SSDPHandler::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { const QJsonObject& obj = config.object(); @@ -102,7 +102,7 @@ void SSDPHandler::handleSettingsUpdate(const settings::type& type, const QJsonDo } } -void SSDPHandler::handleWebServerStateChange(const bool newState) +void SSDPHandler::handleWebServerStateChange(bool newState) { if(newState) { @@ -151,7 +151,7 @@ QString SSDPHandler::getLocalAddress() const return QString(); } -void SSDPHandler::handleMSearchRequest(const QString& target, const QString& mx, const QString address, const quint16 & port) +void SSDPHandler::handleMSearchRequest(const QString& target, const QString& mx, const QString address, quint16 port) { const auto respond = [=] () { // when searched for all devices / root devices / basic device @@ -202,7 +202,7 @@ QString SSDPHandler::buildDesc() const return SSDP_DESCRIPTION.arg(getBaseAddress(), QString("Hyperion (%1)").arg(_localAddress), QString(HYPERION_VERSION), _uuid); } -void SSDPHandler::sendAnnounceList(const bool alive) +void SSDPHandler::sendAnnounceList(bool alive) { for(const auto & entry : _deviceList){ alive ? SSDPServer::sendAlive(entry) : SSDPServer::sendByeBye(entry); diff --git a/libsrc/ssdp/SSDPServer.cpp b/libsrc/ssdp/SSDPServer.cpp index 19ed54c5..c214a6b5 100644 --- a/libsrc/ssdp/SSDPServer.cpp +++ b/libsrc/ssdp/SSDPServer.cpp @@ -166,7 +166,7 @@ void SSDPServer::readPendingDatagrams() } } -void SSDPServer::sendMSearchResponse(const QString& st, const QString& senderIp, const quint16& senderPort) +void SSDPServer::sendMSearchResponse(const QString& st, const QString& senderIp, quint16 senderPort) { QString message = UPNP_MSEARCH_RESPONSE.arg(SSDP_MAX_AGE , QDateTime::currentDateTimeUtc().toString("ddd, dd MMM yyyy HH:mm:ss GMT") diff --git a/libsrc/utils/ColorArgb.cpp b/libsrc/utils/ColorArgb.cpp index 5a9f0c05..4d4c8e82 100644 --- a/libsrc/utils/ColorArgb.cpp +++ b/libsrc/utils/ColorArgb.cpp @@ -1,10 +1,9 @@ - // Utils includes #include -ColorArgb ColorArgb::BLACK = { 255, 0, 0, 0 }; -ColorArgb ColorArgb::RED = { 255, 255, 0, 0 }; -ColorArgb ColorArgb::GREEN = { 255, 0, 255, 0 }; -ColorArgb ColorArgb::BLUE = { 255, 0, 0, 255 }; -ColorArgb ColorArgb::YELLOW= { 255, 255, 255, 0 }; -ColorArgb ColorArgb::WHITE = { 255, 255, 255, 255 }; +const ColorArgb ColorArgb::BLACK = { 255, 0, 0, 0 }; +const ColorArgb ColorArgb::RED = { 255, 255, 0, 0 }; +const ColorArgb ColorArgb::GREEN = { 255, 0, 255, 0 }; +const ColorArgb ColorArgb::BLUE = { 255, 0, 0, 255 }; +const ColorArgb ColorArgb::YELLOW = { 255, 255, 255, 0 }; +const ColorArgb ColorArgb::WHITE = { 255, 255, 255, 255 }; diff --git a/libsrc/utils/ColorBgr.cpp b/libsrc/utils/ColorBgr.cpp index 3167925e..54f0ab58 100644 --- a/libsrc/utils/ColorBgr.cpp +++ b/libsrc/utils/ColorBgr.cpp @@ -1,11 +1,10 @@ - // Local includes #include -ColorBgr ColorBgr::BLACK = { 0, 0, 0 }; -ColorBgr ColorBgr::RED = { 0, 0, 255 }; -ColorBgr ColorBgr::GREEN = { 0, 255, 0 }; -ColorBgr ColorBgr::BLUE = { 255, 0, 0 }; -ColorBgr ColorBgr::YELLOW= { 0, 255, 255 }; -ColorBgr ColorBgr::WHITE = { 255, 255, 255 }; +const ColorBgr ColorBgr::BLACK = { 0, 0, 0 }; +const ColorBgr ColorBgr::RED = { 0, 0, 255 }; +const ColorBgr ColorBgr::GREEN = { 0, 255, 0 }; +const ColorBgr ColorBgr::BLUE = { 255, 0, 0 }; +const ColorBgr ColorBgr::YELLOW = { 0, 255, 255 }; +const ColorBgr ColorBgr::WHITE = { 255, 255, 255 }; diff --git a/libsrc/utils/ColorRgb.cpp b/libsrc/utils/ColorRgb.cpp index 7e8c8769..157fcf29 100644 --- a/libsrc/utils/ColorRgb.cpp +++ b/libsrc/utils/ColorRgb.cpp @@ -1,10 +1,9 @@ - // Local includes #include -ColorRgb ColorRgb::BLACK = { 0, 0, 0 }; -ColorRgb ColorRgb::RED = { 255, 0, 0 }; -ColorRgb ColorRgb::GREEN = { 0, 255, 0 }; -ColorRgb ColorRgb::BLUE = { 0, 0, 255 }; -ColorRgb ColorRgb::YELLOW= { 255, 255, 0 }; -ColorRgb ColorRgb::WHITE = { 255, 255, 255 }; +const ColorRgb ColorRgb::BLACK = { 0, 0, 0 }; +const ColorRgb ColorRgb::RED = { 255, 0, 0 }; +const ColorRgb ColorRgb::GREEN = { 0, 255, 0 }; +const ColorRgb ColorRgb::BLUE = { 0, 0, 255 }; +const ColorRgb ColorRgb::YELLOW = { 255, 255, 0 }; +const ColorRgb ColorRgb::WHITE = { 255, 255, 255 }; diff --git a/libsrc/utils/ColorRgba.cpp b/libsrc/utils/ColorRgba.cpp index a14f1e4c..5736d799 100644 --- a/libsrc/utils/ColorRgba.cpp +++ b/libsrc/utils/ColorRgba.cpp @@ -1,10 +1,9 @@ - // Utils includes #include -ColorRgba ColorRgba::BLACK = { 0, 0, 0, 255 }; -ColorRgba ColorRgba::RED = { 255, 0, 0, 255 }; -ColorRgba ColorRgba::GREEN = { 0, 255, 0, 255 }; -ColorRgba ColorRgba::BLUE = { 0, 0, 255, 255 }; -ColorRgba ColorRgba::YELLOW= { 255, 255, 0, 255 }; -ColorRgba ColorRgba::WHITE = { 255, 255, 255, 255 }; +const ColorRgba ColorRgba::BLACK = { 0, 0, 0, 255 }; +const ColorRgba ColorRgba::RED = { 255, 0, 0, 255 }; +const ColorRgba ColorRgba::GREEN = { 0, 255, 0, 255 }; +const ColorRgba ColorRgba::BLUE = { 0, 0, 255, 255 }; +const ColorRgba ColorRgba::YELLOW = { 255, 255, 0, 255 }; +const ColorRgba ColorRgba::WHITE = { 255, 255, 255, 255 }; diff --git a/libsrc/utils/ColorRgbw.cpp b/libsrc/utils/ColorRgbw.cpp index af7cf9da..dd8e072c 100644 --- a/libsrc/utils/ColorRgbw.cpp +++ b/libsrc/utils/ColorRgbw.cpp @@ -1,10 +1,9 @@ - // Local includes #include -ColorRgbw ColorRgbw::BLACK = { 0, 0, 0, 0 }; -ColorRgbw ColorRgbw::RED = { 255, 0, 0, 0 }; -ColorRgbw ColorRgbw::GREEN = { 0, 255, 0, 0 }; -ColorRgbw ColorRgbw::BLUE = { 0, 0, 255, 0 }; -ColorRgbw ColorRgbw::YELLOW= { 255, 255, 0, 0 }; -ColorRgbw ColorRgbw::WHITE = { 0, 0, 0, 255 }; +const ColorRgbw ColorRgbw::BLACK = { 0, 0, 0, 0 }; +const ColorRgbw ColorRgbw::RED = { 255, 0, 0, 0 }; +const ColorRgbw ColorRgbw::GREEN = { 0, 255, 0, 0 }; +const ColorRgbw ColorRgbw::BLUE = { 0, 0, 255, 0 }; +const ColorRgbw ColorRgbw::YELLOW = { 255, 255, 0, 0 }; +const ColorRgbw ColorRgbw::WHITE = { 0, 0, 0, 255 }; diff --git a/libsrc/utils/ColorSys.cpp b/libsrc/utils/ColorSys.cpp index 5ba00254..bf3278fd 100644 --- a/libsrc/utils/ColorSys.cpp +++ b/libsrc/utils/ColorSys.cpp @@ -2,6 +2,11 @@ #include +inline uint8_t clamp(int x) +{ + return (x<0) ? 0 : ((x>255) ? 255 : uint8_t(x)); +} + void ColorSys::rgb2hsl(uint8_t red, uint8_t green, uint8_t blue, uint16_t & hue, float & saturation, float & luminance) { QColor color(red,green,blue); @@ -35,3 +40,15 @@ void ColorSys::hsv2rgb(uint16_t hue, uint8_t saturation, uint8_t value, uint8_t green = (uint8_t)color.green(); blue = (uint8_t)color.blue(); } + +void ColorSys::yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t &r, uint8_t &g, uint8_t &b) +{ + // see: http://en.wikipedia.org/wiki/YUV#Y.27UV444_to_RGB888_conversion + int c = y - 16; + int d = u - 128; + int e = v - 128; + + r = clamp((298 * c + 409 * e + 128) >> 8); + g = clamp((298 * c - 100 * d - 208 * e + 128) >> 8); + b = clamp((298 * c + 516 * d + 128) >> 8); +} diff --git a/libsrc/utils/FileUtils.cpp b/libsrc/utils/FileUtils.cpp index 5ee8bb2a..faf5e67f 100644 --- a/libsrc/utils/FileUtils.cpp +++ b/libsrc/utils/FileUtils.cpp @@ -10,13 +10,13 @@ namespace FileUtils { - QString getBaseName(QString sourceFile) + QString getBaseName(const QString& sourceFile) { QFileInfo fi(sourceFile); return fi.fileName(); } - QString getDirName(QString sourceFile) + QString getDirName(const QString& sourceFile) { QFileInfo fi(sourceFile); return fi.path(); diff --git a/libsrc/utils/ImageResampler.cpp b/libsrc/utils/ImageResampler.cpp index 11cbfd0e..faa5f575 100644 --- a/libsrc/utils/ImageResampler.cpp +++ b/libsrc/utils/ImageResampler.cpp @@ -1,4 +1,5 @@ #include "utils/ImageResampler.h" +#include #include ImageResampler::ImageResampler() @@ -61,11 +62,12 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i int outputWidth = (width - _cropLeft - cropRight - (_horizontalDecimation >> 1) + _horizontalDecimation - 1) / _horizontalDecimation; int outputHeight = (height - _cropTop - cropBottom - (_verticalDecimation >> 1) + _verticalDecimation - 1) / _verticalDecimation; - if (outputImage.width() != outputWidth || outputImage.height() != outputHeight) - outputImage.resize(outputWidth, outputHeight); + outputImage.resize(outputWidth, outputHeight); for (int yDest = 0, ySource = _cropTop + (_verticalDecimation >> 1); yDest < outputHeight; ySource += _verticalDecimation, ++yDest) { + int yOffset = lineLength * ySource; + for (int xDest = 0, xSource = _cropLeft + (_horizontalDecimation >> 1); xDest < outputWidth; xSource += _horizontalDecimation, ++xDest) { ColorRgb & rgb = outputImage(xDest, yDest); @@ -74,25 +76,25 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i { case PixelFormat::UYVY: { - int index = lineLength * ySource + (xSource << 1); + int index = yOffset + (xSource << 1); uint8_t y = data[index+1]; uint8_t u = ((xSource&1) == 0) ? data[index ] : data[index-2]; uint8_t v = ((xSource&1) == 0) ? data[index+2] : data[index ]; - yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue); + ColorSys::yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue); } break; case PixelFormat::YUYV: { - int index = lineLength * ySource + (xSource << 1); + int index = yOffset + (xSource << 1); uint8_t y = data[index]; uint8_t u = ((xSource&1) == 0) ? data[index+1] : data[index-1]; uint8_t v = ((xSource&1) == 0) ? data[index+3] : data[index+1]; - yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue); + ColorSys::yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue); } break; case PixelFormat::BGR16: { - int index = lineLength * ySource + (xSource << 1); + int index = yOffset + (xSource << 1); rgb.blue = (data[index] & 0x1f) << 3; rgb.green = (((data[index+1] & 0x7) << 3) | (data[index] & 0xE0) >> 5) << 2; rgb.red = (data[index+1] & 0xF8); @@ -100,7 +102,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i break; case PixelFormat::BGR24: { - int index = lineLength * ySource + (xSource << 1) + xSource; + int index = yOffset + (xSource << 1) + xSource; rgb.blue = data[index ]; rgb.green = data[index+1]; rgb.red = data[index+2]; @@ -108,7 +110,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i break; case PixelFormat::RGB32: { - int index = lineLength * ySource + (xSource << 2); + int index = yOffset + (xSource << 2); rgb.red = data[index ]; rgb.green = data[index+1]; rgb.blue = data[index+2]; @@ -116,7 +118,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i break; case PixelFormat::BGR32: { - int index = lineLength * ySource + (xSource << 2); + int index = yOffset + (xSource << 2); rgb.blue = data[index ]; rgb.green = data[index+1]; rgb.red = data[index+2]; @@ -133,20 +135,3 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i } } } - -uint8_t ImageResampler::clamp(int x) -{ - return (x<0) ? 0 : ((x>255) ? 255 : uint8_t(x)); -} - -void ImageResampler::yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t &r, uint8_t &g, uint8_t &b) -{ - // see: http://en.wikipedia.org/wiki/YUV#Y.27UV444_to_RGB888_conversion - int c = y - 16; - int d = u - 128; - int e = v - 128; - - r = clamp((298 * c + 409 * e + 128) >> 8); - g = clamp((298 * c - 100 * d - 208 * e + 128) >> 8); - b = clamp((298 * c + 516 * d + 128) >> 8); -} diff --git a/libsrc/utils/Logger.cpp b/libsrc/utils/Logger.cpp index cd68c7e2..04d2f3fb 100644 --- a/libsrc/utils/Logger.cpp +++ b/libsrc/utils/Logger.cpp @@ -114,7 +114,7 @@ Logger::LogLevel Logger::getLogLevel(const QString & name) return static_cast(int(GLOBAL_MIN_LOG_LEVEL)); } - Logger* log = Logger::getInstance(name); + const Logger* log = Logger::getInstance(name); return log->getMinLevel(); } diff --git a/libsrc/utils/NetOrigin.cpp b/libsrc/utils/NetOrigin.cpp index 465249b1..d5a486e6 100644 --- a/libsrc/utils/NetOrigin.cpp +++ b/libsrc/utils/NetOrigin.cpp @@ -48,7 +48,7 @@ bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& return true; } -void NetOrigin::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void NetOrigin::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::NETWORK) { diff --git a/libsrc/utils/Profiler.cpp b/libsrc/utils/Profiler.cpp index 3643da6f..bab62213 100644 --- a/libsrc/utils/Profiler.cpp +++ b/libsrc/utils/Profiler.cpp @@ -43,7 +43,7 @@ void Profiler::initLogger() _logger = Logger::getInstance("PROFILER", Logger::DEBUG); } -void Profiler::TimerStart(const QString timerName, const char* sourceFile, const char* func, unsigned int line) +void Profiler::TimerStart(const QString& timerName, const char* sourceFile, const char* func, unsigned int line) { std::pair::iterator,bool> ret; Profiler::initLogger(); @@ -71,7 +71,7 @@ void Profiler::TimerStart(const QString timerName, const char* sourceFile, const } -void Profiler::TimerGetTime(const QString timerName, const char* sourceFile, const char* func, unsigned int line) +void Profiler::TimerGetTime(const QString& timerName, const char* sourceFile, const char* func, unsigned int line) { std::map::iterator ret = GlobalProfilerMap.find(timerName); Profiler::initLogger(); diff --git a/libsrc/utils/RgbToRgbw.cpp b/libsrc/utils/RgbToRgbw.cpp index 25df6c4e..1a4d12c5 100644 --- a/libsrc/utils/RgbToRgbw.cpp +++ b/libsrc/utils/RgbToRgbw.cpp @@ -5,7 +5,7 @@ namespace RGBW { -WhiteAlgorithm stringToWhiteAlgorithm(QString str) +WhiteAlgorithm stringToWhiteAlgorithm(const QString& str) { if (str == "subtract_minimum") return WhiteAlgorithm::SUBTRACT_MINIMUM; if (str == "sub_min_warm_adjust") return WhiteAlgorithm::SUB_MIN_WARM_ADJUST; @@ -14,7 +14,7 @@ WhiteAlgorithm stringToWhiteAlgorithm(QString str) return WhiteAlgorithm::INVALID; } -void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm) +void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm) { switch (algorithm) { diff --git a/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp b/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp index 1ee0e6d7..99eae0d6 100644 --- a/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp +++ b/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp @@ -166,7 +166,7 @@ void QJsonSchemaChecker::setMessage(const QString & message) _messages.append(_currentPath.join("") +": "+message); } -const QStringList & QJsonSchemaChecker::getMessages() const +QStringList QJsonSchemaChecker::getMessages() const { return _messages; } diff --git a/libsrc/webserver/CgiHandler.h b/libsrc/webserver/CgiHandler.h index d096a700..3c38de43 100644 --- a/libsrc/webserver/CgiHandler.h +++ b/libsrc/webserver/CgiHandler.h @@ -10,19 +10,20 @@ #include "QtHttpReply.h" #include "QtHttpRequest.h" -class CgiHandler : public QObject { +class CgiHandler : public QObject +{ Q_OBJECT public: - CgiHandler (QObject * parent = NULL); + CgiHandler(QObject * parent = nullptr); void setBaseUrl(const QString& url); - void exec(const QStringList & args,QtHttpRequest * request, QtHttpReply * reply); + void exec(const QStringList & args, QtHttpRequest * request, QtHttpReply * reply); private: // CGI commands void cmd_cfg_jsonserver(); - void cmd_runscript (); + void cmd_runscript(); QtHttpReply * _reply; QtHttpRequest * _request; diff --git a/libsrc/webserver/QtHttpServer.h b/libsrc/webserver/QtHttpServer.h index ca8a9f02..4e09c6d7 100644 --- a/libsrc/webserver/QtHttpServer.h +++ b/libsrc/webserver/QtHttpServer.h @@ -24,7 +24,7 @@ class QtHttpServerWrapper : public QTcpServer public: explicit QtHttpServerWrapper (QObject * parent = Q_NULLPTR); - virtual ~QtHttpServerWrapper (void); + ~QtHttpServerWrapper() override; void setUseSecure (const bool ssl = true); diff --git a/libsrc/webserver/StaticFileServing.h b/libsrc/webserver/StaticFileServing.h index c44f1a65..c1ec6395 100644 --- a/libsrc/webserver/StaticFileServing.h +++ b/libsrc/webserver/StaticFileServing.h @@ -11,12 +11,13 @@ #include -class StaticFileServing : public QObject { +class StaticFileServing : public QObject +{ Q_OBJECT public: - explicit StaticFileServing (QObject * parent = nullptr); - virtual ~StaticFileServing (void); + explicit StaticFileServing (QObject * parent = nullptr); + ~StaticFileServing() override; /// /// @brief Overwrite current base url @@ -29,7 +30,7 @@ public: void setSSDPDescription(const QString& desc); public slots: - void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply); + void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply); private: QString _baseUrl; diff --git a/libsrc/webserver/WebJsonRpc.cpp b/libsrc/webserver/WebJsonRpc.cpp index 0b0c5d0d..345215d9 100644 --- a/libsrc/webserver/WebJsonRpc.cpp +++ b/libsrc/webserver/WebJsonRpc.cpp @@ -6,7 +6,7 @@ #include -WebJsonRpc::WebJsonRpc(QtHttpRequest* request, QtHttpServer* server, const bool& localConnection, QtHttpClientWrapper* parent) +WebJsonRpc::WebJsonRpc(QtHttpRequest* request, QtHttpServer* server, bool localConnection, QtHttpClientWrapper* parent) : QObject(parent) , _server(server) , _wrapper(parent) diff --git a/libsrc/webserver/WebJsonRpc.h b/libsrc/webserver/WebJsonRpc.h index a750817d..2eed7ed8 100644 --- a/libsrc/webserver/WebJsonRpc.h +++ b/libsrc/webserver/WebJsonRpc.h @@ -12,7 +12,7 @@ class JsonAPI; class WebJsonRpc : public QObject { Q_OBJECT public: - WebJsonRpc(QtHttpRequest* request, QtHttpServer* server, const bool& localConnection, QtHttpClientWrapper* parent); + WebJsonRpc(QtHttpRequest* request, QtHttpServer* server, bool localConnection, QtHttpClientWrapper* parent); void handleMessage(QtHttpRequest* request); diff --git a/libsrc/webserver/WebServer.cpp b/libsrc/webserver/WebServer.cpp index e2dcdad2..1470cd07 100644 --- a/libsrc/webserver/WebServer.cpp +++ b/libsrc/webserver/WebServer.cpp @@ -12,7 +12,7 @@ // netUtil #include -WebServer::WebServer(const QJsonDocument& config, const bool& useSsl, QObject * parent) +WebServer::WebServer(const QJsonDocument& config, bool useSsl, QObject * parent) : QObject(parent) , _config(config) , _useSsl(useSsl) @@ -83,7 +83,7 @@ void WebServer::onServerError (QString msg) Error(_log, "%s", msg.toStdString().c_str()); } -void WebServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) +void WebServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config) { if(type == settings::WEBSERVER) { diff --git a/libsrc/webserver/WebSocketClient.cpp b/libsrc/webserver/WebSocketClient.cpp index d5577949..1f865904 100644 --- a/libsrc/webserver/WebSocketClient.cpp +++ b/libsrc/webserver/WebSocketClient.cpp @@ -10,7 +10,7 @@ #include #include -WebSocketClient::WebSocketClient(QtHttpRequest* request, QTcpSocket* sock, const bool& localConnection, QObject* parent) +WebSocketClient::WebSocketClient(QtHttpRequest* request, QTcpSocket* sock, bool localConnection, QObject* parent) : QObject(parent) , _socket(sock) , _log(Logger::getInstance("WEBSOCKET")) @@ -46,7 +46,7 @@ WebSocketClient::WebSocketClient(QtHttpRequest* request, QTcpSocket* sock, const _jsonAPI->initialize(); } -void WebSocketClient::handleWebSocketFrame(void) +void WebSocketClient::handleWebSocketFrame() { while (_socket->bytesAvailable()) { diff --git a/libsrc/webserver/WebSocketClient.h b/libsrc/webserver/WebSocketClient.h index 137cadbd..5c90f8cb 100644 --- a/libsrc/webserver/WebSocketClient.h +++ b/libsrc/webserver/WebSocketClient.h @@ -9,10 +9,11 @@ class QtHttpRequest; class Hyperion; class JsonAPI; -class WebSocketClient : public QObject { +class WebSocketClient : public QObject +{ Q_OBJECT public: - WebSocketClient(QtHttpRequest* request, QTcpSocket* sock, const bool& localConnection, QObject* parent); + WebSocketClient(QtHttpRequest* request, QTcpSocket* sock, bool localConnection, QObject* parent); struct WebSocketHeader { @@ -67,6 +68,6 @@ private: static const quint64 FRAME_SIZE_IN_BYTES = 512 * 512 * 2; //maximum size of a frame when sending a message private slots: - void handleWebSocketFrame(void); + void handleWebSocketFrame(); qint64 sendMessage(QJsonObject obj); }; diff --git a/src/hyperion-aml/AmlogicWrapper.cpp b/src/hyperion-aml/AmlogicWrapper.cpp index 2271445c..cde574cc 100644 --- a/src/hyperion-aml/AmlogicWrapper.cpp +++ b/src/hyperion-aml/AmlogicWrapper.cpp @@ -5,7 +5,7 @@ // Linux includes #include -AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight) : +AmlogicWrapper::AmlogicWrapper(unsigned grabWidth, unsigned grabHeight) : _thread(this), _grabber(grabWidth, grabHeight) { diff --git a/src/hyperion-aml/AmlogicWrapper.h b/src/hyperion-aml/AmlogicWrapper.h index 7fe9334d..778533c9 100644 --- a/src/hyperion-aml/AmlogicWrapper.h +++ b/src/hyperion-aml/AmlogicWrapper.h @@ -9,7 +9,7 @@ class AmlogicWrapper : public QObject { Q_OBJECT public: - AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight); + AmlogicWrapper(unsigned grabWidth, unsigned grabHeight); const Image & getScreenshot(); diff --git a/src/hyperion-dispmanx/DispmanxWrapper.cpp b/src/hyperion-dispmanx/DispmanxWrapper.cpp index 48ace5b8..c18a362b 100644 --- a/src/hyperion-dispmanx/DispmanxWrapper.cpp +++ b/src/hyperion-dispmanx/DispmanxWrapper.cpp @@ -2,11 +2,11 @@ // Hyperion-Dispmanx includes #include "DispmanxWrapper.h" -DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, - const VideoMode& videoMode, - const unsigned cropLeft, const unsigned cropRight, - const unsigned cropTop, const unsigned cropBottom, - const unsigned updateRate_Hz) : +DispmanxWrapper::DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, + VideoMode videoMode, + unsigned cropLeft, unsigned cropRight, + unsigned cropTop, unsigned cropBottom, + unsigned updateRate_Hz) : _timer(this), _grabber(grabWidth, grabHeight) { diff --git a/src/hyperion-dispmanx/DispmanxWrapper.h b/src/hyperion-dispmanx/DispmanxWrapper.h index 712e4093..104f4ea1 100644 --- a/src/hyperion-dispmanx/DispmanxWrapper.h +++ b/src/hyperion-dispmanx/DispmanxWrapper.h @@ -9,11 +9,11 @@ class DispmanxWrapper : public QObject { Q_OBJECT public: - DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, - const VideoMode& videoMode, - const unsigned cropLeft, const unsigned cropRight, - const unsigned cropTop, const unsigned cropBottom, - const unsigned updateRate_Hz); + DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, + VideoMode videoMode, + unsigned cropLeft, unsigned cropRight, + unsigned cropTop, unsigned cropBottom, + unsigned updateRate_Hz); const Image & getScreenshot(); diff --git a/src/hyperion-framebuffer/FramebufferWrapper.cpp b/src/hyperion-framebuffer/FramebufferWrapper.cpp index cd0348da..023ad2c4 100644 --- a/src/hyperion-framebuffer/FramebufferWrapper.cpp +++ b/src/hyperion-framebuffer/FramebufferWrapper.cpp @@ -2,7 +2,7 @@ // Hyperion-AmLogic includes #include "FramebufferWrapper.h" -FramebufferWrapper::FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) : +FramebufferWrapper::FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz) : _timer(this), _grabber(device,grabWidth, grabHeight) { diff --git a/src/hyperion-framebuffer/FramebufferWrapper.h b/src/hyperion-framebuffer/FramebufferWrapper.h index 153c6bb5..a294082e 100644 --- a/src/hyperion-framebuffer/FramebufferWrapper.h +++ b/src/hyperion-framebuffer/FramebufferWrapper.h @@ -10,7 +10,7 @@ class FramebufferWrapper : public QObject { Q_OBJECT public: - FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); + FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz); const Image & getScreenshot(); diff --git a/src/hyperion-osx/OsxWrapper.cpp b/src/hyperion-osx/OsxWrapper.cpp index 26544153..1d0d0a7e 100644 --- a/src/hyperion-osx/OsxWrapper.cpp +++ b/src/hyperion-osx/OsxWrapper.cpp @@ -2,7 +2,7 @@ // Hyperion-AmLogic includes #include "OsxWrapper.h" -OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) : +OsxWrapper::OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz) : _timer(this), _grabber(display,grabWidth, grabHeight) { diff --git a/src/hyperion-osx/OsxWrapper.h b/src/hyperion-osx/OsxWrapper.h index 9ff4c956..e8e72d2e 100644 --- a/src/hyperion-osx/OsxWrapper.h +++ b/src/hyperion-osx/OsxWrapper.h @@ -9,7 +9,7 @@ class OsxWrapper : public QObject { Q_OBJECT public: - OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz); + OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz); const Image & getScreenshot(); diff --git a/src/hyperion-qt/QtWrapper.cpp b/src/hyperion-qt/QtWrapper.cpp index c747948f..31c98745 100644 --- a/src/hyperion-qt/QtWrapper.cpp +++ b/src/hyperion-qt/QtWrapper.cpp @@ -36,7 +36,7 @@ void QtWrapper::capture() emit sig_screenshot(_screenshot); } -void QtWrapper::setVideoMode(const VideoMode mode) +void QtWrapper::setVideoMode(VideoMode mode) { _grabber.setVideoMode(mode); } diff --git a/src/hyperion-qt/QtWrapper.h b/src/hyperion-qt/QtWrapper.h index 327795ec..7ffaad1d 100644 --- a/src/hyperion-qt/QtWrapper.h +++ b/src/hyperion-qt/QtWrapper.h @@ -1,3 +1,4 @@ +#pragma once // QT includes #include @@ -31,7 +32,7 @@ public slots: /// Set the video mode (2D/3D) /// @param[in] mode The new video mode /// - void setVideoMode(const VideoMode videoMode); + void setVideoMode(VideoMode videoMode); private slots: /// diff --git a/src/hyperion-remote/JsonConnection.cpp b/src/hyperion-remote/JsonConnection.cpp index ab7428de..a58c7a02 100644 --- a/src/hyperion-remote/JsonConnection.cpp +++ b/src/hyperion-remote/JsonConnection.cpp @@ -290,7 +290,7 @@ void JsonConnection::clearAll() parseReply(reply); } -void JsonConnection::setComponentState(const QString & component, const bool state) +void JsonConnection::setComponentState(const QString & component, bool state) { qDebug() << (state ? "Enable" : "Disable") << "Component" << component; @@ -517,7 +517,7 @@ void JsonConnection::setToken(const QString &token) parseReply(reply); } -void JsonConnection::setInstance(const int &instance) +void JsonConnection::setInstance(int instance) { // create command QJsonObject command; diff --git a/src/hyperion-remote/JsonConnection.h b/src/hyperion-remote/JsonConnection.h index b7610c8d..08e6ff5d 100644 --- a/src/hyperion-remote/JsonConnection.h +++ b/src/hyperion-remote/JsonConnection.h @@ -111,7 +111,7 @@ public: /// @param component The component [SMOOTHING, BLACKBORDER, FORWARDER, BOBLIGHT_SERVER, GRABBER] /// @param state The state of the component [true | false] /// - void setComponentState(const QString & component, const bool state); + void setComponentState(const QString & component, bool state); /// /// Set current active priority channel and deactivate auto source switching @@ -185,7 +185,7 @@ public: /// Send a json message with a specific instance id /// @param instance The instance id /// - void setInstance(const int &instance); + void setInstance(int instance); private: diff --git a/src/hyperion-x11/X11Wrapper.cpp b/src/hyperion-x11/X11Wrapper.cpp index 9f14bcb5..f3363111 100644 --- a/src/hyperion-x11/X11Wrapper.cpp +++ b/src/hyperion-x11/X11Wrapper.cpp @@ -41,7 +41,7 @@ void X11Wrapper::capture() _inited = true; } -void X11Wrapper::setVideoMode(const VideoMode mode) +void X11Wrapper::setVideoMode(VideoMode mode) { _grabber.setVideoMode(mode); } diff --git a/src/hyperion-x11/X11Wrapper.h b/src/hyperion-x11/X11Wrapper.h index 7c975193..0f1fce96 100644 --- a/src/hyperion-x11/X11Wrapper.h +++ b/src/hyperion-x11/X11Wrapper.h @@ -34,7 +34,7 @@ public slots: /// Set the video mode (2D/3D) /// @param[in] mode The new video mode /// - void setVideoMode(const VideoMode videoMode); + void setVideoMode(VideoMode videoMode); private slots: /// diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 922fd4ce..8cd2a0ef 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -60,7 +60,7 @@ HyperionDaemon *HyperionDaemon::daemon = nullptr; -HyperionDaemon::HyperionDaemon(const QString rootPath, QObject *parent, const bool &logLvlOverwrite) +HyperionDaemon::HyperionDaemon(const QString rootPath, QObject *parent, bool logLvlOverwrite) : QObject(parent), _log(Logger::getInstance("DAEMON")) , _instanceManager(new HyperionIManager(rootPath, this)) , _authManager(new AuthManager(this)) @@ -154,7 +154,7 @@ HyperionDaemon::~HyperionDaemon() delete _pyInit; } -void HyperionDaemon::setVideoMode(const VideoMode &mode) +void HyperionDaemon::setVideoMode(VideoMode mode) { if (_currVideoMode != mode) { @@ -163,7 +163,7 @@ void HyperionDaemon::setVideoMode(const VideoMode &mode) } } -const QJsonDocument HyperionDaemon::getSetting(const settings::type &type) +QJsonDocument HyperionDaemon::getSetting(settings::type type) const { return _settingsManager->getSetting(type); } @@ -312,7 +312,7 @@ void HyperionDaemon::startNetworkServices() ssdpThread->start(); } -void HyperionDaemon::handleSettingsUpdate(const settings::type &settingsType, const QJsonDocument &config) +void HyperionDaemon::handleSettingsUpdate(settings::type settingsType, const QJsonDocument &config) { if (settingsType == settings::LOGGER) { diff --git a/src/hyperiond/hyperiond.h b/src/hyperiond/hyperiond.h index e6bc3733..cff94960 100644 --- a/src/hyperiond/hyperiond.h +++ b/src/hyperiond/hyperiond.h @@ -80,7 +80,7 @@ class HyperionDaemon : public QObject friend SysTray; public: - HyperionDaemon(QString rootPath, QObject *parent, const bool& logLvlOverwrite); + HyperionDaemon(QString rootPath, QObject *parent, bool logLvlOverwrite); ~HyperionDaemon(); /// @@ -91,12 +91,12 @@ public: /// /// @brief Get the current videoMode /// - const VideoMode & getVideoMode() { return _currVideoMode; }; + VideoMode getVideoMode() const { return _currVideoMode; }; /// /// @brief get the settings /// - const QJsonDocument getSetting(const settings::type& type); + QJsonDocument getSetting(settings::type type) const; void startNetworkServices(); @@ -114,7 +114,7 @@ signals: /// /// @brief After eval of setVideoMode this signal emits with a new one on change /// - void videoMode(const VideoMode& mode); + void videoMode(VideoMode mode); /////////////////////////////////////// /// FROM HYPERION TO HYPERIONDAEMON /// @@ -123,12 +123,12 @@ signals: /// /// @brief PIPE settings events from Hyperion class to HyperionDaemon components /// - void settingsChanged(const settings::type& type, const QJsonDocument& data); + void settingsChanged(settings::type type, const QJsonDocument& data); /// /// @brief PIPE component state changes events from Hyperion class to HyperionDaemon components /// - void compStateChangeRequest(const hyperion::Components component, bool enable); + void compStateChangeRequest(hyperion::Components component, bool enable); private slots: /// @@ -136,13 +136,13 @@ private slots: /// @param type settingyType from enum /// @param config configuration object /// - void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config); + void handleSettingsUpdate(settings::type type, const QJsonDocument& config); /// /// @brief Listen for videoMode changes and emit videoMode in case of a change, update _currVideoMode /// @param mode The requested video mode /// - void setVideoMode(const VideoMode& mode); + void setVideoMode(VideoMode mode); private: void createGrabberDispmanx(); diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index cabdf8ac..5cbd9a8e 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -50,7 +50,7 @@ using namespace commandline; #define PERM0664 QFileDevice::ReadOwner | QFileDevice::ReadGroup | QFileDevice::ReadOther | QFileDevice::WriteOwner | QFileDevice::WriteGroup #ifndef _WIN32 -void signal_handler(const int signum) +void signal_handler(int signum) { // Hyperion Managment instance HyperionIManager *_hyperion = HyperionIManager::getInstance(); diff --git a/src/hyperiond/systray.cpp b/src/hyperiond/systray.cpp index 9e92f3ee..c4cdfb27 100644 --- a/src/hyperiond/systray.cpp +++ b/src/hyperiond/systray.cpp @@ -211,7 +211,7 @@ void SysTray::clearEfxColor() _hyperion->clear(1); } -void SysTray::handleInstanceStateChange(const InstanceState& state, const quint8& instance, const QString& name) +void SysTray::handleInstanceStateChange(InstanceState state, quint8 instance, const QString& name) { switch(state){ case InstanceState::H_STARTED: diff --git a/src/hyperiond/systray.h b/src/hyperiond/systray.h index c0ad502d..454a5b09 100644 --- a/src/hyperiond/systray.h +++ b/src/hyperiond/systray.h @@ -35,12 +35,12 @@ private slots: /// /// @brief is called whenever the webserver changes the port /// - void webserverPortChanged(const quint16& port) { _webPort = port; }; + void webserverPortChanged(quint16 port) { _webPort = port; }; /// /// @brief is called whenever a hyperion instance state changes /// - void handleInstanceStateChange(const InstanceState& state, const quint8& instance, const QString& name); + void handleInstanceStateChange(InstanceState state, quint8 instance, const QString& name); private: void createTrayIcon();