ArnLib  4.0.x
Active Registry Network
ArnDiscoverRemote.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // GNU Lesser General Public License Usage
11 // This file may be used under the terms of the GNU Lesser General Public
12 // License version 2.1 as published by the Free Software Foundation and
13 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
14 // file. In addition, as a special exception, you may use the rights described
15 // in the Nokia Qt LGPL Exception version 1.1, included in the file
16 // LGPL_EXCEPTION.txt in this package.
17 //
18 // GNU General Public License Usage
19 // Alternatively, this file may be used under the terms of the GNU General Public
20 // License version 3.0 as published by the Free Software Foundation and appearing
21 // in the file LICENSE_GPL.txt included in the packaging of this file.
22 //
23 // Other Usage
24 // Alternatively, this file may be used in accordance with the terms and conditions
25 // contained in a signed written agreement between you and Michael Wiklund.
26 //
27 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
28 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
30 //
31 
32 #ifndef ARNDISCOVERREMOTE_HPP
33 #define ARNDISCOVERREMOTE_HPP
34 
35 #include "ArnDiscover.hpp"
36 #include "ArnDiscoverConnect.hpp"
37 #include "ArnItem.hpp"
38 
39 class ArnDiscoverRemotePrivate;
40 class ArnServer;
41 class QTimer;
42 class QTime;
43 
44 
45 
47 
95 {
96  Q_OBJECT
97  Q_DECLARE_PRIVATE(ArnDiscoverRemote)
98 
99 public:
100  explicit ArnDiscoverRemote( QObject *parent = arnNullptr);
102 
104 
107  QString defaultService() const;
108 
110 
115  void setDefaultService( const QString& defaultService);
116 
118 
121  int initialServiceTimeout() const;
122 
124 
130 
132 
141  void startUseServer( ArnServer* arnServer, ArnDiscover::Type discoverType = ArnDiscover::Type::Server);
142 
144 
159  void startUseNewServer( ArnDiscover::Type discoverType, int port = -1);
160 
162 
174  ArnDiscoverConnector* newConnector( ArnClient& client, const QString& id);
175 
176 signals:
178 
189  void clientReadyToConnect( ArnClient* arnClient, const QString& id);
190 
191 public slots:
193 
205  virtual void setService( const QString& service);
206 
208 protected:
210  virtual void postSetupThis();
211  virtual void serviceRegistered( const QString& serviceName);
212 
213  ArnDiscoverRemote( ArnDiscoverRemotePrivate& dd, QObject* parent);
215 
216 private slots:
218  void serviceTimeout();
219  void firstServiceSetup( const QString& serviceName, bool forceSetup = false);
220  void doServiceChanged( const QString& val);
221 
222 private:
224  void advertiseService( ArnDiscover::Type discoverType, const QString& serviceName,
225  int port = -1, const QString& hostName = QString());
226 };
227 
228 #endif // ARNDISCOVERREMOTE_HPP
QString defaultService() const
Return the default service name.
void clientReadyToConnect(ArnClient *arnClient, const QString &id)
Central signal for external client connection.
Class for making an Arn Server.
Definition: ArnServer.hpp:98
void setInitialServiceTimeout(int initialServiceTimeout)
Set the time for initial timeout processing.
Advertise an Arn service.
int initialServiceTimeout() const
Return the time for initial timeout processing.
QString service() const
Returns the requested service name for this Advertise.
void startUseNewServer(ArnDiscover::Type discoverType, int port=-1)
Start a new ArnServer and advertise as a service.
Types of Arn discover advertise.
Definition: ArnDiscover.hpp:52
ArnDiscoverRemote(QObject *parent=arnNullptr)
Class for connecting to an Arn Server.
Definition: ArnClient.hpp:104
An automatic client discover connector.
void startUseServer(ArnServer *arnServer, ArnDiscover::Type discoverType=ArnDiscover::Type::Server)
Start advertising the ArnServer as a service.
virtual void setService(const QString &service)
Set the service name.
ArnDiscoverConnector * newConnector(ArnClient &client, const QString &id)
Create and return an ArnDiscoverConnector for handling remote client.
Server Arn discover.
Definition: ArnDiscover.hpp:57
Discover with remote setting.
void setDefaultService(const QString &defaultService)
Set the default service name.