InputRoku.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // Created by Tobias Hieta on 02/02/16.
  3. //
  4. #ifndef PLEXMEDIAPLAYER_ROKUREMOTECOMPONENT_H
  5. #define PLEXMEDIAPLAYER_ROKUREMOTECOMPONENT_H
  6. #include "input/InputComponent.h"
  7. #include "qhttpserver.hpp"
  8. #include <QUdpSocket>
  9. class InputRoku : public InputBase
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit InputRoku(QObject* parent = nullptr) : InputBase(parent) { }
  14. bool initInput() override;
  15. const char* inputName() override { return "roku"; };
  16. private:
  17. void handleRequest(qhttp::server::QHttpRequest* request, qhttp::server::QHttpResponse* response);
  18. void handleQueryApps(qhttp::server::QHttpRequest* request, qhttp::server::QHttpResponse* response);
  19. void handleKeyPress(qhttp::server::QHttpRequest* request, qhttp::server::QHttpResponse* response);
  20. void handleQueryDeviceInfo(qhttp::server::QHttpRequest* request, qhttp::server::QHttpResponse* response);
  21. qhttp::server::QHttpServer* m_server;
  22. QUdpSocket* m_ssdpSocket;
  23. void ssdpRead();
  24. void parseSSDPData(const QByteArray& data, const QHostAddress& sender, quint16 port);
  25. QByteArray getSSDPPacket(const QHostAddress& sender);
  26. void handleRootInfo(qhttp::server::QHttpRequest* request, qhttp::server::QHttpResponse* response);
  27. };
  28. #endif //PLEXMEDIAPLAYER_ROKUREMOTECOMPONENT_H