blob: c1e38ba73d01348e7d51b65b0c1f2253620852a1 [file] [log] [blame]
Steve Kondik55db0532017-06-12 11:27:18 -07001#ifndef VNCFLINGER_H
2#define VNCFLINGER_H
3
Steve Kondik55db0532017-06-12 11:27:18 -07004#include "VirtualDisplay.h"
5
6#include <ui/DisplayInfo.h>
7
8#include "rfb/rfb.h"
9
10#define VNC_PORT 5901
11
12namespace android {
13
Steve Kondik7225c7f2017-06-14 00:06:16 -070014class VNCFlinger {
Steve Kondik55db0532017-06-12 11:27:18 -070015public:
16 VNCFlinger(int argc, char **argv) :
17 mArgc(argc),
18 mArgv(argv),
19 mClientCount(0) {
20 }
21
Steve Kondik7225c7f2017-06-14 00:06:16 -070022 virtual ~VNCFlinger() {}
Steve Kondik55db0532017-06-12 11:27:18 -070023
24 virtual status_t start();
25 virtual status_t stop();
26
Steve Kondik7225c7f2017-06-14 00:06:16 -070027 virtual size_t addClient();
28 virtual size_t removeClient();
Steve Kondik55db0532017-06-12 11:27:18 -070029
30private:
Steve Kondik7225c7f2017-06-14 00:06:16 -070031
Steve Kondik55db0532017-06-12 11:27:18 -070032 virtual status_t setup_l();
33 virtual void release_l();
34
35 static ClientGoneHookPtr onClientGone(rfbClientPtr cl);
36 static enum rfbNewClientAction onNewClient(rfbClientPtr cl);
37 static void rfbLogger(const char *format, ...);
Steve Kondik7225c7f2017-06-14 00:06:16 -070038
39 Condition mCondition;
40
Steve Kondik55db0532017-06-12 11:27:18 -070041 rfbScreenInfoPtr mVNCScreen;
42 uint8_t *mVNCBuf;
43
44 uint32_t mWidth, mHeight;
45 bool mRotate;
46
47 sp<IBinder> mMainDpy;
48 DisplayInfo mMainDpyInfo;
49
50 Mutex mMutex;
51
52 sp<VirtualDisplay> mVirtualDisplay;
53
54 int mArgc;
55 char **mArgv;
56
57 size_t mClientCount;
58};
59
60};
61#endif