/
mythfrontendservice.h
89 lines (75 loc) · 3.33 KB
/
mythfrontendservice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef MYTHFRONTENDSERVICE_H
#define MYTHFRONTENDSERVICE_H
// MythTV
#include "libmythbase/http/mythhttpservice.h"
#define FRONTEND_SERVICE QString("/Frontend/")
#define FRONTEND_HANDLE QString("Frontend")
class FrontendStatus : public QObject
{
Q_OBJECT
Q_CLASSINFO("Version", "1.1")
Q_CLASSINFO("State", "type=QString")
Q_CLASSINFO("ChapterTimes", "type=QString;name=Chapter")
Q_CLASSINFO("SubtitleTracks", "type=QString;name=Track")
Q_CLASSINFO("AudioTracks", "type=QString;name=Track")
SERVICE_PROPERTY(QString, Name, name)
SERVICE_PROPERTY(QString, Version, version)
SERVICE_PROPERTY(QVariantMap, State, state)
SERVICE_PROPERTY(QVariantList, ChapterTimes, chapterTimes)
SERVICE_PROPERTY(QVariantMap, SubtitleTracks, subtitleTracks)
SERVICE_PROPERTY(QVariantMap, AudioTracks, audioTracks)
public:
Q_INVOKABLE FrontendStatus(QObject *parent = nullptr)
: QObject ( parent ) {};
FrontendStatus(const QString& Name, const QString& Version, const QVariantMap& State);
};
Q_DECLARE_METATYPE(FrontendStatus*)
class FrontendActionList : public QObject
{
Q_OBJECT
Q_CLASSINFO("Version", "1.0")
Q_CLASSINFO("ActionList", "type=QString;name=Action")
SERVICE_PROPERTY(QVariantMap, ActionList, actionList)
public:
Q_INVOKABLE FrontendActionList(QObject *parent = nullptr)
: QObject ( parent ) {};
FrontendActionList(const QVariantMap& List);
};
Q_DECLARE_METATYPE(FrontendActionList*)
class MythFrontendService : public MythHTTPService
{
Q_OBJECT
Q_CLASSINFO("Version", "2.1")
Q_CLASSINFO("SendAction", "methods=POST")
Q_CLASSINFO("SendKey", "methods=POST")
Q_CLASSINFO("PlayVideo", "methods=POST")
Q_CLASSINFO("PlayRecording", "methods=POST")
Q_CLASSINFO("SendMessage", "methods=POST")
Q_CLASSINFO("SendNotification", "methods=POST")
Q_CLASSINFO("GetContextList", "name=StringList") // Consistency with old code
public slots:
bool SendAction (const QString& Action, const QString& Value, uint Width, uint Height);
bool SendKey (const QString& Key);
FrontendActionList* GetActionList(const QString& Context);
QStringList GetContextList ();
FrontendStatus* GetStatus ();
bool PlayVideo (const QString& Id, bool UseBookmark);
bool PlayRecording (int RecordedId, int ChanId, const QDateTime& StartTime);
bool SendMessage (const QString& Message, uint Timeout);
bool SendNotification(bool Error, const QString& Type,
const QString& Message, const QString& Origin,
const QString& Description, const QString& Image,
const QString& Extra, const QString& ProgressText,
float Progress, std::chrono::seconds Timeout,
bool Fullscreen, uint Visibility,
uint Priority);
public:
MythFrontendService();
~MythFrontendService() override = default;
static void RegisterCustomTypes();
protected:
static bool IsValidAction(const QString& Action);
private:
Q_DISABLE_COPY(MythFrontendService)
};
#endif