Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 _SD_IMPRESSREMOTE_SERVER_HXX
10 : #define _SD_IMPRESSREMOTE_SERVER_HXX
11 :
12 : // SERVER
13 : #include <stdio.h>
14 : #include <stdlib.h>
15 : #include <unistd.h>
16 : #include <sys/types.h>
17 : #include <vector>
18 :
19 : #include <osl/mutex.hxx>
20 : #include <osl/socket.hxx>
21 : #include <rtl/ref.hxx>
22 : #include <salhelper/thread.hxx>
23 :
24 : #include <com/sun/star/presentation/XSlideShowController.hpp>
25 :
26 : #include "sddllapi.h"
27 :
28 : /**
29 : * The port for use for the main communication between LibO and remote control app.
30 : */
31 : #define PORT 1599
32 :
33 : #define CHARSET RTL_TEXTENCODING_UTF8
34 :
35 : namespace sd
36 : {
37 : class Communicator;
38 : class BufferedStreamSocket;
39 :
40 : struct ClientInfo
41 : {
42 : rtl::OUString mName;
43 : rtl::OUString mAddress;
44 :
45 : enum PROTOCOL { NETWORK = 1, BLUETOOTH };
46 0 : ClientInfo( const rtl::OUString rName, const rtl::OUString rAddress ) :
47 : mName( rName ),
48 0 : mAddress( rAddress ) {}
49 : };
50 :
51 : struct ClientInfoInternal;
52 :
53 : class RemoteServer : public salhelper::Thread
54 : {
55 : public:
56 : // Internal setup
57 : static void setup();
58 :
59 : // For slideshowimpl to inform us.
60 : static void presentationStarted( const css::uno::Reference<
61 : css::presentation::XSlideShowController > &rController );
62 : static void presentationStopped();
63 :
64 : // For the control dialog
65 : SD_DLLPUBLIC static std::vector<ClientInfo*> getClients();
66 : SD_DLLPUBLIC static sal_Bool connectClient( ClientInfo *pClient,
67 : rtl::OUString aPin );
68 :
69 : SD_DLLPUBLIC static bool isBluetoothDiscoverable();
70 : SD_DLLPUBLIC static void setBluetoothDiscoverable( bool aDiscoverable );
71 :
72 : // For the communicator
73 : static void removeCommunicator( Communicator* pCommunicator );
74 : private:
75 : RemoteServer();
76 : ~RemoteServer();
77 : static RemoteServer *spServer;
78 : static ::osl::Mutex sDataMutex;
79 : static ::std::vector<Communicator*> sCommunicators;
80 : osl::AcceptorSocket mSocket;
81 :
82 : ::std::vector<ClientInfoInternal*> mAvailableClients;
83 :
84 : void execute();
85 : };
86 : }
87 :
88 : #endif // _SD_IMPRESSREMOTE_SERVER_HXX
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|