fonts/helvB24.o fonts/helvB18.o
OBJECTS2 = remote.o led.o mtd.o video.o audio.o osd.o surface.o \
+ remotemvp.o remotewin.o \
audiomvp.o audiowin.o \
videomvp.o videowin.o \
osdmvp.o osdwin.o \
#include "defines.h"
#include "log.h"
-#include "remote.h"
#include "mtd.h"
#include "timers.h"
#include "vdr.h"
#include "command.h"
#ifdef WIN32
+ #include "remotewin.h"
#include "ledwin.h"
#include "osdwin.h"
#include "audiowin.h"
#include "videowin.h"
#else
+ #include "remotemvp.h"
#include "ledmvp.h"
#include "osdmvp.h"
#include "audiomvp.h"
// Init global vars ------------------------------------------------------------------------------------------------
logger = new Log();
- remote = new Remote();
mtd = new Mtd();
timers = new Timers();
vdr = new VDR();
#ifdef WIN32
+ remote = new RemoteWin();
led = new LedWin();
osd = new OsdWin();
audio = new AudioWin();
video = new VideoWin();
#else
+ remote = new RemoteMVP();
led = new LedMVP();
osd = new OsdMVP();
audio = new AudioMVP();
shutdown(1);
}
- success = led->init(remote->getDevice());
+#ifdef WIN32
+ success = led->init();
+#else
+ success = led->init(((RemoteMVP*)remote)->getDevice());
+#endif
if (success)
{
logger->log("Core", Log::INFO, "LED module initialised");
{
if (instance) return;
instance = this;
- initted = 0;
- device = 0;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
remoteType = OLDREMOTE;
}
return instance;
}
-int Remote::init(char* devName)
-{
- if (initted) return 0;
- initted = 1;
-
- device = open(devName, O_RDONLY);
- if (device < 0)
- {
- initted = 0;
- return 0;
- }
-
- return 1;
-}
-
-int Remote::shutdown()
-{
- if (!initted) return 0;
- initted = 0;
- close(device);
- device = 0;
- return 1;
-}
-
-int Remote::getDevice()
-{
- if (!initted) return 0;
- return device;
-}
-
void Remote::setRemoteType(UCHAR newType)
{
if ((newType != OLDREMOTE) && (newType != NEWREMOTE)) return;
remoteType = newType;
}
-
-UCHAR Remote::getButtonPress(int waitType)
-{
- /* how = 0 - block
- how = 1 - start new wait
- how = 2 - continue wait
- how = 3 - no wait
- */
-
- unsigned long input;
- struct timeval* passToSelect = NULL;
- int retval;
- fd_set readfds;
-
- if (waitType == 0)
- {
- passToSelect = NULL;
- }
- else if (waitType == 1)
- {
- tv.tv_sec = 1;
- tv.tv_usec = 000000;
- passToSelect = &tv;
- }
- else if (waitType == 2)
- {
- if ((tv.tv_sec == 0) && (tv.tv_usec == 0)) // protection in case timer = 0
- {
- tv.tv_sec = 1;
- tv.tv_usec = 000000;
- }
- passToSelect = &tv;
- }
- else if (waitType == 3)
- {
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- passToSelect = &tv;
- }
- FD_ZERO(&readfds);
- FD_SET(device, &readfds);
-
- retval = select(device + 1, &readfds, NULL, NULL, &tv);
- // 0 = nothing happened
- // 1 = data arrived (actually num of descriptors that changed)
- // other value = signal or error
- if (retval == 0) return NA_NONE;
- if (retval == -1) return NA_SIGNAL;
-
- int count = read(device, &input, 4);
- if (count == 4)
- {
- input = (0X00FF0000 & input) >> 16;
- Log::getInstance()->log("Remote", Log::DEBUG, "Button %i", input);
-
- if (remoteType == OLDREMOTE)
- {
- if (input == VOLUMEDOWN) return DF_LEFT;
- if (input == VOLUMEUP) return DF_RIGHT;
- if (input == CHANNELUP) return DF_UP;
- if (input == CHANNELDOWN) return DF_DOWN;
- }
-
- return (UCHAR) input;
- }
- return NA_UNKNOWN;
-}
-
-void Remote::clearBuffer()
-{
- while(getButtonPress(3) != NA_NONE);
-}
#define REMOTE_H
#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
#include "defines.h"
#include "log.h"
{
public:
Remote();
- ~Remote();
+ virtual ~Remote();
static Remote* getInstance();
- int init(char *devName);
- int shutdown();
- int getDevice();
void setRemoteType(UCHAR type);
- UCHAR getButtonPress(int how);
- void clearBuffer();
+
+ virtual int init(char *devName)=0;
+ virtual int shutdown()=0;
+ virtual UCHAR getButtonPress(int how)=0;
+ virtual void clearBuffer()=0;
// Not buttons
const static UCHAR NA_NONE = 98;
const static UCHAR OLDREMOTE = 1;
const static UCHAR NEWREMOTE = 2;
- private:
+ protected:
static Remote* instance;
- int initted;
- int device;
- struct timeval tv;
UCHAR remoteType;
};
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "remotemvp.h"
+
+RemoteMVP::RemoteMVP()
+{
+ if (instance) return;
+ initted = 0;
+ device = 0;
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+}
+
+RemoteMVP::~RemoteMVP()
+{
+}
+
+int RemoteMVP::init(char* devName)
+{
+ if (initted) return 0;
+ initted = 1;
+
+ device = open(devName, O_RDONLY);
+ if (device < 0)
+ {
+ initted = 0;
+ return 0;
+ }
+
+ return 1;
+}
+
+int RemoteMVP::shutdown()
+{
+ if (!initted) return 0;
+ initted = 0;
+ close(device);
+ device = 0;
+ return 1;
+}
+
+int RemoteMVP::getDevice()
+{
+ if (!initted) return 0;
+ return device;
+}
+
+UCHAR RemoteMVP::getButtonPress(int waitType)
+{
+ /* how = 0 - block
+ how = 1 - start new wait
+ how = 2 - continue wait
+ how = 3 - no wait
+ */
+
+ unsigned long input;
+ struct timeval* passToSelect = NULL;
+ int retval;
+ fd_set readfds;
+
+ if (waitType == 0)
+ {
+ passToSelect = NULL;
+ }
+ else if (waitType == 1)
+ {
+ tv.tv_sec = 1;
+ tv.tv_usec = 000000;
+ passToSelect = &tv;
+ }
+ else if (waitType == 2)
+ {
+ if ((tv.tv_sec == 0) && (tv.tv_usec == 0)) // protection in case timer = 0
+ {
+ tv.tv_sec = 1;
+ tv.tv_usec = 000000;
+ }
+ passToSelect = &tv;
+ }
+ else if (waitType == 3)
+ {
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ passToSelect = &tv;
+ }
+ FD_ZERO(&readfds);
+ FD_SET(device, &readfds);
+
+ retval = select(device + 1, &readfds, NULL, NULL, &tv);
+ // 0 = nothing happened
+ // 1 = data arrived (actually num of descriptors that changed)
+ // other value = signal or error
+ if (retval == 0) return NA_NONE;
+ if (retval == -1) return NA_SIGNAL;
+
+ int count = read(device, &input, 4);
+ if (count == 4)
+ {
+ input = (0X00FF0000 & input) >> 16;
+ Log::getInstance()->log("Remote", Log::DEBUG, "Button %i", input);
+
+ if (remoteType == OLDREMOTE)
+ {
+ if (input == VOLUMEDOWN) return DF_LEFT;
+ if (input == VOLUMEUP) return DF_RIGHT;
+ if (input == CHANNELUP) return DF_UP;
+ if (input == CHANNELDOWN) return DF_DOWN;
+ }
+
+ return (UCHAR) input;
+ }
+ return NA_UNKNOWN;
+}
+
+void RemoteMVP::clearBuffer()
+{
+ while(getButtonPress(3) != NA_NONE);
+}
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef REMOTEMVP_H
+#define REMOTEMVP_H
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "defines.h"
+#include "log.h"
+#include "remote.h"
+
+class RemoteMVP : public Remote
+{
+ public:
+ RemoteMVP();
+ ~RemoteMVP();
+
+ int init(char *devName);
+ int shutdown();
+ int getDevice();
+ UCHAR getButtonPress(int how);
+ void clearBuffer();
+
+ private:
+ int initted;
+ int device;
+ struct timeval tv;
+};
+
+#endif
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "remotewin.h"
+
+RemoteWin::RemoteWin()
+{
+ if (instance) return;
+ initted = 0;
+}
+
+RemoteWin::~RemoteWin()
+{
+}
+
+int RemoteWin::init(char* devName)
+{
+ if (initted) return 0;
+ initted = 1;
+
+ return 1;
+}
+
+int RemoteWin::shutdown()
+{
+ if (!initted) return 0;
+ initted = 0;
+ return 1;
+}
+
+UCHAR RemoteWin::getButtonPress(int waitType)
+{
+ /* how = 0 - block
+ how = 1 - start new wait
+ how = 2 - continue wait
+ how = 3 - no wait
+ */
+
+
+ return NA_UNKNOWN;
+}
+
+void RemoteWin::clearBuffer()
+{
+}
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef REMOTEWIN_H
+#define REMOTEWIN_H
+
+#include <stdio.h>
+
+#include "defines.h"
+#include "log.h"
+#include "remote.h"
+
+class RemoteWin : public Remote
+{
+ public:
+ RemoteWin();
+ ~RemoteWin();
+
+ int init(char *devName);
+ int shutdown();
+ int getDevice();
+ UCHAR getButtonPress(int how);
+ void clearBuffer();
+
+ private:
+ int initted;
+};
+
+#endif