Merge pull request #6 from hyperion-project/master

merge
This commit is contained in:
b1rdhous3 2019-07-10 22:36:35 +02:00 committed by GitHub
commit 846ffb5955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 1264 additions and 1155 deletions

View File

@ -1,5 +1,11 @@
jobs: jobs:
######################
###### Linux #########
######################
- job: Linux - job: Linux
timeoutInMinutes: 120
pool: pool:
vmImage: 'ubuntu-16.04' vmImage: 'ubuntu-16.04'
strategy: strategy:
@ -7,9 +13,11 @@ jobs:
AMD64 (x64): AMD64 (x64):
dockerTag: 'amd64' dockerTag: 'amd64'
dockerName: 'Debian Stretch (AMD64)' dockerName: 'Debian Stretch (AMD64)'
platform: 'x11'
i386 (x86): i386 (x86):
dockerTag: 'i386' dockerTag: 'i386'
dockerName: 'Debian Stretch (i386)' dockerName: 'Debian Stretch (i386)'
platform: 'x11'
ARMv6hf (Raspberry Pi v1 & ZERO): ARMv6hf (Raspberry Pi v1 & ZERO):
dockerTag: 'armv6hf' dockerTag: 'armv6hf'
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)' dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
@ -22,27 +30,124 @@ jobs:
dockerTag: 'aarch64' dockerTag: 'aarch64'
dockerName: 'ARMv8 (Generic AARCH64)' dockerName: 'ARMv8 (Generic AARCH64)'
platform: 'amlogic' platform: 'amlogic'
steps: steps:
- checkout: self - checkout: self # represents the repo where the initial Pipelines YAML file was found
submodules: recursive submodules: recursive # set to 'recursive' to get submodules of submodules
# read channel tag in version.json
- task: oneLuckiDevJson2Variable@1
inputs:
jsonFile: 'version.json'
shouldPrefixVariables: true
variablePrefix: 'json'
displayName: 'Read and generate pipeline variables'
# build process
- bash: ./.ci/ci_build.sh - bash: ./.ci/ci_build.sh
displayName: 'Build $(dockerName)' displayName: 'Build $(dockerName) packages'
env: env:
DOCKER_TAG: $(dockerTag) DOCKER_TAG: $(dockerTag)
DOCKER_NAME: $(dockerName) DOCKER_NAME: $(dockerName)
PLATFORM: $(platform) PLATFORM: $(platform)
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload $(dockerName)' # copy files
- bash: 'cp -v deploy/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
workingDirectory: '$(Build.SourcesDirectory)'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Collecting deployable artifacts'
# publish artifacts
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: $(dockerTag)
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Publish deployables artifacts'
# set release to pre-release
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark beta as pre-release'
# create or update github release
- task: GithubRelease@0
inputs:
gitHubConnection: Hyperion.NG
repositoryName: $(Build.Repository.Name)
action: edit
target: $(Build.SourceVersion)
tagSource: manual
tag: $(Build.SourceBranchName)
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'
addChangeLog: false
isPreRelease: $(preRelease)
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Create/Update GitHub release
######################
###### macOS #########
######################
- job: macOS - job: macOS
timeoutInMinutes: 120
pool: pool:
vmImage: 'macOS-10.13' vmImage: 'macOS-10.13'
steps: steps:
- checkout: self - checkout: self # represents the repo where the initial Pipelines YAML file was found
submodules: recursive submodules: recursive # set to 'recursive' to get submodules of submodules
# read channel tag in version.json
- task: oneLuckiDevJson2Variable@1
inputs:
jsonFile: 'version.json'
shouldPrefixVariables: true
variablePrefix: 'json'
displayName: 'Read and generate pipeline variables'
# install dependencies
- bash: ./.ci/ci_install.sh - bash: ./.ci/ci_install.sh
displayName: 'Install dependencies' displayName: 'Install dependencies'
# build process
- bash: ./.ci/ci_build.sh - bash: ./.ci/ci_build.sh
displayName: 'Build macOS 10.13' displayName: 'Build macOS 10.13 packages'
- bash: ./.ci/ci_deploy.sh env:
displayName: 'Upload macOS 10.13' PLATFORM: 'osx'
# copy files
- bash: 'cp -v build/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
workingDirectory: '$(Build.SourcesDirectory)'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Collecting deployable artifacts'
# publish artifacts
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'macos'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Publish deployables artifacts'
# set release to pre-release
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark beta as pre-release'
# create or update github release
- task: GithubRelease@0
inputs:
gitHubConnection: Hyperion.NG
repositoryName: $(Build.Repository.Name)
action: edit
target: $(Build.SourceVersion)
tagSource: manual
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'
addChangeLog: false
isPreRelease: $(preRelease)
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Create/Update GitHub release

View File

@ -14,47 +14,26 @@ else
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi fi
# set environment variables # set environment variables if not exists
BUILD_TYPE="Debug" [ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Debug"
PACKAGES=""
[ -z "${PLATFORM}" ] && PLATFORM="x11"
# Detect number of processor cores # Determine cmake build type; tag builds are Release, else Debug (-dev appends to platform)
# default is 4 jobs if [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
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 BUILD_TYPE=Release
else
PLATFORM=${PLATFORM}-dev
fi fi
# Determine package creation; True for cron/schedule and tag builds # Build the package on osx or linux
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 if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
# compile prepare # compile prepare
mkdir build || exit 1 mkdir build || exit 1
mkdir ${CI_BUILD_DIR}/deploy || exit 1
cd build cd build
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2 cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ../ || exit 2
make -j ${JOBS} ${PACKAGES} || exit 3 make -j $(sysctl -n hw.ncpu) package || exit 3
echo "---> Copy binaries and packages to folder: ${CI_BUILD_DIR}/deploy" cd ${CI_BUILD_DIR} && source /${CI_BUILD_DIR}/test/testrunner.sh || exit 4
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; exit 0;
exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
elif [[ "$CI_NAME" == 'linux' ]]; then elif [[ "$CI_NAME" == 'linux' ]]; then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}" echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# take ownership of deploy dir # take ownership of deploy dir
@ -65,15 +44,15 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
-v "${CI_BUILD_DIR}/deploy:/deploy" \ -v "${CI_BUILD_DIR}/deploy:/deploy" \
-v "${CI_BUILD_DIR}:/source:ro" \ -v "${CI_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \ hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir build && cp -r source/. /build && /bin/bash -c "mkdir hyperion.ng && cp -r source/. /hyperion.ng &&
cd /build && mkdir build && cd build && cd /hyperion.ng && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 && cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDOCKER_PLATFORM=${DOCKER_TAG} ../ || exit 2 &&
make -j ${JOBS} ${PACKAGES} || exit 3 && make -j $(nproc) package || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${CI_BUILD_DIR}/deploy' && cp /hyperion.ng/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : && cp /hyperion.ng/build/Hyperion.NG-* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : && cd /hyperion.ng && source /hyperion.ng/test/testrunner.sh || exit 4 &&
exit 0; exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; } exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
# overwrite file owner to current user # overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" ${CI_BUILD_DIR}/deploy) ${CI_BUILD_DIR}/deploy sudo chown -fR $(stat -c "%U:%G" ${CI_BUILD_DIR}/deploy) ${CI_BUILD_DIR}/deploy

View File

@ -1,67 +0,0 @@
#!/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

View File

@ -24,11 +24,13 @@ jobs:
env: env:
- DOCKER_TAG=amd64 - DOCKER_TAG=amd64
- DOCKER_NAME="Debian Stretch (AMD64)" - DOCKER_NAME="Debian Stretch (AMD64)"
- PLATFORM="x11"
- <<: *linux - <<: *linux
name: "i386 (x86)" name: "i386 (x86)"
env: env:
- DOCKER_TAG=i386 - DOCKER_TAG=i386
- DOCKER_NAME="Debian Stretch (i386)" - DOCKER_NAME="Debian Stretch (i386)"
- PLATFORM="x11"
# //////////////////////////////////////////////////////////////// # ////////////////////////////////////////////////////////////////
# NOTE: Temporary disabled because travis timeouts # NOTE: Temporary disabled because travis timeouts
# //////////////////////////////////////////////////////////////// # ////////////////////////////////////////////////////////////////
@ -57,9 +59,8 @@ jobs:
name: "macOS 10.12 (Xcode 8.3.3)" name: "macOS 10.12 (Xcode 8.3.3)"
env: env:
- HOMEBREW_CACHE=$HOME/brew-cache - HOMEBREW_CACHE=$HOME/brew-cache
- PLATFORM="osx"
script: script:
- ./.ci/ci_build.sh - ./.ci/ci_build.sh
after_success:
- ./.ci/ci_deploy.sh

View File

@ -7,22 +7,56 @@ set(CMAKE_AUTOMOC ON)
# auto prepare .qrc files # auto prepare .qrc files
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
IF ( POLICY CMP0026 ) if ( POLICY CMP0026 )
CMAKE_POLICY( SET CMP0026 OLD ) CMAKE_POLICY( SET CMP0026 OLD )
ENDIF() endif()
# Configure CCache if available # Configure CCache if available
find_program(CCACHE_FOUND ccache) find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND) if ( CCACHE_FOUND )
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND) endif(CCACHE_FOUND)
SET ( HYPERION_VERSION_STABLE OFF ) find_package( PythonInterp 3.5 REQUIRED )
SET ( HYPERION_VERSION_MAJOR 2 )
SET ( HYPERION_VERSION_MINOR 0 )
SET ( HYPERION_VERSION_PATCH 0 )
# Read version from version.json
EXECUTE_PROCESS (
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_VERSION
)
SET( VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?" )
if ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${RETURN_VERSION} )
LIST( GET VERSION_PARTS 0 VERSION_MAJOR )
LIST( GET VERSION_PARTS 1 VERSION_MINOR )
LIST( GET VERSION_PARTS 2 VERSION_PATCH )
else ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()
SET( HYPERION_VERSION_MAJOR ${VERSION_MAJOR} )
SET( HYPERION_VERSION_MINOR ${VERSION_MINOR} )
SET( HYPERION_VERSION_PATCH ${VERSION_PATCH} )
# Read channel from version.json
EXECUTE_PROCESS (
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json "channel"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_CHANNEL
)
if ( error_code )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()
SET ( HYPERION_VERSION_CHANNEL ${RETURN_CHANNEL} )
# Set build variables
SET ( DEFAULT_AMLOGIC OFF ) SET ( DEFAULT_AMLOGIC OFF )
SET ( DEFAULT_DISPMANX OFF ) SET ( DEFAULT_DISPMANX OFF )
SET ( DEFAULT_OSX OFF ) SET ( DEFAULT_OSX OFF )
@ -46,14 +80,6 @@ ELSE()
SET ( DEFAULT_USB_HID OFF ) SET ( DEFAULT_USB_HID OFF )
ENDIF() ENDIF()
if (APPLE)
SET( PLATFORM "osx")
endif()
if (WIN32)
SET( PLATFORM "windows")
endif()
if ( NOT DEFINED PLATFORM ) if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" ) if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
SET( PLATFORM "x11") SET( PLATFORM "x11")
@ -66,6 +92,10 @@ if ( NOT DEFINED PLATFORM )
elseif ( ("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "odroid-c2" OR "${SYSTEM_CPUINFO}" MATCHES "vero4k") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 ) elseif ( ("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "odroid-c2" OR "${SYSTEM_CPUINFO}" MATCHES "vero4k") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
SET( PLATFORM "amlogic64" ) SET( PLATFORM "amlogic64" )
endif() endif()
elseif ( APPLE )
SET( PLATFORM "osx")
elseif ( WIN32 )
SET( PLATFORM "windows")
endif() endif()
if ( PLATFORM ) if ( PLATFORM )
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}") message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
@ -182,7 +212,7 @@ SET( JSON_FILES
${HYPERION_SCHEMAS} ${HYPERION_SCHEMAS}
) )
EXECUTE_PROCESS ( EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkjson.py ${JSON_FILES} COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkjson.py ${JSON_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CHECK_JSON_FAILED RESULT_VARIABLE CHECK_JSON_FAILED
) )
@ -191,7 +221,7 @@ IF ( ${CHECK_JSON_FAILED} )
ENDIF () ENDIF ()
EXECUTE_PROCESS ( EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkeffects.py effects effects/schema COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkeffects.py effects effects/schema
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CHECK_EFFECTS_FAILED RESULT_VARIABLE CHECK_EFFECTS_FAILED
) )
@ -199,6 +229,7 @@ IF ( ${CHECK_EFFECTS_FAILED} )
MESSAGE (FATAL_ERROR "check of json effect files failed" ) MESSAGE (FATAL_ERROR "check of json effect files failed" )
ENDIF () ENDIF ()
# for python 3 the checkschema.py file must be rewritten
EXECUTE_PROCESS ( EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkschema.py config/hyperion.config.json.default libsrc/hyperion/hyperion.schema.json COMMAND python test/jsonchecks/checkschema.py config/hyperion.config.json.default libsrc/hyperion/hyperion.schema.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
@ -340,3 +371,4 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_D
# enable make package - no code after this line ! # enable make package - no code after this line !
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake) include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)

View File

@ -1,24 +1,33 @@
# With Docker # With Docker
If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compilation for Raspberry Pi (Debian Stretch) If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compiling for Raspberry Pi (Debian Stretch or higher). To compile Hyperion just execute one of the following commands.
To compile Hyperion for Debain Stretch (x64 architecture) or higher just execute the following command The compiled binaries and packages will be available at the deploy folder next to the script
Note: call the script with `./docker-compile.sh -h` for more options
## Native compiling on Raspberry Pi
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t rpi-raspbian
```
## Cross compiling on X64_86 for:
**X64:**
``` ```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh
``` ```
To compile Hyperion for i386 architecture **i386:**
``` ```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386 wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386
``` ```
To compile Hyperion for Raspberry Pi v1 & ZERO **Raspberry Pi v1 & ZERO**
``` ```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf
``` ```
To compile Hyperion for Raspberry Pi 2 & 3 **Raspberry Pi 2 & 3**
``` ```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf
``` ```
The compiled binaries and packages will be available at the deploy folder next to the script
Note: call the script with `./docker-compile.sh -h` for more options
# The usual way # The usual way
@ -80,6 +89,8 @@ mkdir build
cd build cd build
cmake -DCMAKE_BUILD_TYPE=Release .. cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc) make -j $(nproc)
if this get stucked and dmseg says out of memory try:
make -j 2
# optional: install into your system # optional: install into your system
sudo make install/strip sudo make install/strip
# to uninstall (not very well tested, please keep that in mind) # to uninstall (not very well tested, please keep that in mind)

View File

@ -39,9 +39,10 @@
// the hyperion build id string // the hyperion build id string
#define HYPERION_BUILD_ID "${HYPERION_BUILD_ID}" #define HYPERION_BUILD_ID "${HYPERION_BUILD_ID}"
#define HYPERION_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}" #define HYPERION_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}"
#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}" #define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}"
#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}" #define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}" #define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION_CHANNEL "${HYPERION_VERSION_CHANNEL}"
#define HYPERION_JSON_VERSION "1.0.0" #define HYPERION_JSON_VERSION "1.0.0"

View File

@ -1,65 +1,47 @@
<p align="center"> ![Hyperion.NG](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/assets/webconfig/img/hyperion/hyperionlogo.png)
<img src="./assets/webconfig/img/hyperion/hyperionlogo.png" height="130">
</p>
<p align="center"> [![Dependencies](https://img.shields.io/librariesio/github/hyperion-project/hyperion.ng.svg)](https://github.com/hyperion-project/hyperion.ng/tree/master/dependencies/external)
<a href="https://www.hyperion-project.org" alt="Forum"> [![Azure-Pipeline](https://dev.azure.com/Hyperion-Project/Hyperion.NG/_apis/build/status/Hyperion.NG?branchName=master)](https://dev.azure.com/Hyperion-Project/Hyperion.NG/_build/latest?definitionId=7&branchName=master)
<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> [![Travis-CI](https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master)](https://travis-ci.org/hyperion-project/hyperion.ng)
<a href="https://github.com/hyperion-project/hyperion.ng/graphs/contributors" alt="Contributors"> [![LGTM](https://img.shields.io/lgtm/alerts/g/hyperion-project/hyperion.ng.svg)](https://lgtm.com/projects/g/hyperion-project/hyperion.ng/alerts/)
<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=7&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>
<p align="center">This is a pre alpha development repository for the next major version of hyperion</p> ## About Hyperion
-------- [Hyperion.NG](https://github.com/hyperion-project/hyperion.ng) is an opensource '[AmbiLight](https://de.wikipedia.org/wiki/Ambilight)' implementation with support for many LED devices and video grabbers. The project is still in a beta development stage (no stable release available).
## **Important notice!**
Hyperion.NG is under heavy development. This version is currently _only for development_ purpose. ![Screenshot](doc/screenshot.png)
Please do not use it for your 'productiv' setup!
If you want to use hyperion as 'normal user', please use [current stable version](https://github.com/hyperion-project/hyperion) ### Features:
Besides of that .... Feel free to join us! We are looking always for people who wants to participate.
--------
## About
Hyperion is an opensource 'AmbiLight' implementation with support for many LED devices and video grabbers.
The main features of Hyperion are:
* Low CPU load makes it perfect for SoCs like Raspberry Pi * Low CPU load makes it perfect for SoCs like Raspberry Pi
* Json interface which allows easy integration into scripts * Json interface which allows easy integration into scripts
* A command line utility to for testing and integration in automated environment * A command line utility to for testing and integration in automated environment
* Priority channels are not coupled to a specific led data provider which means that a provider can post led data and leave without the need to maintain a connection to Hyperion. This is ideal for a remote application (like our Android app). * Priority channels are not coupled to a specific led data provider which means that a provider can post led data and leave without the need to maintain a connection to Hyperion. This is ideal for a remote application (like our [Android app](https://play.google.com/store/apps/details?id=nl.hyperion.hyperionpro)).
* Black border detector. * Black border detector and processor
* A scriptable (Python) effect engine * A scriptable (Python) effect engine
* A web ui to configure and remote control hyperion * A multi language web interface to configure and remote control hyperion
More information can be found on the official Hyperion [Wiki](https://wiki.hyperion-project.org) If you need further support please open a topic at the forum!
[![Hyperion webpage/forum](https://img.shields.io/website/https/hyperion-project.org.svg?down_color=red&down_message=offline&up_color=green&up_message=online)](https://www.hyperion-project.org)
If you need further support please open a topic at the our new forum! ## Contributing
[Hyperion webpage/forum](https://www.hyperion-project.org).
Contributions are welcome! Feel free to join us! We are looking always for people who wants to participate.
[![Contributors](https://img.shields.io/github/contributors/hyperion-project/hyperion.ng.svg)](https://github.com/hyperion-project/hyperion.ng/graphs/contributors)
For an example, you can participate in the translation.
[![Join Translation](https://img.shields.io/badge/POEditor-translate-green.svg)](https://poeditor.com/join/project/Y4F6vHRFjA)
## Requirements ## Requirements
* Debian 9, Ubuntu 16.04 or higher. Windows is not supported currently. Debian 9, Ubuntu 16.04 or higher. Windows is not supported currently.
## Building ## Building
See [Compilehowto](CompileHowto.md) and [CrossCompileHowto](CrossCompileHowto.txt). See [CompileHowto](CompileHowto.md) and [CrossCompileHowto](CrossCompileHowto.txt).
## Download ## Download
A download isn't available, you need to compile your own version see "Building" **Please be patient. The first release is coming soon.**
## License ## License
The source is released under MIT-License (see http://opensource.org/licenses/MIT). The source is released under MIT-License (see http://opensource.org/licenses/MIT).
[![GitHub license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/LICENSE)

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ $(document).ready( function() {
// add more info // add more info
$('#dash_leddevice').html(window.serverInfo.ledDevices.active); $('#dash_leddevice').html(window.serverInfo.ledDevices.active);
$('#dash_currv').html(window.currentVersion); $('#dash_currv').html(window.currentChannel+' '+window.currentVersion);
$('#dash_instance').html(window.serverConfig.general.name); $('#dash_instance').html(window.serverConfig.general.name);
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port); $('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
$('#dash_versionbranch').html(window.serverConfig.general.versionBranch); $('#dash_versionbranch').html(window.serverConfig.general.versionBranch);

View File

@ -39,6 +39,7 @@ $(document).ready( function() {
window.sysInfo = event.response.info; window.sysInfo = event.response.info;
window.currentVersion = window.sysInfo.hyperion.version; window.currentVersion = window.sysInfo.hyperion.version;
window.currentChannel = window.sysInfo.hyperion.channel;
}); });
$(window.hyperion).one("cmd-config-getschema", function(event) { $(window.hyperion).one("cmd-config-getschema", function(event) {

View File

@ -193,10 +193,10 @@ function createClassicLeds(){
} }
} }
createLeftLeds();
createBottomLeds();
createRightLeds();
createTopLeds(); createTopLeds();
createRightLeds();
createBottomLeds();
createLeftLeds();
//check led gap pos //check led gap pos
if (ledsgpos+ledsglength > ledArray.length) if (ledsgpos+ledsglength > ledArray.length)
@ -429,6 +429,9 @@ $(document).ready(function() {
// create and update editor // create and update editor
$("#leddevices").off().on("change", function() { $("#leddevices").off().on("change", function() {
var generalOptions = window.serverSchema.properties.device; var generalOptions = window.serverSchema.properties.device;
// Modified schema enty "hardwareLedCount" in generalOptions to minimum LedCount
var specificOptions = window.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,

View File

@ -3,6 +3,7 @@ window.webPrio = 1;
window.webOrigin = "Web Configuration"; window.webOrigin = "Web Configuration";
window.showOptHelp = true; window.showOptHelp = true;
window.gitHubReleaseApiUrl = "https://api.github.com/repos/hyperion-project/hyperion.ng/releases"; window.gitHubReleaseApiUrl = "https://api.github.com/repos/hyperion-project/hyperion.ng/releases";
window.currentChannel = null;
window.currentVersion = null; window.currentVersion = null;
window.latestVersion = null; window.latestVersion = null;
window.latestStableVersion = null; window.latestStableVersion = null;

View File

@ -81,8 +81,8 @@ mkdir $SCRIPT_PATH/deploy >/dev/null 2>&1
# get Hyperion source, cleanup previous folder # get Hyperion source, cleanup previous folder
echo "---> Downloading Hyperion source code from ${GIT_REPO_URL}" echo "---> Downloading Hyperion source code from ${GIT_REPO_URL}"
sudo rm -fr $SCRIPT_PATH/hyperion >/dev/null 2>&1 sudo rm -fr $SCRIPT_PATH/hyperion.ng >/dev/null 2>&1
git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; } git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion.ng || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; }
# start compilation # start compilation
# Remove container after stop # Remove container after stop
@ -93,15 +93,15 @@ git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo
echo "---> Startup docker..." echo "---> Startup docker..."
$DOCKER run --rm \ $DOCKER run --rm \
-v "${SCRIPT_PATH}/deploy:/deploy" \ -v "${SCRIPT_PATH}/deploy:/deploy" \
-v "${SCRIPT_PATH}/hyperion:/source:ro" \ -v "${SCRIPT_PATH}/hyperion.ng:/source:ro" \
hyperionproject/hyperion-ci:$BUILD_TARGET \ hyperionproject/hyperion-ci:$BUILD_TARGET \
/bin/bash -c "mkdir build && cp -r /source/. /build && /bin/bash -c "mkdir hyperion.ng && cp -r /source/. /hyperion.ng &&
cd /build && mkdir build && cd build && cd /hyperion.ng && mkdir build && cd build &&
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 && cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j $(nproc) ${PACKAGES} || exit 3 && make -j $(nproc) ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${SCRIPT_PATH}/deploy' && echo '---> Copy binaries and packages to host folder: ${SCRIPT_PATH}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : && cp -v /hyperion.ng/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : && cp -v /hyperion.ng/build/Hyperion.NG-* /deploy/ 2>/dev/null || : &&
exit 0; exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; } exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }

View File

@ -7,4 +7,5 @@ STRING ( STRIP "${BUILD_ID}" BUILD_ID )
STRING ( STRIP "${VERSION_ID}" VERSION_ID ) STRING ( STRIP "${VERSION_ID}" VERSION_ID )
STRING ( STRIP "${GIT_REMOTE_PATH}" GIT_REMOTE_PATH ) STRING ( STRIP "${GIT_REMOTE_PATH}" GIT_REMOTE_PATH )
SET ( HYPERION_BUILD_ID "${VERSION_ID} (${BUILD_ID}) Git Remote: ${GIT_REMOTE_PATH}" ) SET ( HYPERION_BUILD_ID "${VERSION_ID} (${BUILD_ID}) Git Remote: ${GIT_REMOTE_PATH}" )
message ( STATUS "Current Version: ${HYPERION_BUILD_ID}" ) SET ( HYPERION_VERSION "${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}" )
message ( STATUS "Current Version: ${HYPERION_VERSION} (${HYPERION_BUILD_ID})" )

View File

@ -24,10 +24,16 @@ ENDIF()
# Apply to all packages, some of these can be overwritten with generator specific content # Apply to all packages, some of these can be overwritten with generator specific content
# https://cmake.org/cmake/help/v3.5/module/CPack.html # https://cmake.org/cmake/help/v3.5/module/CPack.html
SET ( CPACK_PACKAGE_NAME "Hyperion" ) SET ( CPACK_PACKAGE_NAME "Hyperion.NG" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an open source ambient light implementation" ) SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an open source ambient light implementation" )
SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" ) SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" )
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion-${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
if ( NOT DEFINED DOCKER_PLATFORM )
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
else()
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${DOCKER_PLATFORM}")
endif()
SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org") SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org")
SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" ) SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" )
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png") SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png")

View File

@ -33,7 +33,7 @@
"output" : "/dev/null", "output" : "/dev/null",
"rate" : 1000000, "rate" : 1000000,
"colorOrder" : "rgb", "colorOrder" : "rgb",
"rewriteTime": 0 "rewriteTime": 5000
}, },
/// Color manipulation configuration used to tune the output colors to specific surroundings. /// Color manipulation configuration used to tune the output colors to specific surroundings.

BIN
doc/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

View File

@ -6,7 +6,7 @@
#include <utils/Components.h> #include <utils/Components.h>
#include <hyperion/Hyperion.h> #include <hyperion/Hyperion.h>
// qt includess // qt includes
#include <QJsonObject> #include <QJsonObject>
#include <QMutex> #include <QMutex>
#include <QString> #include <QString>
@ -63,8 +63,8 @@ private:
// true if further callbacks are forbidden (http) // true if further callbacks are forbidden (http)
bool _noListener; bool _noListener;
/// The peer address of the client /// The peer address of the client
QString _peerAddress; QString _peerAddress;
/// Log instance /// Log instance
Logger* _log; Logger* _log;
@ -86,7 +86,7 @@ private:
/// mutex to determine state of image streaming /// mutex to determine state of image streaming
QMutex _image_stream_mutex; QMutex _image_stream_mutex;
/// mutex to determine state of image streaming /// mutex to determine state of led streaming
QMutex _led_stream_mutex; QMutex _led_stream_mutex;
/// timeout for live video refresh /// timeout for live video refresh

View File

@ -15,13 +15,13 @@ class Option: public QCommandLineOption
public: public:
Option(const QString &name, Option(const QString &name,
const QString &description = QString(), const QString &description = QString(),
const QString &valueName = QString::null, const QString &valueName = QString(),
const QString &defaultValue = QString() const QString &defaultValue = QString()
); );
Option(const QStringList &names, Option(const QStringList &names,
const QString &description = QString(), const QString &description = QString(),
const QString &valueName = QString::null, const QString &valueName = QString(),
const QString &defaultValue = QString() const QString &defaultValue = QString()
); );

View File

@ -5,7 +5,6 @@
#include <QMap> #include <QMap>
// QT includes // QT includes
//#include <QObject>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QSize> #include <QSize>
@ -13,6 +12,7 @@
#include <QJsonValue> #include <QJsonValue>
#include <QJsonArray> #include <QJsonArray>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QMutex>
// hyperion-utils includes // hyperion-utils includes
#include <utils/Image.h> #include <utils/Image.h>
@ -410,8 +410,11 @@ signals:
/// Signal which is emitted, when a new json message should be forwarded /// Signal which is emitted, when a new json message should be forwarded
void forwardJsonMessage(QJsonObject); void forwardJsonMessage(QJsonObject);
/// Signal which is emitted, when a new proto image should be forwarded /// Signal which is emitted, when a new system proto image should be forwarded
void forwardProtoMessage(const QString, const Image<ColorRgb>); void forwardSystemProtoMessage(const QString, const Image<ColorRgb>);
/// Signal which is emitted, when a new V4l proto image should be forwarded
void forwardV4lProtoMessage(const QString, const Image<ColorRgb>);
/// ///
/// @brief Is emitted from clients who request a videoMode change /// @brief Is emitted from clients who request a videoMode change
@ -560,12 +563,12 @@ private:
/// Capture control for Daemon native capture /// Capture control for Daemon native capture
CaptureCont* _captureCont; CaptureCont* _captureCont;
// lock Hyperion::update() for exec
bool _lockUpdate = false;
/// buffer for leds (with adjustment) /// buffer for leds (with adjustment)
std::vector<ColorRgb> _ledBuffer; std::vector<ColorRgb> _ledBuffer;
/// Boblight instance /// Boblight instance
BoblightServer* _boblightServer; BoblightServer* _boblightServer;
/// mutex
QMutex _changes;
}; };

View File

@ -150,7 +150,7 @@ public:
// Check black border detection // Check black border detection
verifyBorder(image); verifyBorder(image);
// Determine the mean-colors of each led (using the existing mapping) // Determine the mean or uni colors of each led (using the existing mapping)
switch (_mappingType) switch (_mappingType)
{ {
case 1: _imageToLeds->getUniLedColor(image, ledColors); break; case 1: _imageToLeds->getUniLedColor(image, ledColors); break;

View File

@ -61,7 +61,7 @@ namespace hyperion
unsigned verticalBorder() { 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
/// at construction. /// at construction.
/// ///
/// @param[in] image The image from which to extract the led colors /// @param[in] image The image from which to extract the led colors
@ -104,7 +104,7 @@ namespace hyperion
} }
/// ///
/// Determines the mean-color for each led using the mapping the image given /// Determines the uni color for each led using the mapping the image given
/// at construction. /// at construction.
/// ///
/// @param[in] image The image from which to extract the led colors /// @param[in] image The image from which to extract the led colors
@ -120,7 +120,7 @@ namespace hyperion
} }
/// ///
/// Determines the mean color for each led using the mapping the image given /// Determines the uni color for each led using the mapping the image given
/// at construction. /// at construction.
/// ///
/// @param[in] image The image from which to extract the led colors /// @param[in] image The image from which to extract the led colors

View File

@ -84,6 +84,14 @@ signals:
/// ///
void enableStateChanged(bool newState); void enableStateChanged(bool newState);
///
/// PIPER signal for Priority Muxer -> LedDevice
///
/// @brief Handle priority updates from Priority Muxer
/// @param priority The new visible priority
///
void visiblePriorityChanged(const quint8 &priority);
protected: protected:
virtual bool init(const QJsonObject &deviceConfig); virtual bool init(const QJsonObject &deviceConfig);

View File

@ -117,25 +117,25 @@ private:
void updateBrightnessComponents(); void updateBrightnessComponents();
/// backlight variables /// backlight variables
bool _backLightEnabled; bool _backLightEnabled
bool _backlightColored; , _backlightColored;
double _backlightThreshold; double _backlightThreshold
double _sumBrightnessLow; , _sumBrightnessLow;
/// gamma variables /// gamma variables
double _gammaR; double _gammaR
double _gammaG; , _gammaG
double _gammaB; , _gammaB;
/// The mapping from input color to output color /// The mapping from input color to output color
uint8_t _mappingR[256]; uint8_t _mappingR[256]
uint8_t _mappingG[256]; , _mappingG[256]
uint8_t _mappingB[256]; , _mappingB[256];
/// brightness variables /// brightness variables
uint8_t _brightness; uint8_t _brightness
uint8_t _brightnessCompensation; , _brightnessCompensation
uint8_t _brightness_rgb; , _brightness_rgb
uint8_t _brightness_cmy; , _brightness_cmy
uint8_t _brightness_w; , _brightness_w;
}; };

View File

@ -40,12 +40,12 @@ namespace hyperion {
(uint8_t)FGCONFIG_ARRAY.at(2).toInt(0) (uint8_t)FGCONFIG_ARRAY.at(2).toInt(0)
}; };
hyperion->setColor(FG_PRIORITY, fg_color, fg_duration_ms); hyperion->setColor(FG_PRIORITY, fg_color, fg_duration_ms);
Info(Logger::getInstance("HYPERION"),"Inital foreground color set (%d %d %d)",fg_color.red,fg_color.green,fg_color.blue); Info(Logger::getInstance("HYPERION"),"Initial foreground color set (%d %d %d)",fg_color.red,fg_color.green,fg_color.blue);
} }
else else
{ {
int result = hyperion->setEffect(fgEffectConfig, FG_PRIORITY, fg_duration_ms); int result = hyperion->setEffect(fgEffectConfig, FG_PRIORITY, fg_duration_ms);
Info(Logger::getInstance("HYPERION"),"Inital foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed")); Info(Logger::getInstance("HYPERION"),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed"));
} }
} }
#undef FGCONFIG_ARRAY #undef FGCONFIG_ARRAY

View File

@ -248,6 +248,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject&, const QString& command, c
QJsonObject hyperion; QJsonObject hyperion;
hyperion["jsonrpc_version" ] = QString(HYPERION_JSON_VERSION); hyperion["jsonrpc_version" ] = QString(HYPERION_JSON_VERSION);
hyperion["version" ] = QString(HYPERION_VERSION); hyperion["version" ] = QString(HYPERION_VERSION);
hyperion["channel" ] = QString(HYPERION_VERSION_CHANNEL);
hyperion["build" ] = QString(HYPERION_BUILD_ID); hyperion["build" ] = QString(HYPERION_BUILD_ID);
hyperion["time" ] = QString(__DATE__ " " __TIME__); hyperion["time" ] = QString(__DATE__ " " __TIME__);
hyperion["id" ] = _hyperion->getId(); hyperion["id" ] = _hyperion->getId();

View File

@ -30,7 +30,6 @@ EffectEngine::EffectEngine(Hyperion * hyperion)
{ {
Q_INIT_RESOURCE(EffectEngine); Q_INIT_RESOURCE(EffectEngine);
qRegisterMetaType<std::vector<ColorRgb>>("std::vector<ColorRgb>");
qRegisterMetaType<hyperion::Components>("hyperion::Components"); qRegisterMetaType<hyperion::Components>("hyperion::Components");
// connect the Hyperion channel clear feedback // connect the Hyperion channel clear feedback

View File

@ -246,7 +246,7 @@ void EffectFileHandler::updateEffects()
// collect effect schemas // collect effect schemas
efxCount = 0; efxCount = 0;
directory = path.endsWith("/") ? (path + "schema/") : (path + "/schema/"); directory.setPath(path.endsWith("/") ? (path + "schema/") : (path + "/schema/"));
QStringList pynames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase); QStringList pynames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
for (const QString & pyname : pynames) for (const QString & pyname : pynames)
{ {

View File

@ -13,9 +13,11 @@ CaptureCont::CaptureCont(Hyperion* hyperion)
: QObject() : QObject()
, _hyperion(hyperion) , _hyperion(hyperion)
, _systemCaptEnabled(false) , _systemCaptEnabled(false)
, _systemCaptPrio(0)
, _systemCaptName() , _systemCaptName()
, _systemInactiveTimer(new QTimer(this)) , _systemInactiveTimer(new QTimer(this))
, _v4lCaptEnabled(false) , _v4lCaptEnabled(false)
, _v4lCaptPrio(0)
, _v4lCaptName() , _v4lCaptName()
, _v4lInactiveTimer(new QTimer(this)) , _v4lInactiveTimer(new QTimer(this))
{ {
@ -73,7 +75,7 @@ void CaptureCont::setSystemCaptureEnable(const bool& enable)
{ {
_hyperion->registerInput(_systemCaptPrio, hyperion::COMP_GRABBER); _hyperion->registerInput(_systemCaptPrio, hyperion::COMP_GRABBER);
connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, this, &CaptureCont::handleSystemImage); connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, this, &CaptureCont::handleSystemImage);
connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, _hyperion, &Hyperion::forwardProtoMessage); connect(GlobalSignals::getInstance(), &GlobalSignals::setSystemImage, _hyperion, &Hyperion::forwardSystemProtoMessage);
} }
else else
{ {
@ -94,7 +96,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::setV4lImage, _hyperion, &Hyperion::forwardProtoMessage); connect(GlobalSignals::getInstance(), &GlobalSignals::setV4lImage, _hyperion, &Hyperion::forwardV4lProtoMessage);
} }
else else
{ {

View File

@ -106,9 +106,6 @@ Hyperion::Hyperion(HyperionDaemon* daemon, const quint8& instance, const QString
_ledStringColorOrder.insert(_ledStringColorOrder.begin() + led.index, led.colorOrder); _ledStringColorOrder.insert(_ledStringColorOrder.begin() + led.index, led.colorOrder);
} }
// connect Hyperion::update with Muxer visible priority changes as muxer updates independent
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::update);
// listens for ComponentRegister changes of COMP_ALL to perform core enable/disable actions // listens for ComponentRegister changes of COMP_ALL to perform core enable/disable actions
connect(&_componentRegister, &ComponentRegister::updatedComponentState, this, &Hyperion::updatedComponentState); connect(&_componentRegister, &ComponentRegister::updatedComponentState, this, &Hyperion::updatedComponentState);
@ -186,7 +183,6 @@ void Hyperion::freeObjects(bool emitCloseSignal)
delete _boblightServer; delete _boblightServer;
delete _captureCont; delete _captureCont;
delete _effectEngine; delete _effectEngine;
//delete _deviceSmooth;
delete _raw2ledAdjustment; delete _raw2ledAdjustment;
delete _messageForwarder; delete _messageForwarder;
delete _settingsManager; delete _settingsManager;
@ -209,10 +205,13 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
} }
else if(type == settings::LEDS) else if(type == settings::LEDS)
{ {
QMutexLocker lock(&_changes);
const QJsonArray leds = config.array(); const QJsonArray leds = config.array();
// lock update() // // lock update()
_lockUpdate = true; // _lockUpdate = true;
// stop and cache all running effects, as effects depend heavily on ledlayout // stop and cache all running effects, as effects depend heavily on ledlayout
_effectEngine->cacheRunningEffects(); _effectEngine->cacheRunningEffects();
@ -249,12 +248,13 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
// start cached effects // start cached effects
_effectEngine->startCachedEffects(); _effectEngine->startCachedEffects();
// unlock // // unlock
_lockUpdate = false; // _lockUpdate = false;
} }
else if(type == settings::DEVICE) else if(type == settings::DEVICE)
{ {
_lockUpdate = true; QMutexLocker lock(&_changes);
// _lockUpdate = true;
QJsonObject dev = config.object(); QJsonObject dev = config.object();
// handle hwLedCount update // handle hwLedCount update
@ -278,7 +278,7 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
// do always reinit until the led devices can handle dynamic changes // do always reinit until the led devices can handle dynamic changes
dev["currentLedCount"] = int(_hwLedCount); // Inject led count info dev["currentLedCount"] = int(_hwLedCount); // Inject led count info
_ledDeviceWrapper->createLedDevice(dev); _ledDeviceWrapper->createLedDevice(dev);
_lockUpdate = false; // _lockUpdate = false;
} }
// update once to push single color sets / adjustments/ ledlayout resizes and update ledBuffer color // update once to push single color sets / adjustments/ ledlayout resizes and update ledBuffer color
update(); update();
@ -562,66 +562,42 @@ const QString & Hyperion::getActiveDevice()
void Hyperion::updatedComponentState(const hyperion::Components comp, const bool state) void Hyperion::updatedComponentState(const hyperion::Components comp, const bool state)
{ {
if(comp == hyperion::COMP_ALL) QMutexLocker lock(&_changes);
// evaluate comp change
if (comp != _prevCompId)
{ {
if(state) _imageProcessor->setBlackbarDetectDisable((_prevCompId == hyperion::COMP_EFFECT));
{ _imageProcessor->setHardLedMappingType((_prevCompId == hyperion::COMP_EFFECT) ? 0 : -1);
// first muxer to update all inputs _prevCompId = comp;
_muxer.setEnable(state); _raw2ledAdjustment->setBacklightEnabled((_prevCompId != hyperion::COMP_COLOR && _prevCompId != hyperion::COMP_EFFECT));
}
else
{
_muxer.setEnable(state);
}
} }
if(comp == hyperion::COMP_ALL)
_muxer.setEnable(state); // first muxer to update all inputs
} }
void Hyperion::update() void Hyperion::update()
{ {
if(_lockUpdate) QMutexLocker lock(&_changes);
return;
// the ledbuffer resize for hwledcount needs to be reverted
if(_hwLedCount > _ledBuffer.size())
_ledBuffer.resize(getLedCount());
// Obtain the current priority channel // Obtain the current priority channel
int priority = _muxer.getCurrentPriority(); int priority = _muxer.getCurrentPriority();
const PriorityMuxer::InputInfo priorityInfo = _muxer.getInputInfo(priority); const PriorityMuxer::InputInfo priorityInfo = _muxer.getInputInfo(priority);
// eval comp change
bool compChanged = false;
if (priorityInfo.componentId != _prevCompId)
{
compChanged = true;
_prevCompId = priorityInfo.componentId;
}
// copy image & process OR copy ledColors from muxer // copy image & process OR copy ledColors from muxer
Image<ColorRgb> image = priorityInfo.image; Image<ColorRgb> image = priorityInfo.image;
if(image.size() > 3) if(image.size() > 3)
{ {
emit currentImage(image); emit currentImage(image);
// disable the black border detector for effects and ledmapping to 0 _ledBuffer = _imageProcessor->process(image);
if(compChanged)
{
_imageProcessor->setBlackbarDetectDisable((_prevCompId == hyperion::COMP_EFFECT));
_imageProcessor->setHardLedMappingType((_prevCompId == hyperion::COMP_EFFECT) ? 0 : -1);
}
_imageProcessor->process(image, _ledBuffer);
} }
else else
{
_ledBuffer = priorityInfo.ledColors; _ledBuffer = priorityInfo.ledColors;
}
// emit rawLedColors before transform // emit rawLedColors before transform
emit rawLedColors(_ledBuffer); emit rawLedColors(_ledBuffer);
// apply adjustments
if(compChanged)
_raw2ledAdjustment->setBacklightEnabled((_prevCompId != hyperion::COMP_COLOR && _prevCompId != hyperion::COMP_EFFECT));
_raw2ledAdjustment->applyAdjustment(_ledBuffer); _raw2ledAdjustment->applyAdjustment(_ledBuffer);
// insert cloned leds into buffer // insert cloned leds into buffer
@ -660,7 +636,8 @@ void Hyperion::update()
} }
i++; i++;
} }
// fill aditional hw leds with black
// fill additional hw leds with black
if ( _hwLedCount > _ledBuffer.size() ) if ( _hwLedCount > _ledBuffer.size() )
{ {
_ledBuffer.resize(_hwLedCount, ColorRgb::BLACK); _ledBuffer.resize(_hwLedCount, ColorRgb::BLACK);
@ -671,7 +648,7 @@ void Hyperion::update()
{ {
_deviceSmooth->selectConfig(priorityInfo.smooth_cfg); _deviceSmooth->selectConfig(priorityInfo.smooth_cfg);
// feed smoothing in pause mode to maintain a smooth transistion back to smoth mode // feed smoothing in pause mode to maintain a smooth transistion back to smooth mode
if (_deviceSmooth->enabled() || _deviceSmooth->pause()) if (_deviceSmooth->enabled() || _deviceSmooth->pause())
_deviceSmooth->setLedValues(_ledBuffer); _deviceSmooth->setLedValues(_ledBuffer);

View File

@ -3,7 +3,6 @@
// STL includes // STL includes
#include <vector> #include <vector>
// Qt includes // Qt includes
#include <QVector> #include <QVector>

View File

@ -83,9 +83,12 @@ void MessageForwarder::handleSettingsUpdate(const settings::type &type, const QJ
if (!_protoSlaves.isEmpty() && obj["enable"].toBool() && _forwarder_enabled) if (!_protoSlaves.isEmpty() && obj["enable"].toBool() && _forwarder_enabled)
{ {
InfoIf(obj["enable"].toBool(true), _log, "Forward now to proto targets '%s'", QSTRING_CSTR(_protoSlaves.join(", "))); InfoIf(obj["enable"].toBool(true), _log, "Forward now to proto targets '%s'", QSTRING_CSTR(_protoSlaves.join(", ")));
connect(_hyperion, &Hyperion::forwardProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection); // connect(_hyperion, &Hyperion::forwardProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
} else if ( _protoSlaves.isEmpty() || ! obj["enable"].toBool() || !_forwarder_enabled) } else if ( _protoSlaves.isEmpty() || ! obj["enable"].toBool() || !_forwarder_enabled)
disconnect(_hyperion, &Hyperion::forwardProtoMessage, 0, 0); {
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
}
// update comp state // update comp state
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_FORWARDER, obj["enable"].toBool(true)); _hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_FORWARDER, obj["enable"].toBool(true));
@ -112,8 +115,8 @@ void MessageForwarder::handlePriorityChanges(const quint8 &priority)
while (!_forwardClients.isEmpty()) while (!_forwardClients.isEmpty())
delete _forwardClients.takeFirst(); delete _forwardClients.takeFirst();
hyperion::Components activePrio = _hyperion->getPriorityInfo(priority).componentId; hyperion::Components activeCompId = _hyperion->getPriorityInfo(priority).componentId;
if (activePrio == hyperion::COMP_GRABBER || activePrio == hyperion::COMP_V4L) if (activeCompId == hyperion::COMP_GRABBER || activeCompId == hyperion::COMP_V4L)
{ {
if ( !obj["proto"].isNull() ) if ( !obj["proto"].isNull() )
{ {
@ -123,10 +126,33 @@ void MessageForwarder::handlePriorityChanges(const quint8 &priority)
addProtoSlave(entry.toString()); addProtoSlave(entry.toString());
} }
} }
connect(_hyperion, &Hyperion::forwardProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
switch(activeCompId)
{
case hyperion::COMP_GRABBER:
{
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
connect(_hyperion, &Hyperion::forwardSystemProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
}
break;
case hyperion::COMP_V4L:
{
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
connect(_hyperion, &Hyperion::forwardV4lProtoMessage, this, &MessageForwarder::forwardProtoMessage, Qt::UniqueConnection);
}
break;
default:
{
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
}
}
} }
else else
disconnect(_hyperion, &Hyperion::forwardProtoMessage, 0, 0); {
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
}
} }
} }

View File

@ -106,7 +106,7 @@ void MultiColorAdjustment::applyAdjustment(std::vector<ColorRgb>& ledColors)
uint8_t ored = color.red; uint8_t ored = color.red;
uint8_t ogreen = color.green; uint8_t ogreen = color.green;
uint8_t oblue = color.blue; uint8_t oblue = color.blue;
uint8_t B_RGB, B_CMY, B_W; uint8_t B_RGB = 0, B_CMY = 0, B_W = 0;
adjustment->_rgbTransform.transform(ored,ogreen,oblue); adjustment->_rgbTransform.transform(ored,ogreen,oblue);
adjustment->_rgbTransform.getBrightnessComponents(B_RGB, B_CMY, B_W); adjustment->_rgbTransform.getBrightnessComponents(B_RGB, B_CMY, B_W);

View File

@ -10,6 +10,8 @@
#include "hyperion/Hyperion.h" #include "hyperion/Hyperion.h"
#include <utils/JsonUtils.h> #include <utils/JsonUtils.h>
#include <QDebug>
LedDevice::LedDevice(const QJsonObject& config, QObject* parent) LedDevice::LedDevice(const QJsonObject& config, QObject* parent)
: QObject(parent) : QObject(parent)
, _devConfig(config) , _devConfig(config)
@ -43,21 +45,12 @@ void LedDevice::setEnable(bool enable)
{ {
// emit signal when state changed // emit signal when state changed
if (_enabled != enable) if (_enabled != enable)
{
emit enableStateChanged(enable); emit enableStateChanged(enable);
}
// set black to leds when they should go off // set black to leds when they should go off
if ( _enabled && !enable) if ( _enabled && !enable)
{
switchOff(); switchOff();
}
else {
if ( !_enabled && enable)
{
switchOn();
}
}
_enabled = enable; _enabled = enable;
} }

View File

@ -41,25 +41,26 @@ LedDeviceWrapper::~LedDeviceWrapper()
void LedDeviceWrapper::createLedDevice(const QJsonObject& config) void LedDeviceWrapper::createLedDevice(const QJsonObject& config)
{ {
if(_ledDevice != nullptr) if(_ledDevice != nullptr)
{ {
stopDeviceThread(); stopDeviceThread();
} }
// create thread and device // create thread and device
QThread* thread = new QThread(this); QThread* thread = new QThread(this);
_ledDevice = LedDeviceFactory::construct(config); _ledDevice = LedDeviceFactory::construct(config);
_ledDevice->moveToThread(thread); _ledDevice->moveToThread(thread);
// setup thread management // setup thread management
connect(thread, &QThread::started, _ledDevice, &LedDevice::start); connect(thread, &QThread::started, _ledDevice, &LedDevice::start);
connect(thread, &QThread::finished, thread, &QObject::deleteLater); connect(thread, &QThread::finished, thread, &QThread::deleteLater);
connect(thread, &QThread::finished, _ledDevice, &QObject::deleteLater); connect(thread, &QThread::finished, _ledDevice, &LedDevice::deleteLater);
// further signals // further signals
connect(this, &LedDeviceWrapper::write, _ledDevice, &LedDevice::write); connect(this, &LedDeviceWrapper::write, _ledDevice, &LedDevice::write, Qt::QueuedConnection);
connect(_ledDevice, &LedDevice::enableStateChanged, this, &LedDeviceWrapper::handleInternalEnableState); connect(_hyperion->getMuxerInstance(), &PriorityMuxer::visiblePriorityChanged, _ledDevice, &LedDevice::visiblePriorityChanged, Qt::QueuedConnection);
connect(_ledDevice, &LedDevice::enableStateChanged, this, &LedDeviceWrapper::handleInternalEnableState, Qt::QueuedConnection);
// start the thread // start the thread
thread->start(); thread->start();
} }
const QJsonObject LedDeviceWrapper::getLedDeviceSchemas() const QJsonObject LedDeviceWrapper::getLedDeviceSchemas()
@ -142,9 +143,17 @@ void LedDeviceWrapper::handleInternalEnableState(bool newState)
void LedDeviceWrapper::stopDeviceThread() void LedDeviceWrapper::stopDeviceThread()
{ {
// turns the leds off
_ledDevice->switchOff(); _ledDevice->switchOff();
// get current thread
QThread* oldThread = _ledDevice->thread(); QThread* oldThread = _ledDevice->thread();
delete _ledDevice; // fast desctruction disconnect(oldThread, 0, 0, 0);
oldThread->quit(); // non blocking oldThread->quit();
oldThread->wait(); oldThread->wait();
delete oldThread;
disconnect(_ledDevice, 0, 0, 0);
delete _ledDevice;
_ledDevice = nullptr;
} }

View File

@ -5,17 +5,17 @@ static const unsigned OPC_SET_PIXELS = 0; // OPC command codes
static const unsigned OPC_SYS_EX = 255; // OPC command codes static const unsigned OPC_SYS_EX = 255; // OPC command codes
static const unsigned OPC_HEADER_SIZE = 4; // OPC header size static const unsigned OPC_HEADER_SIZE = 4; // OPC header size
LedDeviceFadeCandy::LedDeviceFadeCandy(const QJsonObject &deviceConfig) LedDeviceFadeCandy::LedDeviceFadeCandy(const QJsonObject &deviceConfig)
: LedDevice() : LedDevice()
, _client(nullptr)
{ {
_deviceReady = init(deviceConfig); _deviceReady = init(deviceConfig);
_client = new QTcpSocket(this);
} }
LedDeviceFadeCandy::~LedDeviceFadeCandy() LedDeviceFadeCandy::~LedDeviceFadeCandy()
{ {
_client.close(); _client->close();
} }
LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig) LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
@ -23,10 +23,9 @@ LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
return new LedDeviceFadeCandy(deviceConfig); return new LedDeviceFadeCandy(deviceConfig);
} }
bool LedDeviceFadeCandy::init(const QJsonObject &deviceConfig) bool LedDeviceFadeCandy::init(const QJsonObject &deviceConfig)
{ {
_client.close(); LedDevice::init(deviceConfig);
if (_ledCount > MAX_NUM_LEDS) if (_ledCount > MAX_NUM_LEDS)
{ {
@ -67,15 +66,14 @@ bool LedDeviceFadeCandy::init(const QJsonObject &deviceConfig)
bool LedDeviceFadeCandy::isConnected() bool LedDeviceFadeCandy::isConnected()
{ {
return _client.state() == QAbstractSocket::ConnectedState; return _client->state() == QAbstractSocket::ConnectedState;
} }
bool LedDeviceFadeCandy::tryConnect() bool LedDeviceFadeCandy::tryConnect()
{ {
if ( _client.state() == QAbstractSocket::UnconnectedState ) { if ( _client->state() == QAbstractSocket::UnconnectedState ) {
_client.connectToHost( _host, _port); _client->connectToHost( _host, _port);
if ( _client.waitForConnected(1000) ) if ( _client->waitForConnected(1000) )
{ {
Info(_log,"fadecandy/opc: connected to %s:%i on channel %i", QSTRING_CSTR(_host), _port, _channel); Info(_log,"fadecandy/opc: connected to %s:%i on channel %i", QSTRING_CSTR(_host), _port, _channel);
if (_setFcConfig) if (_setFcConfig)
@ -88,7 +86,6 @@ bool LedDeviceFadeCandy::tryConnect()
return isConnected(); return isConnected();
} }
int LedDeviceFadeCandy::write( const std::vector<ColorRgb> & ledValues ) int LedDeviceFadeCandy::write( const std::vector<ColorRgb> & ledValues )
{ {
uint idx = OPC_HEADER_SIZE; uint idx = OPC_HEADER_SIZE;
@ -103,11 +100,11 @@ int LedDeviceFadeCandy::write( const std::vector<ColorRgb> & ledValues )
return ( transferData()<0 ? -1 : 0 ); return ( transferData()<0 ? -1 : 0 );
} }
int LedDeviceFadeCandy::transferData() int LedDeviceFadeCandy::transferData()
{ {
if ( isConnected() || tryConnect() ) if (LedDevice::enabled())
return _client.write( _opc_data, _opc_data.size() ); if ( isConnected() || tryConnect() )
return _client->write( _opc_data, _opc_data.size() );
return -2; return -2;
} }
@ -131,7 +128,7 @@ int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArra
sysExData += msg; sysExData += msg;
return _client.write( sysExData, sysExData.size() ); return _client->write( sysExData, sysExData.size() );
} }
return -1; return -1;
} }

View File

@ -56,17 +56,18 @@ public:
/// @return true if success /// @return true if success
bool init(const QJsonObject &deviceConfig); bool init(const QJsonObject &deviceConfig);
private:
/// ///
/// Writes the led color values to the led-device /// Writes the led color values to the led-device
/// ///
/// @param ledValues The color-value per led /// @param ledValues The color-value per led
/// @return Zero on succes else negative /// @return Zero on succes else negative
/// ///
virtual int write(const std::vector<ColorRgb> & ledValues); virtual int write(const std::vector<ColorRgb>& ledValues);
private: protected:
QTcpSocket _client; QTcpSocket* _client;
QString _host; QString _host;
uint16_t _port; uint16_t _port;
unsigned _channel; unsigned _channel;
QByteArray _opc_data; QByteArray _opc_data;

View File

@ -125,7 +125,7 @@ float CiColor::getDistanceBetweenTwoPoints(CiColor p1, CiColor p2)
PhilipsHueBridge::PhilipsHueBridge(Logger* log, QString host, QString username) PhilipsHueBridge::PhilipsHueBridge(Logger* log, QString host, QString username)
: QObject() : QObject()
, log(log) , _log(log)
, host(host) , host(host)
, username(username) , username(username)
{ {
@ -141,12 +141,12 @@ void PhilipsHueBridge::bConnect(void)
{ {
if(username.isEmpty() || host.isEmpty()) if(username.isEmpty() || host.isEmpty())
{ {
Error(log,"Username or IP Address is empty!"); Error(_log,"Username or IP Address is empty!");
} }
else else
{ {
QString url = QString("http://%1/api/%2").arg(host).arg(username); QString url = QString("http://%1/api/%2").arg(host).arg(username);
Debug(log, "Connect to bridge %s", QSTRING_CSTR(url)); Debug(_log, "Connect to bridge %s", QSTRING_CSTR(url));
QNetworkRequest request(url); QNetworkRequest request(url);
manager.get(request); manager.get(request);
@ -164,13 +164,13 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
QJsonDocument doc = QJsonDocument::fromJson(response, &error); QJsonDocument doc = QJsonDocument::fromJson(response, &error);
if (error.error != QJsonParseError::NoError) if (error.error != QJsonParseError::NoError)
{ {
Error(log, "Got invalid response from bridge"); Error(_log, "Got invalid response from bridge");
return; return;
} }
// check for authorization // check for authorization
if(doc.isArray()) if(doc.isArray())
{ {
Error(log, "Authorization failed, username invalid"); Error(_log, "Authorization failed, username invalid");
return; return;
} }
@ -178,7 +178,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
if(obj.isEmpty()) if(obj.isEmpty())
{ {
Error(log, "Bridge has no registered bulbs/stripes"); Error(_log, "Bridge has no registered bulbs/stripes");
return; return;
} }
@ -193,7 +193,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
} }
else else
{ {
Error(log,"Network Error: %s", QSTRING_CSTR(reply->errorString())); Error(_log,"Network Error: %s", QSTRING_CSTR(reply->errorString()));
bTimer.start(); bTimer.start();
} }
} }
@ -202,7 +202,7 @@ void PhilipsHueBridge::resolveReply(QNetworkReply* reply)
void PhilipsHueBridge::post(QString route, QString content) void PhilipsHueBridge::post(QString route, QString content)
{ {
//Debug(log, "Post %s: %s", QSTRING_CSTR(QString("http://IP/api/USR/%1").arg(route)), QSTRING_CSTR(content)); //Debug(_log, "Post %s: %s", QSTRING_CSTR(QString("http://IP/api/USR/%1").arg(route)), QSTRING_CSTR(content));
QNetworkRequest request(QString("http://%1/api/%2/%3").arg(host).arg(username).arg(route)); QNetworkRequest request(QString("http://%1/api/%2/%3").arg(host).arg(username).arg(route));
manager.put(request, content.toLatin1()); manager.put(request, content.toLatin1());
@ -216,14 +216,14 @@ const std::set<QString> PhilipsHueLight::GAMUT_C_MODEL_IDS =
{ "LLC020", "LST002", "LCT011", "LCT012", "LCT010", "LCT014", "LCT015", "LCT016", "LCT024" }; { "LLC020", "LST002", "LCT011", "LCT012", "LCT010", "LCT014", "LCT015", "LCT016", "LCT024" };
PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned int id, QJsonObject values) PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned int id, QJsonObject values)
: log(log) : _log(log)
, bridge(bridge) , bridge(bridge)
, id(id) , id(id)
{ {
// Get state object values which are subject to change. // Get state object values which are subject to change.
if (!values["state"].toObject().contains("on")) if (!values["state"].toObject().contains("on"))
{ {
Error(log, "Got invalid state object from light ID %d", id); Error(_log, "Got invalid state object from light ID %d", id);
} }
QJsonObject state; QJsonObject state;
state["on"] = values["state"].toObject()["on"]; state["on"] = values["state"].toObject()["on"];
@ -248,7 +248,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
// Find id in the sets and set the appropriate color space. // Find id in the sets and set the appropriate color space.
if (GAMUT_A_MODEL_IDS.find(modelId) != GAMUT_A_MODEL_IDS.end()) if (GAMUT_A_MODEL_IDS.find(modelId) != GAMUT_A_MODEL_IDS.end())
{ {
Debug(log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id); Debug(_log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id);
colorSpace.red = colorSpace.red =
{ 0.704f, 0.296f}; { 0.704f, 0.296f};
colorSpace.green = colorSpace.green =
@ -258,7 +258,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
} }
else if (GAMUT_B_MODEL_IDS.find(modelId) != GAMUT_B_MODEL_IDS.end()) else if (GAMUT_B_MODEL_IDS.find(modelId) != GAMUT_B_MODEL_IDS.end())
{ {
Debug(log, "Recognized model id %s of light ID %d as gamut B", modelId.toStdString().c_str(), id); Debug(_log, "Recognized model id %s of light ID %d as gamut B", modelId.toStdString().c_str(), id);
colorSpace.red = colorSpace.red =
{ 0.675f, 0.322f}; { 0.675f, 0.322f};
colorSpace.green = colorSpace.green =
@ -268,7 +268,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
} }
else if (GAMUT_C_MODEL_IDS.find(modelId) != GAMUT_C_MODEL_IDS.end()) else if (GAMUT_C_MODEL_IDS.find(modelId) != GAMUT_C_MODEL_IDS.end())
{ {
Debug(log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id); Debug(_log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id);
colorSpace.red = colorSpace.red =
{ 0.6915f, 0.3083f}; { 0.6915f, 0.3083f};
colorSpace.green = colorSpace.green =
@ -278,7 +278,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
} }
else else
{ {
Warning(log, "Did not recognize model id %s of light ID %d", modelId.toStdString().c_str(), id); Warning(_log, "Did not recognize model id %s of light ID %d", modelId.toStdString().c_str(), id);
colorSpace.red = colorSpace.red =
{ 1.0f, 0.0f}; { 1.0f, 0.0f};
colorSpace.green = colorSpace.green =
@ -287,7 +287,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
{ 0.0f, 0.0f}; { 0.0f, 0.0f};
} }
Info(log,"Light ID %d created", id); Info(_log,"Light ID %d created", id);
} }
PhilipsHueLight::~PhilipsHueLight() PhilipsHueLight::~PhilipsHueLight()

View File

@ -92,7 +92,7 @@ class PhilipsHueBridge : public QObject
Q_OBJECT Q_OBJECT
private: private:
Logger* log; Logger* _log;
/// QNetworkAccessManager for sending requests. /// QNetworkAccessManager for sending requests.
QNetworkAccessManager manager; QNetworkAccessManager manager;
/// Ip address of the bridge /// Ip address of the bridge
@ -138,7 +138,7 @@ public:
class PhilipsHueLight class PhilipsHueLight
{ {
private: private:
Logger* log; Logger* _log;
PhilipsHueBridge* bridge; PhilipsHueBridge* bridge;
/// light id /// light id
unsigned int id; unsigned int id;

View File

@ -41,7 +41,7 @@ public:
protected: protected:
/// ///
/// Writes the given bytes/bits to the SPI-device and sleeps the latch time to ensure that the /// Writes the given bytes/bits to the UDP-device and sleeps the latch time to ensure that the
/// values are latched. /// values are latched.
/// ///
/// @param[in] size The length of the data /// @param[in] size The length of the data

View File

@ -77,6 +77,7 @@
"gamma" : { "gamma" : {
"type" : "number", "type" : "number",
"title" : "edt_dev_spec_gamma_title", "title" : "edt_dev_spec_gamma_title",
"default": 1.0,
"minimum" : 0.1, "minimum" : 0.1,
"maximum": 5.0, "maximum": 5.0,
"options": { "options": {

View File

@ -75,6 +75,7 @@ HyperionDaemon::HyperionDaemon(QString configFile, const QString rootPath, QObje
qRegisterMetaType<settings::type>("settings::type"); qRegisterMetaType<settings::type>("settings::type");
qRegisterMetaType<VideoMode>("VideoMode"); qRegisterMetaType<VideoMode>("VideoMode");
qRegisterMetaType<QMap<quint8,QJsonObject>>("QMap<quint8,QJsonObject>"); qRegisterMetaType<QMap<quint8,QJsonObject>>("QMap<quint8,QJsonObject>");
qRegisterMetaType<std::vector<ColorRgb>>("std::vector<ColorRgb>");
// init settings // init settings
_settingsManager = new SettingsManager(0,configFile); _settingsManager = new SettingsManager(0,configFile);

View File

@ -1,4 +1,4 @@
# Needed for testing non-public components # Needed for testing non-public components
include_directories(../libsrc) include_directories(../libsrc)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
@ -10,7 +10,7 @@ ENDMACRO()
if(ENABLE_SPIDEV) if(ENABLE_SPIDEV)
# Add the simple test executable 'TestSpi' # Add the simple test executable 'TestSpi'
add_executable(test_spi TestSpi.cpp) add_executable(test_spi TestSpi.cpp)
link_to_hyperion(test_spi) target_link_libraries( test_spi leddevice hyperion-utils hyperion )
add_executable(spidev_test spidev_test.c) add_executable(spidev_test spidev_test.c)
add_executable(gpio2spi switchPinCtrl.c) add_executable(gpio2spi switchPinCtrl.c)
endif(ENABLE_SPIDEV) endif(ENABLE_SPIDEV)
@ -21,19 +21,9 @@ link_to_hyperion(test_configfile)
add_executable(test_ImageRgb TestRgbImage.cpp) add_executable(test_ImageRgb TestRgbImage.cpp)
link_to_hyperion(test_ImageRgb) link_to_hyperion(test_ImageRgb)
add_executable(test_image2ledsmap TestImage2LedsMap.cpp)
link_to_hyperion(test_image2ledsmap)
if (ENABLE_DISPMANX)
add_subdirectory(dispmanx2png)
endif (ENABLE_DISPMANX)
add_executable(test_blackborderdetector TestBlackBorderDetector.cpp) add_executable(test_blackborderdetector TestBlackBorderDetector.cpp)
link_to_hyperion(test_blackborderdetector) link_to_hyperion(test_blackborderdetector)
add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp)
link_to_hyperion(test_blackborderprocessor)
add_executable(test_qregexp TestQRegExp.cpp) add_executable(test_qregexp TestQRegExp.cpp)
target_link_libraries(test_qregexp Qt5::Widgets) target_link_libraries(test_qregexp Qt5::Widgets)
@ -45,3 +35,17 @@ if(ENABLE_X11)
add_executable(test_x11performance TestX11Performance.cpp) add_executable(test_x11performance TestX11Performance.cpp)
target_link_libraries(test_x11performance ${X11_LIBRARIES} Qt5::Widgets) target_link_libraries(test_x11performance ${X11_LIBRARIES} Qt5::Widgets)
endif(ENABLE_X11) endif(ENABLE_X11)
######### These tests are broken. May they fix someone ##########
# add_executable(test_image2ledsmap TestImage2LedsMap.cpp)
# link_to_hyperion(test_image2ledsmap)
# if (ENABLE_DISPMANX)
# add_subdirectory(dispmanx2png)
# endif (ENABLE_DISPMANX)
# add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp)
# link_to_hyperion(test_blackborderprocessor)
###################################################

View File

@ -53,6 +53,7 @@ int TC_NO_BORDER()
std::cerr << "Failed to correctly detect no border" << std::endl; std::cerr << "Failed to correctly detect no border" << std::endl;
result = -1; result = -1;
} }
else std::cout << "Correctly detected no border" << std::endl;
} }
return result; return result;
@ -67,11 +68,12 @@ int TC_TOP_BORDER()
{ {
Image<ColorRgb> image = createImage(64, 64, 12, 0); Image<ColorRgb> image = createImage(64, 64, 12, 0);
BlackBorder border = detector.process(image); BlackBorder border = detector.process(image);
if (border.unknown != false && border.horizontalSize != 12 && border.verticalSize != 0) if (border.unknown != false && border.horizontalSize == 12 && border.verticalSize != 0)
{ {
std::cerr << "Failed to correctly detect horizontal border with correct size" << std::endl; std::cerr << "Failed to correctly detect horizontal border with correct size" << std::endl;
result = -1; result = -1;
} }
else std::cout << "Correctly detected horizontal border with correct size" << std::endl;
} }
return result; return result;
@ -86,11 +88,12 @@ int TC_LEFT_BORDER()
{ {
Image<ColorRgb> image = createImage(64, 64, 0, 12); Image<ColorRgb> image = createImage(64, 64, 0, 12);
BlackBorder border = detector.process(image); BlackBorder border = detector.process(image);
if (border.unknown != false && border.horizontalSize != 0 && border.verticalSize != 12) if (border.unknown != false && border.horizontalSize != 0 && border.verticalSize == 12)
{ {
std::cerr << "Failed to detected vertical border with correct size" << std::endl; std::cerr << "Failed to correctly detect vertical border with correct size" << std::endl;
result = -1; result = -1;
} }
else std::cout << "Correctly detected vertical border with correct size" << std::endl;
} }
return result; return result;
@ -105,11 +108,12 @@ int TC_DUAL_BORDER()
{ {
Image<ColorRgb> image = createImage(64, 64, 12, 12); Image<ColorRgb> image = createImage(64, 64, 12, 12);
BlackBorder border = detector.process(image); BlackBorder border = detector.process(image);
if (border.unknown != false && border.horizontalSize != 12 && border.verticalSize != 12) if (border.unknown != false && border.horizontalSize == 12 && border.verticalSize == 12)
{ {
std::cerr << "Failed to detected two-sided border" << std::endl; std::cerr << "Failed to correctly detect two-sided border" << std::endl;
result = -1; result = -1;
} }
else std::cout << "Correctly detected two-sided border" << std::endl;
} }
return result; return result;
} }
@ -125,9 +129,10 @@ int TC_UNKNOWN_BORDER()
BlackBorder border = detector.process(image); BlackBorder border = detector.process(image);
if (border.unknown != true) if (border.unknown != true)
{ {
std::cerr << "Failed to detected unknown border" << std::endl; std::cerr << "Failed to correctly detect unknown border" << std::endl;
result = -1; result = -1;
} }
else std::cout << "Correctly detected unknown border" << std::endl;
} }
return result; return result;
} }

View File

@ -19,7 +19,7 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
QJsonObject schemaJson; QJsonObject schemaJson;
try try
{ {
schemaJson = QJsonFactory::readSchema(":/hyperion-schema"); schemaJson = QJsonFactory::readSchema(":/hyperion-schema");
@ -28,14 +28,14 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore)
{ {
throw std::runtime_error(error.what()); throw std::runtime_error(error.what());
} }
QJsonSchemaChecker schemaChecker; QJsonSchemaChecker schemaChecker;
schemaChecker.setSchema(schemaJson); schemaChecker.setSchema(schemaJson);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// read and validate the configuration file from the command line // read and validate the configuration file from the command line
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
QJsonObject jsonConfig = QJsonFactory::readConfig(configFile); QJsonObject jsonConfig = QJsonFactory::readConfig(configFile);
if (!correct) if (!correct)
@ -47,7 +47,7 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore)
{ {
qDebug() << "config write validation: " << schemaError; qDebug() << "config write validation: " << schemaError;
} }
qDebug() << "FAILED"; qDebug() << "FAILED";
exit(1); exit(1);
return false; return false;
@ -82,7 +82,8 @@ int main(int argc, char** argv)
QString option = argv[1]; QString option = argv[1];
QString configFile; QString configFile;
if (option == "--ac" || option == "--ac-ignore-required") if (option == "--ac" || option == "--ac-ignore-required")
{
if (argc > 2) if (argc > 2)
configFile = argv[2]; configFile = argv[2];
else else
@ -90,8 +91,8 @@ int main(int argc, char** argv)
usage(); usage();
return 0; return 0;
} }
else }
configFile = argv[1]; else configFile = argv[1];
qDebug() << "Configuration file selected: " << configFile; qDebug() << "Configuration file selected: " << configFile;
qDebug() << "Attemp to load..."; qDebug() << "Attemp to load...";

View File

@ -8,6 +8,7 @@
#include <QPixmap> #include <QPixmap>
#include <QFile> #include <QFile>
#include <QRgb> #include <QRgb>
#include <QScreen>
#include <QElapsedTimer> #include <QElapsedTimer>
@ -18,10 +19,11 @@
void createScreenshot(const int cropHorizontal, const int cropVertical, const int decimation, Image<ColorRgb> & image) void createScreenshot(const int cropHorizontal, const int cropVertical, const int decimation, Image<ColorRgb> & image)
{ {
// Create the full size screenshot // Create the full size screenshot
const QRect screenSize = QApplication::desktop()->screenGeometry(); QScreen *screen = QApplication::primaryScreen();
const QRect screenSize = screen->availableGeometry();
const int croppedWidth = screenSize.width() - 2*cropVertical; const int croppedWidth = screenSize.width() - 2*cropVertical;
const int croppedHeight = screenSize.height() - 2*cropHorizontal; const int croppedHeight = screenSize.height() - 2*cropHorizontal;
const QPixmap fullSizeScreenshot = QPixmap::grabWindow(QApplication::desktop()->winId(), cropVertical, cropHorizontal, croppedWidth, croppedHeight); const QPixmap fullSizeScreenshot = screen->grabWindow(QApplication::desktop()->winId(), cropVertical, cropHorizontal, croppedWidth, croppedHeight);
// Scale the screenshot to the required size // Scale the screenshot to the required size
const int width = fullSizeScreenshot.width()/decimation; const int width = fullSizeScreenshot.width()/decimation;

View File

@ -3,6 +3,9 @@ IF ( "${PLATFORM}" MATCHES rpi)
# Find the BCM-package (VC control) # Find the BCM-package (VC control)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
find_package(BCM REQUIRED)
include_directories(${BCM_INCLUDE_DIRS})
add_definitions(${QT_DEFINITIONS}) add_definitions(${QT_DEFINITIONS})
link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf)

View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
import json, sys
retval = 0
with open(sys.argv[1]) as f:
if len(sys.argv) < 3:
data = json.load(f)
sys.stdout.write(data['versionnr'])
sys.exit(0)
else:
data = json.load(f)
sys.stdout.write(data['channel'])
sys.exit(0)

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
[ "${BUILD_TYPE}" == "Release" ] && exit 0
STATS_FAILED=0 STATS_FAILED=0
STATS_SUCCESS=0 STATS_SUCCESS=0
STATS_SKIPPED=0 STATS_SKIPPED=0
STATS_TOTAL=0 STATS_TOTAL=0
# exec_test "test name" test_exec --with --args # exec_test "test name" test_exec --with --args
function exec_test() function exec_test()
{ {
@ -33,7 +34,9 @@ function exec_test()
} }
###################################### ######################################
## EXEC TESTS ############# EXEC TESTS #############
######################################
cd build || exit 1 cd build || exit 1
echo echo
@ -41,7 +44,7 @@ echo "Hyperion test execution"
echo echo
exec_test "hyperiond is executable and show version" bin/hyperiond --version exec_test "hyperiond is executable and show version" bin/hyperiond --version
for cfg in ../config/*json* for cfg in ../config/*json.default
do do
exec_test "test $(basename $cfg)" bin/test_configfile $cfg exec_test "test $(basename $cfg)" bin/test_configfile $cfg
done done
@ -50,10 +53,10 @@ echo
echo echo
echo "TEST SUMMARY" echo "TEST SUMMARY"
echo "============" echo "============"
echo " total: $STATS_TOTAL" echo " total: $STATS_TOTAL"
echo " success: $STATS_SUCCESS" echo "success: $STATS_SUCCESS"
echo " skipped: $STATS_SKIPPED" echo "skipped: $STATS_SKIPPED"
echo " failed: $STATS_FAILED" echo " failed: $STATS_FAILED"
sleep 2 sleep 2