Overte C++ Documentation
AssignmentClient.h
1 //
2 // AssignmentClient.h
3 // assignment-client/src
4 //
5 // Created by Stephen Birarda on 11/25/2013.
6 // Copyright 2013 High Fidelity, Inc.
7 // Copyright 2021 Vircadia contributors.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 //
12 
13 #ifndef hifi_AssignmentClient_h
14 #define hifi_AssignmentClient_h
15 
16 #include <QtCore/QCoreApplication>
17 #include <QtCore/QPointer>
18 #include <QtCore/QSharedPointer>
19 
20 #include <shared/WebRTC.h>
21 
22 #include "ThreadedAssignment.h"
23 
24 class QSharedMemory;
25 
26 class AssignmentClient : public QObject {
27  Q_OBJECT
28 public:
29  AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
30  quint16 listenPort, QString assignmentServerHostname,
31  quint16 assignmentServerPort, quint16 assignmentMonitorPort,
32  bool disableDomainPortAutoDiscovery);
33  ~AssignmentClient();
34 
35 public slots:
36  void aboutToQuit();
37 
38 private slots:
39  void sendAssignmentRequest();
40  void assignmentCompleted();
41  void handleAuthenticationRequest();
42  void sendStatusPacketToACM();
43  void stopAssignmentClient();
44  void handleCreateAssignmentPacket(QSharedPointer<ReceivedMessage> message);
45  void handleStopNodePacket(QSharedPointer<ReceivedMessage> message);
46 #if defined(WEBRTC_DATA_CHANNELS)
47  void handleWebRTCSignalingPacket(QSharedPointer<ReceivedMessage> message);
48  void sendSignalingMessageToUserClient(const QJsonObject& json);
49 #endif
50 
51 signals:
52 #if defined(WEBRTC_DATA_CHANNELS)
53  void webrtcSignalingMessageFromUserClient(const QJsonObject& json);
54 #endif
55 
56 private:
57  void setUpStatusToMonitor();
58 
59  Assignment _requestAssignment;
60  QPointer<ThreadedAssignment> _currentAssignment;
61  bool _isAssigned { false };
62  QString _assignmentServerHostname;
63  SockAddr _assignmentServerSocket;
64  QTimer _requestTimer; // timer for requesting and assignment
65  QTimer _statsTimerACM; // timer for sending stats to assignment client monitor
66  QUuid _childAssignmentUUID = QUuid::createUuid();
67  bool _disableDomainPortAutoDiscovery { false };
68 
69  protected:
70  SockAddr _assignmentClientMonitorSocket;
71 };
72 
73 #endif // hifi_AssignmentClient_h
Holds information used for request, creation, and deployment of assignments.
Definition: Assignment.h:28