Merge branch 'master' into support_for_philips_hue

Former-commit-id: ee3816fde708fa2f9f9e6ad50ec1e6d2ff552b23
This commit is contained in:
ntim 2014-05-07 07:44:11 +02:00
commit 32f09dcc24
18 changed files with 189 additions and 52 deletions

View File

@ -34,13 +34,13 @@ fi
echo 'Downloading hyperion' echo 'Downloading hyperion'
if [ $IS_OPENELEC -eq 1 ]; then if [ $IS_OPENELEC -eq 1 ]; then
# OpenELEC has a readonly file system. Use alternative location # OpenELEC has a readonly file system. Use alternative location
curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz
curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz
# modify the default config to have a correct effect path # modify the default config to have a correct effect path
sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json
else else
wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz
fi fi
# create links to the binaries # create links to the binaries
@ -68,9 +68,9 @@ fi
if [ $USE_INITCTL -eq 1 ]; then if [ $USE_INITCTL -eq 1 ]; then
echo 'Installing initctl script' echo 'Installing initctl script'
if [ $IS_RASPBMC -eq 1 ]; then if [ $IS_RASPBMC -eq 1 ]; then
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/ wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
else else
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
fi fi
elif [ $USE_SERVICE -eq 1 ]; then elif [ $USE_SERVICE -eq 1 ]; then
echo 'Installing startup script in init.d' echo 'Installing startup script in init.d'

View File

@ -1 +1 @@
d61b685eca164580cb39eb5bc3cf65b89afad410 e3e4ea5204c555e64aa909d5bbbd6ac95ebec0dc

View File

@ -37,6 +37,9 @@ public:
/// ///
void setSize(const unsigned width, const unsigned height); void setSize(const unsigned width, const unsigned height);
/// Enable or disable the black border detector
void enableBalckBorderDetector(bool enable);
/// ///
/// Processes the image to a list of led colors. This will update the size of the buffer-image /// Processes the image to a list of led colors. This will update the size of the buffer-image
/// if required and call the image-to-leds mapping to determine the mean color per led. /// if required and call the image-to-leds mapping to determine the mean color per led.
@ -142,7 +145,7 @@ private:
const LedString _ledString; const LedString _ledString;
/// Flag the enables(true)/disabled(false) blackborder detector /// Flag the enables(true)/disabled(false) blackborder detector
const bool _enableBlackBorderRemoval; bool _enableBlackBorderRemoval;
/// The processor for black border detection /// The processor for black border detection
hyperion::BlackBorderProcessor * _borderProcessor; hyperion::BlackBorderProcessor * _borderProcessor;

10
include/utils/Sleep.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include <QThread>
class Sleep : protected QThread {
public:
static inline void msleep(unsigned long msecs) {
QThread::msleep(msecs);
}
};

View File

@ -38,7 +38,7 @@ public:
/// @param grabPhoto Whether or not to grab when the XBMC photo player is playing /// @param grabPhoto Whether or not to grab when the XBMC photo player is playing
/// @param grabAudio Whether or not to grab when the XBMC audio player is playing /// @param grabAudio Whether or not to grab when the XBMC audio player is playing
/// @param grabMenu Whether or not to grab when nothing is playing (in XBMC menu) /// @param grabMenu Whether or not to grab when nothing is playing (in XBMC menu)
/// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated /// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
/// @param enable3DDetection Wheter or not to enable the detection of 3D movies playing /// @param enable3DDetection Wheter or not to enable the detection of 3D movies playing
/// ///
XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection); XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection);
@ -96,6 +96,12 @@ private:
/// The JSON-RPC message to check the screensaver /// The JSON-RPC message to check the screensaver
const QString _checkScreensaverRequest; const QString _checkScreensaverRequest;
/// The JSON-RPC message to check the active stereoscopicmode
const QString _getStereoscopicMode;
/// The JSON-RPC message to check the xbmc version
const QString _getXbmcVersion;
/// The QT TCP Socket with connection to XBMC /// The QT TCP Socket with connection to XBMC
QTcpSocket _socket; QTcpSocket _socket;
@ -111,7 +117,7 @@ private:
/// Flag indicating whether or not to grab when XBMC is playing nothing (in menu) /// Flag indicating whether or not to grab when XBMC is playing nothing (in menu)
const bool _grabMenu; const bool _grabMenu;
/// Flag inidcating whether or not to grab when the XBMC screensaver is activated /// Flag indicating whether or not to grab when the XBMC screensaver is activated
const bool _grabScreensaver; const bool _grabScreensaver;
/// Flag indicating wheter or not to enable the detection of 3D movies playing /// Flag indicating wheter or not to enable the detection of 3D movies playing
@ -125,4 +131,7 @@ private:
/// Previous emitted video mode /// Previous emitted video mode
VideoMode _previousVideoMode; VideoMode _previousVideoMode;
/// XBMC version number
int _xbmcVersion;
}; };

View File

@ -64,6 +64,9 @@ Effect::Effect(PyThreadState * mainThreadState, int priority, int timeout, const
{ {
_colors.resize(_imageProcessor->getLedCount(), ColorRgb::BLACK); _colors.resize(_imageProcessor->getLedCount(), ColorRgb::BLACK);
// disable the black border detector for effects
_imageProcessor->enableBalckBorderDetector(false);
// connect the finished signal // connect the finished signal
connect(this, SIGNAL(finished()), this, SLOT(effectFinished())); connect(this, SIGNAL(finished()), this, SLOT(effectFinished()));
} }

View File

@ -43,6 +43,11 @@ void ImageProcessor::setSize(const unsigned width, const unsigned height)
_imageToLeds = new ImageToLedsMap(width, height, 0, 0, _ledString.leds()); _imageToLeds = new ImageToLedsMap(width, height, 0, 0, _ledString.leds());
} }
void ImageProcessor::enableBalckBorderDetector(bool enable)
{
_enableBlackBorderRemoval = enable;
}
bool ImageProcessor::getScanParameters(size_t led, double &hscanBegin, double &hscanEnd, double &vscanBegin, double &vscanEnd) const bool ImageProcessor::getScanParameters(size_t led, double &hscanBegin, double &hscanEnd, double &vscanBegin, double &vscanEnd) const
{ {
if (led < _ledString.leds().size()) if (led < _ledString.leds().size())

View File

@ -35,6 +35,7 @@ ImageToLedsMap::ImageToLedsMap(
// skip leds without area // skip leds without area
if ((led.maxX_frac-led.minX_frac) < 1e-6 || (led.maxY_frac-led.minY_frac) < 1e-6) if ((led.maxX_frac-led.minX_frac) < 1e-6 || (led.maxY_frac-led.minY_frac) < 1e-6)
{ {
mColorsMap.emplace_back();
continue; continue;
} }

View File

@ -13,6 +13,7 @@ include_directories(
# Group the headers that go through the MOC compiler # Group the headers that go through the MOC compiler
SET(Leddevice_QT_HEADERS SET(Leddevice_QT_HEADERS
${CURRENT_SOURCE_DIR}/LedRs232Device.h
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.h ${CURRENT_SOURCE_DIR}/LedDeviceAdalight.h
${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.h ${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.h
) )
@ -21,8 +22,6 @@ SET(Leddevice_HEADERS
${CURRENT_HEADER_DIR}/LedDevice.h ${CURRENT_HEADER_DIR}/LedDevice.h
${CURRENT_HEADER_DIR}/LedDeviceFactory.h ${CURRENT_HEADER_DIR}/LedDeviceFactory.h
${CURRENT_SOURCE_DIR}/LedRs232Device.h
${CURRENT_SOURCE_DIR}/LedDeviceLightpack.h ${CURRENT_SOURCE_DIR}/LedDeviceLightpack.h
${CURRENT_SOURCE_DIR}/LedDeviceMultiLightpack.h ${CURRENT_SOURCE_DIR}/LedDeviceMultiLightpack.h
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.h ${CURRENT_SOURCE_DIR}/LedDevicePaintpack.h

View File

@ -11,8 +11,8 @@
// hyperion local includes // hyperion local includes
#include "LedDeviceAdalight.h" #include "LedDeviceAdalight.h"
LedDeviceAdalight::LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate) : LedDeviceAdalight::LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms) :
LedRs232Device(outputDevice, baudrate), LedRs232Device(outputDevice, baudrate, delayAfterConnect_ms),
_ledBuffer(0), _ledBuffer(0),
_timer() _timer()
{ {

View File

@ -12,7 +12,7 @@
/// ///
/// Implementation of the LedDevice interface for writing to an Adalight led device. /// Implementation of the LedDevice interface for writing to an Adalight led device.
/// ///
class LedDeviceAdalight : public QObject, public LedRs232Device class LedDeviceAdalight : public LedRs232Device
{ {
Q_OBJECT Q_OBJECT
@ -23,7 +23,7 @@ public:
/// @param outputDevice The name of the output device (eg '/dev/ttyS0') /// @param outputDevice The name of the output device (eg '/dev/ttyS0')
/// @param baudrate The used baudrate for writing to the output device /// @param baudrate The used baudrate for writing to the output device
/// ///
LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate); LedDeviceAdalight(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms);
/// ///
/// Writes the led color values to the led-device /// Writes the led color values to the led-device

View File

@ -43,8 +43,9 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
{ {
const std::string output = deviceConfig["output"].asString(); const std::string output = deviceConfig["output"].asString();
const unsigned rate = deviceConfig["rate"].asInt(); const unsigned rate = deviceConfig["rate"].asInt();
const int delay_ms = deviceConfig["delayAfterConnect"].asInt();
LedDeviceAdalight* deviceAdalight = new LedDeviceAdalight(output, rate); LedDeviceAdalight* deviceAdalight = new LedDeviceAdalight(output, rate, delay_ms);
deviceAdalight->open(); deviceAdalight->open();
device = deviceAdalight; device = deviceAdalight;

View File

@ -19,6 +19,8 @@
* Uses the official Philips Hue API (http://developers.meethue.com). * Uses the official Philips Hue API (http://developers.meethue.com).
* Framegrabber must be limited to 10 Hz / numer of lights to avoid rate limitation by the hue bridge. * Framegrabber must be limited to 10 Hz / numer of lights to avoid rate limitation by the hue bridge.
* Create a new API user name "newdeveloper" on the bridge (http://developers.meethue.com/gettingstarted.html) * Create a new API user name "newdeveloper" on the bridge (http://developers.meethue.com/gettingstarted.html)
*
* @author ntim (github)
*/ */
class LedDevicePhilipsHue: public QObject, public LedDevice { class LedDevicePhilipsHue: public QObject, public LedDevice {
Q_OBJECT Q_OBJECT

View File

@ -4,17 +4,21 @@
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
// Qt includes
#include <QTimer>
// Serial includes // Serial includes
#include <serial/serial.h> #include <serial/serial.h>
// Local Hyperion includes // Local Hyperion includes
#include "LedRs232Device.h" #include "LedRs232Device.h"
LedRs232Device::LedRs232Device(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms) :
LedRs232Device::LedRs232Device(const std::string& outputDevice, const unsigned baudrate) : _deviceName(outputDevice),
mDeviceName(outputDevice), _baudRate_Hz(baudrate),
mBaudRate_Hz(baudrate), _delayAfterConnect_ms(delayAfterConnect_ms),
_rs232Port() _rs232Port(),
_blockedForDelay(false)
{ {
// empty // empty
} }
@ -31,10 +35,17 @@ int LedRs232Device::open()
{ {
try try
{ {
std::cout << "Opening UART: " << mDeviceName << std::endl; std::cout << "Opening UART: " << _deviceName << std::endl;
_rs232Port.setPort(mDeviceName); _rs232Port.setPort(_deviceName);
_rs232Port.setBaudrate(mBaudRate_Hz); _rs232Port.setBaudrate(_baudRate_Hz);
_rs232Port.open(); _rs232Port.open();
if (_delayAfterConnect_ms > 0)
{
_blockedForDelay = true;
QTimer::singleShot(_delayAfterConnect_ms, this, SLOT(unblockAfterDelay()));
std::cout << "Device blocked for " << _delayAfterConnect_ms << " ms" << std::endl;
}
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
@ -47,6 +58,11 @@ int LedRs232Device::open()
int LedRs232Device::writeBytes(const unsigned size, const uint8_t * data) int LedRs232Device::writeBytes(const unsigned size, const uint8_t * data)
{ {
if (_blockedForDelay)
{
return 0;
}
if (!_rs232Port.isOpen()) if (!_rs232Port.isOpen())
{ {
return -1; return -1;
@ -95,3 +111,9 @@ int LedRs232Device::writeBytes(const unsigned size, const uint8_t * data)
return 0; return 0;
} }
void LedRs232Device::unblockAfterDelay()
{
std::cout << "Device unblocked" << std::endl;
_blockedForDelay = false;
}

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <QObject>
// Serial includes // Serial includes
#include <serial/serial.h> #include <serial/serial.h>
@ -9,8 +11,10 @@
/// ///
/// The LedRs232Device implements an abstract base-class for LedDevices using a RS232-device. /// The LedRs232Device implements an abstract base-class for LedDevices using a RS232-device.
/// ///
class LedRs232Device : public LedDevice class LedRs232Device : public QObject, public LedDevice
{ {
Q_OBJECT
public: public:
/// ///
/// Constructs the LedDevice attached to a RS232-device /// Constructs the LedDevice attached to a RS232-device
@ -18,7 +22,7 @@ public:
/// @param[in] outputDevice The name of the output device (eg '/etc/ttyS0') /// @param[in] outputDevice The name of the output device (eg '/etc/ttyS0')
/// @param[in] baudrate The used baudrate for writing to the output device /// @param[in] baudrate The used baudrate for writing to the output device
/// ///
LedRs232Device(const std::string& outputDevice, const unsigned baudrate); LedRs232Device(const std::string& outputDevice, const unsigned baudrate, int delayAfterConnect_ms = 0);
/// ///
/// Destructor of the LedDevice; closes the output device if it is open /// Destructor of the LedDevice; closes the output device if it is open
@ -43,12 +47,22 @@ protected:
*/ */
int writeBytes(const unsigned size, const uint8_t *data); int writeBytes(const unsigned size, const uint8_t *data);
private slots:
/// Unblock the device after a connection delay
void unblockAfterDelay();
private: private:
/// The name of the output device /// The name of the output device
const std::string mDeviceName; const std::string _deviceName;
/// The used baudrate of the output device /// The used baudrate of the output device
const int mBaudRate_Hz; const int _baudRate_Hz;
/// Sleep after the connect before continuing
const int _delayAfterConnect_ms;
/// The RS232 serial-device /// The RS232 serial-device
serial::Serial _rs232Port; serial::Serial _rs232Port;
bool _blockedForDelay;
}; };

View File

@ -11,6 +11,7 @@ add_library(hyperion-utils
${CURRENT_HEADER_DIR}/ColorRgba.h ${CURRENT_HEADER_DIR}/ColorRgba.h
${CURRENT_SOURCE_DIR}/ColorRgba.cpp ${CURRENT_SOURCE_DIR}/ColorRgba.cpp
${CURRENT_HEADER_DIR}/Image.h ${CURRENT_HEADER_DIR}/Image.h
${CURRENT_HEADER_DIR}/Sleep.h
${CURRENT_HEADER_DIR}/HsvTransform.h ${CURRENT_HEADER_DIR}/HsvTransform.h
${CURRENT_SOURCE_DIR}/HsvTransform.cpp ${CURRENT_SOURCE_DIR}/HsvTransform.cpp

View File

@ -17,6 +17,10 @@
// {"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}} // {"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}}
// {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}} // {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}}
// Request stereoscopicmode example:
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) : XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) :
QObject(), QObject(),
_address(QString::fromStdString(address)), _address(QString::fromStdString(address)),
@ -24,6 +28,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
_activePlayerRequest(R"({"id":666,"jsonrpc":"2.0","method":"Player.GetActivePlayers"})"), _activePlayerRequest(R"({"id":666,"jsonrpc":"2.0","method":"Player.GetActivePlayers"})"),
_currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})"), _currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})"),
_checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})"), _checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})"),
_getStereoscopicMode(R"({"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669})"),
_getXbmcVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670})"),
_socket(), _socket(),
_grabVideo(grabVideo), _grabVideo(grabVideo),
_grabPhoto(grabPhoto), _grabPhoto(grabPhoto),
@ -33,7 +39,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
_enable3DDetection(enable3DDetection), _enable3DDetection(enable3DDetection),
_previousScreensaverMode(false), _previousScreensaverMode(false),
_previousGrabbingMode(GRABBINGMODE_INVALID), _previousGrabbingMode(GRABBINGMODE_INVALID),
_previousVideoMode(VIDEO_2D) _previousVideoMode(VIDEO_2D),
_xbmcVersion(0)
{ {
// setup socket // setup socket
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply())); connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
@ -116,24 +123,32 @@ void XBMCVideoChecker::receiveReply()
} }
else if (reply.contains("\"id\":667")) else if (reply.contains("\"id\":667"))
{ {
// result of Player.GetItem if (_xbmcVersion >= 13)
// TODO: what if the filename contains a '"'. In Json this should have been escaped
QRegExp regex("\"file\":\"((?!\").)*\"");
int pos = regex.indexIn(reply);
if (pos > 0)
{ {
QStringRef filename = QStringRef(&reply, pos+8, regex.matchedLength()-9); // check of active stereoscopicmode
if (filename.contains("3DSBS", Qt::CaseInsensitive) || filename.contains("HSBS", Qt::CaseInsensitive)) _socket.write(_getStereoscopicMode.toUtf8());
}
else
{
// result of Player.GetItem
// TODO: what if the filename contains a '"'. In Json this should have been escaped
QRegExp regex("\"file\":\"((?!\").)*\"");
int pos = regex.indexIn(reply);
if (pos > 0)
{ {
setVideoMode(VIDEO_3DSBS); QStringRef filename = QStringRef(&reply, pos+8, regex.matchedLength()-9);
} if (filename.contains("3DSBS", Qt::CaseInsensitive) || filename.contains("HSBS", Qt::CaseInsensitive))
else if (filename.contains("3DTAB", Qt::CaseInsensitive) || filename.contains("HTAB", Qt::CaseInsensitive)) {
{ setVideoMode(VIDEO_3DSBS);
setVideoMode(VIDEO_3DTAB); }
} else if (filename.contains("3DTAB", Qt::CaseInsensitive) || filename.contains("HTAB", Qt::CaseInsensitive))
else {
{ setVideoMode(VIDEO_3DTAB);
setVideoMode(VIDEO_2D); }
else
{
setVideoMode(VIDEO_2D);
}
} }
} }
} }
@ -142,6 +157,41 @@ void XBMCVideoChecker::receiveReply()
// result of System.ScreenSaverActive // result of System.ScreenSaverActive
bool active = reply.contains("\"System.ScreenSaverActive\":true"); bool active = reply.contains("\"System.ScreenSaverActive\":true");
setScreensaverMode(!_grabScreensaver && active); setScreensaverMode(!_grabScreensaver && active);
// check here xbmc version
if (_socket.state() == QTcpSocket::ConnectedState)
{
if (_xbmcVersion == 0)
{
_socket.write(_getXbmcVersion.toUtf8());
}
}
}
else if (reply.contains("\"id\":669"))
{
QRegExp regex("\"mode\":\"(split_vertical|split_horizontal)\"");
int pos = regex.indexIn(reply);
if (pos > 0)
{
QString sMode = regex.cap(1);
if (sMode == "split_vertical")
{
setVideoMode(VIDEO_3DSBS);
}
else if (sMode == "split_horizontal")
{
setVideoMode(VIDEO_3DTAB);
}
}
}
else if (reply.contains("\"id\":670"))
{
QRegExp regex("\"major\":(\\d+)");
int pos = regex.indexIn(reply);
if (pos > 0)
{
_xbmcVersion = regex.cap(1).toInt();
}
} }
} }

View File

@ -113,13 +113,30 @@ int main(int argc, char** argv)
const unsigned duration_ms = effectConfig["duration_ms"].asUInt(); const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
const int priority = 0; const int priority = 0;
if (hyperion.setEffect(effectName, priority, duration_ms) == 0) if (effectConfig.isMember("args"))
{ {
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl; const Json::Value effectConfigArgs = effectConfig["args"];
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
{
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
}
else
{
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
}
} }
else else
{ {
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
{
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
}
else
{
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
}
} }
} }