bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / RemoteServer.hxx
blobcd8fa1a0ad24f593909a32656f957f17c9117f73
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9 #ifndef INCLUDED_SD_SOURCE_UI_INC_REMOTESERVER_HXX
10 #define INCLUDED_SD_SOURCE_UI_INC_REMOTESERVER_HXX
12 // SERVER
13 #include <memory>
14 #include <vector>
16 #include <osl/socket_decl.hxx>
17 #include <salhelper/thread.hxx>
19 #include <sddllapi.h>
21 namespace osl { class Mutex; }
22 namespace com { namespace sun { namespace star { namespace presentation { class XSlideShowController; } } } }
23 namespace com { namespace sun { namespace star { namespace uno { template <class interface_type> class Reference; } } } }
25 /**
26 * The port for use for the main communication between LibO and remote control app.
28 #define PORT 1599
30 #define CHARSET RTL_TEXTENCODING_UTF8
32 namespace sd
34 class Communicator;
36 struct ClientInfo
38 OUString const mName;
40 bool const mbIsAlreadyAuthorised;
42 ClientInfo( const OUString& rName,
43 const bool bIsAlreadyAuthorised ) :
44 mName( rName ),
45 mbIsAlreadyAuthorised( bIsAlreadyAuthorised ) {}
47 virtual ~ClientInfo() {};
50 struct ClientInfoInternal;
52 class RemoteServer : public salhelper::Thread
54 public:
55 // Internal setup
56 static void setup();
58 // For slideshowimpl to inform us.
59 static void presentationStarted( const css::uno::Reference<
60 css::presentation::XSlideShowController > &rController );
61 static void presentationStopped();
63 // For the control dialog
64 SD_DLLPUBLIC static std::vector< std::shared_ptr< ClientInfo > > getClients();
65 SD_DLLPUBLIC static bool connectClient( const std::shared_ptr< ClientInfo >& pClient,
66 const OUString& aPin );
67 SD_DLLPUBLIC static void deauthoriseClient( const std::shared_ptr< ClientInfo >& pClient );
69 /// ensure that discoverability (eg. for Bluetooth) is enabled
70 SD_DLLPUBLIC static void ensureDiscoverable();
71 /// restore the state of discoverability from before ensureDiscoverable
72 SD_DLLPUBLIC static void restoreDiscoverable();
74 // For the communicator
75 static void removeCommunicator( Communicator const * pCommunicator );
76 private:
77 RemoteServer();
78 virtual ~RemoteServer() override;
79 static RemoteServer *spServer;
80 static ::osl::Mutex sDataMutex;
81 static ::std::vector<Communicator*> sCommunicators;
82 osl::AcceptorSocket mSocket;
84 ::std::vector< std::shared_ptr< ClientInfoInternal > > mAvailableClients;
86 void execute() override;
90 #endif // INCLUDED_SD_SOURCE_UI_INC_REMOTESERVER_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */