multi bugfix pr ... (#348)

* move name to general
add a version for config file

* start impl. config migrator

* fix typo amd set access level

* fix schemaa name

* fix schema

* add structure for config migrator

* add more structural things for config migrator

* fix not all grabber provide live video

* add schema for trails
This commit is contained in:
redPanther 2016-12-24 10:02:12 +01:00 committed by GitHub
parent 8ed8823033
commit 3746f643af
20 changed files with 153 additions and 49 deletions

View File

@ -39,3 +39,5 @@
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
#define HYPERION_JSON_VERSION "1.0.0"
#define CURRENT_CONFIG_VERSION 2

View File

@ -428,6 +428,10 @@
"edt_eff_enableshutdown_title" : "Echtes herunterfahren",
"edt_eff_length_title" : "Länge",
"edt_eff_frequency_title" : "Frequenz",
"edt_eff_tails_header_title" : "Trails",
"edt_eff_min_len_title" : "Minimale Länge",
"edt_eff_max_len_title" : "Maximale Länge",
"edt_eff_height_title" : "Höhe",
"edt_append_ns" : "ns",
"edt_append_ms" : "ms",
"edt_append_s" : "s",

View File

@ -429,6 +429,10 @@
"edt_eff_enableshutdown_title" : "Real shutdown",
"edt_eff_length_title" : "Length",
"edt_eff_frequency_title" : "Frequency",
"edt_eff_tails_header_title" : "Trails",
"edt_eff_min_len_title" : "Minimal length",
"edt_eff_max_len_title" : "Maximal length",
"edt_eff_height_title" : "Height",
"edt_append_ns" : "ns",
"edt_append_ms" : "ms",
"edt_append_s" : "s",

View File

@ -0,0 +1,65 @@
{
"type":"object",
"script" : "trails.py",
"title":"edt_eff_trails_header_title",
"required":true,
"properties":{
"min_len": {
"type": "integer",
"title":"edt_eff_min_len_title",
"default": 2,
"minimum" : 1,
"propertyOrder" : 1
},
"max_len": {
"type": "integer",
"title":"edt_eff_max_len_title",
"default": 7,
"minimum" : 1,
"propertyOrder" : 2
},
"height": {
"type": "integer",
"title":"edt_eff_height_title",
"default": 8,
"minimum" : 1,
"propertyOrder" : 3
},
"trails": {
"type": "integer",
"title":"edt_eff_trails_title",
"default": 3,
"minimum" : 1,
"propertyOrder" : 4
},
"speed": {
"type": "number",
"title":"edt_eff_speed_title",
"default": 1.0,
"minimum" : 0.1,
"propertyOrder" : 5
},
"random": {
"type": "boolean",
"title":"edt_eff_random_header_title",
"default": false,
"propertyOrder" : 6
},
"color": {
"type": "array",
"title":"edt_eff_color_title",
"format":"colorpicker",
"default": [255,0,0],
"items" : {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"minItems": 3,
"maxItems": 3,
"propertyOrder" : 7
}
},
"additionalProperties": false
}

View File

@ -39,12 +39,9 @@ void AmlogicWrapper::action()
return;
}
if ( _forward )
{
Image<ColorRgb> image_rgb;
_image.toRgb(image_rgb);
emit emitImage(_priority, image_rgb, _timeout_ms);
}
_processor->process(_image, _ledColors);
setColors(_ledColors, _timeout_ms);

View File

@ -35,12 +35,9 @@ void DispmanxWrapper::action()
// Grab frame into the allocated image
_grabber->grabFrame(_image);
if ( _forward )
{
Image<ColorRgb> image_rgb;
_image.toRgb(image_rgb);
emit emitImage(_priority, image_rgb, _timeout_ms);
}
_processor->process(_image, _ledColors);
setColors(_ledColors, _timeout_ms);

View File

@ -31,10 +31,7 @@ void FramebufferWrapper::action()
// Grab frame into the allocated image
_grabber->grabFrame(_image);
if ( _forward )
{
emit emitImage(_priority, _image, _timeout_ms);
}
_processor->process(_image, _ledColors);
setColors(_ledColors, _timeout_ms);

View File

@ -31,10 +31,7 @@ void OsxWrapper::action()
// Grab frame into the allocated image
_grabber->grabFrame(_image);
if ( _forward )
{
emit emitImage(_priority, _image, _timeout_ms);
}
_processor->process(_image, _ledColors);
setColors(_ledColors, _timeout_ms);

View File

@ -87,11 +87,7 @@ void V4L2Wrapper::set3D(VideoMode mode)
void V4L2Wrapper::newFrame(const Image<ColorRgb> &image)
{
// forward to other hyperions
//if ( _forward )
//{
emit emitImage(_priority, image, _timeout_ms);
//}
// process the new image
_processor->process(image, _ledColors);

View File

@ -64,10 +64,7 @@ void X11Wrapper::action()
// Grab frame into the allocated image
_grabber->grabFrame(_image);
//if ( _forward )
//{
emit emitImage(_priority, _image, _timeout_ms);
//}
_processor->process(_image, _ledColors);
setColors(_ledColors, _timeout_ms);

View File

@ -1,5 +1,7 @@
add_executable(hyperiond
configMigratorBase.cpp
configMigratorBase.h
configMigrator.cpp
configMigrator.h
hyperiond.cpp

View File

@ -2,7 +2,6 @@
ConfigMigrator::ConfigMigrator()
: _log(Logger::getInstance("ConfigMigrator"))
{
}
@ -13,7 +12,23 @@ ConfigMigrator::~ConfigMigrator()
bool ConfigMigrator::migrate(QString configFile, int fromVersion,int toVersion)
{
Debug(_log, "migrate config %s from version %d to %d.", configFile.toLocal8Bit().constData(), fromVersion, toVersion);
throw std::runtime_error("ERROR: config migration not implemented");
for (int v=fromVersion; v<toVersion; v++)
{
switch(v)
{
case 1: migrateFrom1(); break;
default:
throw std::runtime_error("ERROR: config migration - unknown version");
}
}
return true;
}
void ConfigMigrator::migrateFrom1()
{
throw std::runtime_error("ERROR: config migration not implemented");
}

View File

@ -1,10 +1,13 @@
#pragma once
#include <utils/Logger.h>
#include "configMigratorBase.h"
#include <QString>
class ConfigMigrator
///
/// class that contains migration code
/// helper code goeas to base class
class ConfigMigrator : public ConfigMigratorBase
{
public:
@ -12,6 +15,7 @@ public:
~ConfigMigrator();
bool migrate(QString configFile, int fromVersion,int toVersion);
private:
Logger * _log;
void migrateFrom1();
};

View File

@ -0,0 +1,11 @@
#include "configMigratorBase.h"
ConfigMigratorBase::ConfigMigratorBase()
: _log(Logger::getInstance("ConfigMigrator"))
{
}
ConfigMigratorBase::~ConfigMigratorBase()
{
}

View File

@ -0,0 +1,16 @@
#pragma once
#include <utils/Logger.h>
#include <QString>
class ConfigMigratorBase
{
public:
ConfigMigratorBase();
~ConfigMigratorBase();
protected:
Logger * _log;
};

View File

@ -414,7 +414,7 @@ void HyperionDaemon::createSystemFrameGrabber()
if (_qconfig.contains("framegrabber"))
{
const QJsonObject & grabberConfig = _qconfig["framegrabber"].toObject();
if (grabberConfig["enable"].toBool(true))
// if (grabberConfig["enable"].toBool(true))
{
_grabber_width = grabberConfig["width"].toInt(96);
_grabber_height = grabberConfig["height"].toInt(96);
@ -464,7 +464,7 @@ void HyperionDaemon::createSystemFrameGrabber()
Info( _log, "set screen capture device to '%s'", type.toUtf8().constData());
}
bool grabberCompState = true;
bool grabberCompState = grabberConfig["enable"].toBool(true);
if (type == "") { Info( _log, "screen capture device disabled"); grabberCompState = false; }
else if (type == "framebuffer") createGrabberFramebuffer(grabberConfig);
else if (type == "dispmanx") createGrabberDispmanx();
@ -474,6 +474,7 @@ void HyperionDaemon::createSystemFrameGrabber()
else { Warning( _log, "unknown framegrabber type '%s'", type.toUtf8().constData()); grabberCompState = false; }
_hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, grabberCompState);
_hyperion->setComponentState(hyperion::COMP_GRABBER, grabberCompState );
}
}
}

View File

@ -1,7 +1,5 @@
#pragma once
const int CURRENT_CONFIG_VERSION = 2;
#include <QObject>
#ifdef ENABLE_DISPMANX

View File

@ -10,6 +10,7 @@
// hyperion includes
#include <hyperion/LedString.h>
#include "HyperionConfig.h"
bool loadConfig(const QString & configFile)
{
@ -21,7 +22,7 @@ bool loadConfig(const QString & configFile)
// read and set the json schema from the resource
////////////////////////////////////////////////////////////
QFile schemaData(":/hyperion-schema");
QFile schemaData(":/hyperion-schema-"+QString::number(CURRENT_CONFIG_VERSION));
if (!schemaData.open(QIODevice::ReadOnly))
{