From 22ffee20bbacbc3378e4ba0df5b7f0c3daaeffc0 Mon Sep 17 00:00:00 2001 From: horchi Date: Sun, 5 Mar 2017 16:47:41 +0100 Subject: git init --- comthread.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 comthread.h (limited to 'comthread.h') 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 + +#include +#include +#include + +#include +#include + +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 clients; +}; + +//*************************************************************************** +#endif // __GTFT_COMTHREAD_H__ -- cgit v1.2.3