Merge pull request #567 from Paulchen-Panther/master

Bug fixes, new implementation ...
This commit is contained in:
Rick164 2019-06-14 19:24:42 +02:00 committed by GitHub
commit 3e9565cfc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
97 changed files with 1726 additions and 1570 deletions

48
.azure.yml Normal file
View File

@ -0,0 +1,48 @@
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
AMD64 (x64):
dockerTag: 'amd64'
dockerName: 'Debian Stretch (AMD64)'
i386 (x86):
dockerTag: 'i386'
dockerName: 'Debian Stretch (i386)'
ARMv6hf (Raspberry Pi v1 & ZERO):
dockerTag: 'armv6hf'
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
platform: 'rpi'
ARMv7hf (Raspberry Pi 2 & 3):
dockerTag: 'armv7hf'
dockerName: 'Debian Stretch (Raspberry Pi 2 & 3)'
platform: 'rpi'
ARMv8 (Generic AARCH64):
dockerTag: 'aarch64'
dockerName: 'ARMv8 (Generic AARCH64)'
platform: 'amlogic'
steps:
- checkout: self
submodules: recursive
- bash: ./.ci/ci_build.sh
displayName: 'Build $(dockerName)'
env:
DOCKER_TAG: $(dockerTag)
DOCKER_NAME: $(dockerName)
PLATFORM: $(platform)
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload $(dockerName)'
- job: macOS
pool:
vmImage: 'macOS-10.13'
steps:
- checkout: self
submodules: recursive
- bash: ./.ci/ci_install.sh
displayName: 'Install dependencies'
- bash: ./.ci/ci_build.sh
displayName: 'Build macOS 10.13'
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload macOS 10.13'

80
.ci/ci_build.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$TRAVIS_BUILD_DIR"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
# set environment variables
BUILD_TYPE="Debug"
PACKAGES=""
[ -z "${PLATFORM}" ] && PLATFORM="x11"
# Detect number of processor cores
# default is 4 jobs
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
JOBS=$(sysctl -n hw.ncpu)
PLATFORM=osx
elif [[ "$CI_NAME" == 'linux' ]]; then
JOBS=$(nproc)
fi
echo "compile jobs: ${JOBS:=4}"
# Determine cmake build type; tag builds are Release, else Debug
if [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
BUILD_TYPE=Release
fi
# Determine package creation; True for cron/schedule and tag builds
if [ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_REASON == "Schedule" ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
PACKAGES="package"
fi
# Determie -dev appends to platform;
# Commented because tests are currently broken
# [ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
# Build the package on osx or docker for linux
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
# compile prepare
mkdir build || exit 1
mkdir ${CI_BUILD_DIR}/deploy || exit 1
cd build
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
make -j ${JOBS} ${PACKAGES} || exit 3
echo "---> Copy binaries and packages to folder: ${CI_BUILD_DIR}/deploy"
cp -v ${CI_BUILD_DIR}/build/bin/h* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : &&
cp -v ${CI_BUILD_DIR}/build/Hyperion-* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : &&
exit 0;
elif [[ "$CI_NAME" == 'linux' ]]; then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# take ownership of deploy dir
mkdir ${CI_BUILD_DIR}/deploy
# run docker
docker run --rm \
-v "${CI_BUILD_DIR}/deploy:/deploy" \
-v "${CI_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir build && cp -r source/. /build &&
cd /build && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j ${JOBS} ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${CI_BUILD_DIR}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }
# overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" ${CI_BUILD_DIR}/deploy) ${CI_BUILD_DIR}/deploy
fi

67
.ci/ci_deploy.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$TRAVIS_BUILD_DIR"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
# sf_upload <FILES> <sf_dir>
# {
# echo "Uploading following files: ${1} to dir /hyperion-project/${2}"
#
# }
# append current Date to filename (just packages no binaries)
appendDate()
{
D=$(date +%Y-%m-%d)
for F in $CI_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-$D.${F##*.}"
done
}
# append friendly name (just packages no binaries)
appendName()
{
for F in $CI_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}"
done
}
# get all files to deploy (just packages no binaries)
getFiles()
{
FILES=""
for f in $CI_BUILD_DIR/deploy/Hy*;
do FILES+="${f} ";
done;
}
if [[ $CI_NAME == 'linux' || "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
if [[ -n $TRAVIS_TAG ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
echo "tag upload"
appendName
appendDate
getFiles
# sf_upload $FILES release
elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]] || [[ $BUILD_REASON == "Schedule" ]]; then
echo "cron/schedule upload"
appendName
appendDate
getFiles
# sf_upload $FILES dev/alpha
else
echo "Direct pushed no upload, PRs not possible"
fi
fi

42
.ci/ci_install.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
function installAndUpgrade()
{
arr=("$@")
for i in "${arr[@]}";
do
list_output=`brew list | grep $i`
outdated_output=`brew outdated | grep $i`
if [[ ! -z "$list_output" ]]; then
if [[ ! -z "$outdated_output" ]]; then
brew upgrade $i
fi
else
brew install $i
fi
done
}
# install osx deps for hyperion compile
if [[ $CI_NAME == 'osx' || $CI_NAME == 'darwin' ]]; then
echo "Install dependencies"
brew update
dependencies=("qt5" "python" "libusb" "cmake" "doxygen")
installAndUpgrade "${dependencies[@]}"
elif [[ $CI_NAME != 'linux' ]]; then
echo "Unsupported platform: $CI_NAME"
exit 5
fi

View File

@ -1,6 +1,6 @@
linux: &linux linux: &linux
os: linux os: linux
dist: trusty dist: xenial
services: services:
- docker - docker
osx: &osx osx: &osx
@ -15,7 +15,7 @@ notifications:
language: cpp language: cpp
before_install: before_install:
- ./.travis/travis_install.sh - ./.ci/ci_install.sh
jobs: jobs:
include: include:
@ -29,24 +29,29 @@ jobs:
env: env:
- DOCKER_TAG=i386 - DOCKER_TAG=i386
- DOCKER_NAME="Debian Stretch (i386)" - DOCKER_NAME="Debian Stretch (i386)"
- <<: *linux # ////////////////////////////////////////////////////////////////
name: "ARMv6hf (Raspberry Pi v1 & ZERO)" # NOTE: Temporary disabled because travis timeouts
env: # ////////////////////////////////////////////////////////////////
- DOCKER_TAG=armv6hf # - <<: *linux
- DOCKER_NAME="Debian Stretch (Raspberry Pi v1 & ZERO)" # name: "ARMv6hf (Raspberry Pi v1 & ZERO)"
- PLATFORM="rpi" # env:
- <<: *linux # - DOCKER_TAG=armv6hf
name: "ARMv7hf (Raspberry Pi 2 & 3)" # - DOCKER_NAME="Debian Stretch (Raspberry Pi v1 & ZERO)"
env: # - PLATFORM="rpi"
- DOCKER_TAG=armv7hf # - <<: *linux
- DOCKER_NAME="Debian Stretch (Raspberry Pi 2 & 3)" # name: "ARMv7hf (Raspberry Pi 2 & 3)"
- PLATFORM="rpi" # env:
- <<: *linux # - DOCKER_TAG=armv7hf
name: "ARMv8 (Generic AARCH64)" # - DOCKER_NAME="Debian Stretch (Raspberry Pi 2 & 3)"
env: # - PLATFORM="rpi"
- DOCKER_TAG=aarch64 # - <<: *linux
- DOCKER_NAME="ARMv8 (Generic AARCH64)" # name: "ARMv8 (Generic AARCH64)"
- PLATFORM="amlogic" # env:
# - DOCKER_TAG=aarch64
# - DOCKER_NAME="ARMv8 (Generic AARCH64)"
# - PLATFORM="amlogic"
#
# ////////////////////////////////////////////////////////////////
- <<: *osx - <<: *osx
osx_image: xcode8.3 osx_image: xcode8.3
name: "macOS 10.12 (Xcode 8.3.3)" name: "macOS 10.12 (Xcode 8.3.3)"
@ -54,7 +59,7 @@ jobs:
- HOMEBREW_CACHE=$HOME/brew-cache - HOMEBREW_CACHE=$HOME/brew-cache
script: script:
- ./.travis/travis_build.sh - ./.ci/ci_build.sh
after_success: after_success:
- ./.travis/travis_deploy.sh - ./.ci/ci_deploy.sh

View File

@ -1,67 +0,0 @@
#!/bin/bash
# for executing in non travis environment
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [ -z "${PLATFORM}" ]; then
PLATFORM=x86
fi
BUILD_TYPE=Debug
PACKAGES=""
# Detect number of processor cores
# default is 4 jobs
if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]]
then
JOBS=$(sysctl -n hw.ncpu)
PLATFORM=osx
elif [[ "$TRAVIS_OS_NAME" == 'linux' ]]
then
JOBS=$(nproc)
fi
echo "compile jobs: ${JOBS:=4}"
# Determine cmake build type; tag builds are Release, else Debug
[ -n "${TRAVIS_TAG:-}" ] && BUILD_TYPE=Release
# Determine package creation; True for cron and tag builds
# Commented because tests are currently broken
# [ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] && PACKAGES=package
# Determie -dev appends to platform;
# [ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
# Build the package on osx
if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]]
then
# compile prepare
mkdir build || exit 1
cd build
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
make -j ${JOBS} || exit 3
fi
# Build the package with docker
if [[ $TRAVIS_OS_NAME == 'linux' ]]
then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# take ownership of deploy dir
mkdir $TRAVIS_BUILD_DIR/deploy
# run docker
docker run --rm \
-v "${TRAVIS_BUILD_DIR}/deploy:/deploy" \
-v "${TRAVIS_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir build && cp -r /source/. /build &&
cd /build && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j $(nproc) ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${TRAVIS_BUILD_DIR}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }
# overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" $TRAVIS_BUILD_DIR/deploy) $TRAVIS_BUILD_DIR/deploy
fi

View File

@ -1,64 +0,0 @@
#!/bin/bash
# sf_upload <FILES> <sf_dir>
sf_upload()
{
echo "Uploading following files: ${1}
to dir /hyperion-project/${2}"
/usr/bin/expect <<-EOD
spawn scp $1hyperionsf37@frs.sourceforge.net:/home/frs/project/hyperion-project/$2
expect "*(yes/no)*"
send "yes\r"
expect "*password:*"
send "$SFPW\r"
expect eof
EOD
}
# append current Date to filename (just packages no binaries)
appendDate()
{
D=$(date +%Y-%m-%d)
for F in $TRAVIS_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-$D.${F##*.}"
done
}
# append friendly name (just packages no binaries)
appendName()
{
for F in $TRAVIS_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}"
done
}
# get all files to deploy (just packages no binaries)
getFiles()
{
FILES=""
for f in $TRAVIS_BUILD_DIR/deploy/Hy*;
do FILES+="${f} ";
done;
}
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
if [[ -n $TRAVIS_TAG ]]; then
echo "tag upload"
appendName
appendDate
getFiles
sf_upload $FILES release
elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]]; then
echo "cron upload"
appendName
appendDate
getFiles
sf_upload $FILES dev/alpha
else
echo "Direct pushed no upload, PRs not possible"
#sf_upload $FILES pr
fi
fi

View File

@ -1,26 +0,0 @@
#!/bin/bash
# for executing in non travis environment
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$( uname -s | tr '[:upper:]' '[:lower:]' )"
# install osx deps for hyperion compile
if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]]
then
echo "Install OSX deps"
brew update
brew install qt5 || true
brew upgrade python3 || true
brew upgrade libusb || true
brew upgrade cmake || true
brew install doxygen || true
# install linux deps for hyperion compile
elif [[ $TRAVIS_OS_NAME == 'linux' ]]
then
echo "Install linux deps"
#sudo apt-get -qq update
#sudo apt-get install -qq -y qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev doxygen expect
else
echo "Unsupported platform: $TRAVIS_OS_NAME"
exit 5
fi

View File

@ -11,6 +11,13 @@ IF ( POLICY CMP0026 )
CMAKE_POLICY( SET CMP0026 OLD ) CMAKE_POLICY( SET CMP0026 OLD )
ENDIF() ENDIF()
# Configure CCache if available
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
SET ( HYPERION_VERSION_STABLE OFF ) SET ( HYPERION_VERSION_STABLE OFF )
SET ( HYPERION_VERSION_MAJOR 2 ) SET ( HYPERION_VERSION_MAJOR 2 )
SET ( HYPERION_VERSION_MINOR 0 ) SET ( HYPERION_VERSION_MINOR 0 )
@ -201,9 +208,6 @@ IF ( ${CHECK_CONFIG_FAILED} )
MESSAGE (FATAL_ERROR "check of json default config failed" ) MESSAGE (FATAL_ERROR "check of json default config failed" )
ENDIF () ENDIF ()
# Createt the configuration file
# Add project specific cmake modules (find, etc) # Add project specific cmake modules (find, etc)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@ -214,7 +218,6 @@ find_package(GitVersion)
configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h") configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h")
include_directories("${PROJECT_BINARY_DIR}") include_directories("${PROJECT_BINARY_DIR}")
# Define the global output path of binaries # Define the global output path of binaries
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
@ -247,6 +250,9 @@ else()
message(STATUS "No support for C++11 detected. Compilation will most likely fail on your compiler") message(STATUS "No support for C++11 detected. Compilation will most likely fail on your compiler")
endif() endif()
# Use GNU gold linker if available
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/LDGold.cmake)
# setup -rpath to search for shared libs in BINARY/../libs folder # setup -rpath to search for shared libs in BINARY/../libs folder
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
SET(CMAKE_SKIP_BUILD_RPATH FALSE) SET(CMAKE_SKIP_BUILD_RPATH FALSE)
@ -262,12 +268,23 @@ IF ( "${Qt5Core_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" )
message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" ) message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" )
ENDIF() ENDIF()
# Add libusb and pthreads # Add libusb and pthreads
find_package(libusb-1.0 REQUIRED) find_package(libusb-1.0 REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
add_definitions(${QT_DEFINITIONS}) add_definitions(${QT_DEFINITIONS})
# Add jpeg library
if (ENABLE_V4L2)
find_package(JPEG)
if (JPEG_FOUND)
add_definitions(-DHAVE_JPEG)
message( STATUS "Using JPEG library: ${JPEG_LIBRARIES}")
include_directories(${JPEG_INCLUDE_DIR})
else()
message( STATUS "JPEG library not found, MJPEG camera format won't work in V4L2 grabber.")
endif()
endif()
# TODO[TvdZ]: This linking directory should only be added if we are cross compiling # TODO[TvdZ]: This linking directory should only be added if we are cross compiling
#if(NOT APPLE) #if(NOT APPLE)
# link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) # link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf)

View File

@ -26,7 +26,7 @@ Note: call the script with `./docker-compile.sh -h` for more options
``` ```
sudo apt-get update sudo apt-get update
sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev
``` ```
**on RPI you need the videocore IV headers** **on RPI you need the videocore IV headers**

View File

@ -1,9 +1,27 @@
# HYPERION <p align="center">
<img src="./assets/webconfig/img/hyperion/hyperionlogo.png" height="130">
</p>
[![Build Status](https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master)](https://travis-ci.org/hyperion-project/hyperion.ng) <p align="center">
[![GitHub license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/LICENSE) <a href="https://www.hyperion-project.org" alt="Forum">
<img src="https://img.shields.io/website/https/hyperion-project.org.svg?down_color=red&down_message=offline&up_color=green&up_message=online" /></a>
<a href="https://github.com/hyperion-project/hyperion.ng/graphs/contributors" alt="Contributors">
<img src="https://img.shields.io/github/contributors/hyperion-project/hyperion.ng.svg" /></a>
<a href="https://github.com/hyperion-project/hyperion.ng/tree/master/dependencies/external" alt="Dependencies">
<img src="https://img.shields.io/librariesio/github/hyperion-project/hyperion.ng.svg" /></a>
<a href="https://dev.azure.com/Hyperion-Project/Hyperion.NG/_build/latest?definitionId=2&branchName=master" alt="Azure-Pipeline">
<img src="https://dev.azure.com/Hyperion-Project/Hyperion.NG/_apis/build/status/Hyperion.NG?branchName=master" /></a>
<a href="https://travis-ci.org/hyperion-project/hyperion.ng" alt="Travis-CI">
<img src="https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master" /></a>
<a href="https://lgtm.com/projects/g/hyperion-project/hyperion.ng/alerts/">
<img src="https://img.shields.io/lgtm/alerts/g/hyperion-project/hyperion.ng.svg"
alt="Total alerts"/></a>
<a href="https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg"
alt="GitHub license"></a>
</p>
This is a pre alpha development repository for the next major version of hyperion <p align="center">This is a pre alpha development repository for the next major version of hyperion</p>
-------- --------
## **Important notice!** ## **Important notice!**

View File

@ -20,7 +20,6 @@ import sys
import socket import socket
import serial import serial
import serial.threaded import serial.threaded
import time
class SerialToNet(serial.threaded.Protocol): class SerialToNet(serial.threaded.Protocol):

View File

@ -34,7 +34,7 @@
createTable("","atb","about_cont"); createTable("","atb","about_cont");
for(var i = 0; i<fc.length; i++) for(var i = 0; i<fc.length; i++)
$('.atb').append(createTableRow([fc[i],sc[i]], "atb", false, true)); $('.atb').append(createTableRow([fc[i],sc[i]], "atb", false));
$('#danger_trig').off().on('click',function(){ $('#danger_trig').off().on('click',function(){
dcount++; dcount++;

View File

@ -15,7 +15,8 @@
</div> </div>
<script> <script>
performTranslation('trans_update'); // performTranslation('trans_update');
performTranslation();
for (key in parsedUpdateJSON) for (key in parsedUpdateJSON)
{ {

View File

@ -432,6 +432,7 @@
"edt_conf_enum_bbdefault" : "Standard", "edt_conf_enum_bbdefault" : "Standard",
"edt_conf_enum_bbclassic" : "Klassisch", "edt_conf_enum_bbclassic" : "Klassisch",
"edt_conf_enum_bbosd" : "OSD", "edt_conf_enum_bbosd" : "OSD",
"edt_conf_enum_automatic" : "Automatisch",
"edt_conf_gen_heading_title" : "Allgemeine Einstellungen", "edt_conf_gen_heading_title" : "Allgemeine Einstellungen",
"edt_conf_gen_name_title" : "Name der Konfiguration", "edt_conf_gen_name_title" : "Name der Konfiguration",
"edt_conf_gen_name_expl" : "Der Name wird verwendet, um Hyperion besser zu identifizieren. (Hilfreich bei mehreren Instanzen)", "edt_conf_gen_name_expl" : "Der Name wird verwendet, um Hyperion besser zu identifizieren. (Hilfreich bei mehreren Instanzen)",

View File

@ -433,6 +433,7 @@
"edt_conf_enum_bbdefault" : "Default", "edt_conf_enum_bbdefault" : "Default",
"edt_conf_enum_bbclassic" : "Classic", "edt_conf_enum_bbclassic" : "Classic",
"edt_conf_enum_bbosd" : "OSD", "edt_conf_enum_bbosd" : "OSD",
"edt_conf_enum_automatic" : "Automatic",
"edt_conf_gen_heading_title" : "General Settings", "edt_conf_gen_heading_title" : "General Settings",
"edt_conf_gen_name_title" : "Configuration name", "edt_conf_gen_name_title" : "Configuration name",
"edt_conf_gen_name_expl" : "A user defined name which is used to detect Hyperion. (Helpful with more than one Hyperion instance)", "edt_conf_gen_name_expl" : "A user defined name which is used to detect Hyperion. (Helpful with more than one Hyperion instance)",

View File

@ -4,22 +4,22 @@ $(document).ready( function() {
var editor_smoothing = null; var editor_smoothing = null;
var editor_blackborder = null; var editor_blackborder = null;
if(showOptHelp) if(window.showOptHelp)
{ {
//color //color
$('#conf_cont').append(createRow('conf_cont_color')) $('#conf_cont').append(createRow('conf_cont_color'));
$('#conf_cont_color').append(createOptPanel('fa-photo', $.i18n("edt_conf_color_heading_title"), 'editor_container_color', 'btn_submit_color')); $('#conf_cont_color').append(createOptPanel('fa-photo', $.i18n("edt_conf_color_heading_title"), 'editor_container_color', 'btn_submit_color'));
$('#conf_cont_color').append(createHelpTable(schema.color.properties, $.i18n("edt_conf_color_heading_title"))); $('#conf_cont_color').append(createHelpTable(window.schema.color.properties, $.i18n("edt_conf_color_heading_title")));
//smoothing //smoothing
$('#conf_cont').append(createRow('conf_cont_smoothing')) $('#conf_cont').append(createRow('conf_cont_smoothing'));
$('#conf_cont_smoothing').append(createOptPanel('fa-photo', $.i18n("edt_conf_smooth_heading_title"), 'editor_container_smoothing', 'btn_submit_smoothing')); $('#conf_cont_smoothing').append(createOptPanel('fa-photo', $.i18n("edt_conf_smooth_heading_title"), 'editor_container_smoothing', 'btn_submit_smoothing'));
$('#conf_cont_smoothing').append(createHelpTable(schema.smoothing.properties, $.i18n("edt_conf_smooth_heading_title"))); $('#conf_cont_smoothing').append(createHelpTable(window.schema.smoothing.properties, $.i18n("edt_conf_smooth_heading_title")));
//blackborder //blackborder
$('#conf_cont').append(createRow('conf_cont_blackborder')) $('#conf_cont').append(createRow('conf_cont_blackborder'));
$('#conf_cont_blackborder').append(createOptPanel('fa-photo', $.i18n("edt_conf_bb_heading_title"), 'editor_container_blackborder', 'btn_submit_blackborder')); $('#conf_cont_blackborder').append(createOptPanel('fa-photo', $.i18n("edt_conf_bb_heading_title"), 'editor_container_blackborder', 'btn_submit_blackborder'));
$('#conf_cont_blackborder').append(createHelpTable(schema.blackborderdetector.properties, $.i18n("edt_conf_bb_heading_title"))); $('#conf_cont_blackborder').append(createHelpTable(window.schema.blackborderdetector.properties, $.i18n("edt_conf_bb_heading_title")));
} }
else else
{ {
@ -31,7 +31,7 @@ $(document).ready( function() {
//color //color
editor_color = createJsonEditor('editor_container_color', { editor_color = createJsonEditor('editor_container_color', {
color : schema.color color : window.schema.color
}, true, true); }, true, true);
editor_color.on('change',function() { editor_color.on('change',function() {
@ -44,7 +44,7 @@ $(document).ready( function() {
//smoothing //smoothing
editor_smoothing = createJsonEditor('editor_container_smoothing', { editor_smoothing = createJsonEditor('editor_container_smoothing', {
smoothing : schema.smoothing smoothing : window.schema.smoothing
}, true, true); }, true, true);
editor_smoothing.on('change',function() { editor_smoothing.on('change',function() {
@ -57,7 +57,7 @@ $(document).ready( function() {
//blackborder //blackborder
editor_blackborder = createJsonEditor('editor_container_blackborder', { editor_blackborder = createJsonEditor('editor_container_blackborder', {
blackborderdetector: schema.blackborderdetector blackborderdetector: window.schema.blackborderdetector
}, true, true); }, true, true);
editor_blackborder.on('change',function() { editor_blackborder.on('change',function() {
@ -72,7 +72,7 @@ $(document).ready( function() {
$('#editor_container_blackborder').append(buildWL("user/moretopics/bbmode","edt_conf_bb_mode_title",true)); $('#editor_container_blackborder').append(buildWL("user/moretopics/bbmode","edt_conf_bb_mode_title",true));
//create introduction //create introduction
if(showOptHelp) if(window.showOptHelp)
{ {
createHint("intro", $.i18n('conf_colors_color_intro'), "editor_container_color"); createHint("intro", $.i18n('conf_colors_color_intro'), "editor_container_color");
createHint("intro", $.i18n('conf_colors_smoothing_intro'), "editor_container_smoothing"); createHint("intro", $.i18n('conf_colors_smoothing_intro'), "editor_container_smoothing");

View File

@ -1,58 +1,58 @@
$(document).ready( function() { $(document).ready( function() {
performTranslation(); performTranslation();
function newsCont(t,e,l) // function newsCont(t,e,l)
{ // {
var h = '<div style="padding-left:9px;border-left:6px solid #0088cc;">'; // var h = '<div style="padding-left:9px;border-left:6px solid #0088cc;">';
h += '<h4 style="font-weight:bold;font-size:17px">'+t+'</h4>'; // h += '<h4 style="font-weight:bold;font-size:17px">'+t+'</h4>';
h += e; // h += e;
h += '<a href="'+l+'" class="" target="_blank"><i class="fa fa-fw fa-newspaper-o"></i>'+$.i18n('dashboard_newsbox_readmore')+'</a>'; // h += '<a href="'+l+'" class="" target="_blank"><i class="fa fa-fw fa-newspaper-o"></i>'+$.i18n('dashboard_newsbox_readmore')+'</a>';
h += '</div><hr/>'; // h += '</div><hr/>';
$('#dash_news').append(h); // $('#dash_news').append(h);
} // }
function createNews(d) // function createNews(d)
{ // {
for(var i = 0; i<d.length; i++) // for(var i = 0; i<d.length; i++)
{ // {
if(i > 5) // if(i > 5)
break; // break;
//
// var title = d[i].title.rendered;
// var excerpt = d[i].excerpt.rendered;
// var link = d[i].link+'?pk_campaign=WebUI&pk_kwd=news_'+d[i].slug;
//
// newsCont(title,excerpt,link);
// }
// }
title = d[i].title.rendered; // function getNews()
excerpt = d[i].excerpt.rendered; // {
link = d[i].link+'?pk_campaign=WebUI&pk_kwd=news_'+d[i].slug; // var h = '<span style="color:red;font-weight:bold">'+$.i18n('dashboard_newsbox_noconn')+'</span>';
// $.ajax({
// url: 'https://hyperion-project.org/wp-json/wp/v2/posts?_embed',
// dataType: 'json',
// type: 'GET',
// timeout: 2000
// })
// .done( function( data, textStatus, jqXHR ) {
// if(jqXHR.status == 200)
// createNews(data);
// else
// $('#dash_news').html(h);
// })
// .fail( function( jqXHR, textStatus ) {
// $('#dash_news').html(h);
// });
// }
newsCont(title,excerpt,link); // getNews();
}
}
function getNews()
{
var h = '<span style="color:red;font-weight:bold">'+$.i18n('dashboard_newsbox_noconn')+'</span>';
$.ajax({
url: 'https://hyperion-project.org/wp-json/wp/v2/posts?_embed',
dataType: 'json',
type: 'GET',
timeout: 2000
})
.done( function( data, textStatus, jqXHR ) {
if(jqXHR.status == 200)
createNews(data);
else
$('#dash_news').html(h);
})
.fail( function( jqXHR, textStatus ) {
$('#dash_news').html(h);
});
}
//getNews();
function updateComponents() function updateComponents()
{ {
var components = comps; var components = window.comps;
components_html = ""; var components_html = "";
for ( idx=0; idx<components.length;idx++) for ( var idx=0; idx<components.length;idx++)
{ {
if(components[idx].name != "ALL") if(components[idx].name != "ALL")
components_html += '<tr><td>'+$.i18n('general_comp_'+components[idx].name)+'</td><td><i class="fa fa-circle component-'+(components[idx].enabled?"on":"off")+'"></i></td></tr>'; components_html += '<tr><td>'+$.i18n('general_comp_'+components[idx].name)+'</td><td><i class="fa fa-circle component-'+(components[idx].enabled?"on":"off")+'"></i></td></tr>';
@ -60,7 +60,7 @@ $(document).ready( function() {
$("#tab_components").html(components_html); $("#tab_components").html(components_html);
//info //info
hyperion_enabled = true; var hyperion_enabled = true;
components.forEach( function(obj) { components.forEach( function(obj) {
if (obj.name == "ALL") if (obj.name == "ALL")
@ -74,27 +74,28 @@ $(document).ready( function() {
} }
// add more info // add more info
$('#dash_leddevice').html(serverInfo.ledDevices.active); $('#dash_leddevice').html(window.serverInfo.ledDevices.active);
$('#dash_currv').html(currentVersion); $('#dash_currv').html(window.currentVersion);
$('#dash_instance').html(serverConfig.general.name); $('#dash_instance').html(window.serverConfig.general.name);
$('#dash_ports').html(serverConfig.flatbufServer.port+' | '+serverConfig.protoServer.port); $('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) { $.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
parsedUpdateJSON = JSON.parse(data); window.parsedUpdateJSON = JSON.parse(data);
latestVersion = parsedUpdateJSON[0].versionnr; window.latestVersion = window.parsedUpdateJSON[0].versionnr;
var cleanLatestVersion = latestVersion.replace(/\./g, ''); // var cleanLatestVersion = window.latestVersion.replace(/\./g, '');
var cleanCurrentVersion = currentVersion.replace(/\./g, ''); // var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
// $('#dash_latev').html(latestVersion); $('#dash_latev').html(window.currentVersion);
// $('#dash_latev').html(window.latestVersion);
// if ( cleanCurrentVersion < cleanLatestVersion ) // if ( cleanCurrentVersion < cleanLatestVersion )
// $('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', latestVersion)+'</div>'); // $('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion)+'</div>');
// else // else
$('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>'); $('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
}); });
//determine platform //determine platform
var grabbers = serverInfo.grabbers.available; var grabbers = window.serverInfo.grabbers.available;
var html = ""; var html = "";
if(grabbers.indexOf('dispmanx') > -1) if(grabbers.indexOf('dispmanx') > -1)
@ -113,9 +114,9 @@ $(document).ready( function() {
//interval update //interval update
updateComponents(); updateComponents();
$(hyperion).on("components-updated",updateComponents); $(window.hyperion).on("components-updated",updateComponents);
if(showOptHelp) if(window.showOptHelp)
createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro"); createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro");
removeOverlay(); removeOverlay();

View File

@ -2,29 +2,29 @@ $(document).ready( function() {
performTranslation(); performTranslation();
var oldEffects = []; var oldEffects = [];
var effects_editor = null; var effects_editor = null;
var confFgEff = serverConfig.foregroundEffect.effect; var confFgEff = window.serverConfig.foregroundEffect.effect;
var confBgEff = serverConfig.backgroundEffect.effect; var confBgEff = window.serverConfig.backgroundEffect.effect;
var foregroundEffect_editor = null; var foregroundEffect_editor = null;
var backgroundEffect_editor = null; var backgroundEffect_editor = null;
if(showOptHelp) if(window.showOptHelp)
{ {
//foreground effect //foreground effect
$('#conf_cont').append(createRow('conf_cont_fge')) $('#conf_cont').append(createRow('conf_cont_fge'));
$('#conf_cont_fge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect')); $('#conf_cont_fge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect'));
$('#conf_cont_fge').append(createHelpTable(schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title"))); $('#conf_cont_fge').append(createHelpTable(window.schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title")));
//background effect //background effect
$('#conf_cont').append(createRow('conf_cont_bge')) $('#conf_cont').append(createRow('conf_cont_bge'));
$('#conf_cont_bge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect')); $('#conf_cont_bge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect'));
$('#conf_cont_bge').append(createHelpTable(schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title"))); $('#conf_cont_bge').append(createHelpTable(window.schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title")));
//effect path //effect path
if(storedAccess != 'default') if(storedAccess != 'default')
{ {
$('#conf_cont').append(createRow('conf_cont_ef')) $('#conf_cont').append(createRow('conf_cont_ef'));
$('#conf_cont_ef').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects')); $('#conf_cont_ef').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects'));
$('#conf_cont_ef').append(createHelpTable(schema.effects.properties, $.i18n("edt_conf_effp_heading_title"))); $('#conf_cont_ef').append(createHelpTable(window.schema.effects.properties, $.i18n("edt_conf_effp_heading_title")));
} }
} }
else else
@ -39,7 +39,7 @@ $(document).ready( function() {
if(storedAccess != 'default') if(storedAccess != 'default')
{ {
effects_editor = createJsonEditor('editor_container_effects', { effects_editor = createJsonEditor('editor_container_effects', {
effects : schema.effects effects : window.schema.effects
}, true, true); }, true, true);
effects_editor.on('change',function() { effects_editor.on('change',function() {
@ -52,11 +52,11 @@ $(document).ready( function() {
} }
foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', { foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', {
foregroundEffect : schema.foregroundEffect foregroundEffect : window.schema.foregroundEffect
}, true, true); }, true, true);
backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', { backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', {
backgroundEffect : schema.backgroundEffect backgroundEffect : window.schema.backgroundEffect
}, true, true); }, true, true);
@ -75,19 +75,19 @@ $(document).ready( function() {
$('#btn_submit_foregroundEffect').off().on('click',function() { $('#btn_submit_foregroundEffect').off().on('click',function() {
var value = foregroundEffect_editor.getValue(); var value = foregroundEffect_editor.getValue();
if(typeof value.foregroundEffect.effect == 'undefined') if(typeof value.foregroundEffect.effect == 'undefined')
value.foregroundEffect.effect = serverConfig.foregroundEffect.effect; value.foregroundEffect.effect = window.serverConfig.foregroundEffect.effect;
requestWriteConfig(value); requestWriteConfig(value);
}); });
$('#btn_submit_backgroundEffect').off().on('click',function() { $('#btn_submit_backgroundEffect').off().on('click',function() {
var value = backgroundEffect_editor.getValue(); var value = backgroundEffect_editor.getValue();
if(typeof value.backgroundEffect.effect == 'undefined') if(typeof value.backgroundEffect.effect == 'undefined')
value.backgroundEffect.effect = serverConfig.backgroundEffect.effect; value.backgroundEffect.effect = window.serverConfig.backgroundEffect.effect;
requestWriteConfig(value); requestWriteConfig(value);
}); });
//create introduction //create introduction
if(showOptHelp) if(window.showOptHelp)
{ {
createHint("intro", $.i18n('conf_effect_path_intro'), "editor_container_effects"); createHint("intro", $.i18n('conf_effect_path_intro'), "editor_container_effects");
createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect"); createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect");
@ -95,14 +95,14 @@ $(document).ready( function() {
} }
function updateEffectlist(){ function updateEffectlist(){
var newEffects = serverInfo.effects; var newEffects = window.serverInfo.effects;
if (newEffects.length != oldEffects.length) if (newEffects.length != oldEffects.length)
{ {
$('#root_foregroundEffect_effect').html(''); $('#root_foregroundEffect_effect').html('');
var usrEffArr = []; var usrEffArr = [];
var sysEffArr = []; var sysEffArr = [];
for(i = 0; i < newEffects.length; i++) for(var i = 0; i < newEffects.length; i++)
{ {
var effectName = newEffects[i].name; var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file)) if(!/^\:/.test(newEffects[i].file))
@ -121,8 +121,8 @@ $(document).ready( function() {
} }
//interval update //interval update
$(hyperion).on("cmd-effects-update", function(event){ $(window.hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects window.serverInfo.effects = event.response.data.effects
updateEffectlist(); updateEffectlist();
}); });

View File

@ -7,11 +7,11 @@ $(document).ready( function() {
var effectPy = ""; var effectPy = "";
var testrun; var testrun;
if(showOptHelp) if(window.showOptHelp)
createHintH("intro", $.i18n('effectsconfigurator_label_intro'), "intro_effc"); createHintH("intro", $.i18n('effectsconfigurator_label_intro'), "intro_effc");
function updateDelEffectlist(){ function updateDelEffectlist(){
var newDelList = serverInfo.effects; var newDelList = window.serverInfo.effects;
if(newDelList.length != oldDelList.length) if(newDelList.length != oldDelList.length)
{ {
$('#effectsdellist').html(""); $('#effectsdellist').html("");
@ -107,7 +107,7 @@ $(document).ready( function() {
// Save Effect // Save Effect
$('#btn_write').off().on('click',function() { $('#btn_write').off().on('click',function() {
requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue()),imageData); requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue()),imageData);
$(hyperion).one("cmd-create-effect", function(event) { $(window.hyperion).one("cmd-create-effect", function(event) {
if (event.response.success) if (event.response.success)
showInfoDialog('success', "", $.i18n('infoDialog_effconf_created_text', effectName)); showInfoDialog('success', "", $.i18n('infoDialog_effconf_created_text', effectName));
}); });
@ -137,7 +137,7 @@ $(document).ready( function() {
$('#btn_delete').off().on('click',function() { $('#btn_delete').off().on('click',function() {
var name = $("#effectsdellist").val().split("_")[1]; var name = $("#effectsdellist").val().split("_")[1];
requestDeleteEffect(name); requestDeleteEffect(name);
$(hyperion).one("cmd-delete-effect", function(event) { $(window.hyperion).one("cmd-delete-effect", function(event) {
if (event.response.success) if (event.response.success)
showInfoDialog('success', "", $.i18n('infoDialog_effconf_deleted_text', name)); showInfoDialog('success', "", $.i18n('infoDialog_effconf_deleted_text', name));
}); });
@ -163,15 +163,15 @@ $(document).ready( function() {
$("#name-input").val(name); $("#name-input").val(name);
} }
var efx = serverInfo.effects; var efx = window.serverInfo.effects;
for(var i = 0; i<efx.length; i++) for(var i = 0; i<efx.length; i++)
{ {
if(efx[i].name == name) if(efx[i].name == name)
{ {
var py = efx[i].script.split("/").pop() var py = efx[i].script.split("/").pop();
$("#effectslist").val(py).trigger("change"); $("#effectslist").val(py).trigger("change");
for(key in efx[i].args) for(var key in efx[i].args)
{ {
var ed = effects_editor.getEditor('root.args.'+[key]); var ed = effects_editor.getEditor('root.args.'+[key]);
if(ed) if(ed)
@ -183,7 +183,7 @@ $(document).ready( function() {
}); });
//create basic effect list //create basic effect list
var effects = serverSchema.properties.effectSchemas.internal var effects = window.serverSchema.properties.effectSchemas.internal;
for(var idx=0; idx<effects.length; idx++) for(var idx=0; idx<effects.length; idx++)
{ {
$("#effectslist").append(createSelOpt(effects[idx].schemaContent.script, $.i18n(effects[idx].schemaContent.title))); $("#effectslist").append(createSelOpt(effects[idx].schemaContent.script, $.i18n(effects[idx].schemaContent.title)));
@ -193,8 +193,8 @@ $(document).ready( function() {
updateDelEffectlist(); updateDelEffectlist();
//interval update //interval update
$(hyperion).on("cmd-effects-update", function(event){ $(window.hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects window.serverInfo.effects = event.response.data.effects
updateDelEffectlist(); updateDelEffectlist();
}); });

View File

@ -6,15 +6,15 @@ $(document).ready( function() {
var conf_editor = null; var conf_editor = null;
$('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_gen_heading_title"), 'editor_container', 'btn_submit')); $('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_gen_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp) if(window.showOptHelp)
{ {
$('#conf_cont').append(createHelpTable(schema.general.properties, $.i18n("edt_conf_gen_heading_title"))); $('#conf_cont').append(createHelpTable(window.schema.general.properties, $.i18n("edt_conf_gen_heading_title")));
} }
else else
$('#conf_imp').appendTo('#conf_cont'); $('#conf_imp').appendTo('#conf_cont');
conf_editor = createJsonEditor('editor_container', { conf_editor = createJsonEditor('editor_container', {
general: schema.general general: window.schema.general
}, true, true); }, true, true);
conf_editor.on('change',function() { conf_editor.on('change',function() {
@ -88,7 +88,7 @@ $(document).ready( function() {
//export //export
$('#btn_export_conf').off().on('click', function(){ $('#btn_export_conf').off().on('click', function(){
var name = serverConfig.general.name; var name = window.serverConfig.general.name;
var d = new Date(); var d = new Date();
var month = d.getMonth()+1; var month = d.getMonth()+1;
@ -98,11 +98,11 @@ $(document).ready( function() {
(month<10 ? '0' : '') + month + '.' + (month<10 ? '0' : '') + month + '.' +
(day<10 ? '0' : '') + day; (day<10 ? '0' : '') + day;
download(JSON.stringify(serverConfig, null, "\t"), 'Hyperion-'+currentVersion+'-Backup ('+name+') '+timestamp+'.json', "application/json"); download(JSON.stringify(window.serverConfig, null, "\t"), 'Hyperion-'+window.currentVersion+'-Backup ('+name+') '+timestamp+'.json', "application/json");
}); });
//create introduction //create introduction
if(showOptHelp) if(window.showOptHelp)
createHint("intro", $.i18n('conf_general_intro'), "editor_container"); createHint("intro", $.i18n('conf_general_intro'), "editor_container");
removeOverlay(); removeOverlay();

View File

@ -12,22 +12,22 @@ $(document).ready( function() {
} }
} }
if(showOptHelp) if(window.showOptHelp)
{ {
//fg //fg
$('#conf_cont').append(createRow('conf_cont_instCapt')) $('#conf_cont').append(createRow('conf_cont_instCapt'));
$('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); $('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt'));
$('#conf_cont_instCapt').append(createHelpTable(schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title"))); $('#conf_cont_instCapt').append(createHelpTable(window.schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title")));
//fg //fg
$('#conf_cont').append(createRow('conf_cont_fg')) $('#conf_cont').append(createRow('conf_cont_fg'));
$('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); $('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg'));
$('#conf_cont_fg').append(createHelpTable(schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title"))); $('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title")));
//v4l //v4l
$('#conf_cont').append(createRow('conf_cont_v4l')) $('#conf_cont').append(createRow('conf_cont_v4l'));
$('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); $('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2'));
$('#conf_cont_v4l').append(createHelpTable(schema.grabberV4L2.items.properties, $.i18n("edt_conf_v4l2_heading_title"))); $('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title")));
} }
else else
{ {
@ -38,7 +38,7 @@ $(document).ready( function() {
} }
//instCapt //instCapt
conf_editor_instCapt = createJsonEditor('editor_container_instCapt', { conf_editor_instCapt = createJsonEditor('editor_container_instCapt', {
instCapture: schema.instCapture instCapture: window.schema.instCapture
}, true, true); }, true, true);
conf_editor_instCapt.on('change',function() { conf_editor_instCapt.on('change',function() {
@ -52,7 +52,7 @@ $(document).ready( function() {
//fg //fg
conf_editor_fg = createJsonEditor('editor_container_fg', { conf_editor_fg = createJsonEditor('editor_container_fg', {
framegrabber: schema.framegrabber framegrabber: window.schema.framegrabber
}, true, true); }, true, true);
conf_editor_fg.on('change',function() { conf_editor_fg.on('change',function() {
@ -65,7 +65,7 @@ $(document).ready( function() {
//vl4 //vl4
conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', { conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', {
grabberV4L2 : schema.grabberV4L2 grabberV4L2 : window.schema.grabberV4L2
}, true, true); }, true, true);
conf_editor_v4l2.on('change',function() { conf_editor_v4l2.on('change',function() {
@ -77,7 +77,7 @@ $(document).ready( function() {
}); });
//create introduction //create introduction
if(showOptHelp) if(window.showOptHelp)
{ {
createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg"); createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg");
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2"); createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2");
@ -85,7 +85,7 @@ $(document).ready( function() {
//hide specific options //hide specific options
conf_editor_fg.on('ready',function() { conf_editor_fg.on('ready',function() {
var grabbers = serverInfo.grabbers.available; var grabbers = window.serverInfo.grabbers.available;
if(grabbers.indexOf('dispmanx') > -1) if(grabbers.indexOf('dispmanx') > -1)
hideEl(["device","pixelDecimation"]); hideEl(["device","pixelDecimation"]);

View File

@ -4,14 +4,14 @@ $(document).ready( function() {
loadContentTo("#container_restart","restart"); loadContentTo("#container_restart","restart");
initWebSocket(); initWebSocket();
$(hyperion).on("cmd-serverinfo",function(event){ $(window.hyperion).on("cmd-serverinfo",function(event){
serverInfo = event.response.info; window.serverInfo = event.response.info;
// comps // comps
comps = event.response.info.components window.comps = event.response.info.components
$(hyperion).trigger("ready"); $(window.hyperion).trigger("ready");
comps.forEach( function(obj) { window.comps.forEach( function(obj) {
if (obj.name == "ALL") if (obj.name == "ALL")
{ {
if(obj.enabled) if(obj.enabled)
@ -21,7 +21,7 @@ $(document).ready( function() {
} }
}); });
if (serverInfo.hyperion.enabled) if (window.serverInfo.hyperion.enabled)
$("#hyperion_disabled_notify").fadeOut("fast"); $("#hyperion_disabled_notify").fadeOut("fast");
else else
$("#hyperion_disabled_notify").fadeIn("fast"); $("#hyperion_disabled_notify").fadeIn("fast");
@ -29,59 +29,59 @@ $(document).ready( function() {
updateSessions(); updateSessions();
}); // end cmd-serverinfo }); // end cmd-serverinfo
$(hyperion).on("cmd-sessions-update", function(event) { $(window.hyperion).on("cmd-sessions-update", function(event) {
serverInfo.sessions = event.response.data; window.serverInfo.sessions = event.response.data;
updateSessions(); updateSessions();
}); });
$(hyperion).on("cmd-sysinfo", function(event) { $(window.hyperion).on("cmd-sysinfo", function(event) {
requestServerInfo(); requestServerInfo();
sysInfo = event.response.info; window.sysInfo = event.response.info;
currentVersion = sysInfo.hyperion.version; window.currentVersion = window.sysInfo.hyperion.version;
}); });
$(hyperion).one("cmd-config-getschema", function(event) { $(window.hyperion).one("cmd-config-getschema", function(event) {
serverSchema = event.response.info; window.serverSchema = event.response.info;
requestServerConfig(); requestServerConfig();
schema = serverSchema.properties; window.schema = window.serverSchema.properties;
}); });
$(hyperion).on("cmd-config-getconfig", function(event) { $(window.hyperion).on("cmd-config-getconfig", function(event) {
serverConfig = event.response.info; window.serverConfig = event.response.info;
requestSysInfo(); requestSysInfo();
showOptHelp = serverConfig.general.showOptHelp; window.showOptHelp = window.serverConfig.general.showOptHelp;
}); });
$(hyperion).on("cmd-config-setconfig", function(event) { $(window.hyperion).on("cmd-config-setconfig", function(event) {
if (event.response.success === true) { if (event.response.success === true) {
$('#hyperion_config_write_success_notify').fadeIn().delay(5000).fadeOut(); $('#hyperion_config_write_success_notify').fadeIn().delay(5000).fadeOut();
} }
}); });
$(hyperion).on("error",function(event){ $(window.hyperion).on("error",function(event){
showInfoDialog("error","Error", event.reason); showInfoDialog("error","Error", event.reason);
}); });
$(hyperion).on("open",function(event){ $(window.hyperion).on("open",function(event){
requestServerConfigSchema(); requestServerConfigSchema();
}); });
$(hyperion).one("ready", function(event) { $(window.hyperion).one("ready", function(event) {
loadContent(); loadContent();
}); });
$(hyperion).on("cmd-adjustment-update", function(event) { $(window.hyperion).on("cmd-adjustment-update", function(event) {
serverInfo.adjustment = event.response.data window.serverInfo.adjustment = event.response.data
}); });
$(hyperion).on("cmd-videomode-update", function(event) { $(window.hyperion).on("cmd-videomode-update", function(event) {
serverInfo.videomode = event.response.data.videomode window.serverInfo.videomode = event.response.data.videomode
}); });
$(hyperion).on("cmd-components-update", function(event) { $(window.hyperion).on("cmd-components-update", function(event) {
let obj = event.response.data let obj = event.response.data
// notfication in index // notfication in index
@ -93,17 +93,17 @@ $(document).ready( function() {
$("#hyperion_disabled_notify").fadeIn("fast"); $("#hyperion_disabled_notify").fadeIn("fast");
} }
comps.forEach((entry, index) => { window.comps.forEach((entry, index) => {
if (entry.name === obj.name){ if (entry.name === obj.name){
comps[index] = obj; window.comps[index] = obj;
} }
}); });
// notify the update // notify the update
$(hyperion).trigger("components-updated"); $(window.hyperion).trigger("components-updated");
}); });
$(hyperion).on("cmd-effects-update", function(event){ $(window.hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects window.serverInfo.effects = event.response.data.effects
}); });
$(".mnava").bind('click.menu', function(e){ $(".mnava").bind('click.menu', function(e){

View File

@ -30,19 +30,19 @@ function createLedPreview(leds, origin){
$('.st_helper').css("border", "8px solid grey"); $('.st_helper').css("border", "8px solid grey");
canvas_height = $('#leds_preview').innerHeight(); var canvas_height = $('#leds_preview').innerHeight();
canvas_width = $('#leds_preview').innerWidth(); var canvas_width = $('#leds_preview').innerWidth();
leds_html = ""; var leds_html = "";
for(var idx=0; idx<leds.length; idx++) for(var idx=0; idx<leds.length; idx++)
{ {
led = leds[idx]; var led = leds[idx];
led_id='ledc_'+[idx]; var led_id='ledc_'+[idx];
bgcolor = "background-color:hsl("+(idx*360/leds.length)+",100%,50%);"; var bgcolor = "background-color:hsl("+(idx*360/leds.length)+",100%,50%);";
pos = "left:"+(led.hscan.minimum * canvas_width)+"px;"+ var pos = "left:"+(led.hscan.minimum * canvas_width)+"px;"+
"top:"+(led.vscan.minimum * canvas_height)+"px;"+ "top:"+(led.vscan.minimum * canvas_height)+"px;"+
"width:"+((led.hscan.maximum-led.hscan.minimum) * canvas_width-1)+"px;"+ "width:"+((led.hscan.maximum-led.hscan.minimum) * (canvas_width-1))+"px;"+
"height:"+((led.vscan.maximum-led.vscan.minimum) * canvas_height-1)+"px;"; "height:"+((led.vscan.maximum-led.vscan.minimum) * (canvas_height-1))+"px;";
leds_html += '<div id="'+led_id+'" class="led" style="'+bgcolor+pos+'" title="'+led.index+'"><span id="'+led_id+'_num" class="led_prev_num">'+led.index+'</span></div>'; leds_html += '<div id="'+led_id+'" class="led" style="'+bgcolor+pos+'" title="'+led.index+'"><span id="'+led_id+'_num" class="led_prev_num">'+led.index+'</span></div>';
} }
$('#leds_preview').html(leds_html); $('#leds_preview').html(leds_html);
@ -87,10 +87,10 @@ function createClassicLeds(){
function createFinalArray(array){ function createFinalArray(array){
finalLedArray = []; finalLedArray = [];
for(var i = 0; i<array.length; i++){ for(var i = 0; i<array.length; i++){
hmin = array[i].hscan.minimum; var hmin = array[i].hscan.minimum;
hmax = array[i].hscan.maximum; var hmax = array[i].hscan.maximum;
vmin = array[i].vscan.minimum; var vmin = array[i].vscan.minimum;
vmax = array[i].vscan.maximum; var vmax = array[i].vscan.maximum;
finalLedArray[i] = { "index" : i, "hscan": { "maximum" : hmax, "minimum" : hmin }, "vscan": { "maximum": vmax, "minimum": vmin}} finalLedArray[i] = { "index" : i, "hscan": { "maximum" : hmax, "minimum" : hmin }, "vscan": { "maximum": vmax, "minimum": vmin}}
} }
createLedPreview(finalLedArray, 'classic'); createLedPreview(finalLedArray, 'classic');
@ -115,9 +115,9 @@ function createClassicLeds(){
function valScan(val) function valScan(val)
{ {
if(val > 1) if(val > 1)
return val = 1; return 1;
if(val < 0) if(val < 0)
return val = 0; return 0;
return val; return val;
} }
@ -138,62 +138,65 @@ function createClassicLeds(){
} }
function createTopLeds(){ function createTopLeds(){
step=(Hmax-Hmin)/ledstop; var step=(Hmax-Hmin)/ledstop;
//if(cornerVGap != '0') //if(cornerVGap != '0')
// step=(Hmax-Hmin-(cornerHGap*2))/ledstop; // step=(Hmax-Hmin-(cornerHGap*2))/ledstop;
vmin=Vmin; var vmin=Vmin;
vmax=vmin+ledsHDepth; var vmax=vmin+ledsHDepth;
for (var i = 0; i<ledstop; i++){ for (var i = 0; i<ledstop; i++){
hmin = ovl("-",(Hdiff/ledstop*[i])+edgeHGap); var hmin = ovl("-",(Hdiff/ledstop*Number([i]))+edgeHGap);
hmax = ovl("+",(Hdiff/ledstop*[i])+step+edgeHGap); var hmax = ovl("+",(Hdiff/ledstop*Number([i]))+step+edgeHGap);
createLedArray(hmin, hmax, vmin, vmax); createLedArray(hmin, hmax, vmin, vmax);
} }
} }
function createLeftLeds(){ function createLeftLeds(){
step=(Vmax-Vmin)/ledsleft; var step=(Vmax-Vmin)/ledsleft;
//if(cornerVGap != '0') //if(cornerVGap != '0')
// step=(Vmax-Vmin-(cornerVGap*2))/ledsleft; // step=(Vmax-Vmin-(cornerVGap*2))/ledsleft;
hmin=Hmin; var hmin=Hmin;
hmax=hmin+ledsVDepth; var hmax=hmin+ledsVDepth;
for (var i = ledsleft-1; i>-1; --i){ for (var i = ledsleft-1; i>-1; --i){
vmin = ovl("-",(Vdiff/ledsleft*[i])+edgeVGap); var vmin = ovl("-",(Vdiff/ledsleft*Number([i]))+edgeVGap);
vmax = ovl("+",(Vdiff/ledsleft*[i])+step+edgeVGap); var vmax = ovl("+",(Vdiff/ledsleft*Number([i]))+step+edgeVGap);
createLedArray(hmin, hmax, vmin, vmax); createLedArray(hmin, hmax, vmin, vmax);
} }
} }
function createRightLeds(){ function createRightLeds(){
step=(Vmax-Vmin)/ledsright; var step=(Vmax-Vmin)/ledsright;
//if(cornerVGap != '0') //if(cornerVGap != '0')
// step=(Vmax-Vmin-(cornerVGap*2))/ledsright; // step=(Vmax-Vmin-(cornerVGap*2))/ledsright;
hmax=Hmax; var hmax=Hmax;
hmin=hmax-ledsVDepth; var hmin=hmax-ledsVDepth;
for (var i = 0; i<ledsright; i++){ for (var i = 0; i<ledsright; i++){
vmin = ovl("-",(Vdiff/ledsright*[i])+edgeVGap); var vmin = ovl("-",(Vdiff/ledsright*Number([i]))+edgeVGap);
vmax = ovl("+",(Vdiff/ledsright*[i])+step+edgeVGap); var vmax = ovl("+",(Vdiff/ledsright*Number([i]))+step+edgeVGap);
createLedArray(hmin, hmax, vmin, vmax); createLedArray(hmin, hmax, vmin, vmax);
} }
} }
function createBottomLeds(){ function createBottomLeds(){
step=(Hmax-Hmin)/ledsbottom; var step=(Hmax-Hmin)/ledsbottom;
//if(cornerVGap != '0') //if(cornerVGap != '0')
// step=(Hmax-Hmin-(cornerHGap*2))/ledsbottom; // step=(Hmax-Hmin-(cornerHGap*2))/ledsbottom;
vmax=Vmax; var vmax=Vmax;
vmin=vmax-ledsHDepth; var vmin=vmax-ledsHDepth;
for (var i = ledsbottom-1; i>-1; i--){ for (var i = ledsbottom-1; i>-1; i--){
hmin = ovl("-",(Hdiff/ledsbottom*[i])+edgeHGap); var hmin = ovl("-",(Hdiff/ledsbottom*Number([i]))+edgeHGap);
hmax = ovl("+",(Hdiff/ledsbottom*[i])+step+edgeHGap); var hmax = ovl("+",(Hdiff/ledsbottom*Number([i]))+step+edgeHGap);
createLedArray(hmin, hmax, vmin, vmax); createLedArray(hmin, hmax, vmin, vmax);
} }
} }
createLeftLeds(createBottomLeds(createRightLeds(createTopLeds()))); createLeftLeds();
createBottomLeds();
createRightLeds();
createTopLeds();
//check led gap pos //check led gap pos
if (ledsgpos+ledsglength > ledArray.length) if (ledsgpos+ledsglength > ledArray.length)
@ -308,17 +311,17 @@ $(document).ready(function() {
performTranslation(); performTranslation();
//add intros //add intros
if(showOptHelp) if(window.showOptHelp)
{ {
createHintH("intro", $.i18n('conf_leds_device_intro'), "leddevice_intro"); createHintH("intro", $.i18n('conf_leds_device_intro'), "leddevice_intro");
createHintH("intro", $.i18n('conf_leds_layout_intro'), "layout_intro"); createHintH("intro", $.i18n('conf_leds_layout_intro'), "layout_intro");
$('#led_vis_help').html('<div><div class="led_ex" style="background-color:black;margin-right:5px;margin-top:3px"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l1')+'</div></div><div class="led_ex" style="background-color:grey;margin-top:3px;margin-right:2px"></div><div class="led_ex" style="background-color: rgb(169, 169, 169);margin-right:5px;margin-top:3px;"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l2')+'</div>'); $('#led_vis_help').html('<div><div class="led_ex" style="background-color:black;margin-right:5px;margin-top:3px"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l1')+'</div></div><div class="led_ex" style="background-color:grey;margin-top:3px;margin-right:2px"></div><div class="led_ex" style="background-color: rgb(169, 169, 169);margin-right:5px;margin-top:3px;"></div><div style="display:inline-block;vertical-align:top">'+$.i18n('conf_leds_layout_preview_l2')+'</div>');
} }
var slConfig = serverConfig.ledConfig; var slConfig = window.serverConfig.ledConfig;
//restore ledConfig //restore ledConfig
for(key in slConfig) for(var key in slConfig)
{ {
if(typeof(slConfig[key]) === "boolean") if(typeof(slConfig[key]) === "boolean")
$('#ip_cl_'+key).prop('checked', slConfig[key]); $('#ip_cl_'+key).prop('checked', slConfig[key]);
@ -329,7 +332,7 @@ $(document).ready(function() {
function saveValues() function saveValues()
{ {
var ledConfig = {}; var ledConfig = {};
for(key in slConfig) for(var key in slConfig)
{ {
if(typeof(slConfig[key]) === "boolean") if(typeof(slConfig[key]) === "boolean")
ledConfig[key] = $('#ip_cl_'+key).is(':checked'); ledConfig[key] = $('#ip_cl_'+key).is(':checked');
@ -370,7 +373,7 @@ $(document).ready(function() {
}); });
// v4 of json schema with diff required assignment - remove when hyperion schema moved to v4 // v4 of json schema with diff required assignment - remove when hyperion schema moved to v4
var ledschema = {"items":{"additionalProperties":false,"required":["hscan","vscan","index"],"properties":{"clone":{"type":"integer"},"colorOrder":{"enum":["rgb","bgr","rbg","brg","gbr","grb"],"type":"string"},"hscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"},"index":{"type":"integer"},"vscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"}},"type":"object"},"type":"array"} var ledschema = {"items":{"additionalProperties":false,"required":["hscan","vscan","index"],"properties":{"clone":{"type":"integer"},"colorOrder":{"enum":["rgb","bgr","rbg","brg","gbr","grb"],"type":"string"},"hscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"},"index":{"type":"integer"},"vscan":{"additionalProperties":false,"properties":{"maximum":{"maximum":1,"minimum":0,"type":"number"},"minimum":{"maximum":1,"minimum":0,"type":"number"}},"type":"object"}},"type":"object"},"type":"array"};
//create jsonace editor //create jsonace editor
var aceEdt = new JSONACEEditor(document.getElementById("aceedit"),{ var aceEdt = new JSONACEEditor(document.getElementById("aceedit"),{
mode: 'code', mode: 'code',
@ -396,7 +399,7 @@ $(document).ready(function() {
$('#leds_custom_save').attr("disabled", true); $('#leds_custom_save').attr("disabled", true);
} }
} }
}, serverConfig.leds); }, window.serverConfig.leds);
//TODO: HACK! No callback for schema validation - Add it! //TODO: HACK! No callback for schema validation - Add it!
setInterval(function(){ setInterval(function(){
@ -405,12 +408,12 @@ $(document).ready(function() {
$('#leds_custom_updsim').attr("disabled", true); $('#leds_custom_updsim').attr("disabled", true);
$('#leds_custom_save').attr("disabled", true); $('#leds_custom_save').attr("disabled", true);
} }
},1000) },1000);
$('.jsoneditor-menu').toggle(); $('.jsoneditor-menu').toggle();
// leds to finalLedArray // leds to finalLedArray
finalLedArray = serverConfig.leds; finalLedArray = window.serverConfig.leds;
// cl/ma leds push to textfield // cl/ma leds push to textfield
$('#btn_cl_generate, #btn_ma_generate').off().on("click", function(e) { $('#btn_cl_generate, #btn_ma_generate').off().on("click", function(e) {
@ -425,28 +428,28 @@ $(document).ready(function() {
// create and update editor // create and update editor
$("#leddevices").off().on("change", function() { $("#leddevices").off().on("change", function() {
generalOptions = serverSchema.properties.device; var generalOptions = window.serverSchema.properties.device;
specificOptions = serverSchema.properties.alldevices[$(this).val()]; var specificOptions = window.serverSchema.properties.alldevices[$(this).val()];
conf_editor = createJsonEditor('editor_container', { conf_editor = createJsonEditor('editor_container', {
generalOptions : generalOptions, generalOptions : generalOptions,
specificOptions : specificOptions, specificOptions : specificOptions,
}); });
values_general = {}; var values_general = {};
values_specific = {}; var values_specific = {};
isCurrentDevice = (serverInfo.ledDevices.active == $(this).val()); var isCurrentDevice = (window.serverInfo.ledDevices.active == $(this).val());
for(var key in serverConfig.device){ for(var key in window.serverConfig.device){
if (key != "type" && key in generalOptions.properties) if (key != "type" && key in generalOptions.properties)
values_general[key] = serverConfig.device[key]; values_general[key] = window.serverConfig.device[key];
}; };
conf_editor.getEditor("root.generalOptions").setValue( values_general ); conf_editor.getEditor("root.generalOptions").setValue( values_general );
if (isCurrentDevice) if (isCurrentDevice)
{ {
specificOptions_val = conf_editor.getEditor("root.specificOptions").getValue() var specificOptions_val = conf_editor.getEditor("root.specificOptions").getValue()
for(var key in specificOptions_val){ for(var key in specificOptions_val){
values_specific[key] = (key in serverConfig.device) ? serverConfig.device[key] : specificOptions_val[key]; values_specific[key] = (key in window.serverConfig.device) ? window.serverConfig.device[key] : specificOptions_val[key];
}; };
conf_editor.getEditor("root.specificOptions").setValue( values_specific ); conf_editor.getEditor("root.specificOptions").setValue( values_specific );
@ -469,12 +472,12 @@ $(document).ready(function() {
}); });
// create led device selection // create led device selection
ledDevices = serverInfo.ledDevices.available var ledDevices = window.serverInfo.ledDevices.available;
devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'ws2812spi']; var devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'ws2812spi'];
devRPiPWM = ['ws281x']; var devRPiPWM = ['ws281x'];
devRPiGPIO = ['piblaster']; var devRPiGPIO = ['piblaster'];
devNET = ['atmoorb', 'fadecandy', 'philipshue', 'nanoleaf', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw']; var devNET = ['atmoorb', 'fadecandy', 'philipshue', 'aurora', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw'];
devUSB = ['adalight', 'dmx', 'atmo', 'hyperionusbasp', 'lightpack', 'multilightpack', 'paintpack', 'rawhid', 'sedu', 'tpm2', 'karate']; var devUSB = ['adalight', 'dmx', 'atmo', 'hyperionusbasp', 'lightpack', 'multilightpack', 'paintpack', 'rawhid', 'sedu', 'tpm2', 'karate'];
var optArr = [[]]; var optArr = [[]];
optArr[1]=[]; optArr[1]=[];
@ -483,7 +486,7 @@ $(document).ready(function() {
optArr[4]=[]; optArr[4]=[];
optArr[5]=[]; optArr[5]=[];
for (idx=0; idx<ledDevices.length; idx++) for (var idx=0; idx<ledDevices.length; idx++)
{ {
if($.inArray(ledDevices[idx], devRPiSPI) != -1) if($.inArray(ledDevices[idx], devRPiSPI) != -1)
optArr[0].push(ledDevices[idx]); optArr[0].push(ledDevices[idx]);
@ -505,7 +508,7 @@ $(document).ready(function() {
$("#leddevices").append(createSel(optArr[3], $.i18n('conf_leds_optgroup_network'))); $("#leddevices").append(createSel(optArr[3], $.i18n('conf_leds_optgroup_network')));
$("#leddevices").append(createSel(optArr[4], $.i18n('conf_leds_optgroup_usb'))); $("#leddevices").append(createSel(optArr[4], $.i18n('conf_leds_optgroup_usb')));
$("#leddevices").append(createSel(optArr[5], $.i18n('conf_leds_optgroup_debug'))); $("#leddevices").append(createSel(optArr[5], $.i18n('conf_leds_optgroup_debug')));
$("#leddevices").val(serverInfo.ledDevices.active); $("#leddevices").val(window.serverInfo.ledDevices.active);
$("#leddevices").trigger("change"); $("#leddevices").trigger("change");
// validate textfield and update preview // validate textfield and update preview
@ -559,11 +562,11 @@ $(document).ready(function() {
// save led device config // save led device config
$("#btn_submit_controller").off().on("click", function(event) { $("#btn_submit_controller").off().on("click", function(event) {
ledDevice = $("#leddevices").val(); var ledDevice = $("#leddevices").val();
result = {device:{}}; var result = {device:{}};
general = conf_editor.getEditor("root.generalOptions").getValue(); var general = conf_editor.getEditor("root.generalOptions").getValue();
specific = conf_editor.getEditor("root.specificOptions").getValue(); var specific = conf_editor.getEditor("root.specificOptions").getValue();
for(var key in general){ for(var key in general){
result.device[key] = general[key]; result.device[key] = general[key];
} }
@ -577,6 +580,3 @@ $(document).ready(function() {
removeOverlay(); removeOverlay();
}); });

View File

@ -10,15 +10,15 @@ $(document).ready(function() {
var reportUrl = 'https://report.hyperion-project.org/#'; var reportUrl = 'https://report.hyperion-project.org/#';
$('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit')); $('#conf_cont').append(createOptPanel('fa-reorder', $.i18n("edt_conf_log_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp) if(window.showOptHelp)
{ {
$('#conf_cont').append(createHelpTable(schema.logger.properties, $.i18n("edt_conf_log_heading_title"))); $('#conf_cont').append(createHelpTable(window.schema.logger.properties, $.i18n("edt_conf_log_heading_title")));
createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head"); createHintH("intro", $.i18n('conf_logging_label_intro'), "log_head");
} }
$("#log_upl_pol").append('<span style="color:grey;font-size:80%">'+$.i18n("conf_logging_uplpolicy")+' '+buildWL("user/support#report_privacy_policy",$.i18n("conf_logging_contpolicy"))); $("#log_upl_pol").append('<span style="color:grey;font-size:80%">'+$.i18n("conf_logging_uplpolicy")+' '+buildWL("user/support#report_privacy_policy",$.i18n("conf_logging_contpolicy")));
conf_editor = createJsonEditor('editor_container', { conf_editor = createJsonEditor('editor_container', {
logger : schema.logger logger : window.schema.logger
}, true, true); }, true, true);
conf_editor.on('change',function() { conf_editor.on('change',function() {
@ -61,11 +61,11 @@ $(document).ready(function() {
function uploadLog() function uploadLog()
{ {
var log = ""; var log = "";
var config = JSON.stringify(serverConfig, null).replace(/"/g, '\"'); var config = JSON.stringify(window.serverConfig, null).replace(/"/g, '\\"');
var prios = serverInfo.priorities; var prios = window.serverInfo.priorities;
var comps = serverInfo.components; var comps = window.serverInfo.components;
var sys = sysInfo.system; var sys = window.sysInfo.system;
var shy = sysInfo.hyperion; var shy = window.sysInfo.hyperion;
var info; var info;
//create log //create log
@ -78,8 +78,8 @@ $(document).ready(function() {
info += 'Version: '+shy.version+'\n'; info += 'Version: '+shy.version+'\n';
info += 'UI Lang: '+storedLang+' (BrowserL: '+navigator.language+')\n'; info += 'UI Lang: '+storedLang+' (BrowserL: '+navigator.language+')\n';
info += 'UI Access: '+storedAccess+'\n'; info += 'UI Access: '+storedAccess+'\n';
info += 'Log lvl: '+serverConfig.logger.level+'\n'; info += 'Log lvl: '+window.serverConfig.logger.level+'\n';
info += 'Avail Capt: '+serverInfo.grabbers.available+'\n\n'; info += 'Avail Capt: '+window.serverInfo.grabbers.available+'\n\n';
info += 'Distribution:'+sys.prettyName+'\n'; info += 'Distribution:'+sys.prettyName+'\n';
info += 'Arch: '+sys.architecture+'\n'; info += 'Arch: '+sys.architecture+'\n';
info += 'Kernel: '+sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))\n'; info += 'Kernel: '+sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))\n';
@ -96,10 +96,10 @@ $(document).ready(function() {
info += ' '; info += ' ';
info += ' ('+prios[i].component+') Owner: '+prios[i].owner+'\n'; info += ' ('+prios[i].component+') Owner: '+prios[i].owner+'\n';
} }
info += '\npriorities_autoselect: '+serverInfo.priorities_autoselect+'\n\n'; info += '\npriorities_autoselect: '+window.serverInfo.priorities_autoselect+'\n\n';
//create comps //create comps
info += '### COMPONENTS ### \n' info += '### COMPONENTS ### \n';
for(var i = 0; i<comps.length; i++) for(var i = 0; i<comps.length; i++)
{ {
info += comps[i].enabled+' - '+comps[i].name+'\n'; info += comps[i].enabled+' - '+comps[i].name+'\n';
@ -109,7 +109,7 @@ $(document).ready(function() {
info = JSON.stringify(info); info = JSON.stringify(info);
log = JSON.stringify(log); log = JSON.stringify(log);
config = JSON.stringify(config); config = JSON.stringify(config);
var title = 'Hyperion '+currentVersion+' Report ('+serverConfig.general.name+' ('+serverInfo.ledDevices.active+'))'; var title = 'Hyperion '+window.currentVersion+' Report ('+window.serverConfig.general.name+' ('+window.serverInfo.ledDevices.active+'))';
$.ajax({ $.ajax({
url: 'https://api.hyperion-project.org/report.php', url: 'https://api.hyperion-project.org/report.php',
@ -140,15 +140,15 @@ $(document).ready(function() {
}); });
} }
if (!loggingHandlerInstalled) if (!window.loggingHandlerInstalled)
{ {
loggingHandlerInstalled = true; window.loggingHandlerInstalled = true;
$(hyperion).on("cmd-logging-update",function(event){ $(window.hyperion).on("cmd-logging-update",function(event){
if ($("#logmessages").length == 0 && loggingStreamActive) if ($("#logmessages").length == 0 && window.loggingStreamActive)
{ {
requestLoggingStop(); requestLoggingStop();
loggingStreamActive = false; window.loggingStreamActive = false;
} }
messages = (event.response.result.messages); messages = (event.response.result.messages);
@ -163,13 +163,13 @@ $(document).ready(function() {
} }
for(var idx=0; idx<messages.length; idx++) for(var idx=0; idx<messages.length; idx++)
{ {
app_name = messages[idx].appName; var app_name = messages[idx].appName;
logger_name = messages[idx].loggerName; var logger_name = messages[idx].loggerName;
function_ = messages[idx].function; var function_ = messages[idx].function;
line = messages[idx].line; var line = messages[idx].line;
file_name = messages[idx].fileName; var file_name = messages[idx].fileName;
msg = messages[idx].message; var msg = messages[idx].message;
level_string = messages[idx].levelString; var level_string = messages[idx].levelString;
var debug = ""; var debug = "";

View File

@ -1,7 +1,6 @@
$(document).ready( function() { $(document).ready( function() {
performTranslation(); performTranslation();
var conf_editor_net = null;
var conf_editor_json = null; var conf_editor_json = null;
var conf_editor_proto = null; var conf_editor_proto = null;
var conf_editor_fbs = null; var conf_editor_fbs = null;
@ -9,39 +8,39 @@ $(document).ready( function() {
var conf_editor_udpl = null; var conf_editor_udpl = null;
var conf_editor_forw = null; var conf_editor_forw = null;
if(showOptHelp) if(window.showOptHelp)
{ {
//jsonserver //jsonserver
$('#conf_cont').append(createRow('conf_cont_json')) $('#conf_cont').append(createRow('conf_cont_json'))
$('#conf_cont_json').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_js_heading_title"), 'editor_container_jsonserver', 'btn_submit_jsonserver')); $('#conf_cont_json').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_js_heading_title"), 'editor_container_jsonserver', 'btn_submit_jsonserver'));
$('#conf_cont_json').append(createHelpTable(schema.jsonServer.properties, $.i18n("edt_conf_js_heading_title"))); $('#conf_cont_json').append(createHelpTable(window.schema.jsonServer.properties, $.i18n("edt_conf_js_heading_title")));
//flatbufserver //flatbufserver
$('#conf_cont').append(createRow('conf_cont_flatbuf')) $('#conf_cont').append(createRow('conf_cont_flatbuf'))
$('#conf_cont_flatbuf').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fbs_heading_title"), 'editor_container_fbserver', 'btn_submit_fbserver')); $('#conf_cont_flatbuf').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fbs_heading_title"), 'editor_container_fbserver', 'btn_submit_fbserver'));
$('#conf_cont_flatbuf').append(createHelpTable(schema.flatbufServer.properties, $.i18n("edt_conf_fbs_heading_title"))); $('#conf_cont_flatbuf').append(createHelpTable(window.schema.flatbufServer.properties, $.i18n("edt_conf_fbs_heading_title")));
//protoserver //protoserver
$('#conf_cont').append(createRow('conf_cont_proto')) $('#conf_cont').append(createRow('conf_cont_proto'))
$('#conf_cont_proto').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_pbs_heading_title"), 'editor_container_protoserver', 'btn_submit_protoserver')); $('#conf_cont_proto').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_pbs_heading_title"), 'editor_container_protoserver', 'btn_submit_protoserver'));
$('#conf_cont_proto').append(createHelpTable(schema.protoServer.properties, $.i18n("edt_conf_pbs_heading_title"))); $('#conf_cont_proto').append(createHelpTable(window.schema.protoServer.properties, $.i18n("edt_conf_pbs_heading_title")));
//boblight //boblight
$('#conf_cont').append(createRow('conf_cont_bobl')) $('#conf_cont').append(createRow('conf_cont_bobl'))
$('#conf_cont_bobl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_bobls_heading_title"), 'editor_container_boblightserver', 'btn_submit_boblightserver')); $('#conf_cont_bobl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_bobls_heading_title"), 'editor_container_boblightserver', 'btn_submit_boblightserver'));
$('#conf_cont_bobl').append(createHelpTable(schema.boblightServer.properties, $.i18n("edt_conf_bobls_heading_title"))); $('#conf_cont_bobl').append(createHelpTable(window.schema.boblightServer.properties, $.i18n("edt_conf_bobls_heading_title")));
//udplistener //udplistener
$('#conf_cont').append(createRow('conf_cont_udpl')) $('#conf_cont').append(createRow('conf_cont_udpl'))
$('#conf_cont_udpl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_udpl_heading_title"), 'editor_container_udplistener', 'btn_submit_udplistener')); $('#conf_cont_udpl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_udpl_heading_title"), 'editor_container_udplistener', 'btn_submit_udplistener'));
$('#conf_cont_udpl').append(createHelpTable(schema.udpListener.properties, $.i18n("edt_conf_udpl_heading_title"))); $('#conf_cont_udpl').append(createHelpTable(window.schema.udpListener.properties, $.i18n("edt_conf_udpl_heading_title")));
//forwarder //forwarder
if(storedAccess != 'default') if(storedAccess != 'default')
{ {
$('#conf_cont').append(createRow('conf_cont_fw')) $('#conf_cont').append(createRow('conf_cont_fw'))
$('#conf_cont_fw').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fw_heading_title"), 'editor_container_forwarder', 'btn_submit_forwarder')); $('#conf_cont_fw').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fw_heading_title"), 'editor_container_forwarder', 'btn_submit_forwarder'));
$('#conf_cont_fw').append(createHelpTable(schema.forwarder.properties, $.i18n("edt_conf_fw_heading_title"))); $('#conf_cont_fw').append(createHelpTable(window.schema.forwarder.properties, $.i18n("edt_conf_fw_heading_title")));
} }
} }
else else
@ -58,7 +57,7 @@ $(document).ready( function() {
//json //json
conf_editor_json = createJsonEditor('editor_container_jsonserver', { conf_editor_json = createJsonEditor('editor_container_jsonserver', {
jsonServer : schema.jsonServer jsonServer : window.schema.jsonServer
}, true, true); }, true, true);
conf_editor_json.on('change',function() { conf_editor_json.on('change',function() {
@ -71,7 +70,7 @@ $(document).ready( function() {
//flatbuffer //flatbuffer
conf_editor_fbs = createJsonEditor('editor_container_fbserver', { conf_editor_fbs = createJsonEditor('editor_container_fbserver', {
flatbufServer : schema.flatbufServer flatbufServer : window.schema.flatbufServer
}, true, true); }, true, true);
conf_editor_fbs.on('change',function() { conf_editor_fbs.on('change',function() {
@ -84,7 +83,7 @@ $(document).ready( function() {
//protobuffer //protobuffer
conf_editor_proto = createJsonEditor('editor_container_protoserver', { conf_editor_proto = createJsonEditor('editor_container_protoserver', {
protoServer : schema.protoServer protoServer : window.schema.protoServer
}, true, true); }, true, true);
conf_editor_proto.on('change',function() { conf_editor_proto.on('change',function() {
@ -97,7 +96,7 @@ $(document).ready( function() {
//boblight //boblight
conf_editor_bobl = createJsonEditor('editor_container_boblightserver', { conf_editor_bobl = createJsonEditor('editor_container_boblightserver', {
boblightServer : schema.boblightServer boblightServer : window.schema.boblightServer
}, true, true); }, true, true);
conf_editor_bobl.on('change',function() { conf_editor_bobl.on('change',function() {
@ -110,7 +109,7 @@ $(document).ready( function() {
//udplistener //udplistener
conf_editor_udpl = createJsonEditor('editor_container_udplistener', { conf_editor_udpl = createJsonEditor('editor_container_udplistener', {
udpListener : schema.udpListener udpListener : window.schema.udpListener
}, true, true); }, true, true);
conf_editor_udpl.on('change',function() { conf_editor_udpl.on('change',function() {
@ -125,7 +124,7 @@ $(document).ready( function() {
{ {
//forwarder //forwarder
conf_editor_forw = createJsonEditor('editor_container_forwarder', { conf_editor_forw = createJsonEditor('editor_container_forwarder', {
forwarder : schema.forwarder forwarder : window.schema.forwarder
}, true, true); }, true, true);
conf_editor_forw.on('change',function() { conf_editor_forw.on('change',function() {
@ -138,7 +137,7 @@ $(document).ready( function() {
} }
//create introduction //create introduction
if(showOptHelp) if(window.showOptHelp)
{ {
createHint("intro", $.i18n('conf_network_json_intro'), "editor_container_jsonserver"); createHint("intro", $.i18n('conf_network_json_intro'), "editor_container_jsonserver");
createHint("intro", $.i18n('conf_network_fbs_intro'), "editor_container_fbserver"); createHint("intro", $.i18n('conf_network_fbs_intro'), "editor_container_fbserver");

View File

@ -3,7 +3,7 @@ $(document).ready(function() {
var oldEffects = []; var oldEffects = [];
var cpcolor = '#B500FF'; var cpcolor = '#B500FF';
var mappingList = serverSchema.properties.color.properties.imageToLedMappingType.enum; var mappingList = window.serverSchema.properties.color.properties.imageToLedMappingType.enum;
var duration = 0; var duration = 0;
var rgb = {r:255,g:0,b:0}; var rgb = {r:255,g:0,b:0};
@ -14,7 +14,7 @@ $(document).ready(function() {
//create introduction //create introduction
if(showOptHelp) if(window.showOptHelp)
{ {
createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro"); createHint("intro", $.i18n('remote_color_intro', $.i18n('remote_losthint')), "color_intro");
createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont"); createHint("intro", $.i18n('remote_input_intro', $.i18n('remote_losthint')), "sstcont");
@ -25,16 +25,16 @@ $(document).ready(function() {
} }
//color adjustment //color adjustment
var sColor = sortProperties(serverSchema.properties.color.properties.channelAdjustment.items.properties) var sColor = sortProperties(window.serverSchema.properties.color.properties.channelAdjustment.items.properties);
var values = serverInfo.adjustment[0] var values = window.serverInfo.adjustment[0];
for(key in sColor) for(var key in sColor)
{ {
if(sColor[key].key != "id" && sColor[key].key != "leds") if(sColor[key].key != "id" && sColor[key].key != "leds")
{ {
var title = '<label for="cr_'+sColor[key].key+'">'+$.i18n(sColor[key].title)+'</label>'; var title = '<label for="cr_'+sColor[key].key+'">'+$.i18n(sColor[key].title)+'</label>';
var property; var property;
var value = values[sColor[key].key] var value = values[sColor[key].key];
if(sColor[key].type == "array") if(sColor[key].type == "array")
{ {
@ -71,11 +71,11 @@ $(document).ready(function() {
function sendEffect() function sendEffect()
{ {
efx = $("#effect_select").val(); var efx = $("#effect_select").val();
if(efx != "__none__") if(efx != "__none__")
{ {
requestPriorityClear(); requestPriorityClear();
$(hyperion).one("cmd-clear", function(event) { $(window.hyperion).one("cmd-clear", function(event) {
setTimeout(function() {requestPlayEffect(efx,duration)}, 100); setTimeout(function() {requestPlayEffect(efx,duration)}, 100);
}); });
} }
@ -89,8 +89,7 @@ $(document).ready(function() {
function updateInputSelect() function updateInputSelect()
{ {
$('.sstbody').html(""); $('.sstbody').html("");
var data = ""; var prios = window.serverInfo.priorities;
var prios = serverInfo.priorities
var i; var i;
var clearAll = false; var clearAll = false;
@ -172,9 +171,9 @@ $(document).ready(function() {
if(btn_type != 'default') if(btn_type != 'default')
$('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true)); $('.sstbody').append(createTableRow([origin, owner, priority, btn], false, true));
} }
var btn_auto_color = (serverInfo.priorities_autoselect? "btn-success" : "btn-danger"); var btn_auto_color = (window.serverInfo.priorities_autoselect? "btn-success" : "btn-danger");
var btn_auto_state = (serverInfo.priorities_autoselect? "disabled" : "enabled"); var btn_auto_state = (window.serverInfo.priorities_autoselect? "disabled" : "enabled");
var btn_auto_text = (serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off')); var btn_auto_text = (window.serverInfo.priorities_autoselect? $.i18n('general_btn_on') : $.i18n('general_btn_off'));
var btn_call_state = (clearAll? "enabled" : "disabled"); var btn_call_state = (clearAll? "enabled" : "disabled");
$('#auto_btn').html('<button id="srcBtn'+i+'" type="button" '+btn_auto_state+' class="btn '+btn_auto_color+'" style="margin-right:5px;display:inline-block;" onclick="requestSetSource(\'auto\');">'+$.i18n('remote_input_label_autoselect')+' ('+btn_auto_text+')</button>'); $('#auto_btn').html('<button id="srcBtn'+i+'" type="button" '+btn_auto_state+' class="btn '+btn_auto_color+'" style="margin-right:5px;display:inline-block;" onclick="requestSetSource(\'auto\');">'+$.i18n('remote_input_label_autoselect')+' ('+btn_auto_text+')</button>');
$('#auto_btn').append('<button type="button" '+btn_call_state+' class="btn btn-danger" style="display:inline-block;" onclick="requestClearAll();">'+$.i18n('remote_input_clearall')+'</button>'); $('#auto_btn').append('<button type="button" '+btn_call_state+' class="btn btn-danger" style="display:inline-block;" onclick="requestClearAll();">'+$.i18n('remote_input_clearall')+'</button>');
@ -189,15 +188,15 @@ $(document).ready(function() {
function updateLedMapping() function updateLedMapping()
{ {
mapping = serverInfo.imageToLedMappingType; var mapping = window.serverInfo.imageToLedMappingType;
$('#mappingsbutton').html(""); $('#mappingsbutton').html("");
for(var ix = 0; ix < mappingList.length; ix++) for(var ix = 0; ix < mappingList.length; ix++)
{ {
if(mapping == mappingList[ix]) if(mapping == mappingList[ix])
btn_style = 'btn-success'; var btn_style = 'btn-success';
else else
btn_style = 'btn-primary'; var btn_style = 'btn-primary';
$('#mappingsbutton').append('<button type="button" id="lmBtn_'+mappingList[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestMappingType(\''+mappingList[ix]+'\');">'+$.i18n('remote_maptype_label_'+mappingList[ix])+'</button><br/>'); $('#mappingsbutton').append('<button type="button" id="lmBtn_'+mappingList[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestMappingType(\''+mappingList[ix]+'\');">'+$.i18n('remote_maptype_label_'+mappingList[ix])+'</button><br/>');
} }
@ -205,7 +204,7 @@ $(document).ready(function() {
function updateComponents() function updateComponents()
{ {
components = comps; var components = window.comps;
var hyperionEnabled = true; var hyperionEnabled = true;
components.forEach( function(obj) { components.forEach( function(obj) {
if (obj.name == "ALL") if (obj.name == "ALL")
@ -216,21 +215,21 @@ $(document).ready(function() {
// create buttons // create buttons
$('#componentsbutton').html(""); $('#componentsbutton').html("");
for ( idx=0; idx<components.length;idx++) for (var idx=0; idx<components.length;idx++)
{ {
if(components[idx].name == "ALL") if(components[idx].name == "ALL")
continue continue;
enable_style = (components[idx].enabled? "btn-success" : "btn-danger"); var enable_style = (components[idx].enabled? "btn-success" : "btn-danger");
enable_icon = (components[idx].enabled? "fa-play" : "fa-stop"); var enable_icon = (components[idx].enabled? "fa-play" : "fa-stop");
comp_name = components[idx].name; var comp_name = components[idx].name;
comp_btn_id = "comp_btn_"+comp_name; var comp_btn_id = "comp_btn_"+comp_name;
comp_goff = hyperionEnabled? "enabled" : "disabled"; var comp_goff = hyperionEnabled? "enabled" : "disabled";
// create btn if not there // create btn if not there
if ($("#"+comp_btn_id).length == 0) if ($("#"+comp_btn_id).length == 0)
{ {
d='<span style="display:block;margin:3px"><button type="button" '+comp_goff+' id="'+comp_btn_id+'" class="btn '+enable_style var d='<span style="display:block;margin:3px"><button type="button" '+comp_goff+' id="'+comp_btn_id+'" class="btn '+enable_style
+'" onclick="requestSetComponentState(\''+comp_name+'\','+(!components[idx].enabled) +'" onclick="requestSetComponentState(\''+comp_name+'\','+(!components[idx].enabled)
+')"><i id="'+comp_btn_id+'_icon" class="fa '+enable_icon+'"></i></button> '+$.i18n('general_comp_'+components[idx].name)+'</span>'; +')"><i id="'+comp_btn_id+'_icon" class="fa '+enable_icon+'"></i></button> '+$.i18n('general_comp_'+components[idx].name)+'</span>';
$('#componentsbutton').append(d); $('#componentsbutton').append(d);
@ -246,14 +245,14 @@ $(document).ready(function() {
function updateEffectlist() function updateEffectlist()
{ {
var newEffects = serverInfo.effects; var newEffects = window.serverInfo.effects;
if (newEffects.length != oldEffects.length) if (newEffects.length != oldEffects.length)
{ {
$('#effect_select').html('<option value="__none__"></option>'); $('#effect_select').html('<option value="__none__"></option>');
var usrEffArr = []; var usrEffArr = [];
var sysEffArr = []; var sysEffArr = [];
for(i = 0; i < newEffects.length; i++) { for(var i = 0; i < newEffects.length; i++) {
var effectName = newEffects[i].name; var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file)){ if(!/^\:/.test(newEffects[i].file)){
usrEffArr.push(effectName); usrEffArr.push(effectName);
@ -270,16 +269,16 @@ $(document).ready(function() {
function updateVideoMode() function updateVideoMode()
{ {
videoModes = ["2D","3DSBS","3DTAB"]; var videoModes = ["2D","3DSBS","3DTAB"];
currVideoMode = serverInfo.videomode; var currVideoMode = window.serverInfo.videomode;
$('#videomodebtns').html(""); $('#videomodebtns').html("");
for(var ix = 0; ix < videoModes.length; ix++) for(var ix = 0; ix < videoModes.length; ix++)
{ {
if(currVideoMode == videoModes[ix]) if(currVideoMode == videoModes[ix])
btn_style = 'btn-success'; var btn_style = 'btn-success';
else else
btn_style = 'btn-primary'; var btn_style = 'btn-primary';
$('#videomodebtns').append('<button type="button" id="vModeBtn_'+videoModes[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestVideoMode(\''+videoModes[ix]+'\');">'+$.i18n('remote_videoMode_'+videoModes[ix])+'</button><br/>'); $('#videomodebtns').append('<button type="button" id="vModeBtn_'+videoModes[ix]+'" class="btn '+btn_style+'" style="margin:3px;min-width:200px" onclick="requestVideoMode(\''+videoModes[ix]+'\');">'+$.i18n('remote_videoMode_'+videoModes[ix])+'</button><br/>');
} }
} }
@ -339,25 +338,25 @@ $(document).ready(function() {
updateEffectlist(); updateEffectlist();
// interval updates // interval updates
$(hyperion).on("components-updated",updateComponents); $(window.hyperion).on("components-updated",updateComponents);
$(hyperion).on("cmd-priorities-update", function(event){ $(window.hyperion).on("cmd-priorities-update", function(event){
serverInfo.priorities = event.response.data.priorities window.serverInfo.priorities = event.response.data.priorities
serverInfo.priorities_autoselect = event.response.data.priorities_autoselect window.serverInfo.priorities_autoselect = event.response.data.priorities_autoselect
updateInputSelect() updateInputSelect()
}); });
$(hyperion).on("cmd-imageToLedMapping-update", function(event){ $(window.hyperion).on("cmd-imageToLedMapping-update", function(event){
serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType window.serverInfo.imageToLedMappingType = event.response.data.imageToLedMappingType
updateLedMapping() updateLedMapping()
}); });
$(hyperion).on("cmd-videomode-update", function(event){ $(window.hyperion).on("cmd-videomode-update", function(event){
serverInfo.videomode = event.response.data.videomode window.serverInfo.videomode = event.response.data.videomode
updateVideoMode() updateVideoMode()
}); });
$(hyperion).on("cmd-effects-update", function(event){ $(window.hyperion).on("cmd-effects-update", function(event){
serverInfo.effects = event.response.data.effects window.serverInfo.effects = event.response.data.effects
updateEffectlist(); updateEffectlist();
}); });

View File

@ -4,13 +4,13 @@
var conf_editor = null; var conf_editor = null;
$('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_webc_heading_title"), 'editor_container', 'btn_submit')); $('#conf_cont').append(createOptPanel('fa-wrench', $.i18n("edt_conf_webc_heading_title"), 'editor_container', 'btn_submit'));
if(showOptHelp) if(window.showOptHelp)
{ {
$('#conf_cont').append(createHelpTable(schema.webConfig.properties, $.i18n("edt_conf_webc_heading_title"))); $('#conf_cont').append(createHelpTable(window.schema.webConfig.properties, $.i18n("edt_conf_webc_heading_title")));
} }
conf_editor = createJsonEditor('editor_container', { conf_editor = createJsonEditor('editor_container', {
webConfig : schema.webConfig webConfig : window.schema.webConfig
}, true, true); }, true, true);
conf_editor.on('change',function() { conf_editor.on('change',function() {
@ -21,7 +21,7 @@
requestWriteConfig(conf_editor.getValue()); requestWriteConfig(conf_editor.getValue());
}); });
if(showOptHelp) if(window.showOptHelp)
createHint("intro", $.i18n('conf_webconfig_label_intro'), "editor_container"); createHint("intro", $.i18n('conf_webconfig_label_intro'), "editor_container");
removeOverlay(); removeOverlay();

View File

@ -1,44 +1,39 @@
// global vars (read and write in window object)
// global vars window.webPrio = 1;
var webPrio = 1; window.webOrigin = "Web Configuration";
var webOrigin = "Web Configuration"; window.showOptHelp = true;
var showOptHelp; window.currentVersion = null;
var currentVersion; window.latestVersion = null;
var latestVersion; window.serverInfo = {};
var serverInfo = {}; window.parsedUpdateJSON = {};
var parsedUpdateJSON = {}; window.serverSchema = {};
var serverSchema = {}; window.serverConfig = {};
var serverConfig = {}; window.schema = {};
var schema; window.sysInfo = {};
var sysInfo = {}; window.jsonPort = 19444;
var jsonPort = 19444; window.websocket = null;
var websocket = null; window.hyperion = {};
var hyperion = {}; window.wsTan = 1;
var wsTan = 1; window.ledStreamActive = false;
var ledStreamActive = false; window.imageStreamActive = false;
var imageStreamActive = false; window.loggingStreamActive = false;
var loggingStreamActive = false; window.loggingHandlerInstalled = false;
var loggingHandlerInstalled = false; window.watchdog = 0;
var watchdog = 0; window.debugMessagesActive = true;
var debugMessagesActive = true; window.wSess = [];
var wSess = []; window.comps = [];
var plugins_installed = {};
var plugins_available = {};
//comps serverinfo
comps = [];
function initRestart() function initRestart()
{ {
$(hyperion).off(); $(window.hyperion).off();
requestServerConfigReload(); requestServerConfigReload();
watchdog = 10; window.watchdog = 10;
connectionLostDetection('restart'); connectionLostDetection('restart');
} }
function connectionLostDetection(type) function connectionLostDetection(type)
{ {
if ( watchdog > 2 ) if ( window.watchdog > 2 )
{ {
var interval_id = window.setInterval("", 9999); // Get a reference to the last var interval_id = window.setInterval("", 9999); // Get a reference to the last
for (var i = 1; i < interval_id; i++) for (var i = 1; i < interval_id; i++)
@ -57,7 +52,7 @@ function connectionLostDetection(type)
} }
else else
{ {
$.get( "/cgi/cfg_jsonserver", function() {watchdog=0}).fail(function() {watchdog++;}); $.get( "/cgi/cfg_jsonserver", function() {window.watchdog=0}).fail(function() {window.watchdog++;});
} }
} }
@ -69,20 +64,20 @@ function initWebSocket()
{ {
if ("WebSocket" in window) if ("WebSocket" in window)
{ {
if (websocket == null) if (window.websocket == null)
{ {
jsonPort = (document.location.port == '') ? '80' : document.location.port; window.jsonPort = (document.location.port == '') ? '80' : document.location.port;
websocket = new WebSocket('ws://'+document.location.hostname+":"+jsonPort); window.websocket = new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort);
websocket.onopen = function (event) { window.websocket.onopen = function (event) {
$(hyperion).trigger({type:"open"}); $(window.hyperion).trigger({type:"open"});
$(hyperion).on("cmd-serverinfo", function(event) { $(window.hyperion).on("cmd-serverinfo", function(event) {
watchdog = 0; window.watchdog = 0;
}); });
}; };
websocket.onclose = function (event) { window.websocket.onclose = function (event) {
// See http://tools.ietf.org/html/rfc6455#section-7.4.1 // See http://tools.ietf.org/html/rfc6455#section-7.4.1
var reason; var reason;
switch(event.code) switch(event.code)
@ -102,45 +97,44 @@ function initWebSocket()
case 1015: reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; break; case 1015: reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; break;
default: reason = "Unknown reason"; default: reason = "Unknown reason";
} }
console.log("[websocket::onclose] "+reason) $(window.hyperion).trigger({type:"close", reason:reason});
$(hyperion).trigger({type:"close", reason:reason}); window.watchdog = 10;
watchdog = 10;
connectionLostDetection(); connectionLostDetection();
}; };
websocket.onmessage = function (event) { window.websocket.onmessage = function (event) {
try try
{ {
response = JSON.parse(event.data); var response = JSON.parse(event.data);
success = response.success; var success = response.success;
cmd = response.command; var cmd = response.command;
if (success || typeof(success) == "undefined") if (success || typeof(success) == "undefined")
{ {
$(hyperion).trigger({type:"cmd-"+cmd, response:response}); $(window.hyperion).trigger({type:"cmd-"+cmd, response:response});
} }
else else
{ {
error = response.hasOwnProperty("error")? response.error : "unknown"; var error = response.hasOwnProperty("error")? response.error : "unknown";
$(hyperion).trigger({type:"error",reason:error}); $(window.hyperion).trigger({type:"error",reason:error});
console.log("[websocket::onmessage] "+error) console.log("[window.websocket::onmessage] "+error)
} }
} }
catch(exception_error) catch(exception_error)
{ {
$(hyperion).trigger({type:"error",reason:exception_error}); $(window.hyperion).trigger({type:"error",reason:exception_error});
console.log("[websocket::onmessage] "+exception_error) console.log("[window.websocket::onmessage] "+exception_error)
} }
}; };
websocket.onerror = function (error) { window.websocket.onerror = function (error) {
$(hyperion).trigger({type:"error",reason:error}); $(window.hyperion).trigger({type:"error",reason:error});
console.log("[websocket::onerror] "+error) console.log("[window.websocket::onerror] "+error)
}; };
} }
} }
else else
{ {
$(hyperion).trigger("error"); $(window.hyperion).trigger("error");
alert("Websocket is not supported by your browser"); alert("Websocket is not supported by your browser");
return; return;
} }
@ -158,7 +152,7 @@ function sendToHyperion(command, subcommand, msg)
else else
msg = ""; msg = "";
websocket.send(encode_utf8('{"command":"'+command+'", "tan":'+wsTan+subcommand+msg+'}')); window.websocket.send(encode_utf8('{"command":"'+command+'", "tan":'+window.wsTan+subcommand+msg+'}'));
} }
// ----------------------------------------------------------- // -----------------------------------------------------------
@ -192,32 +186,32 @@ function requestServerConfigReload()
function requestLedColorsStart() function requestLedColorsStart()
{ {
ledStreamActive=true; window.ledStreamActive=true;
sendToHyperion("ledcolors", "ledstream-start"); sendToHyperion("ledcolors", "ledstream-start");
} }
function requestLedColorsStop() function requestLedColorsStop()
{ {
ledStreamActive=false; window.ledStreamActive=false;
sendToHyperion("ledcolors", "ledstream-stop"); sendToHyperion("ledcolors", "ledstream-stop");
} }
function requestLedImageStart() function requestLedImageStart()
{ {
imageStreamActive=true; window.imageStreamActive=true;
sendToHyperion("ledcolors", "imagestream-start"); sendToHyperion("ledcolors", "imagestream-start");
} }
function requestLedImageStop() function requestLedImageStop()
{ {
imageStreamActive=false; window.imageStreamActive=false;
sendToHyperion("ledcolors", "imagestream-stop"); sendToHyperion("ledcolors", "imagestream-stop");
} }
function requestPriorityClear(prio) function requestPriorityClear(prio)
{ {
if(typeof prio !== 'number') if(typeof prio !== 'number')
prio = webPrio; prio = window.webPrio;
sendToHyperion("clear", "", '"priority":'+prio+''); sendToHyperion("clear", "", '"priority":'+prio+'');
} }
@ -229,22 +223,22 @@ function requestClearAll()
function requestPlayEffect(effectName, duration) function requestPlayEffect(effectName, duration)
{ {
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"'); sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
} }
function requestSetColor(r,g,b,duration) function requestSetColor(r,g,b,duration)
{ {
sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+webOrigin+'"'); sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
} }
function requestSetImage(data,width,height,duration) function requestSetImage(data,width,height,duration)
{ {
sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+webPrio+',"duration":'+validateDuration(duration)+''); sendToHyperion("image", "", '"imagedata":"'+data+'", "imagewidth":'+width+',"imageheight":'+height+', "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+'');
} }
function requestSetComponentState(comp, state) function requestSetComponentState(comp, state)
{ {
state_str = state ? "true" : "false"; var state_str = state ? "true" : "false";
sendToHyperion("componentstate", "", '"componentstate":{"component":"'+comp+'","state":'+state_str+'}'); sendToHyperion("componentstate", "", '"componentstate":{"component":"'+comp+'","state":'+state_str+'}');
} }
@ -259,15 +253,15 @@ function requestSetSource(prio)
function requestWriteConfig(config, full) function requestWriteConfig(config, full)
{ {
if(full === true) if(full === true)
serverConfig = config; window.serverConfig = config;
else else
{ {
jQuery.each(config, function(i, val) { jQuery.each(config, function(i, val) {
serverConfig[i] = val; window.serverConfig[i] = val;
}); });
} }
sendToHyperion("config","setconfig", '"config":'+JSON.stringify(serverConfig)); sendToHyperion("config","setconfig", '"config":'+JSON.stringify(window.serverConfig));
} }
function requestWriteEffect(effectName,effectPy,effectArgs,data) function requestWriteEffect(effectName,effectPy,effectArgs,data)
@ -278,7 +272,7 @@ function requestWriteEffect(effectName,effectPy,effectArgs,data)
function requestTestEffect(effectName,effectPy,effectArgs,data) function requestTestEffect(effectName,effectPy,effectArgs,data)
{ {
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+webPrio+', "origin":"'+webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"'); sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+window.webPrio+', "origin":"'+window.webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"');
} }
function requestDeleteEffect(effectName) function requestDeleteEffect(effectName)
@ -288,13 +282,13 @@ function requestDeleteEffect(effectName)
function requestLoggingStart() function requestLoggingStart()
{ {
loggingStreamActive=true; window.loggingStreamActive=true;
sendToHyperion("logging", "start"); sendToHyperion("logging", "start");
} }
function requestLoggingStop() function requestLoggingStop()
{ {
loggingStreamActive=false; window.loggingStreamActive=false;
sendToHyperion("logging", "stop"); sendToHyperion("logging", "stop");
} }

View File

@ -43,14 +43,7 @@ $(document).ready(function() {
* @return {Path2D} The final path * @return {Path2D} The final path
*/ */
function build2DPath(x, y, width, height, radius) { function build2DPath(x, y, width, height, radius) {
var useColor = false if (typeof radius == 'number') {
if (typeof stroke == 'undefined') {
stroke = true;
}
if (typeof radius === 'undefined') {
radius = 5;
}
if (typeof radius === 'number') {
radius = {tl: radius, tr: radius, br: radius, bl: radius}; radius = {tl: radius, tr: radius, br: radius, bl: radius};
} else { } else {
var defaultRadius = {tl: 0, tr: 0, br: 0, bl: 0}; var defaultRadius = {tl: 0, tr: 0, br: 0, bl: 0};
@ -59,7 +52,7 @@ $(document).ready(function() {
} }
} }
var path = new Path2D() var path = new Path2D();
path.moveTo(x + radius.tl, y); path.moveTo(x + radius.tl, y);
path.lineTo(x + width - radius.tr, y); path.lineTo(x + width - radius.tr, y);
@ -74,10 +67,10 @@ $(document).ready(function() {
return path; return path;
} }
$(hyperion).one("ready",function(){ $(window.hyperion).one("ready",function(){
leds = serverConfig.leds; leds = window.serverConfig.leds;
if(showOptHelp) if(window.showOptHelp)
{ {
createHint('intro', $.i18n('main_ledsim_text'), 'ledsim_text'); createHint('intro', $.i18n('main_ledsim_text'), 'ledsim_text');
$('#ledsim_text').css({'margin':'10px 15px 0px 15px'}); $('#ledsim_text').css({'margin':'10px 15px 0px 15px'});
@ -125,7 +118,7 @@ $(document).ready(function() {
} }
}); });
// apply new serverinfos // apply new serverinfos
$(hyperion).on("cmd-config-getconfig",function(event){ $(window.hyperion).on("cmd-config-getconfig",function(event){
leds = event.response.info.leds; leds = event.response.info.leds;
updateLedLayout(); updateLedLayout();
}); });
@ -135,7 +128,7 @@ $(document).ready(function() {
{ {
// toggle leds, do not print // toggle leds, do not print
if(toggleLeds) if(toggleLeds)
return return;
var useColor = false; var useColor = false;
ledsCanvasNodeCtx.clear(); ledsCanvasNodeCtx.clear();
@ -169,7 +162,7 @@ $(document).ready(function() {
canvas_width = $('#ledsim_dialog').outerWidth()-30; canvas_width = $('#ledsim_dialog').outerWidth()-30;
$('#leds_canvas').html(""); $('#leds_canvas').html("");
leds_html = '<canvas id="image_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99998;"></canvas>'; var leds_html = '<canvas id="image_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99998;"></canvas>';
leds_html += '<canvas id="leds_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99999;"></canvas>'; leds_html += '<canvas id="leds_preview_canv" width="'+canvas_width+'" height="'+canvas_height+'" style="position: absolute; left: 0; top: 0; z-index: 99999;"></canvas>';
$('#leds_canvas').html(leds_html); $('#leds_canvas').html(leds_html);
@ -178,7 +171,7 @@ $(document).ready(function() {
ledsCanvasNodeCtx = document.getElementById("leds_preview_canv").getContext("2d"); ledsCanvasNodeCtx = document.getElementById("leds_preview_canv").getContext("2d");
create2dPaths(); create2dPaths();
printLedsToCanvas(); printLedsToCanvas();
resetImage() resetImage();
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -196,8 +189,8 @@ $(document).ready(function() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
$('#leds_toggle_live_video').off().on("click", function() { $('#leds_toggle_live_video').off().on("click", function() {
setClassByBool('#leds_toggle_live_video',imageStreamActive,"btn-success","btn-danger"); setClassByBool('#leds_toggle_live_video',window.imageStreamActive,"btn-success","btn-danger");
if ( imageStreamActive ) if ( window.imageStreamActive )
{ {
requestLedImageStop(); requestLedImageStop();
resetImage(); resetImage();
@ -209,7 +202,7 @@ $(document).ready(function() {
}); });
// ------------------------------------------------------------------ // ------------------------------------------------------------------
$(hyperion).on("cmd-ledcolors-ledstream-update",function(event){ $(window.hyperion).on("cmd-ledcolors-ledstream-update",function(event){
if (!modalOpened) if (!modalOpened)
{ {
requestLedColorsStop(); requestLedColorsStop();
@ -221,14 +214,14 @@ $(document).ready(function() {
}); });
// ------------------------------------------------------------------ // ------------------------------------------------------------------
$(hyperion).on("cmd-ledcolors-imagestream-update",function(event){ $(window.hyperion).on("cmd-ledcolors-imagestream-update",function(event){
if (!modalOpened) if (!modalOpened)
{ {
requestLedImageStop(); requestLedImageStop();
} }
else else
{ {
imageData = (event.response.result.image); var imageData = (event.response.result.image);
var image = new Image(); var image = new Image();
image.onload = function() { image.onload = function() {
@ -243,12 +236,12 @@ $(document).ready(function() {
}); });
// ------------------------------------------------------------------ // ------------------------------------------------------------------
$(hyperion).on("cmd-settings-update",function(event){ $(window.hyperion).on("cmd-settings-update",function(event){
var obj = event.response.data var obj = event.response.data
Object.getOwnPropertyNames(obj).forEach(function(val, idx, array) { Object.getOwnPropertyNames(obj).forEach(function(val, idx, array) {
serverInfo[val] = obj[val]; window.serverInfo[val] = obj[val];
}); });
leds = serverConfig.leds leds = window.serverConfig.leds
updateLedLayout(); updateLedLayout();
}); });

View File

@ -1,4 +1,4 @@
var storedAccess; var storedAccess;
var storedLang; var storedLang;
var availLang = ['en','de','es','it','cs']; var availLang = ['en','de','es','it','cs'];
var availAccess = ['default','advanced','expert']; var availAccess = ['default','advanced','expert'];
@ -30,7 +30,7 @@ $(document).ready( function() {
storedLang = getStorage("langcode"); storedLang = getStorage("langcode");
if (storedLang == null) if (storedLang == null)
{ {
setStorage("langcode", 'auto') setStorage("langcode", 'auto');
storedLang = 'auto'; storedLang = 'auto';
initTrans(storedLang); initTrans(storedLang);
} }
@ -119,14 +119,14 @@ $(document).ready( function() {
// instance switcher // instance switcher
$('#btn_instanceswitch').off().on('click',function() { $('#btn_instanceswitch').off().on('click',function() {
var lsys = sysInfo.system.hostName+':'+serverConfig.webConfig.port; var lsys = window.sysInfo.system.hostName+':'+window.serverConfig.webConfig.port;
showInfoDialog('iswitch', $.i18n('InfoDialog_iswitch_title'), $.i18n('InfoDialog_iswitch_text')); showInfoDialog('iswitch', $.i18n('InfoDialog_iswitch_title'), $.i18n('InfoDialog_iswitch_text'));
for (var i = 0; i<wSess.length; i++) for (var i = 0; i<window.wSess.length; i++)
{ {
if(lsys != wSess[i].host+':'+wSess[i].port) if(lsys != window.wSess[i].host+':'+window.wSess[i].port)
$('#id_select').append(createSelOpt('http://'+wSess[i].address+':'+wSess[i].port, wSess[i].name)) $('#id_select').append(createSelOpt('http://'+window.wSess[i].address+':'+window.wSess[i].port, window.wSess[i].name))
} }
$('#id_btn_saveset').off().on('click',function() { $('#id_btn_saveset').off().on('click',function() {

View File

@ -42,7 +42,7 @@ function setStorage(item, value, session)
function debugMessage(msg) function debugMessage(msg)
{ {
if (debugMessagesActive) if (window.debugMessagesActive)
{ {
console.log(msg); console.log(msg);
} }
@ -50,19 +50,19 @@ function debugMessage(msg)
function updateSessions() function updateSessions()
{ {
var sess = serverInfo.sessions; var sess = window.serverInfo.sessions;
if (sess.length) if (sess.length)
{ {
wSess = []; window.wSess = [];
for(var i = 0; i<sess.length; i++) for(var i = 0; i<sess.length; i++)
{ {
if(sess[i].type == "_hyperiond-http._tcp.") if(sess[i].type == "_hyperiond-http._tcp.")
{ {
wSess.push(sess[i]); window.wSess.push(sess[i]);
} }
} }
if (wSess.length > 1) if (window.wSess.length > 1)
$('#btn_instanceswitch').toggle(true); $('#btn_instanceswitch').toggle(true);
else else
$('#btn_instanceswitch').toggle(false); $('#btn_instanceswitch').toggle(false);
@ -72,7 +72,7 @@ function updateSessions()
function validateDuration(d) function validateDuration(d)
{ {
if(typeof d === "undefined" || d < 0) if(typeof d === "undefined" || d < 0)
return d = 0; return 0;
else else
return d *= 1000; return d *= 1000;
} }
@ -110,8 +110,10 @@ function loadContent(event, forceRefresh)
$("#page-content").off(); $("#page-content").off();
$("#page-content").load("/content/"+tag+".html", function(response,status,xhr){ $("#page-content").load("/content/"+tag+".html", function(response,status,xhr){
if(status == "error") if(status == "error")
{
$("#page-content").html('<h3>'+$.i18n('info_404')+'</h3>'); $("#page-content").html('<h3>'+$.i18n('info_404')+'</h3>');
removeOverlay(); removeOverlay();
}
}); });
} }
} }
@ -212,7 +214,8 @@ function showInfoDialog(type,header,message)
function createHintH(type, text, container) function createHintH(type, text, container)
{ {
if(type = "intro") type = String(type);
if(type == "intro")
tclass = "introd"; tclass = "introd";
$('#'+container).prepend('<div class="'+tclass+'"><h4 style="font-size:16px">'+text+'</h4><hr/></div>'); $('#'+container).prepend('<div class="'+tclass+'"><h4 style="font-size:16px">'+text+'</h4><hr/></div>');
@ -349,7 +352,7 @@ function createJsonEditor(container,schema,setconfig,usePanel,arrayre)
{ {
for(var key in editor.root.editors) for(var key in editor.root.editors)
{ {
editor.getEditor("root."+key).setValue( serverConfig[key] ); editor.getEditor("root."+key).setValue( window.serverConfig[key] );
} }
} }
@ -476,8 +479,8 @@ function createCP(id, color, cb)
} }
}); });
$('#'+id).colorpicker().on('changeColor', function(e) { $('#'+id).colorpicker().on('changeColor', function(e) {
rgb = e.color.toRGB(); var rgb = e.color.toRGB();
hex = e.color.toHex(); var hex = e.color.toHex();
cb(rgb,hex,e); cb(rgb,hex,e);
}); });
} }
@ -549,7 +552,7 @@ function createRow(id)
function createOptPanel(phicon, phead, bodyid, footerid) function createOptPanel(phicon, phead, bodyid, footerid)
{ {
phead = '<i class="fa '+phicon+' fa-fw"></i>'+phead; phead = '<i class="fa '+phicon+' fa-fw"></i>'+phead;
pfooter = document.createElement('button'); var pfooter = document.createElement('button');
pfooter.className = "btn btn-primary"; pfooter.className = "btn btn-primary";
pfooter.setAttribute("id", footerid); pfooter.setAttribute("id", footerid);
pfooter.innerHTML = '<i class="fa fa-fw fa-save"></i>'+$.i18n('general_button_savesettings'); pfooter.innerHTML = '<i class="fa fa-fw fa-save"></i>'+$.i18n('general_button_savesettings');
@ -559,7 +562,7 @@ function createOptPanel(phicon, phead, bodyid, footerid)
function sortProperties(list) function sortProperties(list)
{ {
for(key in list) for(var key in list)
{ {
list[key].key = key; list[key].key = key;
} }
@ -583,7 +586,7 @@ function createHelpTable(list, phead){
thead.appendChild(createTableRow([$.i18n('conf_helptable_option'), $.i18n('conf_helptable_expl')], true, false)); thead.appendChild(createTableRow([$.i18n('conf_helptable_option'), $.i18n('conf_helptable_expl')], true, false));
for (key in list) for (var key in list)
{ {
if(list[key].access != 'system') if(list[key].access != 'system')
{ {
@ -596,7 +599,7 @@ function createHelpTable(list, phead){
if(list[key].items && list[key].items.properties) if(list[key].items && list[key].items.properties)
{ {
var ilist = sortProperties(list[key].items.properties); var ilist = sortProperties(list[key].items.properties);
for (ikey in ilist) for (var ikey in ilist)
{ {
// break one iteration (in the loop), if the schema has the entry hidden=true // break one iteration (in the loop), if the schema has the entry hidden=true
if ("options" in ilist[ikey] && "hidden" in ilist[ikey].options && (ilist[ikey].options.hidden)) if ("options" in ilist[ikey] && "hidden" in ilist[ikey].options && (ilist[ikey].options.hidden))
@ -635,7 +638,7 @@ function createPanel(head, body, footer, type, bodyid){
if(typeof bodyid != 'undefined') if(typeof bodyid != 'undefined')
{ {
pfooter.style.textAlign = 'right'; pfooter.style.textAlign = 'right';
pbody.setAttribute("id", bodyid) pbody.setAttribute("id", bodyid);
} }
if(typeof body != 'undefined' && body != "") if(typeof body != 'undefined' && body != "")

View File

@ -1,11 +1,11 @@
//clear priority and other tasks if people reload the page or lost connection while a wizard was active //clear priority and other tasks if people reload the page or lost connection while a wizard was active
$(hyperion).one("ready", function(event) { $(window.hyperion).one("ready", function(event) {
if(getStorage("wizardactive") === 'true') if(getStorage("wizardactive") === 'true')
{ {
requestPriorityClear(); requestPriorityClear();
setStorage("wizardactive", false); setStorage("wizardactive", false);
if(getStorage("kodiAddress" != null)) if(getStorage("kodiAddress") != null)
{ {
kodiAddress = getStorage("kodiAddress"); kodiAddress = getStorage("kodiAddress");
sendToKodi("stop"); sendToKodi("stop");
@ -58,7 +58,7 @@
$('#wizp2_body').append('<div class="form-group"><label>'+$.i18n('wiz_rgb_switchevery')+'</label><div class="input-group" style="width:100px"><select id="wiz_switchtime_select" class="form-control"></select><div class="input-group-addon">'+$.i18n('edt_append_s')+'</div></div></div>'); $('#wizp2_body').append('<div class="form-group"><label>'+$.i18n('wiz_rgb_switchevery')+'</label><div class="input-group" style="width:100px"><select id="wiz_switchtime_select" class="form-control"></select><div class="input-group-addon">'+$.i18n('edt_append_s')+'</div></div></div>');
$('#wizp2_body').append('<canvas id="wiz_canv_color" width="100" height="100" style="border-radius:60px;background-color:red; display:block; margin: 10px 0;border:4px solid grey;"></canvas><label>'+$.i18n('wiz_rgb_q')+'</label>'); $('#wizp2_body').append('<canvas id="wiz_canv_color" width="100" height="100" style="border-radius:60px;background-color:red; display:block; margin: 10px 0;border:4px solid grey;"></canvas><label>'+$.i18n('wiz_rgb_q')+'</label>');
$('#wizp2_body').append('<table class="table borderless" style="width:200px"><tbody><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qrend')+'</label></td><td class="itd"><select id="wiz_r_select" class="form-control wselect"></select></td></tr><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qgend')+'</label></td><td class="itd"><select id="wiz_g_select" class="form-control wselect"></select></td></tr></tbody></table>'); $('#wizp2_body').append('<table class="table borderless" style="width:200px"><tbody><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qrend')+'</label></td><td class="itd"><select id="wiz_r_select" class="form-control wselect"></select></td></tr><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qgend')+'</label></td><td class="itd"><select id="wiz_g_select" class="form-control wselect"></select></td></tr></tbody></table>');
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_checkok" style="display:none" data-dismiss="modal"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_ok')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>') $('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_checkok" style="display:none" data-dismiss="modal"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_ok')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
//open modal //open modal
$("#wizard_modal").modal({ $("#wizard_modal").modal({
@ -84,7 +84,7 @@
}); });
$('.wselect').change(function () { $('.wselect').change(function () {
var rgb_order = serverConfig.device.colorOrder.split(""); var rgb_order = window.serverConfig.device.colorOrder.split("");
var redS = $("#wiz_r_select").val(); var redS = $("#wiz_r_select").val();
var greenS = $("#wiz_g_select").val(); var greenS = $("#wiz_g_select").val();
var blueS = rgb_order.toString().replace(/,/g,"").replace(redS, "").replace(greenS,""); var blueS = rgb_order.toString().replace(/,/g,"").replace(redS, "").replace(greenS,"");
@ -127,7 +127,7 @@
$('#btn_wiz_save').toggle(true); $('#btn_wiz_save').toggle(true);
$('#btn_wiz_checkok').toggle(false); $('#btn_wiz_checkok').toggle(false);
} }
new_rgb_order = rgb_order new_rgb_order = rgb_order;
} }
else else
$('#btn_wiz_save').attr('disabled',true); $('#btn_wiz_save').attr('disabled',true);
@ -153,8 +153,8 @@
$('#btn_wiz_save').off().on('click',function() { $('#btn_wiz_save').off().on('click',function() {
resetWizard(); resetWizard();
serverConfig.device.colorOrder = new_rgb_order; window.serverConfig.device.colorOrder = new_rgb_order;
requestWriteConfig({"device" : serverConfig.device}); requestWriteConfig({"device" : window.serverConfig.device});
}); });
} }
@ -232,10 +232,10 @@
{ {
$('#wiz_cc_desc').html($.i18n('wiz_cc_chooseid')); $('#wiz_cc_desc').html($.i18n('wiz_cc_chooseid'));
updateWEditor(["id"]); updateWEditor(["id"]);
$('#btn_wiz_back').attr("disabled", true) $('#btn_wiz_back').attr("disabled", true);
} }
else else
$('#btn_wiz_back').attr("disabled", false) $('#btn_wiz_back').attr("disabled", false);
if(step == 2) if(step == 2)
{ {
@ -415,7 +415,7 @@
$('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('wiz_cc_title')+'</h4><p>'+$.i18n('wiz_cc_intro1')+'</p><label>'+$.i18n('wiz_cc_kwebs')+'</label><input class="form-control" style="width:170px;margin:auto" id="wiz_cc_kodiip" type="text" placeholder="'+kodiAddress+'" value="'+kodiAddress+'" /><span id="kodi_status"></span><span id="multi_cali"></span>'); $('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('wiz_cc_title')+'</h4><p>'+$.i18n('wiz_cc_intro1')+'</p><label>'+$.i18n('wiz_cc_kwebs')+'</label><input class="form-control" style="width:170px;margin:auto" id="wiz_cc_kodiip" type="text" placeholder="'+kodiAddress+'" value="'+kodiAddress+'" /><span id="kodi_status"></span><span id="multi_cali"></span>');
$('#wizp1_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_cont" disabled="disabled"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_continue')+'</button><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>'); $('#wizp1_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_cont" disabled="disabled"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_continue')+'</button><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
$('#wizp2_body').html('<div id="wiz_cc_desc" style="font-weight:bold"></div><div id="editor_container_wiz"></div>'); $('#wizp2_body').html('<div id="wiz_cc_desc" style="font-weight:bold"></div><div id="editor_container_wiz"></div>');
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_back"><i class="fa fa-fw fa-chevron-left"></i>'+$.i18n('general_btn_back')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_next">'+$.i18n('general_btn_next')+'<i style="margin-left:4px;"class="fa fa-fw fa-chevron-right"></i></button><button type="button" class="btn btn-warning" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>') $('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_back"><i class="fa fa-fw fa-chevron-left"></i>'+$.i18n('general_btn_back')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_next">'+$.i18n('general_btn_next')+'<i style="margin-left:4px;"class="fa fa-fw fa-chevron-right"></i></button><button type="button" class="btn btn-warning" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
//open modal //open modal
$("#wizard_modal").modal({ $("#wizard_modal").modal({
@ -450,10 +450,10 @@
$('#wizp2').toggle(true); $('#wizp2').toggle(true);
}); });
$('#wiz_cc_kodiip').trigger("change") $('#wiz_cc_kodiip').trigger("change");
colorLength = serverConfig.color.channelAdjustment; colorLength = window.serverConfig.color.channelAdjustment;
cobj = schema.color.properties.channelAdjustment.items.properties; cobj = window.schema.color.properties.channelAdjustment.items.properties;
websAddress = document.location.hostname+':'+serverConfig.webConfig.port; websAddress = document.location.hostname+':'+window.serverConfig.webConfig.port;
imgAddress = 'http://'+websAddress+'/img/cc/'; imgAddress = 'http://'+websAddress+'/img/cc/';
setStorage("wizardactive", true); setStorage("wizardactive", true);
@ -471,7 +471,7 @@
//prepare editor //prepare editor
wiz_editor = createJsonEditor('editor_container_wiz', { wiz_editor = createJsonEditor('editor_container_wiz', {
color : schema.color color : window.schema.color
}, true, true); }, true, true);
$('#editor_container_wiz h4').toggle(false); $('#editor_container_wiz h4').toggle(false);
@ -716,7 +716,7 @@
//create hue led config //create hue led config
var incC = 0; var incC = 0;
for(key in lightIDs) for(var key in lightIDs)
{ {
if($('#hue_'+key).val() != "disabled") if($('#hue_'+key).val() != "disabled")
{ {
@ -726,10 +726,10 @@
} }
} }
serverConfig.leds = hueLedConfig; window.serverConfig.leds = hueLedConfig;
//Adjust gamma, brightness and compensation //Adjust gamma, brightness and compensation
var c = serverConfig.color.channelAdjustment[0]; var c = window.serverConfig.color.channelAdjustment[0];
c.gammaBlue = 1.0; c.gammaBlue = 1.0;
c.gammaRed = 1.0; c.gammaRed = 1.0;
c.gammaGreen = 1.0; c.gammaGreen = 1.0;
@ -737,7 +737,7 @@
c.brightnessCompensation = 0; c.brightnessCompensation = 0;
//device config //device config
var d = serverConfig.device; var d = window.serverConfig.device;
d.output = $('#ip').val(); d.output = $('#ip').val();
d.lightIds = finalLightIds; d.lightIds = finalLightIds;
d.username = $('#user').val(); d.username = $('#user').val();
@ -746,9 +746,9 @@
d.switchOffOnBlack = true; d.switchOffOnBlack = true;
//smoothing off //smoothing off
serverConfig.smoothing.enable = false; window.serverConfig.smoothing.enable = false;
requestWriteConfig(serverConfig, true); requestWriteConfig(window.serverConfig, true);
resetWizard(); resetWizard();
}); });
@ -822,7 +822,7 @@
$('.hue_sel_watch').bind("change", function(){ $('.hue_sel_watch').bind("change", function(){
var cC = 0; var cC = 0;
for(key in lightIDs) for(var key in lightIDs)
{ {
if($('#hue_'+key).val() != "disabled") if($('#hue_'+key).val() != "disabled")
{ {

17
cmake/LDGold.cmake Normal file
View File

@ -0,0 +1,17 @@
option(ENABLE_LDGOLD "Use GNU gold linker" ON)
set(LDGOLD_FOUND FALSE)
if(ENABLE_LDGOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if(LD_VERSION MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(LDGOLD_FOUND TRUE)
message(STATUS "Linker: GNU gold")
else()
message(STATUS "GNU gold linker is not available, falling back to default system linker")
endif()
else()
message(STATUS "Linker: Default system linker")
endif()

View File

@ -114,26 +114,24 @@
/// * sDHOffsetMax : area for signal detection - horizontal maximum offset value. Values between 0.0 and 1.0 /// * sDHOffsetMax : area for signal detection - horizontal maximum offset value. Values between 0.0 and 1.0
/// * sDVOffsetMax : area for signal detection - vertical maximum offset value. Values between 0.0 and 1.0 /// * sDVOffsetMax : area for signal detection - vertical maximum offset value. Values between 0.0 and 1.0
"grabberV4L2" : "grabberV4L2" :
[ {
{ "device" : "auto",
"device" : "auto", "standard" : "NO_CHANGE",
"standard" : "NO_CHANGE", "sizeDecimation" : 8,
"sizeDecimation" : 8, "priority" : 240,
"priority" : 240, "cropLeft" : 0,
"cropLeft" : 0, "cropRight" : 0,
"cropRight" : 0, "cropTop" : 0,
"cropTop" : 0, "cropBottom" : 0,
"cropBottom" : 0, "redSignalThreshold" : 5,
"redSignalThreshold" : 5, "greenSignalThreshold" : 5,
"greenSignalThreshold" : 5, "blueSignalThreshold" : 5,
"blueSignalThreshold" : 5, "signalDetection" : false,
"signalDetection" : false, "sDVOffsetMin" : 0.25,
"sDVOffsetMin" : 0.25, "sDHOffsetMin" : 0.25,
"sDHOffsetMin" : 0.25, "sDVOffsetMax" : 0.75,
"sDVOffsetMax" : 0.75, "sDHOffsetMax" : 0.75
"sDHOffsetMax" : 0.75 },
}
],
/// The configuration for the frame-grabber, contains the following items: /// The configuration for the frame-grabber, contains the following items:
/// * type : type of grabber. (auto|osx|dispmanx|amlogic|x11|framebuffer|qt) [auto] /// * type : type of grabber. (auto|osx|dispmanx|amlogic|x11|framebuffer|qt) [auto]
@ -255,12 +253,12 @@
/// The configuration of the boblight server which enables the boblight remote interface /// The configuration of the boblight server which enables the boblight remote interface
/// * enable : Enable or disable the boblight server (true/false) /// * enable : Enable or disable the boblight server (true/false)
/// * port : Port at which the boblight server is started /// * port : Port at which the boblight server is started
/// * priority : Priority of the boblight server (Default=201) HINT: lower value result in HIGHER priority! /// * priority : Priority of the boblight server (Default=128) HINT: lower value result in HIGHER priority!
"boblightServer" : "boblightServer" :
{ {
"enable" : false, "enable" : false,
"port" : 19333, "port" : 19333,
"priority" : 201 "priority" : 128
}, },
/// The configuration of the udp listener /// The configuration of the udp listener

View File

@ -57,25 +57,23 @@
}, },
"grabberV4L2" : "grabberV4L2" :
[ {
{ "device" : "auto",
"device" : "auto", "standard" : "NO_CHANGE",
"standard" : "NO_CHANGE", "sizeDecimation" : 8,
"sizeDecimation" : 8, "cropLeft" : 0,
"cropLeft" : 0, "cropRight" : 0,
"cropRight" : 0, "cropTop" : 0,
"cropTop" : 0, "cropBottom" : 0,
"cropBottom" : 0, "redSignalThreshold" : 5,
"redSignalThreshold" : 5, "greenSignalThreshold" : 5,
"greenSignalThreshold" : 5, "blueSignalThreshold" : 5,
"blueSignalThreshold" : 5, "signalDetection" : false,
"signalDetection" : false, "sDVOffsetMin" : 0.25,
"sDVOffsetMin" : 0.25, "sDHOffsetMin" : 0.25,
"sDHOffsetMin" : 0.25, "sDVOffsetMax" : 0.75,
"sDVOffsetMax" : 0.75, "sDHOffsetMax" : 0.75
"sDHOffsetMax" : 0.75 },
}
],
"framegrabber" : "framegrabber" :
{ {
@ -149,7 +147,7 @@
{ {
"enable" : false, "enable" : false,
"port" : 19333, "port" : 19333,
"priority" : 201 "priority" : 128
}, },
"udpListener" : "udpListener" :

View File

@ -1055,7 +1055,7 @@ static void ipcon_dispatch_meta(IPConnectionPrivate *ipcon_p, Meta *meta) {
mutex_unlock(&ipcon_p->socket_mutex); mutex_unlock(&ipcon_p->socket_mutex);
} }
// FIXME: wait a moment here, otherwise the next connect // NOTE: wait a moment here, otherwise the next connect
// attempt will succeed, even if there is no open server // attempt will succeed, even if there is no open server
// socket. the first receive will then fail directly // socket. the first receive will then fail directly
thread_sleep(100); thread_sleep(100);
@ -1146,11 +1146,11 @@ static void ipcon_callback_loop(void *opaque) {
while (true) { while (true) {
if (queue_get(&callback->queue, &kind, &data, &length) < 0) { if (queue_get(&callback->queue, &kind, &data, &length) < 0) {
// FIXME: what to do here? try again? exit? // NOTE: what to do here? try again? exit?
break; break;
} }
// FIXME: cannot lock callback mutex here because this can // NOTE: cannot lock callback mutex here because this can
// deadlock due to an ordering problem with the socket mutex // deadlock due to an ordering problem with the socket mutex
//mutex_lock(&callback->mutex); //mutex_lock(&callback->mutex);
@ -1219,7 +1219,7 @@ static void ipcon_disconnect_probe_loop(void *opaque) {
while (event_wait(&ipcon_p->disconnect_probe_event, while (event_wait(&ipcon_p->disconnect_probe_event,
IPCON_DISCONNECT_PROBE_INTERVAL) < 0) { IPCON_DISCONNECT_PROBE_INTERVAL) < 0) {
if (ipcon_p->disconnect_probe_flag) { if (ipcon_p->disconnect_probe_flag) {
// FIXME: this might block // TODO: this might block
if (socket_send(ipcon_p->socket, &disconnect_probe, if (socket_send(ipcon_p->socket, &disconnect_probe,
disconnect_probe.length) < 0) { disconnect_probe.length) < 0) {
ipcon_handle_disconnect_by_peer(ipcon_p, IPCON_DISCONNECT_REASON_ERROR, ipcon_handle_disconnect_by_peer(ipcon_p, IPCON_DISCONNECT_REASON_ERROR,
@ -1509,7 +1509,7 @@ static void ipcon_disconnect_unlocked(IPConnectionPrivate *ipcon_p) {
// thread to avoid timeout exceptions due to callback functions // thread to avoid timeout exceptions due to callback functions
// trying to call getters // trying to call getters
if (!thread_is_current(&ipcon_p->callback->thread)) { if (!thread_is_current(&ipcon_p->callback->thread)) {
// FIXME: cannot lock callback mutex here because this can // NOTE: cannot lock callback mutex here because this can
// deadlock due to an ordering problem with the socket mutex // deadlock due to an ordering problem with the socket mutex
//mutex_lock(&ipcon->callback->mutex); //mutex_lock(&ipcon->callback->mutex);
@ -1608,7 +1608,7 @@ void ipcon_create(IPConnection *ipcon) {
void ipcon_destroy(IPConnection *ipcon) { void ipcon_destroy(IPConnection *ipcon) {
IPConnectionPrivate *ipcon_p = ipcon->p; IPConnectionPrivate *ipcon_p = ipcon->p;
ipcon_disconnect(ipcon); // FIXME: disable disconnected callback before? ipcon_disconnect(ipcon); // NOTE: disable disconnected callback before?
mutex_destroy(&ipcon_p->sequence_number_mutex); mutex_destroy(&ipcon_p->sequence_number_mutex);

View File

@ -1,4 +1,4 @@
import os, hyperion, time import hyperion, time
# Get the parameters # Get the parameters
imageFile = hyperion.args.get('image') imageFile = hyperion.args.get('image')

View File

@ -1,4 +1,4 @@
import hyperion, time, colorsys import hyperion, time
# Get the parameters # Get the parameters
speed = float(hyperion.args.get('speed', 1.0)) speed = float(hyperion.args.get('speed', 1.0))

View File

@ -1,4 +1,4 @@
import hyperion, time, colorsys import hyperion, time
from random import randint from random import randint
#get args #get args

View File

@ -1,4 +1,4 @@
import hyperion, time, colorsys, random import hyperion, time
# get options from args # get options from args
sleepTime = float(hyperion.args.get('speed', 1.5)) * 0.005 sleepTime = float(hyperion.args.get('speed', 1.5)) * 0.005

View File

@ -1,4 +1,4 @@
import hyperion, time, math, random import hyperion, time, random
# Convert x/y (0.0 - 1.0) point to proper int values based on Hyperion image width/height # Convert x/y (0.0 - 1.0) point to proper int values based on Hyperion image width/height
# Or get a random value # Or get a random value

View File

@ -39,7 +39,7 @@ diag = int(diag*1.3)
# calc positions # calc positions
pos = 0 pos = 0
step = int(255/len(colors)) step = int(255/len(colors))
for entry in colors: for _ in colors:
positions.append(pos) positions.append(pos)
pos += step pos += step

View File

@ -1,4 +1,4 @@
import hyperion, time, colorsys import hyperion, time
# Get the parameters # Get the parameters
sleepTime = float(hyperion.args.get('sleepTime', 1000))/1000.0 sleepTime = float(hyperion.args.get('sleepTime', 1000))/1000.0

View File

@ -46,7 +46,7 @@ public slots:
void setImage(const Image<ColorRgb> & image); void setImage(const Image<ColorRgb> & image);
/// process and push new log messages from logger (if enabled) /// process and push new log messages from logger (if enabled)
void incommingLogMessage(Logger::T_LOG_MESSAGE); void incommingLogMessage(const Logger::T_LOG_MESSAGE&);
signals: signals:
/// ///

View File

@ -45,7 +45,7 @@ public:
/// @param[out] resultMsg The feedback message /// @param[out] resultMsg The feedback message
/// @return True on success else false /// @return True on success else false
/// ///
const bool saveEffect(const QJsonObject& obj, QString& resultMsg); bool saveEffect(const QJsonObject& obj, QString& resultMsg);
/// ///
/// @brief Delete an effect by name. /// @brief Delete an effect by name.
@ -53,7 +53,7 @@ public:
/// @param[out] resultMsg The message on error /// @param[out] resultMsg The message on error
/// @return True on success else false /// @return True on success else false
/// ///
const bool deleteEffect(const QString& effectName, QString& resultMsg); bool deleteEffect(const QString& effectName, QString& resultMsg);
/// ///
/// @brief Get all init data of the running effects and stop them /// @brief Get all init data of the running effects and stop them

View File

@ -33,7 +33,7 @@ public:
/// @param[out] resultMsg The feedback message /// @param[out] resultMsg The feedback message
/// @return True on success else false /// @return True on success else false
/// ///
const bool saveEffect(const QJsonObject& obj, QString& resultMsg); bool saveEffect(const QJsonObject& obj, QString& resultMsg);
/// ///
/// @brief Delete an effect by name. /// @brief Delete an effect by name.
@ -41,7 +41,7 @@ public:
/// @param[out] resultMsg The message on error /// @param[out] resultMsg The message on error
/// @return True on success else false /// @return True on success else false
/// ///
const bool deleteEffect(const QString& effectName, QString& resultMsg); bool deleteEffect(const QString& effectName, QString& resultMsg);
public slots: public slots:
/// ///

View File

@ -70,7 +70,7 @@ private:
/// @brief Setup a new capture display, will free the previous one /// @brief Setup a new capture display, will free the previous one
/// @return True on success, false if no display is found /// @return True on success, false if no display is found
/// ///
const bool setupDisplay(); bool setupDisplay();
/// ///
/// @brief Is called whenever we need new screen dimension calculations based on window geometry /// @brief Is called whenever we need new screen dimension calculations based on window geometry

View File

@ -13,6 +13,14 @@
#include <utils/PixelFormat.h> #include <utils/PixelFormat.h>
#include <hyperion/Grabber.h> #include <hyperion/Grabber.h>
#include <grabber/VideoStandard.h> #include <grabber/VideoStandard.h>
#include <utils/Components.h>
#ifdef HAVE_JPEG
#include <QImage>
#include <QColor>
#include <jpeglib.h>
#include <csetjmp>
#endif
/// Capture class for V4L2 devices /// Capture class for V4L2 devices
/// ///
@ -29,8 +37,12 @@ public:
); );
virtual ~V4L2Grabber(); virtual ~V4L2Grabber();
QRectF getSignalDetectionOffset(); QRectF getSignalDetectionOffset()
bool getSignalDetectionEnabled(); {
return QRectF(_x_frac_min, _y_frac_min, _x_frac_max, _y_frac_max);
}
bool getSignalDetectionEnabled() { return _signalDetectionEnabled; }
int grabFrame(Image<ColorRgb> &); int grabFrame(Image<ColorRgb> &);
@ -78,6 +90,8 @@ public slots:
void stop(); void stop();
void componentStateChanged(const hyperion::Components component, bool enable);
signals: signals:
void newFrame(const Image<ColorRgb> & image); void newFrame(const Image<ColorRgb> & image);
void readError(const char* err); void readError(const char* err);
@ -91,7 +105,7 @@ private:
bool init(); bool init();
void uninit(); void uninit();
void open_device(); bool open_device();
void close_device(); void close_device();
@ -111,26 +125,56 @@ private:
bool process_image(const void *p, int size); bool process_image(const void *p, int size);
void process_image(const uint8_t *p); void process_image(const uint8_t *p, int size);
int xioctl(int request, void *arg); int xioctl(int request, void *arg);
void throw_exception(const QString &error); void throw_exception(const QString & error)
{
Error(_log, "Throws error: %s", QSTRING_CSTR(error));
}
void throw_errno_exception(const QString &error); void throw_errno_exception(const QString & error)
{
Error(_log, "Throws error nr: %s", QSTRING_CSTR(QString(error + " error code " + QString::number(errno) + ", " + strerror(errno))));
}
private: private:
enum io_method { enum io_method
{
IO_METHOD_READ, IO_METHOD_READ,
IO_METHOD_MMAP, IO_METHOD_MMAP,
IO_METHOD_USERPTR IO_METHOD_USERPTR
}; };
struct buffer { struct buffer
{
void *start; void *start;
size_t length; size_t length;
}; };
#ifdef HAVE_JPEG
struct errorManager
{
jpeg_error_mgr pub;
jmp_buf setjmp_buffer;
};
static void errorHandler(j_common_ptr cInfo)
{
errorManager* mgr = reinterpret_cast<errorManager*>(cInfo->err);
longjmp(mgr->setjmp_buffer, 1);
}
static void outputHandler(j_common_ptr cInfo)
{
// Suppress fprintf warnings.
}
jpeg_decompress_struct* _decompress;
errorManager* _error;
#endif
private: private:
QString _deviceName; QString _deviceName;
std::map<QString,QString> _v4lDevices; std::map<QString,QString> _v4lDevices;
@ -156,7 +200,7 @@ private:
double _x_frac_max; double _x_frac_max;
double _y_frac_max; double _y_frac_max;
QSocketNotifier * _streamNotifier; QSocketNotifier *_streamNotifier;
bool _initialized; bool _initialized;
bool _deviceAutoDiscoverEnabled; bool _deviceAutoDiscoverEnabled;

View File

@ -84,12 +84,12 @@ public:
/// ///
/// @brief get current resulting height of image (after crop) /// @brief get current resulting height of image (after crop)
/// ///
virtual const int getImageWidth() { return _width; }; virtual int getImageWidth() { return _width; };
/// ///
/// @brief get current resulting width of image (after crop) /// @brief get current resulting width of image (after crop)
/// ///
virtual const int getImageHeight() { return _height; }; virtual int getImageHeight() { return _height; };
/// ///
/// @brief Prevent the real capture implementation from capturing if disabled /// @brief Prevent the real capture implementation from capturing if disabled

View File

@ -168,7 +168,7 @@ public:
/// @param[out] resultMsg The feedback message /// @param[out] resultMsg The feedback message
/// @return True on success else false /// @return True on success else false
/// ///
const bool saveEffect(const QJsonObject& obj, QString& resultMsg); bool saveEffect(const QJsonObject& obj, QString& resultMsg);
/// ///
/// @brief Delete an effect by name. /// @brief Delete an effect by name.
@ -176,7 +176,7 @@ public:
/// @param[out] resultMsg The message on error /// @param[out] resultMsg The message on error
/// @return True on success else false /// @return True on success else false
/// ///
const bool deleteEffect(const QString& effectName, QString& resultMsg); bool deleteEffect(const QString& effectName, QString& resultMsg);
/// Get the list of available effects /// Get the list of available effects
/// @return The list of available effects /// @return The list of available effects
@ -282,7 +282,7 @@ public slots:
/// @param clearEffect Should be true when NOT called from an effect /// @param clearEffect Should be true when NOT called from an effect
/// @return True on success, false when priority is not found /// @return True on success, false when priority is not found
/// ///
const bool setInput(const int priority, const std::vector<ColorRgb>& ledColors, const int timeout_ms = -1, const bool& clearEffect = true); bool setInput(const int priority, const std::vector<ColorRgb>& ledColors, const int timeout_ms = -1, const bool& clearEffect = true);
/// ///
/// @brief Update the current image of a priority (prev registered with registerInput()) /// @brief Update the current image of a priority (prev registered with registerInput())
@ -293,14 +293,14 @@ public slots:
/// @param clearEffect Should be true when NOT called from an effect /// @param clearEffect Should be true when NOT called from an effect
/// @return True on success, false when priority is not found /// @return True on success, false when priority is not found
/// ///
const bool setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1, const bool& clearEffect = true); bool setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1, const bool& clearEffect = true);
/// ///
/// @brief Set the given priority to inactive /// @brief Set the given priority to inactive
/// @param priority The priority /// @param priority The priority
/// @return True on success false if not found /// @return True on success false if not found
/// ///
const bool setInputInactive(const quint8& priority); bool setInputInactive(const quint8& priority);
/// ///
/// Writes a single color to all the leds for the given time and priority /// Writes a single color to all the leds for the given time and priority
@ -336,7 +336,7 @@ public slots:
/// @param[in] priority The priority channel /// @param[in] priority The priority channel
/// @return True on success else false (not found) /// @return True on success else false (not found)
/// ///
const bool clear(int priority); bool clear(int priority);
/// ///
/// @brief Clears all priority channels. This will switch the leds off until a new priority is written. /// @brief Clears all priority channels. This will switch the leds off until a new priority is written.

View File

@ -57,8 +57,8 @@ namespace hyperion
/// ///
unsigned height() const; unsigned height() const;
const unsigned horizontalBorder() const { return _horizontalBorder; }; unsigned horizontalBorder() { return _horizontalBorder; };
const unsigned verticalBorder() const { return _verticalBorder; }; unsigned verticalBorder() { return _verticalBorder; };
/// ///
/// Determines the mean-color for each led using the mapping the image given /// Determines the mean-color for each led using the mapping the image given
@ -96,9 +96,9 @@ namespace hyperion
// Iterate each led and compute the mean // Iterate each led and compute the mean
auto led = ledColors.begin(); auto led = ledColors.begin();
for (auto ledColors = _colorsMap.begin(); ledColors != _colorsMap.end(); ++ledColors, ++led) for (auto colors = _colorsMap.begin(); colors != _colorsMap.end(); ++colors, ++led)
{ {
const ColorRgb color = calcMeanColor(image, *ledColors); const ColorRgb color = calcMeanColor(image, *colors);
*led = color; *led = color;
} }
} }

View File

@ -151,7 +151,7 @@ public:
/// @param timeout_ms The new timeout (defaults to -1 endless) /// @param timeout_ms The new timeout (defaults to -1 endless)
/// @return True on success, false when priority is not found /// @return True on success, false when priority is not found
/// ///
const bool setInput(const int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms = -1); bool setInput(const int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms = -1);
/// ///
/// @brief Update the current image of a priority (prev registered with registerInput()) /// @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) /// @param timeout_ms The new timeout (defaults to -1 endless)
/// @return True on success, false when priority is not found /// @return True on success, false when priority is not found
/// ///
const bool setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1); bool setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1);
/// ///
/// @brief Set the given priority to inactive /// @brief Set the given priority to inactive
/// @param priority The priority /// @param priority The priority
/// @return True on success false if not found /// @return True on success false if not found
/// ///
const bool setInputInactive(const quint8& priority); bool setInputInactive(const quint8& priority);
/// ///
/// Clears the specified priority channel and update _currentPriority on success /// 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 /// @param[in] priority The priority of the channel to clear
/// @return True if priority has been cleared else false (not found) /// @return True if priority has been cleared else false (not found)
/// ///
const bool clearInput(const uint8_t priority); bool clearInput(const uint8_t priority);
/// ///
/// Clears all priority channels /// Clears all priority channels

View File

@ -34,7 +34,7 @@ public:
/// @param correct If true will correct json against schema before save /// @param correct If true will correct json against schema before save
/// @return True on success else false /// @return True on success else false
/// ///
const bool saveSettings(QJsonObject config, const bool& correct = false); bool saveSettings(QJsonObject config, const bool& correct = false);
/// ///
/// @brief get a single setting json from config /// @brief get a single setting json from config

View File

@ -58,7 +58,7 @@ public:
void setEnable(bool enable); void setEnable(bool enable);
bool enabled() { return _enabled; }; bool enabled() { return _enabled; };
const int getLatchTime() { return _latchTime_ms; }; int getLatchTime() { return _latchTime_ms; };
inline bool componentState() { return enabled(); }; inline bool componentState() { return enabled(); };

View File

@ -28,7 +28,7 @@ public:
/// @brief Start SSDP /// @brief Start SSDP
/// @return false if already running or bind failure /// @return false if already running or bind failure
/// ///
const bool start(); bool start();
/// ///
/// @brief Stop SSDP /// @brief Stop SSDP

View File

@ -68,7 +68,7 @@ public:
_pixels(new Pixel_T[other._width * other._height + 1]), _pixels(new Pixel_T[other._width * other._height + 1]),
_endOfPixels(_pixels + other._width * other._height) _endOfPixels(_pixels + other._width * other._height)
{ {
memcpy(_pixels, other._pixels, other._width * other._height * sizeof(Pixel_T)); memcpy(_pixels, other._pixels, (long) other._width * other._height * sizeof(Pixel_T));
} }
// Define assignment operator in terms of the copy constructor // Define assignment operator in terms of the copy constructor
@ -242,7 +242,7 @@ public:
// //
ssize_t size() const ssize_t size() const
{ {
return _width * _height * sizeof(Pixel_T); return (ssize_t) _width * _height * sizeof(Pixel_T);
} }
private: private:

View File

@ -86,7 +86,7 @@ public:
QVector<Logger::T_LOG_MESSAGE>* getLogMessageBuffer() { return &_logMessageBuffer; }; QVector<Logger::T_LOG_MESSAGE>* getLogMessageBuffer() { return &_logMessageBuffer; };
public slots: public slots:
void handleNewLogMessage(Logger::T_LOG_MESSAGE); void handleNewLogMessage(const Logger::T_LOG_MESSAGE&);
signals: signals:
void newLogMessage(Logger::T_LOG_MESSAGE); void newLogMessage(Logger::T_LOG_MESSAGE);

View File

@ -11,7 +11,7 @@ namespace NetUtils {
/// @param log The logger of the caller to print /// @param log The logger of the caller to print
/// @return True on success else false /// @return True on success else false
/// ///
static const bool portAvailable(quint16& port, Logger* log) static bool portAvailable(quint16& port, Logger* log)
{ {
const quint16 prevPort = port; const quint16 prevPort = port;
QTcpServer server; QTcpServer server;

View File

@ -12,6 +12,9 @@ enum PixelFormat {
PIXELFORMAT_BGR24, PIXELFORMAT_BGR24,
PIXELFORMAT_RGB32, PIXELFORMAT_RGB32,
PIXELFORMAT_BGR32, PIXELFORMAT_BGR32,
#ifdef HAVE_JPEG
PIXELFORMAT_MJPEG,
#endif
PIXELFORMAT_NO_CHANGE PIXELFORMAT_NO_CHANGE
}; };
@ -44,6 +47,12 @@ inline PixelFormat parsePixelFormat(QString pixelFormat)
{ {
return PIXELFORMAT_BGR32; return PIXELFORMAT_BGR32;
} }
#ifdef HAVE_JPEG
else if (pixelFormat == "mjpeg")
{
return PIXELFORMAT_MJPEG;
}
#endif
// return the default NO_CHANGE // return the default NO_CHANGE
return PIXELFORMAT_NO_CHANGE; return PIXELFORMAT_NO_CHANGE;

View File

@ -1,45 +0,0 @@
// qt includes
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QUrlQuery>
#include <QTimer>
// hyperion includes
#include <utils/Logger.h>
#include <hyperion/Hyperion.h>
class Stats : public QObject
{
Q_OBJECT
public:
Stats();
static Stats* getInstance() { return instance; };
static Stats* instance;
void handleDataUpdate(const QJsonObject& config);
private:
friend class HyperionDaemon;
Stats(const QJsonObject& config);
~Stats();
private:
Logger* _log;
Hyperion* _hyperion;
QString _hash = "";
QByteArray _ba;
QNetworkRequest _req;
QNetworkAccessManager _mgr;
bool trigger(bool set = false);
private slots:
void initialExec();
void sendHTTP();
void sendHTTPp();
void resolveReply(QNetworkReply *reply);
};

View File

@ -29,7 +29,7 @@ public:
quint16 getPort() { return _port; }; quint16 getPort() { return _port; };
/// check if server has been inited /// check if server has been inited
const bool isInited() { return _inited; }; bool isInited() { return _inited; };
/// ///
/// @brief Set a new description, if empty the description is NotFound for clients /// @brief Set a new description, if empty the description is NotFound for clients

View File

@ -25,7 +25,6 @@
#include <hyperion/GrabberWrapper.h> #include <hyperion/GrabberWrapper.h>
#include <utils/Process.h> #include <utils/Process.h>
#include <utils/JsonUtils.h> #include <utils/JsonUtils.h>
#include <utils/Stats.h>
// bonjour wrapper // bonjour wrapper
#include <bonjour/bonjourbrowserwrapper.h> #include <bonjour/bonjourbrowserwrapper.h>
@ -1052,7 +1051,7 @@ void JsonAPI::setImage(const Image<ColorRgb> & image)
} }
} }
void JsonAPI::incommingLogMessage(Logger::T_LOG_MESSAGE msg) void JsonAPI::incommingLogMessage(const Logger::T_LOG_MESSAGE &msg)
{ {
QJsonObject result, message; QJsonObject result, message;
QJsonArray messageArray; QJsonArray messageArray;

View File

@ -192,6 +192,9 @@ void BoblightClientConnection::handleMessage(const QString & message)
{ {
// clear the current channel // clear the current channel
_hyperion->clear(_priority); _hyperion->clear(_priority);
// register new priority
_hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString()));
} }
_priority = prio; _priority = prio;

View File

@ -34,7 +34,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <utils/Logger.h> #include <utils/Logger.h>
#include <HyperionConfig.h> #include <HyperionConfig.h>
#include <utils/Stats.h> #include <hyperion/Hyperion.h>
BonjourServiceRegister::BonjourServiceRegister(QObject *parent) BonjourServiceRegister::BonjourServiceRegister(QObject *parent)
: QObject(parent), dnssref(0), bonjourSocket(0) : QObject(parent), dnssref(0), bonjourSocket(0)

View File

@ -48,12 +48,12 @@ EffectEngine::~EffectEngine()
{ {
} }
const bool EffectEngine::saveEffect(const QJsonObject& obj, QString& resultMsg) bool EffectEngine::saveEffect(const QJsonObject& obj, QString& resultMsg)
{ {
return _effectFileHandler->saveEffect(obj, resultMsg); return _effectFileHandler->saveEffect(obj, resultMsg);
} }
const bool EffectEngine::deleteEffect(const QString& effectName, QString& resultMsg) bool EffectEngine::deleteEffect(const QString& effectName, QString& resultMsg)
{ {
return _effectFileHandler->deleteEffect(effectName, resultMsg); return _effectFileHandler->deleteEffect(effectName, resultMsg);
} }

View File

@ -58,7 +58,7 @@ void EffectFileHandler::handleSettingsUpdate(const settings::type& type, const Q
} }
} }
const bool EffectFileHandler::deleteEffect(const QString& effectName, QString& resultMsg) bool EffectFileHandler::deleteEffect(const QString& effectName, QString& resultMsg)
{ {
std::list<EffectDefinition> effectsDefinition = getEffects(); std::list<EffectDefinition> effectsDefinition = getEffects();
std::list<EffectDefinition>::iterator it = std::find_if(effectsDefinition.begin(), effectsDefinition.end(), find_effect(effectName)); std::list<EffectDefinition>::iterator it = std::find_if(effectsDefinition.begin(), effectsDefinition.end(), find_effect(effectName));
@ -95,7 +95,7 @@ const bool EffectFileHandler::deleteEffect(const QString& effectName, QString& r
return false; return false;
} }
const bool EffectFileHandler::saveEffect(const QJsonObject& message, QString& resultMsg) bool EffectFileHandler::saveEffect(const QJsonObject& message, QString& resultMsg)
{ {
if (!message["args"].toObject().isEmpty()) if (!message["args"].toObject().isEmpty())
{ {

View File

@ -138,9 +138,9 @@ void FlatBufferClient::handleImageCommand(const hyperionnet::Image *image)
return; return;
} }
Image<ColorRgb> image(width, height); Image<ColorRgb> imageDest(width, height);
memmove(image.memptr(), imageData->data(), imageData->size()); memmove(imageDest.memptr(), imageData->data(), imageData->size());
_hyperion->setInputImage(_priority, image, duration); _hyperion->setInputImage(_priority, imageDest, duration);
} }
// send reply // send reply

View File

@ -41,7 +41,7 @@ void QtGrabber::freeResources()
} }
} }
const bool QtGrabber::setupDisplay() bool QtGrabber::setupDisplay()
{ {
// cleanup last screen // cleanup last screen
freeResources(); freeResources();
@ -105,7 +105,7 @@ int QtGrabber::grabFrame(Image<ColorRgb> & image)
QPixmap originalPixmap = _screen->grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max); QPixmap originalPixmap = _screen->grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max);
QPixmap resizedPixmap = originalPixmap.scaled(_width,_height); QPixmap resizedPixmap = originalPixmap.scaled(_width,_height);
QImage img = resizedPixmap.toImage().convertToFormat( QImage::Format_RGB888); QImage img = resizedPixmap.toImage().convertToFormat( QImage::Format_RGB888);
memcpy(image.memptr(), img.bits(),_width*_height*3); memcpy(image.memptr(), img.bits(),(size_t) _width*_height*3);
return 0; return 0;
} }

View File

@ -10,3 +10,7 @@ target_link_libraries(v4l2-grabber
hyperion hyperion
${QT_LIBRARIES} ${QT_LIBRARIES}
) )
if (JPEG_FOUND)
target_link_libraries(v4l2-grabber ${JPEG_LIBRARY})
endif()

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ void X11Grabber::setupResources()
if(_XShmAvailable) if(_XShmAvailable)
{ {
_xImage = XShmCreateImage(_x11Display, _windowAttr.visual, _windowAttr.depth, ZPixmap, NULL, &_shminfo, _width, _height); _xImage = XShmCreateImage(_x11Display, _windowAttr.visual, _windowAttr.depth, ZPixmap, NULL, &_shminfo, _width, _height);
_shminfo.shmid = shmget(IPC_PRIVATE, _xImage->bytes_per_line * _xImage->height, IPC_CREAT|0777); _shminfo.shmid = shmget(IPC_PRIVATE, (size_t) _xImage->bytes_per_line * _xImage->height, IPC_CREAT|0777);
_xImage->data = (char*)shmat(_shminfo.shmid,0,0); _xImage->data = (char*)shmat(_shminfo.shmid,0,0);
_shminfo.shmaddr = _xImage->data; _shminfo.shmaddr = _xImage->data;
_shminfo.readOnly = False; _shminfo.readOnly = False;

View File

@ -82,6 +82,7 @@ void CaptureCont::setSystemCaptureEnable(const bool& enable)
} }
_systemCaptEnabled = enable; _systemCaptEnabled = enable;
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, enable); _hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, enable);
_hyperion->setComponentState(hyperion::COMP_GRABBER, enable);
} }
} }
@ -93,7 +94,7 @@ void CaptureCont::setV4LCaptureEnable(const bool& enable)
{ {
_hyperion->registerInput(_v4lCaptPrio, hyperion::COMP_V4L); _hyperion->registerInput(_v4lCaptPrio, hyperion::COMP_V4L);
connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, this, &CaptureCont::handleV4lImage); connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, this, &CaptureCont::handleV4lImage);
connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, _hyperion, &Hyperion::forwardProtoMessage); connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, _hyperion, &Hyperion::forwardProtoMessage);
} }
else else
{ {
@ -103,6 +104,7 @@ void CaptureCont::setV4LCaptureEnable(const bool& enable)
} }
_v4lCaptEnabled = enable; _v4lCaptEnabled = enable;
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_V4L, enable); _hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_V4L, enable);
_hyperion->setComponentState(hyperion::COMP_V4L, enable);
} }
} }

View File

@ -14,8 +14,8 @@ Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int c
, _enabled(true) , _enabled(true)
, _log(Logger::getInstance(grabberName)) , _log(Logger::getInstance(grabberName))
{ {
setVideoMode(VIDEO_2D); Grabber::setVideoMode(VIDEO_2D);
setCropping(cropLeft, cropRight, cropTop, cropBottom); Grabber::setCropping(cropLeft, cropRight, cropTop, cropBottom);
} }
Grabber::~Grabber() Grabber::~Grabber()

View File

@ -32,7 +32,7 @@ GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned
GrabberWrapper::~GrabberWrapper() GrabberWrapper::~GrabberWrapper()
{ {
stop(); GrabberWrapper::stop(); // TODO Is this right????????
Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName)); Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName));
} }
@ -104,11 +104,7 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
if(type == settings::V4L2 || type == settings::SYSTEMCAPTURE) if(type == settings::V4L2 || type == settings::SYSTEMCAPTURE)
{ {
// extract settings // extract settings
QJsonObject obj; const QJsonObject& obj = config.object();
if(config.isArray() && !config.isEmpty())
obj = config.array().at(0).toObject();
else
obj = config.object();
if(type == settings::SYSTEMCAPTURE && !_grabberName.startsWith("V4L")) if(type == settings::SYSTEMCAPTURE && !_grabberName.startsWith("V4L"))
{ {
@ -172,5 +168,4 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
} }
} }
} }

View File

@ -15,6 +15,7 @@
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QHostInfo> #include <QHostInfo>
#include <QCryptographicHash>
// hyperion include // hyperion include
#include <hyperion/Hyperion.h> #include <hyperion/Hyperion.h>
@ -161,6 +162,9 @@ Hyperion::Hyperion(HyperionDaemon* daemon, const quint8& instance, const QString
// boblight, can't live in global scope as it depends on layout // boblight, can't live in global scope as it depends on layout
_boblightServer = new BoblightServer(this, getSetting(settings::BOBLSERVER)); _boblightServer = new BoblightServer(this, getSetting(settings::BOBLSERVER));
connect(this, &Hyperion::settingsChanged, _boblightServer, &BoblightServer::handleSettingsUpdate); connect(this, &Hyperion::settingsChanged, _boblightServer, &BoblightServer::handleSettingsUpdate);
// set unique id
_id = QString(QCryptographicHash::hash(getConfigFileName().toLocal8Bit(),QCryptographicHash::Sha1).toHex());
} }
Hyperion::~Hyperion() Hyperion::~Hyperion()
@ -376,7 +380,7 @@ void Hyperion::registerInput(const int priority, const hyperion::Components& com
_muxer.registerInput(priority, component, origin, owner, smooth_cfg); _muxer.registerInput(priority, component, origin, owner, smooth_cfg);
} }
const bool Hyperion::setInput(const int priority, const std::vector<ColorRgb>& ledColors, int timeout_ms, const bool& clearEffect) bool Hyperion::setInput(const int priority, const std::vector<ColorRgb>& ledColors, int timeout_ms, const bool& clearEffect)
{ {
if(_muxer.setInput(priority, ledColors, timeout_ms)) if(_muxer.setInput(priority, ledColors, timeout_ms))
{ {
@ -393,7 +397,7 @@ const bool Hyperion::setInput(const int priority, const std::vector<ColorRgb>& l
return false; return false;
} }
const bool Hyperion::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms, const bool& clearEffect) bool Hyperion::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms, const bool& clearEffect)
{ {
if(_muxer.setInputImage(priority, image, timeout_ms)) if(_muxer.setInputImage(priority, image, timeout_ms))
{ {
@ -410,7 +414,7 @@ const bool Hyperion::setInputImage(const int priority, const Image<ColorRgb>& im
return false; return false;
} }
const bool Hyperion::setInputInactive(const quint8& priority) bool Hyperion::setInputInactive(const quint8& priority)
{ {
return _muxer.setInputInactive(priority); return _muxer.setInputInactive(priority);
} }
@ -447,7 +451,7 @@ void Hyperion::adjustmentsUpdated()
update(); update();
} }
const bool Hyperion::clear(int priority) bool Hyperion::clear(int priority)
{ {
// send clear signal to the effect engine // send clear signal to the effect engine
// (outside the check so the effect gets cleared even when the effect is not sending colors) // (outside the check so the effect gets cleared even when the effect is not sending colors)
@ -487,12 +491,12 @@ const Hyperion::InputInfo Hyperion::getPriorityInfo(const int priority) const
return _muxer.getInputInfo(priority); return _muxer.getInputInfo(priority);
} }
const bool Hyperion::saveEffect(const QJsonObject& obj, QString& resultMsg) bool Hyperion::saveEffect(const QJsonObject& obj, QString& resultMsg)
{ {
return _effectEngine->saveEffect(obj, resultMsg); return _effectEngine->saveEffect(obj, resultMsg);
} }
const bool Hyperion::deleteEffect(const QString& effectName, QString& resultMsg) bool Hyperion::deleteEffect(const QString& effectName, QString& resultMsg)
{ {
return _effectEngine->deleteEffect(effectName, resultMsg); return _effectEngine->deleteEffect(effectName, resultMsg);
} }

View File

@ -60,7 +60,7 @@ ImageToLedsMap::ImageToLedsMap(
const auto maxXLedCount = qMin(maxX_idx, xOffset+actualWidth); const auto maxXLedCount = qMin(maxX_idx, xOffset+actualWidth);
std::vector<unsigned> ledColors; std::vector<unsigned> ledColors;
ledColors.reserve(maxXLedCount*maxYLedCount); ledColors.reserve((size_t) maxXLedCount*maxYLedCount);
for (unsigned y = minY_idx; y < maxYLedCount; ++y) for (unsigned y = minY_idx; y < maxYLedCount; ++y)
{ {

View File

@ -157,7 +157,7 @@ void PriorityMuxer::registerInput(const int priority, const hyperion::Components
} }
} }
const bool PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms) bool PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms)
{ {
if(!_activeInputs.contains(priority)) if(!_activeInputs.contains(priority))
{ {
@ -196,7 +196,7 @@ const bool PriorityMuxer::setInput(const int priority, const std::vector<ColorRg
return true; return true;
} }
const bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms) bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms)
{ {
if(!_activeInputs.contains(priority)) if(!_activeInputs.contains(priority))
{ {
@ -235,13 +235,13 @@ const bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb
return true; return true;
} }
const bool PriorityMuxer::setInputInactive(const quint8& priority) bool PriorityMuxer::setInputInactive(const quint8& priority)
{ {
Image<ColorRgb> image; Image<ColorRgb> image;
return setInputImage(priority, image, -100); return setInputImage(priority, image, -100);
} }
const bool PriorityMuxer::clearInput(const uint8_t priority) bool PriorityMuxer::clearInput(const uint8_t priority)
{ {
if (priority < PriorityMuxer::LOWEST_PRIORITY && _activeInputs.remove(priority)) if (priority < PriorityMuxer::LOWEST_PRIORITY && _activeInputs.remove(priority))
{ {
@ -294,7 +294,7 @@ void PriorityMuxer::setCurrentTime(void)
else else
{ {
// timeoutTime of -100 is awaiting data (inactive); skip // timeoutTime of -100 is awaiting data (inactive); skip
if(infoIt->timeoutTime_ms >= -100) if(infoIt->timeoutTime_ms > -100)
newPriority = qMin(newPriority, infoIt->priority); newPriority = qMin(newPriority, infoIt->priority);
// call timeTrigger when effect or color is running with timeout > 0, blacklist prio 255 // call timeTrigger when effect or color is running with timeout > 0, blacklist prio 255

View File

@ -142,7 +142,7 @@ const QJsonDocument SettingsManager::getSetting(const settings::type& type)
return QJsonDocument(_qconfig[key].toArray()); return QJsonDocument(_qconfig[key].toArray());
} }
const bool SettingsManager::saveSettings(QJsonObject config, const bool& correct) bool SettingsManager::saveSettings(QJsonObject config, const bool& correct)
{ {
// we need to validate data against schema // we need to validate data against schema
QJsonSchemaChecker schemaChecker; QJsonSchemaChecker schemaChecker;

View File

@ -25,7 +25,7 @@
"title" : "edt_conf_general_priority_title", "title" : "edt_conf_general_priority_title",
"minimum" : 100, "minimum" : 100,
"maximum" : 254, "maximum" : 254,
"default" : 201, "default" : 128,
"propertyOrder" : 3 "propertyOrder" : 3
} }
}, },

View File

@ -8,6 +8,8 @@
{ {
"type" : "boolean", "type" : "boolean",
"title" : "edt_conf_general_enable_title", "title" : "edt_conf_general_enable_title",
"required" : true,
"default" : false,
"propertyOrder" : 1 "propertyOrder" : 1
}, },
"json" : "json" :
@ -15,6 +17,7 @@
"type" : "array", "type" : "array",
"title" : "edt_conf_fw_json_title", "title" : "edt_conf_fw_json_title",
"required" : true, "required" : true,
"default" : ["127.0.0.1:19446"],
"items" : { "items" : {
"type": "string", "type": "string",
"title" : "edt_conf_fw_json_itemtitle" "title" : "edt_conf_fw_json_itemtitle"
@ -25,6 +28,8 @@
{ {
"type" : "array", "type" : "array",
"title" : "edt_conf_fw_proto_title", "title" : "edt_conf_fw_proto_title",
"required" : true,
"default" : ["127.0.0.1:19401"],
"items" : { "items" : {
"type": "string", "type": "string",
"title" : "edt_conf_fw_proto_itemtitle" "title" : "edt_conf_fw_proto_itemtitle"

View File

@ -8,6 +8,10 @@
"type" : "string", "type" : "string",
"title" : "edt_conf_fg_type_title", "title" : "edt_conf_fg_type_title",
"enum" : ["auto","dispmanx","amlogic","x11","framebuffer","qt"], "enum" : ["auto","dispmanx","amlogic","x11","framebuffer","qt"],
"options":
{
"enum_titles": ["edt_conf_enum_automatic","DispmanX","AMLogic","X11","Framebuffer","QT"]
},
"default" : "auto", "default" : "auto",
"propertyOrder" : 2 "propertyOrder" : 2
}, },

View File

@ -1,208 +1,200 @@
{ {
"type":"array", "type" : "object",
"required" : true, "required" : true,
"title" : "edt_conf_v4l2_heading_title", "title" : "edt_conf_v4l2_heading_title",
"minItems": 1, "properties" :
"maxItems": 1,
"items":
{ {
"type" : "object", "device" :
"required" : true,
"title" : "edt_conf_v4l2_heading_title",
"properties" :
{ {
"device" : "type" : "string",
{ "title" : "edt_conf_v4l2_device_title",
"type" : "string", "default" : "auto",
"title" : "edt_conf_v4l2_device_title", "minLength" : 4,
"default" : "auto", "required" : true,
"minLength" : 4, "propertyOrder" : 1
"required" : true,
"propertyOrder" : 1
},
"standard" :
{
"type" : "string",
"title" : "edt_conf_v4l2_standard_title",
"enum" : ["PAL","NTSC","SECAM","NO_CHANGE"],
"default" : "NO_CHANGE",
"options" : {
"enum_titles" : ["edt_conf_enum_PAL", "edt_conf_enum_NTSC", "edt_conf_enum_SECAM", "edt_conf_enum_NO_CHANGE"]
},
"required" : true,
"propertyOrder" : 2
},
"sizeDecimation" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_sizeDecimation_title",
"minimum" : 1,
"maximum" : 30,
"default" : 6,
"required" : true,
"propertyOrder" : 3
},
"cropLeft" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropLeft_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 4
},
"cropRight" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropRight_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 5
},
"cropTop" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropTop_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 6
},
"cropBottom" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropBottom_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 7
},
"signalDetection" :
{
"type" : "boolean",
"title" : "edt_conf_v4l2_signalDetection_title",
"default" : false,
"required" : true,
"propertyOrder" : 8
},
"redSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_redSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 9
},
"greenSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_greenSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 10
},
"blueSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_blueSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 11
},
"sDVOffsetMin" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDVOffsetMin_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.25,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 12
},
"sDVOffsetMax" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDVOffsetMax_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.75,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 13
},
"sDHOffsetMin" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDHOffsetMin_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.25,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 14
},
"sDHOffsetMax" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDHOffsetMax_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.75,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 15
}
}, },
"standard" :
{
"type" : "string",
"title" : "edt_conf_v4l2_standard_title",
"enum" : ["PAL","NTSC","SECAM","NO_CHANGE"],
"default" : "NO_CHANGE",
"options" : {
"enum_titles" : ["edt_conf_enum_PAL", "edt_conf_enum_NTSC", "edt_conf_enum_SECAM", "edt_conf_enum_NO_CHANGE"]
},
"required" : true,
"propertyOrder" : 2
},
"sizeDecimation" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_sizeDecimation_title",
"minimum" : 1,
"maximum" : 30,
"default" : 6,
"required" : true,
"propertyOrder" : 3
},
"cropLeft" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropLeft_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 4
},
"cropRight" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropRight_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 5
},
"cropTop" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropTop_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 6
},
"cropBottom" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_cropBottom_title",
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 7
},
"signalDetection" :
{
"type" : "boolean",
"title" : "edt_conf_v4l2_signalDetection_title",
"default" : false,
"required" : true,
"propertyOrder" : 8
},
"redSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_redSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 9
},
"greenSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_greenSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 10
},
"blueSignalThreshold" :
{
"type" : "integer",
"title" : "edt_conf_v4l2_blueSignalThreshold_title",
"minimum" : 0,
"maximum" : 100,
"default" : 5,
"append" : "edt_append_percent",
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 11
},
"sDVOffsetMin" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDVOffsetMin_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.25,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 12
},
"sDVOffsetMax" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDVOffsetMax_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.75,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 13
},
"sDHOffsetMin" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDHOffsetMin_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.25,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 14
},
"sDHOffsetMax" :
{
"type" : "number",
"title" : "edt_conf_v4l2_sDHOffsetMax_title",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.75,
"step" : 0.01,
"options": {
"dependencies": {
"signalDetection": true
}
},
"required" : true,
"propertyOrder" : 15
}
},
"additionalProperties" : false "additionalProperties" : false
}
} }

View File

@ -5,12 +5,14 @@
"items": "items":
{ {
"type":"object", "type":"object",
"required" : true,
"properties": "properties":
{ {
"index": "index":
{ {
"type":"integer", "type":"integer",
"required":true "required":true,
"default" : 0
}, },
"clone": "clone":
{ {
@ -19,6 +21,7 @@
"hscan": "hscan":
{ {
"type":"object", "type":"object",
"required" : true,
"properties": "properties":
{ {
"minimum": "minimum":
@ -26,14 +29,16 @@
"type":"number", "type":"number",
"minimum" : 0, "minimum" : 0,
"maximum" : 1, "maximum" : 1,
"required":true "required":true,
"default" : 0
}, },
"maximum": "maximum":
{ {
"type":"number", "type":"number",
"minimum" : 0, "minimum" : 0,
"maximum" : 1, "maximum" : 1,
"required":true "required":true,
"default" : 0.1
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -41,6 +46,7 @@
"vscan": "vscan":
{ {
"type":"object", "type":"object",
"required" : true,
"properties": "properties":
{ {
"minimum": "minimum":
@ -48,14 +54,16 @@
"type":"number", "type":"number",
"minimum" : 0, "minimum" : 0,
"maximum" : 1, "maximum" : 1,
"required":true "required":true,
"default" : 0
}, },
"maximum": "maximum":
{ {
"type":"number", "type":"number",
"minimum" : 0, "minimum" : 0,
"maximum" : 1, "maximum" : 1,
"required":true "required":true,
"default" : 0.1
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -63,7 +71,10 @@
"colorOrder": "colorOrder":
{ {
"type": "string", "type": "string",
"enum" : ["rgb", "bgr", "rbg", "brg", "gbr", "grb"] "enum" : ["rgb", "bgr", "rbg", "brg", "gbr", "grb"],
"options" : {
"enum_titles" : ["edt_conf_enum_rgb", "edt_conf_enum_bgr", "edt_conf_enum_rbg", "edt_conf_enum_brg", "edt_conf_enum_gbr", "edt_conf_enum_grb"]
}
} }
}, },
"additionalProperties" : false "additionalProperties" : false

View File

@ -53,7 +53,7 @@ bool ProviderUdp::init(const QJsonObject &deviceConfig)
} }
_port = deviceConfig["port"].toInt(_port); _port = deviceConfig["port"].toInt(_port);
if ( _port<=0 || _port > 65535) if ( (_port <= 0) || (_port > 65535) )
{ {
throw std::runtime_error("invalid target port"); throw std::runtime_error("invalid target port");
} }

View File

@ -101,7 +101,7 @@ void SSDPServer::initServer()
connect(_udpSocket, &QUdpSocket::readyRead, this, &SSDPServer::readPendingDatagrams); connect(_udpSocket, &QUdpSocket::readyRead, this, &SSDPServer::readPendingDatagrams);
} }
const bool SSDPServer::start() bool SSDPServer::start()
{ {
if(!_running && _udpSocket->bind(QHostAddress::AnyIPv4, SSDP_PORT, QAbstractSocket::ShareAddress)) if(!_running && _udpSocket->bind(QHostAddress::AnyIPv4, SSDP_PORT, QAbstractSocket::ShareAddress))
{ {

View File

@ -121,6 +121,10 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
rgb.red = data[index+2]; rgb.red = data[index+2];
} }
break; break;
#ifdef HAVE_JPEG
case PIXELFORMAT_MJPEG:
break;
#endif
case PIXELFORMAT_NO_CHANGE: case PIXELFORMAT_NO_CHANGE:
Error(Logger::getInstance("ImageResampler"), "Invalid pixel format given"); Error(Logger::getInstance("ImageResampler"), "Invalid pixel format given");
break; break;

View File

@ -164,7 +164,7 @@ LoggerManager::LoggerManager()
{ {
} }
void LoggerManager::handleNewLogMessage(Logger::T_LOG_MESSAGE msg) void LoggerManager::handleNewLogMessage(const Logger::T_LOG_MESSAGE &msg)
{ {
_logMessageBuffer.append(msg); _logMessageBuffer.append(msg);
if (_logMessageBuffer.length() > _loggerMaxMsgBufferSize) if (_logMessageBuffer.length() > _loggerMaxMsgBufferSize)

View File

@ -1,164 +0,0 @@
#include <utils/Stats.h>
#include <utils/SysInfo.h>
#include <HyperionConfig.h>
#include <leddevice/LedDevice.h>
// qt includes
#include <QJsonObject>
#include <QJsonDocument>
#include <QNetworkInterface>
#include <QCryptographicHash>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QDateTime>
Stats* Stats::instance = nullptr;
Stats::Stats(const QJsonObject& config)
: QObject()
, _log(Logger::getInstance("STATS"))
, _hyperion(Hyperion::getInstance())
{
Stats::instance = this;
// generate hash
foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces())
{
if (!(interface.flags() & QNetworkInterface::IsLoopBack))
{
_hyperion->setId(QString(QCryptographicHash::hash(interface.hardwareAddress().toLocal8Bit().append(_hyperion->getConfigFileName().toLocal8Bit()),QCryptographicHash::Sha1).toHex()));
_hash = QString(QCryptographicHash::hash(interface.hardwareAddress().toLocal8Bit(),QCryptographicHash::Sha1).toHex());
break;
}
}
// stop reporting if not found
if(_hash.isEmpty())
{
Warning(_log, "No interface found, abort");
// fallback id
_hyperion->setId(QString(QCryptographicHash::hash(_hyperion->getConfigFileName().toLocal8Bit(),QCryptographicHash::Sha1).toHex()));
return;
}
// prep data
handleDataUpdate(config);
// QNetworkRequest Header
_req.setRawHeader("Content-Type", "application/json");
_req.setRawHeader("Authorization", "Basic SHlwZXJpb25YbDQ5MlZrcXA6ZDQxZDhjZDk4ZjAwYjIw");
connect(&_mgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(resolveReply(QNetworkReply*)));
// 7 days interval
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(sendHTTP()));
timer->start(604800000);
// delay initial check
QTimer::singleShot(60000, this, SLOT(initialExec()));
}
Stats::~Stats()
{
}
void Stats::handleDataUpdate(const QJsonObject& config)
{
// prepare content
SysInfo::HyperionSysInfo data = SysInfo::get();
QJsonObject system;
system["kType" ] = data.kernelType;
system["arch" ] = data.architecture;
system["pType" ] = data.productType;
system["pVersion" ] = data.productVersion;
system["pName" ] = data.prettyName;
system["version" ] = QString(HYPERION_VERSION);
system["device" ] = Hyperion::getInstance()->getActiveDevice();
system["id" ] = _hyperion->getId();
system["hw_id" ] = _hash;
system["ledCount" ] = QString::number(Hyperion::getInstance()->getLedCount());
system["comp_sm" ] = config["smoothing"].toObject().take("enable");
system["comp_bb" ] = config["blackborderdetector"].toObject().take("enable");
system["comp_fw" ] = config["forwarder"].toObject().take("enable");
system["comp_udpl" ] = config["udpListener"].toObject().take("enable");
system["comp_bobl" ] = config["boblightServer"].toObject().take("enable");
system["comp_pc" ] = config["framegrabber"].toObject().take("enable");
system["comp_uc" ] = config["grabberV4L2"].toArray().at(0).toObject().take("enable");
QJsonDocument doc(system);
_ba = doc.toJson();
}
void Stats::initialExec()
{
if(trigger())
{
QTimer::singleShot(0,this, SLOT(sendHTTP()));
}
}
void Stats::sendHTTP()
{
_req.setUrl(QUrl("https://api.hyperion-project.org/api/stats"));
_mgr.post(_req,_ba);
}
void Stats::sendHTTPp()
{
_req.setUrl(QUrl("https://api.hyperion-project.org/api/stats/"+_hyperion->getId()));
_mgr.put(_req,_ba);
}
void Stats::resolveReply(QNetworkReply *reply)
{
if (reply->error() == QNetworkReply::NoError)
{
// update file timestamp
trigger(true);
// already created, update entry
if(reply->readAll().startsWith("null"))
{
QTimer::singleShot(0, this, SLOT(sendHTTPp()));
}
}
}
bool Stats::trigger(bool set)
{
QString path = _hyperion->getRootPath()+"/misc/";
QDir dir;
QFile file(path + _hyperion->getId());
if(set && file.open(QIODevice::ReadWrite) )
{
QTextStream stream( &file );
stream << "DO NOT DELETE" << endl;
file.close();
}
else
{
if(!dir.exists(path))
{
dir.mkpath(path);
}
if (!file.exists())
{
if(file.open(QIODevice::ReadWrite))
{
file.close();
return true;
}
return true;
}
QFileInfo info(file);
QDateTime newDate = QDateTime::currentDateTime();
QDateTime oldDate = info.lastModified();
int diff = oldDate.daysTo(newDate);
return diff >= 7 ? true : false;
}
return false;
}

View File

@ -49,7 +49,7 @@ public:
quint16 getServerPort (void) const; quint16 getServerPort (void) const;
QString getErrorString (void) const; QString getErrorString (void) const;
const bool isListening(void) { return m_sockServer->isListening(); }; bool isListening(void) { return m_sockServer->isListening(); };
public slots: public slots:
void start (quint16 port = 0); void start (quint16 port = 0);

View File

@ -23,7 +23,7 @@ StaticFileServing::StaticFileServing (QObject * parent)
StaticFileServing::~StaticFileServing () StaticFileServing::~StaticFileServing ()
{ {
delete _mimeDb;
} }
void StaticFileServing::setBaseUrl(const QString& url) void StaticFileServing::setBaseUrl(const QString& url)

View File

@ -1,3 +1,4 @@
#pragma once
// QT includes // QT includes
#include <QTimer> #include <QTimer>

View File

@ -1,3 +1,5 @@
#pragma once
// Qt includes // Qt includes
#include <QObject> #include <QObject>
#include <QRectF> #include <QRectF>

View File

@ -26,14 +26,6 @@
using namespace commandline; using namespace commandline;
// save the image as screenshot
void saveScreenshot(QString filename, const Image<ColorRgb> & image)
{
// store as PNG
QImage pngImage((const uint8_t *) image.memptr(), image.width(), image.height(), 3*image.width(), QImage::Format_RGB888);
pngImage.save(filename);
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
Logger *log = Logger::getInstance("V4L2GRABBER"); Logger *log = Logger::getInstance("V4L2GRABBER");
@ -60,7 +52,7 @@ int main(int argc, char** argv)
Option & argDevice = parser.add<Option> ('d', "device", "The device to use, can be /dev/video0 [default: %1 (auto detected)]", "auto"); Option & argDevice = parser.add<Option> ('d', "device", "The device to use, can be /dev/video0 [default: %1 (auto detected)]", "auto");
SwitchOption<VideoStandard> & argVideoStandard= parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC, SECAM or no-change. [default: %1]", "no-change"); SwitchOption<VideoStandard> & argVideoStandard= parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC, SECAM or no-change. [default: %1]", "no-change");
SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32 or no-change. [default: %1]", "no-change"); SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32, MJPEG or no-change. [default: %1]", "no-change");
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0"); IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0"); IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0");
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)"); IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)");
@ -96,6 +88,9 @@ int main(int argc, char** argv)
argPixelFormat.addSwitch("yuyv", PIXELFORMAT_YUYV); argPixelFormat.addSwitch("yuyv", PIXELFORMAT_YUYV);
argPixelFormat.addSwitch("uyvy", PIXELFORMAT_UYVY); argPixelFormat.addSwitch("uyvy", PIXELFORMAT_UYVY);
argPixelFormat.addSwitch("rgb32", PIXELFORMAT_RGB32); argPixelFormat.addSwitch("rgb32", PIXELFORMAT_RGB32);
#ifdef HAVE_JPEG
argPixelFormat.addSwitch("mjpeg", PIXELFORMAT_MJPEG);
#endif
argPixelFormat.addSwitch("no-change", PIXELFORMAT_NO_CHANGE); argPixelFormat.addSwitch("no-change", PIXELFORMAT_NO_CHANGE);
// parse all options // parse all options
@ -212,9 +207,11 @@ int main(int argc, char** argv)
// Connect the screen capturing to flatbuf connection processing // Connect the screen capturing to flatbuf connection processing
QObject::connect(&grabber, SIGNAL(newFrame(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>))); QObject::connect(&grabber, SIGNAL(newFrame(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
if (grabber.start()) // Start the capturing
QCoreApplication::exec(); grabber.start();
grabber.stop();
// Start the application
app.exec();
} }
} }
catch (const std::runtime_error & e) catch (const std::runtime_error & e)

View File

@ -1,3 +1,4 @@
#pragma once
// QT includes // QT includes
#include <QTimer> #include <QTimer>

View File

@ -22,7 +22,6 @@
#include <jsonserver/JsonServer.h> #include <jsonserver/JsonServer.h>
#include <udplistener/UDPListener.h> #include <udplistener/UDPListener.h>
#include <webserver/WebServer.h> #include <webserver/WebServer.h>
#include <utils/Stats.h>
#include <HyperionConfig.h> // Required to determine the cmake options #include <HyperionConfig.h> // Required to determine the cmake options
#include "hyperiond.h" #include "hyperiond.h"
@ -57,7 +56,7 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
, _webserver(nullptr) , _webserver(nullptr)
, _jsonServer(nullptr) , _jsonServer(nullptr)
, _udpListener(nullptr) , _udpListener(nullptr)
, _v4l2Grabbers() , _v4l2Grabber(nullptr)
, _dispmanx(nullptr) , _dispmanx(nullptr)
, _x11Grabber(nullptr) , _x11Grabber(nullptr)
, _amlGrabber(nullptr) , _amlGrabber(nullptr)
@ -65,7 +64,6 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
, _osxGrabber(nullptr) , _osxGrabber(nullptr)
, _qtGrabber(nullptr) , _qtGrabber(nullptr)
, _hyperion(nullptr) , _hyperion(nullptr)
, _stats(nullptr)
, _ssdp(nullptr) , _ssdp(nullptr)
, _currVideoMode(VIDEO_2D) , _currVideoMode(VIDEO_2D)
{ {
@ -83,10 +81,10 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
// set inital log lvl if the loglvl wasn't overwritten by arg // set inital log lvl if the loglvl wasn't overwritten by arg
if(!logLvlOverwrite) if(!logLvlOverwrite)
handleSettingsUpdate(settings::LOGGER, _settingsManager->getSetting(settings::LOGGER)); handleSettingsUpdate(settings::LOGGER, getSetting(settings::LOGGER));
// init EffectFileHandler // init EffectFileHandler
EffectFileHandler* efh = new EffectFileHandler(rootPath, _settingsManager->getSetting(settings::EFFECTS), this); EffectFileHandler* efh = new EffectFileHandler(rootPath, getSetting(settings::EFFECTS), this);
connect(this, &HyperionDaemon::settingsChanged, efh, &EffectFileHandler::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, efh, &EffectFileHandler::handleSettingsUpdate);
// spawn all Hyperion instances before network services // spawn all Hyperion instances before network services
@ -94,7 +92,7 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
Info(_log, "Hyperion initialized"); Info(_log, "Hyperion initialized");
//connect(_hyperion,SIGNAL(closing()),this,SLOT(freeObjects())); for app restart refactor required //connect(_hyperion,SIGNAL(closing()),this,SLOT(freeObjects())); // TODO for app restart, refactor required
// listen for setting changes // listen for setting changes
connect(_hyperion, &Hyperion::settingsChanged, this, &HyperionDaemon::settingsChanged); connect(_hyperion, &Hyperion::settingsChanged, this, &HyperionDaemon::settingsChanged);
@ -111,10 +109,17 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
Warning(_log, "No platform capture can be instantiated, because all grabbers have been left out from the build"); Warning(_log, "No platform capture can be instantiated, because all grabbers have been left out from the build");
#endif #endif
// init system capture (framegrabber) // get power state of system/v4l2 capture
const QJsonObject & grabberConfig = getSetting(settings::INSTCAPTURE).object();
// init system capture (framegrabber) and update power state
handleSettingsUpdate(settings::SYSTEMCAPTURE, getSetting(settings::SYSTEMCAPTURE)); handleSettingsUpdate(settings::SYSTEMCAPTURE, getSetting(settings::SYSTEMCAPTURE));
// init v4l2 capture _hyperion->setComponentState(hyperion::COMP_GRABBER, grabberConfig["systemEnable"].toBool(true));
// init v4l2 capture and update power state
handleSettingsUpdate(settings::V4L2, getSetting(settings::V4L2)); handleSettingsUpdate(settings::V4L2, getSetting(settings::V4L2));
_hyperion->setComponentState(hyperion::COMP_V4L, grabberConfig["v4lEnable"].toBool(true));
// ---- network services ----- // ---- network services -----
startNetworkServices(); startNetworkServices();
} }
@ -162,14 +167,9 @@ void HyperionDaemon::freeObjects()
delete _fbGrabber; delete _fbGrabber;
delete _osxGrabber; delete _osxGrabber;
delete _qtGrabber; delete _qtGrabber;
delete _v4l2Grabber;
for(V4L2Wrapper* grabber : _v4l2Grabbers) _v4l2Grabber = nullptr;
{
delete grabber;
}
delete _stats;
_v4l2Grabbers.clear();
_bonjourBrowserWrapper = nullptr; _bonjourBrowserWrapper = nullptr;
_amlGrabber = nullptr; _amlGrabber = nullptr;
_dispmanx = nullptr; _dispmanx = nullptr;
@ -182,14 +182,10 @@ void HyperionDaemon::freeObjects()
_webserver = nullptr; _webserver = nullptr;
_jsonServer = nullptr; _jsonServer = nullptr;
_udpListener = nullptr; _udpListener = nullptr;
_stats = nullptr;
} }
void HyperionDaemon::startNetworkServices() void HyperionDaemon::startNetworkServices()
{ {
// Create Stats
_stats = new Stats(_settingsManager->getSettings());
// Create Json server // Create Json server
_jsonServer = new JsonServer(getSetting(settings::JSONSERVER)); _jsonServer = new JsonServer(getSetting(settings::JSONSERVER));
connect(this, &HyperionDaemon::settingsChanged, _jsonServer, &JsonServer::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _jsonServer, &JsonServer::handleSettingsUpdate);
@ -240,9 +236,9 @@ void HyperionDaemon::startNetworkServices()
ssdpThread->start(); ssdpThread->start();
} }
void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) void HyperionDaemon::handleSettingsUpdate(const settings::type& settingsType, const QJsonDocument& config)
{ {
if(type == settings::LOGGER) if(settingsType == settings::LOGGER)
{ {
const QJsonObject & logConfig = config.object(); const QJsonObject & logConfig = config.object();
@ -253,7 +249,7 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
else if (level == "debug") Logger::setLogLevel(Logger::DEBUG); else if (level == "debug") Logger::setLogLevel(Logger::DEBUG);
} }
if(type == settings::SYSTEMCAPTURE) if(settingsType == settings::SYSTEMCAPTURE)
{ {
const QJsonObject & grabberConfig = config.object(); const QJsonObject & grabberConfig = config.object();
@ -384,38 +380,31 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
_prevType = type; _prevType = type;
} }
} }
else if(type == settings::V4L2) else if(settingsType == settings::V4L2)
{ {
// stop
if(_v4l2Grabbers.size()>0)
return;
unsigned v4lEnableCount = 0; #ifdef ENABLE_V4L2
if(_v4l2Grabber != nullptr)
return;
const QJsonArray & v4lArray = config.array(); const QJsonObject & grabberConfig = config.object();
for ( signed idx=0; idx<v4lArray.size(); idx++)
{
#ifdef ENABLE_V4L2
const QJsonObject & grabberConfig = v4lArray.at(idx).toObject(); _v4l2Grabber = new V4L2Wrapper(
bool enableV4l = grabberConfig["enable"].toBool(true);
V4L2Wrapper* grabber = new V4L2Wrapper(
grabberConfig["device"].toString("auto"), grabberConfig["device"].toString("auto"),
parseVideoStandard(grabberConfig["standard"].toString("no-change")), parseVideoStandard(grabberConfig["standard"].toString("no-change")),
parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change")), parsePixelFormat(grabberConfig["pixelFormat"].toString("no-change")),
grabberConfig["sizeDecimation"].toInt(8) ); grabberConfig["sizeDecimation"].toInt(8) );
grabber->setSignalThreshold( _v4l2Grabber->setSignalThreshold(
grabberConfig["redSignalThreshold"].toDouble(0.0)/100.0, grabberConfig["redSignalThreshold"].toDouble(0.0)/100.0,
grabberConfig["greenSignalThreshold"].toDouble(0.0)/100.0, grabberConfig["greenSignalThreshold"].toDouble(0.0)/100.0,
grabberConfig["blueSignalThreshold"].toDouble(0.0)/100.0); grabberConfig["blueSignalThreshold"].toDouble(0.0)/100.0);
grabber->setCropping( _v4l2Grabber->setCropping(
grabberConfig["cropLeft"].toInt(0), grabberConfig["cropLeft"].toInt(0),
grabberConfig["cropRight"].toInt(0), grabberConfig["cropRight"].toInt(0),
grabberConfig["cropTop"].toInt(0), grabberConfig["cropTop"].toInt(0),
grabberConfig["cropBottom"].toInt(0)); grabberConfig["cropBottom"].toInt(0));
grabber->setSignalDetectionEnable(grabberConfig["signalDetection"].toBool(true)); _v4l2Grabber->setSignalDetectionEnable(grabberConfig["signalDetection"].toBool(true));
grabber->setSignalDetectionOffset( _v4l2Grabber->setSignalDetectionOffset(
grabberConfig["sDHOffsetMin"].toDouble(0.25), grabberConfig["sDHOffsetMin"].toDouble(0.25),
grabberConfig["sDVOffsetMin"].toDouble(0.25), grabberConfig["sDVOffsetMin"].toDouble(0.25),
grabberConfig["sDHOffsetMax"].toDouble(0.75), grabberConfig["sDHOffsetMax"].toDouble(0.75),
@ -423,17 +412,11 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
Debug(_log, "V4L2 grabber created"); Debug(_log, "V4L2 grabber created");
// connect to HyperionDaemon signal // connect to HyperionDaemon signal
connect(this, &HyperionDaemon::videoMode, grabber, &V4L2Wrapper::setVideoMode); connect(this, &HyperionDaemon::videoMode, _v4l2Grabber, &V4L2Wrapper::setVideoMode);
connect(this, &HyperionDaemon::settingsChanged, grabber, &V4L2Wrapper::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _v4l2Grabber, &V4L2Wrapper::handleSettingsUpdate);
#else
if (enableV4l) Error(_log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
v4lEnableCount++; #endif
_v4l2Grabbers.push_back(grabber);
#endif
}
ErrorIf( (v4lEnableCount>0 && _v4l2Grabbers.size()==0), _log, "The v4l2 grabber can not be instantiated, because it has been left out from the build");
} }
} }
@ -449,7 +432,7 @@ void HyperionDaemon::createGrabberDispmanx()
Info(_log, "DISPMANX frame grabber created"); Info(_log, "DISPMANX frame grabber created");
#else #else
Error( _log, "The dispmanx framegrabber can not be instantiated, because it has been left out from the build"); Error(_log, "The dispmanx framegrabber can not be instantiated, because it has been left out from the build");
#endif #endif
} }
@ -466,7 +449,7 @@ void HyperionDaemon::createGrabberAmlogic()
Info(_log, "AMLOGIC grabber created"); Info(_log, "AMLOGIC grabber created");
#else #else
Error( _log, "The AMLOGIC grabber can not be instantiated, because it has been left out from the build"); Error(_log, "The AMLOGIC grabber can not be instantiated, because it has been left out from the build");
#endif #endif
} }

View File

@ -56,7 +56,6 @@ class Hyperion;
class SysTray; class SysTray;
class JsonServer; class JsonServer;
class UDPListener; class UDPListener;
class Stats;
class BonjourBrowserWrapper; class BonjourBrowserWrapper;
class WebServer; class WebServer;
class SettingsManager; class SettingsManager;
@ -137,7 +136,7 @@ private:
WebServer* _webserver; WebServer* _webserver;
JsonServer* _jsonServer; JsonServer* _jsonServer;
UDPListener* _udpListener; UDPListener* _udpListener;
std::vector<V4L2Wrapper*> _v4l2Grabbers; V4L2Wrapper* _v4l2Grabber;
DispmanxWrapper* _dispmanx; DispmanxWrapper* _dispmanx;
X11Wrapper* _x11Grabber; X11Wrapper* _x11Grabber;
AmlogicWrapper* _amlGrabber; AmlogicWrapper* _amlGrabber;
@ -145,7 +144,6 @@ private:
OsxWrapper* _osxGrabber; OsxWrapper* _osxGrabber;
QtWrapper* _qtGrabber; QtWrapper* _qtGrabber;
Hyperion* _hyperion; Hyperion* _hyperion;
Stats* _stats;
SSDPHandler* _ssdp; SSDPHandler* _ssdp;
FlatBufferServer* _flatBufferServer; FlatBufferServer* _flatBufferServer;
ProtoServer* _protoServer; ProtoServer* _protoServer;