2013-08-23 20:44:53 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// system includes
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
// QT includes
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QString>
|
2013-08-23 21:40:42 +02:00
|
|
|
#include <QTcpSocket>
|
|
|
|
#include <QByteArray>
|
2013-08-23 20:44:53 +02:00
|
|
|
|
|
|
|
// Hyperion includes
|
|
|
|
#include <hyperion/Hyperion.h>
|
|
|
|
|
2013-08-23 21:40:42 +02:00
|
|
|
/// Check if XBMC is playing something. When it does not, this class will send all black data Hyperion to
|
|
|
|
/// override (grabbed) data with a lower priority
|
|
|
|
///
|
|
|
|
/// Note: The json TCP server needs to be enabled manually in XBMC in System/Settings/Network/Services
|
2013-08-23 20:44:53 +02:00
|
|
|
class XBMCVideoChecker : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-08-24 11:51:52 +02:00
|
|
|
XBMCVideoChecker(const std::string & address, uint16_t port, uint64_t interval, Hyperion * hyperion, int priority);
|
2013-08-23 20:44:53 +02:00
|
|
|
|
|
|
|
void start();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void sendRequest();
|
|
|
|
|
2013-08-23 21:40:42 +02:00
|
|
|
void receiveReply();
|
2013-08-23 20:44:53 +02:00
|
|
|
|
|
|
|
private:
|
2013-08-23 21:40:42 +02:00
|
|
|
const QString _address;
|
|
|
|
|
|
|
|
const uint16_t _port;
|
2013-08-23 20:44:53 +02:00
|
|
|
|
2013-08-23 21:40:42 +02:00
|
|
|
const QByteArray _request;
|
|
|
|
|
|
|
|
QTimer _timer;
|
2013-08-23 20:44:53 +02:00
|
|
|
|
2013-08-23 21:40:42 +02:00
|
|
|
QTcpSocket _socket;
|
2013-08-23 20:44:53 +02:00
|
|
|
|
|
|
|
Hyperion * _hyperion;
|
|
|
|
|
2013-08-23 21:40:42 +02:00
|
|
|
const int _priority;
|
2013-08-23 20:44:53 +02:00
|
|
|
};
|
|
|
|
|