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/.
9 #ifndef INCLUDED_SD_SOURCE_UI_INC_REMOTESERVER_HXX
10 #define INCLUDED_SD_SOURCE_UI_INC_REMOTESERVER_HXX
18 #include <sys/types.h>
21 #include <boost/shared_ptr.hpp>
23 #include <osl/mutex.hxx>
24 #include <osl/socket.hxx>
25 #include <rtl/ref.hxx>
26 #include <salhelper/thread.hxx>
28 #include <com/sun/star/presentation/XSlideShowController.hpp>
33 * The port for use for the main communication between LibO and remote control app.
37 #define CHARSET RTL_TEXTENCODING_UTF8
42 class BufferedStreamSocket
;
49 bool mbIsAlreadyAuthorised
;
51 enum PROTOCOL
{ NETWORK
= 1, BLUETOOTH
};
52 ClientInfo( const OUString
& rName
,
53 const OUString
& rAddress
,
54 const bool bIsAlreadyAuthorised
) :
57 mbIsAlreadyAuthorised( bIsAlreadyAuthorised
) {}
59 virtual ~ClientInfo() {};
62 struct ClientInfoInternal
;
64 class RemoteServer
: public salhelper::Thread
70 // For slideshowimpl to inform us.
71 static void presentationStarted( const css::uno::Reference
<
72 css::presentation::XSlideShowController
> &rController
);
73 static void presentationStopped();
75 // For the control dialog
76 SD_DLLPUBLIC
static std::vector
< ::boost::shared_ptr
< ClientInfo
> > getClients();
77 SD_DLLPUBLIC
static bool connectClient( ::boost::shared_ptr
< ClientInfo
> pClient
,
78 const OUString
& aPin
);
79 SD_DLLPUBLIC
static void deauthoriseClient( ::boost::shared_ptr
< ClientInfo
> pClient
);
81 /// ensure that discoverability (eg. for Bluetooth) is enabled
82 SD_DLLPUBLIC
static void ensureDiscoverable();
83 /// restore the state of discoverability from before ensureDiscoverable
84 SD_DLLPUBLIC
static void restoreDiscoverable();
86 // For the communicator
87 static void removeCommunicator( Communicator
* pCommunicator
);
90 virtual ~RemoteServer();
91 static RemoteServer
*spServer
;
92 static ::osl::Mutex sDataMutex
;
93 static ::std::vector
<Communicator
*> sCommunicators
;
94 osl::AcceptorSocket mSocket
;
96 ::std::vector
< ::boost::shared_ptr
< ClientInfoInternal
> > mAvailableClients
;
98 void execute() SAL_OVERRIDE
;
102 #endif // INCLUDED_SD_SOURCE_UI_INC_REMOTESERVER_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */