summaryrefslogtreecommitdiff
path: root/comthread.h
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-03-05 16:47:41 +0100
committerhorchi <vdr@jwendel.de>2017-03-05 16:47:41 +0100
commit22ffee20bbacbc3378e4ba0df5b7f0c3daaeffc0 (patch)
treede46c945c62d43d1febb027b5bfa075e58c5b69a /comthread.h
downloadvdr-plugin-graphtftng-0.6.16.tar.gz
vdr-plugin-graphtftng-0.6.16.tar.bz2
Diffstat (limited to 'comthread.h')
-rw-r--r--comthread.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/comthread.h b/comthread.h
new file mode 100644
index 0000000..84ef25d
--- /dev/null
+++ b/comthread.h
@@ -0,0 +1,95 @@
+//***************************************************************************
+// Group VDR/GraphTFTng
+// File comthread.h
+// Date 31.10.06
+// This code is distributed under the terms and conditions of the
+// GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
+// (c) 2006-2013 Jörg Wendel
+//--------------------------------------------------------------------------
+// Class ComThread
+//***************************************************************************
+
+#ifndef __GTFT_COMTHREAD_H__
+#define __GTFT_COMTHREAD_H__
+
+#include <vector>
+
+#include <vdr/plugin.h>
+#include <vdr/remote.h>
+#include <tcpchannel.h>
+
+#include <renderer.h>
+#include <service.h>
+
+using std::vector;
+
+//***************************************************************************
+// Communication Thread
+//***************************************************************************
+
+class ComThread : protected cThread, protected cRemote, public cGraphTftComService
+{
+ public:
+
+ enum Misc
+ {
+ maxBuf = 512*1024
+ };
+
+ struct TcpClient
+ {
+ TcpChannel* channel;
+ int jpgQuality;
+ time_t lastCheck;
+ };
+
+ ComThread(void* aDisplay, int width, int height);
+ virtual ~ComThread();
+
+ void stop() { running = false; }
+ int refresh();
+
+ int init(Renderer* aRenderer, unsigned int aPort = 0, const char* aHost = 0);
+ bool Start() { return cThread::Start(); }
+ void Stop();
+
+ void setHost(const char* aHost) { strcpy(host, aHost); }
+ void setPort(unsigned short aPort) { port = aPort; }
+ void setJpegQuality(int value) { jpgQuality = value; }
+
+ protected:
+
+ void Action();
+
+ int close(TcpClient* client, int status, const char* message = 0);
+ int read(fd_set* readSet);
+ int read(TcpClient* client);
+ int refresh(TcpClient* client);
+
+ virtual bool Put(uint64_t Code, bool Repeat = false, bool Release = false);
+
+ // data
+
+ TcpChannel* listener;
+ Renderer* renderer;
+ void* display;
+ cMutex _mutex;
+
+ int themeWidth;
+ int themeHeight;
+
+ char* buffer;
+ int bufferSize;
+ int timeout;
+ int checkTime;
+ int running;
+ unsigned short port;
+ char host[100+TB];
+ int pid;
+ int jpgQuality;
+
+ vector<TcpClient> clients;
+};
+
+//***************************************************************************
+#endif // __GTFT_COMTHREAD_H__