Torc  0.1
torchttpservices.h
Go to the documentation of this file.
1 #ifndef TORCHTTPSERVICES_H
2 #define TORCHTTPSERVICES_H
3 
4 // Qt
5 #include <QObject>
6 #include <QVariant>
7 
8 // Torc
9 #include "torchttpservice.h"
10 
11 class TorcHTTPServer;
12 class TorcHTTPRequest;
13 
14 class TorcHTTPServices : public QObject, public TorcHTTPService
15 {
16  Q_OBJECT
17  Q_CLASSINFO("Version", "1.0.0")
18  Q_CLASSINFO("GetServiceList", "type=services")
19  Q_CLASSINFO("GetStartTime", "type=starttime")
20  Q_CLASSINFO("GetPriority", "type=priority")
21  Q_CLASSINFO("GetUuid", "type=uuid")
22  Q_CLASSINFO("GetDetails", "type=details")
23  Q_CLASSINFO("GetWebSocketToken", "type=accesstoken,methods=GET+AUTH")
24  Q_CLASSINFO("IsSecure", "type=secure,methods=GET")
25 
26  Q_PROPERTY(QMap serviceList READ GetServiceList NOTIFY ServiceListChanged)
27  Q_PROPERTY(QVariantList returnFormats READ GetReturnFormats CONSTANT)
28  Q_PROPERTY(QVariantList webSocketProtocols READ GetWebSocketProtocols CONSTANT)
29 
30  public:
31  explicit TorcHTTPServices(TorcHTTPServer *Server);
32  virtual ~TorcHTTPServices() = default;
33 
34  static QString GetVersion (void);
35  void ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override;
36  QVariantMap ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override;
37  QString GetUIName (void) override;
38 
39  signals:
40  void ServiceListChanged (void);
41 
42  public slots:
43  void SubscriberDeleted (QObject *Subscriber);
44  QVariantMap GetDetails (void);
45  QVariantMap GetServiceList (void);
46  QVariantMap GetServiceDescription(const QString &Service);
47  QVariantList GetReturnFormats (void);
48  QVariantList GetWebSocketProtocols (void);
49  qint64 GetStartTime (void);
50  int GetPriority (void);
51  QString GetUuid (void);
52  QString GetWebSocketToken (void);
53  bool IsSecure (void);
54  void HandlersChanged (void);
55 
56  private:
57  QVariantMap serviceList; // dummy
58  QVariantList returnFormats;
59  QVariantList webSocketProtocols; // dummy
60 };
61 
62 #endif // TORCHTTPSERVICES_H
void HandlersChanged(void)
QVariantList returnFormats
QVariantMap GetDetails(void)
Return complete application information.
A class to encapsulate an incoming HTTP request.
QVariantList webSocketProtocols
void SubscriberDeleted(QObject *Subscriber)
void ServiceListChanged(void)
Top level interface into services.
QVariantList GetWebSocketProtocols(void)
QString GetUuid(void)
QVariantMap GetServiceList(void)
qint64 GetStartTime(void)
void ProcessHTTPRequest(const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override
QVariantMap ProcessRequest(const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override
static QString GetVersion(void)
QVariantMap GetServiceDescription(const QString &Service)
QString GetUIName(void) override
An HTTP server.
QString GetWebSocketToken(void)
Return a WebSocket token for connecting a WebSocket when authentication is required.
QVariantList GetReturnFormats(void)