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 dispatch(const QSharedPointer<FITSData> &data, const QString &uuid);
83 void upload(const QSharedPointer<FITSView> &view, const QString &uuid);
84
85 void upload(const QSharedPointer<FITSData> &data, const QImage &image, const StretchParams &params, const QString &uuid);
86 void stretch(const QSharedPointer<FITSData> &data, QImage &image, StretchParams &params) const;
87
88 Ekos::Manager * m_Manager { nullptr };
90 QString extension;
91 QStringList temporaryFiles;
92 QLineF correctionVector;
93
94 bool m_sendBlobs { true};
95
96 // Image width for high-bandwidth setting
97 static const uint16_t HB_IMAGE_WIDTH = 1920;
98 // Video width for high-bandwidth setting
99 static const uint16_t HB_VIDEO_WIDTH = 1280;
100 // Image high bandwidth image quality (jpg)
101 static const uint8_t HB_IMAGE_QUALITY = 90;
102 // Video high bandwidth video quality (jpg)
103 static const uint8_t HB_VIDEO_QUALITY = 64;
104 // Image high bandwidth image quality (jpg) for PAH
105 static const uint8_t HB_PAH_IMAGE_QUALITY = 50;
106 // Video high bandwidth video quality (jpg) for PAH
107 static const uint8_t HB_PAH_VIDEO_QUALITY = 24;
108
109 // Retry every 5 seconds in case remote server is down
110 static const uint16_t RECONNECT_INTERVAL = 5000;
111 // Retry for 1 hour before giving up
112 static const uint16_t RECONNECT_MAX_TRIES = 720;
113
114 // Binary Metadata Size
115 static const uint16_t METADATA_PACKET = 512;
116
117 // HIPS Tile Width and Height
118 static const uint16_t HIPS_TILE_WIDTH = 512;
119 static const uint16_t HIPS_TILE_HEIGHT = 512;
120};
121}
Generic record interfaces and implementations.
Definition cloud.cpp:22
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.