summaryrefslogtreecommitdiff
path: root/vdr-androvdr/androvdrthread.cpp
diff options
context:
space:
mode:
authorbju <bju@maxi.fritz.box>2011-03-19 15:54:21 +0100
committerbju <bju@maxi.fritz.box>2011-03-19 15:54:21 +0100
commitb4558f9dac4977c6ac933f52fc98b9eea9dfdbca (patch)
tree2f0c36309c44235d4bd8121d82271cd16bcd5348 /vdr-androvdr/androvdrthread.cpp
downloadvdr-manager-b4558f9dac4977c6ac933f52fc98b9eea9dfdbca.tar.gz
vdr-manager-b4558f9dac4977c6ac933f52fc98b9eea9dfdbca.tar.bz2
First revision
Diffstat (limited to 'vdr-androvdr/androvdrthread.cpp')
-rw-r--r--vdr-androvdr/androvdrthread.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/vdr-androvdr/androvdrthread.cpp b/vdr-androvdr/androvdrthread.cpp
new file mode 100644
index 0000000..3329e3e
--- /dev/null
+++ b/vdr-androvdr/androvdrthread.cpp
@@ -0,0 +1,62 @@
+/*
+ * VdrmonThread
+ */
+#include <string.h>
+#include <vdr/plugin.h>
+#include <vdr/thread.h>
+#include "androvdrthread.h"
+#include "select.h"
+#include "helpers.h"
+
+cAndroVdrThread::cAndroVdrThread(int port, const char * password)
+{
+ select = NULL;
+ this->port = port;
+ this->password = password;
+}
+
+cAndroVdrThread::~cAndroVdrThread()
+{
+ Cleanup();
+}
+
+void cAndroVdrThread::Action(void)
+{
+ // create listener socket
+ if (!Init())
+ return;
+
+ // do processing
+ select->Action();
+
+ // cleanup
+ Cleanup();
+}
+
+bool cAndroVdrThread::Init()
+{
+ // create select
+ select = new cSelect();
+ if (select == NULL)
+ return false;
+
+ // create server socket
+ cVdrmanagerServerSocket * sock = new cVdrmanagerServerSocket();
+ if (sock == NULL || !sock->Create(port, password))
+ return false;
+
+ // register server socket
+ select->SetServerSocket(sock);
+
+ return true;
+}
+
+void cAndroVdrThread::Cleanup()
+{
+ if (select)
+ delete select;
+}
+
+void cAndroVdrThread::Shutdown()
+{
+}