]> git.vomp.tv Git - vompclient.git/blob - remote.h
Removal of Message::REDRAW and BoxStack handler for it
[vompclient.git] / remote.h
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef REMOTE_H
22 #define REMOTE_H
23
24 #include <stdio.h>
25 #include <map>
26
27 #include "defines.h"
28 #include "abstractoption.h"
29
30
31 using namespace std;
32 typedef map<ULLONG,UCHAR> RemoteTranslationList;
33
34 class Remote: public AbstractOption
35 {
36   public:
37     Remote();
38     virtual ~Remote();
39     static Remote* getInstance();
40
41     bool addOptionPagesToWTB(WTabBar *wtb);
42     bool loadOptionsfromServer(VDR* vdr);
43     bool saveOptionstoServer();
44
45     void setRemoteType(UCHAR type);
46     void setHWCtoCommand(ULLONG hcw,UCHAR command);
47     void unsetHWC(ULLONG hcw);
48     void LoadKeysConfig(char *cfg);
49     char *SaveKeysConfig();
50     void EnterLearningMode(UCHAR command);
51
52     virtual int init(char *devName)=0;
53     virtual int shutdown()=0;
54     virtual UCHAR getButtonPress(int how)=0;
55     virtual void clearBuffer()=0;
56
57     virtual void InitHWCListwithDefaults();
58     virtual char* HCWDesc(ULLONG hcw);
59     const char *CommandDesc(UCHAR number);
60     char *CommandTranslateStr(UCHAR command);
61     virtual const char*HardcodedTranslateStr(UCHAR command);
62     void EnterLearnMode(UCHAR command);
63     void ResetToDefault();
64
65     const static ULONG NOLEARNMODE = 256;
66     // Not buttons
67     const static UCHAR NA_LEARN    = 101;
68     const static UCHAR NA_NONE     = 98;
69     const static UCHAR NA_UNKNOWN  = 99;
70     const static UCHAR NA_SIGNAL   = 100;
71     const static UCHAR DF_UP       = 94;
72     const static UCHAR DF_DOWN     = 95;
73     const static UCHAR DF_LEFT     = 96;
74     const static UCHAR DF_RIGHT    = 97;
75
76     // Problem common buttons
77     const static UCHAR VOLUMEUP    = 16;
78     const static UCHAR VOLUMEDOWN  = 17;
79     const static UCHAR CHANNELUP   = 32;
80     const static UCHAR CHANNELDOWN = 33;
81
82     // Common buttons
83     const static UCHAR ZERO        = 0;
84     const static UCHAR ONE         = 1;
85     const static UCHAR TWO         = 2;
86     const static UCHAR THREE       = 3;
87     const static UCHAR FOUR        = 4;
88     const static UCHAR FIVE        = 5;
89     const static UCHAR SIX         = 6;
90     const static UCHAR SEVEN       = 7;
91     const static UCHAR EIGHT       = 8;
92     const static UCHAR NINE        = 9;
93     const static UCHAR POWER       = 61;
94     const static UCHAR GO          = 59;
95     const static UCHAR BACK        = 31;
96     const static UCHAR MENU        = 13;
97     const static UCHAR RED         = 11;
98     const static UCHAR GREEN       = 46;
99     const static UCHAR YELLOW      = 56;
100     const static UCHAR BLUE        = 41;
101     const static UCHAR MUTE        = 15;
102     const static UCHAR RADIO       = 12; // The unlabelled button on old
103     const static UCHAR REVERSE     = 50;
104     const static UCHAR PLAY        = 53;
105     const static UCHAR FORWARD     = 52;
106     const static UCHAR RECORD      = 55;
107     const static UCHAR STOP        = 54;
108     const static UCHAR PAUSE       = 48;
109     const static UCHAR SKIPBACK    = 36;
110     const static UCHAR SKIPFORWARD = 30;
111     const static UCHAR OK          = 37;
112
113     // Old remote only
114     const static UCHAR FULL        = 60;
115
116     // New remote only
117     const static UCHAR TV          = 28;
118     const static UCHAR VIDEOS      = 24;
119     const static UCHAR MUSIC       = 25;
120     const static UCHAR PICTURES    = 26;
121     const static UCHAR GUIDE       = 27;
122     const static UCHAR UP          = 20;
123     const static UCHAR DOWN        = 21;
124     const static UCHAR LEFT        = 22;
125     const static UCHAR RIGHT       = 23;
126     const static UCHAR PREVCHANNEL = 18;
127     const static UCHAR STAR        = 10;
128     const static UCHAR HASH        = 14;
129
130     // Remote types
131     const static UCHAR OLDREMOTE   = 1;
132     const static UCHAR NEWREMOTE   = 2;
133
134   protected:
135     virtual UCHAR TranslateHWCFixed(ULLONG code);
136     UCHAR TranslateHWCList(ULLONG code);
137     UCHAR TranslateHWC(ULLONG code);
138     
139
140     ULONG learnmode;
141     static Remote* instance;
142     UCHAR remoteType;
143     RemoteTranslationList translist;
144 };
145
146 #endif