Kstars

media.h
1/*
2 SPDX-FileCopyrightText: 2018 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 Media Channel
5
6 SPDX-License-Identifier: GPL-2.0-or-later
7*/
8
9#pragma once
10
11#include <QtWebSockets/QWebSocket>
12#include <memory>
13
14#include "ekos/manager.h"
15#include "nodemanager.h"
16
17class FITSView;
18
19namespace EkosLive
20{
21class Media : public QObject
22{
24
25 public:
26 explicit Media(Ekos::Manager * manager, QVector<QSharedPointer<NodeManager>> &nodeManagers);
27 virtual ~Media() = default;
28
29 bool isConnected() const;
30 void sendResponse(const QString &command, const QJsonObject &payload);
31 void sendResponse(const QString &command, const QJsonArray &payload);
32
33 void registerCameras();
34
35 // Ekos Media Message to User
36 void sendFile(const QString &filename, const QString &uuid);
37 void sendData(const QSharedPointer<FITSData> &data, const QString &uuid);
38 void sendView(const QSharedPointer<FITSView> &view, const QString &uuid);
39 void sendUpdatedFrame(const QSharedPointer<FITSView> &view);
40 void sendModuleFrame(const QSharedPointer<FITSView> &view);
41
42 // Convenience functions
43 void sendDarkLibraryData(const QSharedPointer<FITSData> &data);
44
45 signals:
46 void connected();
47 void disconnected();
48
49 void newBoundingRect(QRect rect, QSize view, double currentZoom);
50 void newMetadata(const QByteArray &metadata);
51 void newImage(const QByteArray &image);
52
53 public slots:
54 // Capture
55 void sendVideoFrame(const QSharedPointer<QImage> &frame);
56
57 // Correction Vector
58 void setCorrectionVector(QLineF correctionVector)
59 {
60 this->correctionVector = correctionVector;
61 }
62
63 // Polar View
64 void resetPolarView();
65
66 void processNewBLOB(IBLOB *bp);
67
68 private slots:
69 // Connection
70 void onConnected();
71 void onDisconnected();
72
73 // Communication
74 void onTextReceived(const QString &message);
75 void onBinaryReceived(const QByteArray &message);
76
77 // Metadata and Image upload
78 void uploadMetadata(const QByteArray &metadata);
79 void uploadImage(const QByteArray &image);
80
81 private:
82 void upload(const QSharedPointer<FITSView> &view);
83
84 Ekos::Manager * m_Manager { nullptr };
86 QString m_UUID;
87 QString extension;
88 QStringList temporaryFiles;
89 QLineF correctionVector;
90 QSharedPointer<FITSView> m_TemporaryView;
91
92 bool m_sendBlobs { true};
93
94 // Image width for high-bandwidth setting
95 static const uint16_t HB_IMAGE_WIDTH = 1920;
96 // Video width for high-bandwidth setting
97 static const uint16_t HB_VIDEO_WIDTH = 1280;
98 // Image high bandwidth image quality (jpg)
99 static const uint8_t HB_IMAGE_QUALITY = 90;
100 // Video high bandwidth video quality (jpg)
101 static const uint8_t HB_VIDEO_QUALITY = 64;
102 // Image high bandwidth image quality (jpg) for PAH
103 static const uint8_t HB_PAH_IMAGE_QUALITY = 50;
104 // Video high bandwidth video quality (jpg) for PAH
105 static const uint8_t HB_PAH_VIDEO_QUALITY = 24;
106
107 // Retry every 5 seconds in case remote server is down
108 static const uint16_t RECONNECT_INTERVAL = 5000;
109 // Retry for 1 hour before giving up
110 static const uint16_t RECONNECT_MAX_TRIES = 720;
111
112 // Binary Metadata Size
113 static const uint16_t METADATA_PACKET = 512;
114
115 // HIPS Tile Width and Height
116 static const uint16_t HIPS_TILE_WIDTH = 512;
117 static const uint16_t HIPS_TILE_HEIGHT = 512;
118};
119}
Generic record interfaces and implementations.
Definition cloud.cpp:23
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:48:25 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.