-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStatusSender.h
More file actions
55 lines (46 loc) · 2.88 KB
/
StatusSender.h
File metadata and controls
55 lines (46 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef STATUSSENDER_H
#define STATUSSENDER_H
#include <QObject>
#include <QJsonObject>
#include <QList>
#include "TelescopeState.h"
#include "WebSocketConnection.h"
class StatusSender : public QObject {
Q_OBJECT
public:
explicit StatusSender(TelescopeState *state, QObject *parent = nullptr);
void addWebSocketClient(WebSocketConnection *client);
void removeWebSocketClient(WebSocketConnection *client);
// Send status to specific client or all clients
void sendMountStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendFocuserStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendCameraParams(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendNewImageReady(WebSocketConnection *specificClient = nullptr);
void sendEnvironmentStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendDiskStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendDewHeaterStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendOrientationStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendTaskControllerStatus(WebSocketConnection *specificClient = nullptr, int sequenceId = -1, const QString &destination = "All");
void sendSystemVersion(WebSocketConnection *wsConn, int sequenceId, const QString &destination);
void sendSystemModel(WebSocketConnection *wsConn, int sequenceId, const QString &destination);
void sendCameraFilter(WebSocketConnection *wsConn, int sequenceId, const QString &destination);
void sendCalibrationStatus(WebSocketConnection *wsConn, int sequenceId, const QString &destination);
// Broadcast methods (send to all clients)
void sendMountStatusToAll() { sendMountStatus(); }
void sendFocuserStatusToAll() { sendFocuserStatus(); }
void sendCameraParamsToAll() { sendCameraParams(); }
void sendNewImageReadyToAll() { sendNewImageReady(); }
void sendEnvironmentStatusToAll() { sendEnvironmentStatus(); }
void sendDiskStatusToAll() { sendDiskStatus(); }
void sendDewHeaterStatusToAll() { sendDewHeaterStatus(); }
void sendOrientationStatusToAll() { sendOrientationStatus(); }
void sendTaskControllerStatusToAll() { sendTaskControllerStatus(); }
// was private
void sendJsonMessageToAll(const QJsonObject &obj);
private:
TelescopeState *m_telescopeState;
QList<WebSocketConnection*> m_webSocketClients;
// Helper methods
void sendJsonMessage(WebSocketConnection *wsConn, const QJsonObject &obj);
};
#endif // STATUSSENDER_H