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 
13 class QByteArray;
14 class NetStream;
15 
16 class MHInteractionChannel : public QObject
17 {
18  Q_OBJECT
19 
20 public:
21  explicit MHInteractionChannel(QObject* parent = nullptr);
22  virtual ~MHInteractionChannel();
23 
24  // Properties
25 public:
26  // Get network status
28  static EStatus status();
29 
30  // Operations
31 public:
32  // Is a file ready to read?
33  bool CheckFile(const QString &csPath, const QByteArray &cert = QByteArray());
34  // Read a file
35  enum EResult { kError = -1, kSuccess = 0, kPending };
36  EResult GetFile(const QString &csPath, QByteArray &data,
37  const QByteArray &cert = QByteArray() );
38 
39  // Implementation
40 private slots:
41  // NetStream signals
42  void slotFinished(QObject*);
43 
44 private:
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 */
bool CheckFile(const QString &csPath, const QByteArray &cert=QByteArray())
Definition: mhegic.cpp:69
unsigned int slots[4]
Definition: element.c:38
QHash< QUrl, NetStream * > map_t
Definition: mhegic.h:47
virtual ~MHInteractionChannel()
Definition: mhegic.cpp:33
EResult GetFile(const QString &csPath, QByteArray &data, const QByteArray &cert=QByteArray())
Definition: mhegic.cpp:103
void slotFinished(QObject *)
Definition: mhegic.cpp:166
Stream content from a URI.
Definition: netstream.h:30
MHInteractionChannel(QObject *parent=nullptr)
Definition: mhegic.cpp:26
static EStatus status()
Definition: mhegic.cpp:44