MythTV master
mhegic.h
Go to the documentation of this file.
1/* MHEG Interaction Channel
2 * Copyright 2011 Lawrence Rust <lvr at softsystem dot co dot uk>
3 */
4#ifndef MHEGIC_H
5#define MHEGIC_H
6
7#include <QObject>
8#include <QString>
9#include <QUrl>
10#include <QMutex>
11#include <QHash>
12
13class QByteArray;
14class NetStream;
15
16class MHInteractionChannel : public QObject
17{
18 Q_OBJECT
19
20public:
21 explicit MHInteractionChannel(QObject* parent = nullptr);
22 ~MHInteractionChannel() override;
23
24 // Properties
25public:
26 // Get network status
27 enum EStatus : std::uint8_t { kActive = 0, kInactive, kDisabled };
28 static EStatus status();
29
30 // Operations
31public:
32 // Is a file ready to read?
33 bool CheckFile(const QString &csPath, const QByteArray &cert = QByteArray());
34 // Read a file
35 enum EResult : std::int8_t { kError = -1, kSuccess = 0, kPending = 1 };
36 EResult GetFile(const QString &csPath, QByteArray &data,
37 const QByteArray &cert = QByteArray() );
38
39 // Implementation
40private slots:
41 // NetStream signals
42 void slotFinished(QObject *obj);
43
44private:
45 Q_DISABLE_COPY(MHInteractionChannel)
46 mutable QMutex m_mutex;
47 using map_t = QHash< QUrl, NetStream* >;
48 map_t m_pending; // Pending requests
49 map_t m_finished; // Completed requests
50};
51
52#endif /* ndef MHEGIC_H */
EResult GetFile(const QString &csPath, QByteArray &data, const QByteArray &cert=QByteArray())
Definition: mhegic.cpp:98
bool CheckFile(const QString &csPath, const QByteArray &cert=QByteArray())
Definition: mhegic.cpp:64
QHash< QUrl, NetStream * > map_t
Definition: mhegic.h:47
static EStatus status()
Definition: mhegic.cpp:39
void slotFinished(QObject *obj)
Definition: mhegic.cpp:161
~MHInteractionChannel() override
Definition: mhegic.cpp:28
MHInteractionChannel(QObject *parent=nullptr)
Definition: mhegic.cpp:21
Stream content from a URI.
Definition: netstream.h:32