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