1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
15 #include <osl/socket_decl.hxx>
16 #include <salhelper/thread.hxx>
20 namespace osl
{ class Mutex
; }
21 namespace com::sun::star::presentation
{ class XSlideShowController
; }
22 namespace com::sun::star::uno
{ template <class interface_type
> class Reference
; }
25 * The port for use for the main communication between LibO and remote control app.
31 class BufferedStreamSocket
;
38 bool mbIsAlreadyAuthorised
;
40 ClientInfo( OUString aName
,
41 const bool bIsAlreadyAuthorised
) :
42 mName(std::move( aName
)),
43 mbIsAlreadyAuthorised( bIsAlreadyAuthorised
) {}
45 virtual ~ClientInfo() {};
48 struct ClientInfoInternal
;
50 class RemoteServer final
: public salhelper::Thread
56 // For slideshowimpl to inform us.
57 static void presentationStarted( const css::uno::Reference
<
58 css::presentation::XSlideShowController
> &rController
);
59 static void presentationStopped();
61 // For the control dialog
62 SD_DLLPUBLIC
static std::vector
< std::shared_ptr
< ClientInfo
> > getClients();
63 SD_DLLPUBLIC
static bool connectClient( const std::shared_ptr
< ClientInfo
>& pClient
,
64 std::u16string_view aPin
);
65 SD_DLLPUBLIC
static void deauthoriseClient( const std::shared_ptr
< ClientInfo
>& pClient
);
67 /// ensure that discoverability (eg. for Bluetooth) is enabled
68 SD_DLLPUBLIC
static void ensureDiscoverable();
69 /// restore the state of discoverability from before ensureDiscoverable
70 SD_DLLPUBLIC
static void restoreDiscoverable();
72 // For the communicator
73 static void removeCommunicator( Communicator
const * pCommunicator
);
76 virtual ~RemoteServer() override
;
77 static RemoteServer
*spServer
;
78 static ::osl::Mutex sDataMutex
;
79 static ::std::vector
<Communicator
*> sCommunicators
;
80 osl::AcceptorSocket mSocket
;
82 ::std::vector
< std::shared_ptr
< ClientInfoInternal
> > mAvailableClients
;
84 void execute() override
;
85 void handleAcceptedConnection( BufferedStreamSocket
*pSocket
) ;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */