hyperion.ng/include/xbmcvideochecker/XBMCVideoChecker.h

51 lines
904 B
C
Raw Normal View History

2013-08-23 20:44:53 +02:00
#pragma once
// system includes
#include <cstdint>
#include <string>
// QT includes
#include <QTimer>
#include <QString>
#include <QTcpSocket>
#include <QByteArray>
2013-08-23 20:44:53 +02:00
// Hyperion includes
#include <hyperion/Hyperion.h>
/// 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:
XBMCVideoChecker(QString 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();
void receiveReply();
2013-08-23 20:44:53 +02:00
private:
const QString _address;
const uint16_t _port;
2013-08-23 20:44:53 +02:00
const QByteArray _request;
QTimer _timer;
2013-08-23 20:44:53 +02:00
QTcpSocket _socket;
2013-08-23 20:44:53 +02:00
Hyperion * _hyperion;
const int _priority;
2013-08-23 20:44:53 +02:00
};