VPTissue Reference Manual
NodeAdvertiser.h
Go to the documentation of this file.
1 #ifndef SIMPT_PAREX_NODE_ADVERTISER_H_INCLUDED
2 #define SIMPT_PAREX_NODE_ADVERTISER_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include <string>
23 #include <QObject>
24 
25 class QTimer;
26 class QUdpSocket;
27 
28 namespace SimPT_Parex {
29 
33 class NodeAdvertiser : public QObject
34 {
35  Q_OBJECT
36 public:
43  NodeAdvertiser(int port, bool verbose = true, QObject *parent = nullptr);
44 
48  virtual ~NodeAdvertiser();
49 
50 
55  void Start(int serverPort);
56 
63  void Start(int serverPort, const std::string &exploration, int taskId);
64 
68  void Stop();
69 
70 
71 private slots:
72  void SendAdvertisement();
73 
74 private:
75  void BackoffTimer();
76 
77 private:
78  int m_port;
79  bool m_verbose;
80 
81  QTimer *m_resend_timer;
82  QUdpSocket *m_socket;
83 
84  int m_server_port;
85  std::string m_exploration;
86  int m_task_id;
87 
88 private:
89  static const int g_initial_interval;
90  static const int g_maximal_interval;
91 };
92 
93 } // namespace
94 
95 #endif // end-of-include-guard
NodeAdvertiser(int port, bool verbose=true, QObject *parent=nullptr)
Constructor.
Class advertising an available node over the network.
void Start(int serverPort)
Start finding a server to do work for.
void Stop()
Stop finding a server.
virtual ~NodeAdvertiser()
Destructor.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
see the online Qt documentation