]> git.vomp.tv Git - vompclient.git/blob - vconnect.h
Message queue fix for VVideoRec
[vompclient.git] / vconnect.h
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef VCONNECT_H
21 #define VCONNECT_H
22
23 #include <mutex>
24 #include <thread>
25 #include <condition_variable>
26
27 #include "vinfo.h"
28 #include "messagequeue.h"
29 #include "vdpc.h"
30
31 class LogNT;
32 class BoxStack;
33 class VDRServer;
34
35 class VConnect : public VInfo
36 {
37   public:
38     VConnect();
39     ~VConnect();
40
41     int handleCommand(int command);
42     void processMessage(Message* m); // override
43     void draw();
44
45     void run();
46
47   private:
48     BoxStack* boxstack;
49     LogNT* logger;
50     VDPC vdpc;
51     VDR* vdr;
52
53     int serverSelectResponse;
54
55     std::thread connectThread;
56     std::mutex threadMutex;
57     std::condition_variable threadCond;
58     bool threadReqQuit{};
59     void threadMethod();
60     void stop();
61
62     bool attemptConnect(const VDRServer*);
63 };
64
65 #endif