summaryrefslogtreecommitdiff
path: root/interface.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-10-08 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-10-08 18:00:00 +0200
commita379eb714f7f5ef9a12efbe7588bb3509faba056 (patch)
treeea9a0720f305e8ee76ea7c60c996fd3a8bad0ce5 /interface.c
parentef8fe3f04c30caedeb17b11ac275581539f039c7 (diff)
downloadvdr-patch-lnbsharing-a379eb714f7f5ef9a12efbe7588bb3509faba056.tar.gz
vdr-patch-lnbsharing-a379eb714f7f5ef9a12efbe7588bb3509faba056.tar.bz2
Version 0.66vdr-0.66
- Remote control data is now received in a separate thread, which makes things a lot smoother. - Repeat and release of remote control keys is now explicitly distinguished. - In replay mode the search forward/back and skip functions now have two modes: Pressing the key shortly and releasing it starts the function, and pressing it again stops it. Pressing and holding down the key starts the function and releasing the key stops it. - The '@' character that marks an "instant recording" can now be turned off in the "Setup" menu (thanks to Matthias Schniedermeyer). - Pressing the "Back" button while replaying now stops replaying and brings up the "Recordings" menu (suggested by Carsten Koch). This can be used to easily delete a recording after watching it, or to switch to a different recording. - The "Recordings" menu now places the cursor on the last replayed recording, if that file still exists. - The "Blue" button in the "Main" menu can now be used to "Resume" a previously stopped replay session (suggested by Martin Hammerschmid). - The low and high LNB frequencies can now be changed in the "Setup" menu.
Diffstat (limited to 'interface.c')
-rw-r--r--interface.c82
1 files changed, 46 insertions, 36 deletions
diff --git a/interface.c b/interface.c
index a0fca0e..5940195 100644
--- a/interface.c
+++ b/interface.c
@@ -4,43 +4,39 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: interface.c 1.21 2000/10/03 13:28:02 kls Exp $
+ * $Id: interface.c 1.25 2000/10/08 16:34:17 kls Exp $
*/
#include "interface.h"
#include <unistd.h>
#include "eit.h"
-#include "remote.h"
cEIT EIT;
-#if defined(REMOTE_RCU)
-cRcIoRCU RcIo("/dev/ttyS1");
-#elif defined(REMOTE_LIRC)
-cRcIoLIRC RcIo("/dev/lircd");
-#else
-cRcIoKBD RcIo;
-#endif
-
-cInterface Interface;
+cInterface *Interface = NULL;
-cInterface::cInterface(void)
+cInterface::cInterface(int SVDRPport)
{
open = 0;
cols[0] = 0;
keyFromWait = kNone;
+ rcIo = NULL;
SVDRP = NULL;
-}
-
-void cInterface::Init(int SVDRPport)
-{
- RcIo.SetCode(Keys.code, Keys.address);
+#if defined(REMOTE_RCU)
+ rcIo = new cRcIoRCU("/dev/ttyS1");
+#elif defined(REMOTE_LIRC)
+ rcIo = new cRcIoLIRC("/dev/lircd");
+#else
+ rcIo = new cRcIoKBD;
+#endif
+ rcIo->SetCode(Keys.code, Keys.address);
if (SVDRPport)
SVDRP = new cSVDRP(SVDRPport);
}
-void cInterface::Cleanup(void)
+cInterface::~cInterface()
{
+ delete rcIo;
delete SVDRP;
}
@@ -58,22 +54,29 @@ void cInterface::Close(void)
cDvbApi::PrimaryDvbApi->Close();
}
-unsigned int cInterface::GetCh(bool Wait)
+unsigned int cInterface::GetCh(bool Wait, bool *Repeat, bool *Release)
{
- if (RcIo.InputAvailable(Wait)) {
- unsigned int Command;
- return RcIo.GetCommand(&Command, NULL) ? Command : 0;
- }
- return 0;
+ if (open)
+ cDvbApi::PrimaryDvbApi->Flush();
+ if (!rcIo->InputAvailable())
+ cFile::AnyFileReady(-1, Wait ? 1000 : 0);
+ unsigned int Command;
+ return rcIo->GetCommand(&Command, Repeat, Release) ? Command : 0;
}
eKeys cInterface::GetKey(bool Wait)
{
- if (open)
- cDvbApi::PrimaryDvbApi->Flush();
if (SVDRP)
SVDRP->Process();
- eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait));
+ eKeys Key = keyFromWait;
+ if (Key == kNone) {
+ bool Repeat = false, Release = false;
+ Key = Keys.Get(GetCh(Wait, &Repeat, &Release));
+ if (Repeat)
+ Key = eKeys(Key | k_Repeat);
+ if (Release)
+ Key = eKeys(Key | k_Release);
+ }
keyFromWait = kNone;
return Key;
}
@@ -85,13 +88,16 @@ void cInterface::PutKey(eKeys Key)
eKeys cInterface::Wait(int Seconds, bool KeepChar)
{
- eKeys Key = kNone;
if (open)
cDvbApi::PrimaryDvbApi->Flush();
- RcIo.Flush(500);
- if (cFile::AnyFileReady(-1, Seconds * 1000))
- Key = GetKey();
- if (KeepChar)
+ eKeys Key = kNone;
+ time_t timeout = time(NULL) + Seconds;
+ for (;;) {
+ Key = GetKey();
+ if ((Key != kNone && (RAWKEY(Key) != kOk || RAWKEY(Key) == Key)) || time(NULL) > timeout)
+ break;
+ }
+ if (KeepChar && ISRAWKEY(Key))
keyFromWait = Key;
return Key;
}
@@ -220,9 +226,11 @@ void cInterface::Help(const char *Red, const char *Green, const char *Yellow, co
void cInterface::QueryKeys(void)
{
Keys.Clear();
+ Clear();
WriteText(1, 1, "Learning Remote Control Keys");
WriteText(1, 3, "Phase 1: Detecting RC code type");
WriteText(1, 5, "Press any key on the RC unit");
+ cDvbApi::PrimaryDvbApi->Flush();
#ifndef REMOTE_KBD
unsigned char Code = 0;
unsigned short Address;
@@ -233,14 +241,16 @@ void cInterface::QueryKeys(void)
break;
#else
//TODO on screen display...
- if (RcIo.DetectCode(&Code, &Address)) {
+ if (rcIo->DetectCode(&Code, &Address)) {
Keys.code = Code;
Keys.address = Address;
WriteText(1, 5, "RC code detected!");
WriteText(1, 6, "Do not press any key...");
- RcIo.Flush(3000);
+ cDvbApi::PrimaryDvbApi->Flush();
+ rcIo->Flush(3000);
ClearEol(0, 5);
ClearEol(0, 6);
+ cDvbApi::PrimaryDvbApi->Flush();
break;
}
#endif
@@ -328,7 +338,7 @@ eKeys cInterface::DisplayChannel(int Number, const char *Name, bool WithInfo)
{
// Number = 0 is used for channel group display and no EIT
if (Number)
- RcIo.Number(Number);
+ rcIo->Number(Number);
if (Name && !Recording()) {
Open(MenuColumns, 5);
cDvbApi::PrimaryDvbApi->Fill(0, 0, MenuColumns, 1, clrBackground);
@@ -387,7 +397,7 @@ eKeys cInterface::DisplayChannel(int Number, const char *Name, bool WithInfo)
void cInterface::DisplayRecording(int Index, bool On)
{
- RcIo.SetPoints(1 << Index, On);
+ rcIo->SetPoints(1 << Index, On);
}
bool cInterface::Recording(void)