bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / RemoteServer.hxx
blob91718f9a364e46fabbf62d0ba8ab8b5e10c595fc
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 <stdio.h>
14 #include <stdlib.h>
15 #ifndef _WIN32
16 #include <unistd.h>
17 #endif
18 #include <sys/types.h>
19 #include <vector>
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>
30 #include "sddllapi.h"
32 /**
33 * The port for use for the main communication between LibO and remote control app.
35 #define PORT 1599
37 #define CHARSET RTL_TEXTENCODING_UTF8
39 namespace sd
41 class Communicator;
42 class BufferedStreamSocket;
44 struct ClientInfo
46 OUString mName;
47 OUString mAddress;
49 bool mbIsAlreadyAuthorised;
51 enum PROTOCOL { NETWORK = 1, BLUETOOTH };
52 ClientInfo( const OUString& rName,
53 const OUString& rAddress,
54 const bool bIsAlreadyAuthorised ) :
55 mName( rName ),
56 mAddress( rAddress ),
57 mbIsAlreadyAuthorised( bIsAlreadyAuthorised ) {}
59 virtual ~ClientInfo() {};
62 struct ClientInfoInternal;
64 class RemoteServer : public salhelper::Thread
66 public:
67 // Internal setup
68 static void setup();
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 );
88 private:
89 RemoteServer();
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: */