]> git.vomp.tv Git - vompclient.git/blob - remote.h
MVP code removal
[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, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef REMOTE_H
21 #define REMOTE_H
22
23 #include <stdio.h>
24 #include <map>
25
26 #include "defines.h"
27 #include "abstractoption.h"
28
29
30 using namespace std;
31 typedef map<ULLONG,UCHAR> RemoteTranslationList;
32
33 class Remote: public AbstractOption
34 {
35   public:
36     Remote();
37     virtual ~Remote();
38     static Remote* getInstance();
39
40     bool addOptionPagesToWTB(WTabBar *wtb);
41     bool loadOptionsfromServer(VDR* vdr);
42     bool saveOptionstoServer();
43
44     void setRemoteType(UCHAR type);
45     void setHWCtoCommand(ULLONG hcw,UCHAR command);
46     void unsetHWC(ULLONG hcw);
47     void LoadKeysConfig(VDR *vdr,const char*keynum);
48     void SaveKeysConfig();
49     void EnterLearningMode(UCHAR command);
50
51     virtual int init(const char *devName)=0;
52     virtual int shutdown()=0;
53     virtual UCHAR getButtonPress(int how)=0;
54     virtual void clearBuffer()=0;
55
56     virtual bool mayHaveFewButtons() {return false;};
57
58     virtual bool handlesVolume() {return false;};
59     virtual void volumeUp() {};
60     virtual void volumeDown() {};
61     virtual void volumeMute() {};
62
63     virtual void InitHWCListwithDefaults();
64     virtual char* HCWDesc(ULLONG hcw);
65     const char *CommandDesc(UCHAR number);
66     char *CommandTranslateStr(UCHAR command);
67     virtual const char*HardcodedTranslateStr(UCHAR command);
68     void EnterLearnMode(UCHAR command);
69     void ResetToDefault();
70
71     virtual void changePowerState(bool /* poweron */) {}; //informs the remote control, that about vomp's power state, this is important e.g. for cec
72
73     const static ULONG NOLEARNMODE = 256;
74     // Not buttons
75     const static UCHAR NA_LEARN    = 101;
76     const static UCHAR NA_NONE     = 98;
77     const static UCHAR NA_UNKNOWN  = 99;
78     const static UCHAR NA_SIGNAL   = 100;
79     const static UCHAR DF_UP       = 94;
80     const static UCHAR DF_DOWN     = 95;
81     const static UCHAR DF_LEFT     = 96;
82     const static UCHAR DF_RIGHT    = 97;
83
84     // Problem common buttons
85     const static UCHAR VOLUMEUP    = 16;
86     const static UCHAR VOLUMEDOWN  = 17;
87     const static UCHAR CHANNELUP   = 32;
88     const static UCHAR CHANNELDOWN = 33;
89
90     // Common buttons
91     const static UCHAR ZERO        = 0;
92     const static UCHAR ONE         = 1;
93     const static UCHAR TWO         = 2;
94     const static UCHAR THREE       = 3;
95     const static UCHAR FOUR        = 4;
96     const static UCHAR FIVE        = 5;
97     const static UCHAR SIX         = 6;
98     const static UCHAR SEVEN       = 7;
99     const static UCHAR EIGHT       = 8;
100     const static UCHAR NINE        = 9;
101     const static UCHAR POWER       = 61;
102     const static UCHAR GO          = 59;
103     const static UCHAR BACK        = 31;
104     const static UCHAR MENU        = 13;
105     const static UCHAR RED         = 11;
106     const static UCHAR GREEN       = 46;
107     const static UCHAR YELLOW      = 56;
108     const static UCHAR BLUE        = 41;
109     const static UCHAR MUTE        = 15;
110     const static UCHAR RADIO       = 12; // The unlabelled button on old
111     const static UCHAR REVERSE     = 50;
112     const static UCHAR PLAY        = 53;
113     const static UCHAR FORWARD     = 52;
114     const static UCHAR RECORD      = 55;
115     const static UCHAR STOP        = 54;
116     const static UCHAR PAUSE       = 48;
117     const static UCHAR SKIPBACK    = 36;
118     const static UCHAR SKIPFORWARD = 30;
119     const static UCHAR OK          = 37;
120
121     // Old remote only
122     const static UCHAR FULL        = 60;
123
124     // New remote only
125     const static UCHAR TV          = 28;
126     const static UCHAR VIDEOS      = 24;
127     const static UCHAR MUSIC       = 25;
128     const static UCHAR PICTURES    = 26;
129     const static UCHAR GUIDE       = 27;
130     const static UCHAR UP          = 20;
131     const static UCHAR DOWN        = 21;
132     const static UCHAR LEFT        = 22;
133     const static UCHAR RIGHT       = 23;
134     const static UCHAR PREVCHANNEL = 18;
135     const static UCHAR STAR        = 10;
136     const static UCHAR HASH        = 14;
137
138     // Android only
139     const static UCHAR PLAYPAUSE       = 201;
140     // cec only
141     const static UCHAR POWERON       = 202;
142     const static UCHAR POWEROFF       = 203;
143
144
145     // Remote types
146     const static UCHAR OLDREMOTE   = 1;
147     const static UCHAR NEWREMOTE   = 2;
148
149   protected:
150     virtual UCHAR TranslateHWCFixed(ULLONG code);
151     UCHAR TranslateHWCList(ULLONG code);
152     UCHAR TranslateHWC(ULLONG code);
153     
154
155     ULONG learnmode;
156     static Remote* instance;
157     UCHAR remoteType;
158     RemoteTranslationList translist;
159 };
160
161 #endif