Merge branch 'master' into refactor/led_device

This commit is contained in:
Murat Seker 2020-08-23 21:02:25 +02:00 committed by GitHub
commit bc57a45089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
272 changed files with 1711 additions and 1738 deletions

4
.gitignore vendored
View File

@ -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

View File

@ -1380,3 +1380,320 @@ Copyright (C) 2011 Olaf Lüke <olaf@tinkerforge.com>
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 <license@pulse-eight.com>
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

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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];

View File

@ -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 = '<option value=disabled>'+$.i18n('wiz_yeelight_unsupported')+'</option>';
}
@ -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;
}
}

View File

@ -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}

View File

@ -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 </dev/null >/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 </dev/null >/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

View File

@ -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

View File

@ -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" \

View File

@ -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

View File

@ -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!
* 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!

View File

@ -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

View File

@ -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.

View File

@ -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":{

View File

@ -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. <br/> **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. <br/> **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 <br/> **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 <br/> **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: <br/> `0` -> The area is filled with the closest stop color <br/> `1` -> The gradient is reflected outside the gradient area <br/> `2` -> The gradient is repeated outside the gradient area <br/> 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. <br/> **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. <br/> **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: <br/> `0` -> The area is filled with the closest stop color <br/> `1` -> The gradient is reflected outside the gradient area <br/> `2` -> The gradient is repeated outside the gradient area <br/> 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
:::

View File

@ -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**

View File

@ -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) |
| 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) |

View File

@ -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",

View File

@ -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.
You will get a response of your action. `plugin-start` or `plugin-stop` with success true/false.

View File

@ -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",

View File

@ -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).

View File

@ -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",

View File

@ -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

View File

@ -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
<ImageWrap src="/images/en/user_hyperbian_wpa_suppli1.jpg" alt="Create a new textfile" />
- Rename it to "wpa_supplicant.conf"
<ImageWrap src="/images/en/user_hyperbian_wpa_suppli2.jpg" alt="Rename to wpa_supplicant.conf"/>

View File

@ -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

View File

@ -55,7 +55,7 @@ Now with three LEDs
</ImageWrap>
### 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).
<ImageWrap src="/images/en/user_bbmodes.jpg" alt="Hyperion Blackbar detection modes" />
## 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

View File

@ -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.

View File

@ -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<uint8_t> &ledColors, const int &timeout_ms = -1, const QString &origin = "API", const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setColor(int priority, const std::vector<uint8_t> &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<QVariantMap> getAllInstanceData(void);
QVector<QVariantMap> 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();

View File

@ -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();
};

View File

@ -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

View File

@ -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

View File

@ -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:
///

View File

@ -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<BonjourRecord> currentRecords() const { return bonjourRecords; }
inline QString serviceType() const { return browsingType; }

View File

@ -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<std::pair<std::string, std::string>> txt = std::vector<std::pair<std::string, std::string>>());
inline BonjourRecord registeredRecord() const {return finalRecord; }
void registerService(const QString& service, int port);
void registerService(const BonjourRecord &record, quint16 servicePort, const std::vector<std::pair<std::string, std::string>>& 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

View File

@ -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);

View File

@ -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; }
};
}

View File

@ -12,6 +12,7 @@ class ColorsOption: public Option
{
protected:
QList<QColor> _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<QColor> &getColors(Parser &parser)
{ return _colors; }
QList<QColor> getColors(Parser &parser) const { return _colors; }
};
}

View File

@ -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; }
};
}

View File

@ -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<int>::min(), int maximum = std::numeric_limits<int>::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<int>::min(), int maximum = std::numeric_limits<int>::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<int>::min(), int maximum = std::numeric_limits<int>::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);

View File

@ -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;

View File

@ -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);
}
};
}

View File

@ -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)));
}
};
}

View File

@ -30,8 +30,6 @@ public:
: Option(other), _switches(switches)
{}
virtual ~SwitchOption() {}
const QMap<QString, T> &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()); }

View File

@ -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)

View File

@ -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

View File

@ -27,7 +27,7 @@ class DBManager : public QObject
public:
DBManager(QObject* parent = nullptr);
~DBManager();
~DBManager() override;
/// set root path
void setRootPath(const QString& rootPath);

View File

@ -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<QVariantMap> getAllInstances(const bool& justEnabled = false)
inline QVector<QVariantMap> getAllInstances(bool justEnabled = false)
{
QVector<QVariantMap> 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));

View File

@ -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<QVariantMap> results;
getRecords(results, QStringList() << "uuid");

View File

@ -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

View File

@ -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<ColorRgb> &ledColors, const int timeout_ms, const bool &clearEffect);
void setInputImage(const int priority, const Image<ColorRgb> &image, const int timeout_ms, const bool &clearEffect);
void setInput(int priority, const std::vector<ColorRgb> &ledColors, int timeout_ms, bool clearEffect);
void setInputImage(int priority, const Image<ColorRgb> &image, int timeout_ms, bool clearEffect);
private:

View File

@ -27,17 +27,17 @@ class EffectEngine : public QObject
public:
EffectEngine(Hyperion * hyperion);
virtual ~EffectEngine();
~EffectEngine() override;
const std::list<EffectDefinition> & getEffects() const { return _availableEffects; };
std::list<EffectDefinition> getEffects() const { return _availableEffects; }
const std::list<ActiveEffectDefinition> & getActiveEffects();
std::list<ActiveEffectDefinition> getActiveEffects() const;
///
/// Get available schemas from EffectFileHandler
/// @return all schemas
///
const std::list<EffectSchema> & getEffectSchemas();
std::list<EffectSchema> getEffectSchemas() const;
///
/// @brief Save an effect with EffectFileHandler
@ -115,8 +115,6 @@ private:
std::list<Effect *> _activeEffects;
std::list<ActiveEffectDefinition> _availableActiveEffects;
std::list<ActiveEffectDefinition> _cachedActiveEffects;
Logger * _log;

View File

@ -20,12 +20,12 @@ public:
///
/// @brief Get all available effects
///
const std::list<EffectDefinition> & getEffects() const { return _availableEffects; };
std::list<EffectDefinition> getEffects() const { return _availableEffects; }
///
/// @brief Get all available schemas
///
const std::list<EffectSchema> & getEffectSchemas() { return _effectSchemas; };
std::list<EffectSchema> 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:
///

View File

@ -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:

View File

@ -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();

View File

@ -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;
///

View File

@ -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:
///

View File

@ -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

View File

@ -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:
///

View File

@ -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

View File

@ -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:
///

View File

@ -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;
///

View File

@ -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:
///

View File

@ -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

View File

@ -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:
///

View File

@ -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<ColorRgb> &);
@ -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<QString, int> getV4L2deviceInputs(QString devicePath) override;
QMultiMap<QString, int> 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<QString, QString> _v4lDevices;
QMap<QString, V4L2Grabber::DeviceProperties> _deviceProperties;
VideoStandard _videoStandard;
io_method _ioMethod;
int _fileDescriptor;
std::vector<buffer> _buffers;
std::map<QString, QString> _v4lDevices;
QMap<QString, V4L2Grabber::DeviceProperties> _deviceProperties;
VideoStandard _videoStandard;
io_method _ioMethod;
int _fileDescriptor;
std::vector<buffer> _buffers;
PixelFormat _pixelFormat;
int _pixelDecimation;

View File

@ -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<ColorRgb> & image);

View File

@ -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;
}

View File

@ -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.

View File

@ -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<AuthManager::AuthDefinition> getPendingRequests();
QVector<AuthManager::AuthDefinition> 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<AuthManager::AuthDefinition> getTokenList();
QVector<AuthManager::AuthDefinition> 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;

View File

@ -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)
{

View File

@ -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

View File

@ -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<hyperion::Components, bool> getRegister() const { return _componentStates; };
std::map<hyperion::Components, bool> 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

View File

@ -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<QString, int> getV4L2deviceInputs(QString devicePath) { return QMultiMap<QString, int>(); }
virtual QMultiMap<QString, int> getV4L2deviceInputs(const QString& /*devicePath*/) const { return QMultiMap<QString, int>(); }
///
/// @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;

View File

@ -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<QString, int> getV4L2deviceInputs(QString devicePath);
virtual QMultiMap<QString, int> 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

View File

@ -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<ColorRgb>& ledColors, const int timeout_ms = -1, const bool& clearEffect = true);
bool setInput(int priority, const std::vector<ColorRgb>& 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<ColorRgb>& image, const int64_t timeout_ms = -1, const bool& clearEffect = true);
bool setInputImage(int priority, const Image<ColorRgb>& 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<ColorRgb> &ledColors, const int timeout_ms = -1, const QString& origin = "System" ,bool clearEffects = true);
void setColor(int priority, const std::vector<ColorRgb> &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<EffectDefinition> &getEffects() const;
std::list<EffectDefinition> getEffects() const;
/// Get the list of active effects
/// @return The list of active effects
const std::list<ActiveEffectDefinition> &getActiveEffects() const;
std::list<ActiveEffectDefinition> getActiveEffects() const;
/// Get the list of available effect schema files
/// @return The list of available effect schema files
const std::list<EffectSchema> &getEffectSchemas() const;
std::list<EffectSchema> 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<ColorRgb>);
void forwardSystemProtoMessage(const QString&, const Image<ColorRgb>&);
/// Signal which is emitted, when a new V4l proto image should be forwarded
void forwardV4lProtoMessage(const QString, const Image<ColorRgb>);
void forwardV4lProtoMessage(const QString&, const Image<ColorRgb>&);
///
/// @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;

View File

@ -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<QVariantMap> getInstanceData();
QVector<QVariantMap> 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;

View File

@ -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;

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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

View File

@ -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<ColorRgb>& ledColors, int64_t timeout_ms = -1);
bool setInput(int priority, const std::vector<ColorRgb>& 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<ColorRgb>& image, int64_t timeout_ms = -1);
bool setInputImage(int priority, const Image<ColorRgb>& 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;

View File

@ -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:
///

View File

@ -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

View File

@ -1,8 +1,8 @@
#ifndef LEDEVICEFACTORY_H
#define LEDEVICEFACTORY_H
// LedDevice includes
#include <leddevice/LedDevice.h>
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
///

View File

@ -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:
///

View File

@ -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();

View File

@ -7,7 +7,7 @@ class PythonInit
{
private:
friend class HyperionDaemon;
PythonInit();
~PythonInit();
};

View File

@ -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<QString, SSDPService> 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)

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
};

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More