]> git.vomp.tv Git - vompclient.git/blob - src/input.h
Have build.sh deal with cmake
[vompclient.git] / src / input.h
1 /*
2     Copyright 2004-2020 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 INPUT_H
21 #define INPUT_H
22
23 #include <string>
24 #include <map>
25
26 #include "defines.h"
27 #include "abstractoption.h"
28
29 class VDR;
30
31 typedef std::map<u8, u1> RemoteTranslationList;
32
33 class Input: public AbstractOption
34 {
35   public:
36     virtual ~Input() {}
37
38     virtual bool start() { return false; }
39     virtual void stop() {}
40
41     // Abstract Option interface
42     virtual bool loadOptionsFromServer(VDR* vdr);
43     virtual bool saveOptionstoServer();
44
45     static void sendInputKey(int key);
46
47     void setHWCtoCommand(u8 hcw, u1 command);
48     void unsetHWC(u8 hcw);
49     void LoadKeysConfig(VDR* vdr, const char* keynum);
50     void SaveKeysConfig();
51
52     virtual bool init()=0;
53     virtual void shutdown()=0;
54
55     virtual bool handlesVolume() {return false;};
56     virtual void volumeUp() {};
57     virtual void volumeDown() {};
58     virtual void volumeMute() {};
59     virtual void changePowerState(bool /* poweron */) {}; //informs the remote control, that about vomp's power state, this is important e.g. for cec
60
61     virtual void InitHWCListwithDefaults()=0;
62     std::string getAllHardwareKeyNamesAssignedToVompKey(u1 vompKey);
63     char* CommandTranslateStr(u1 command);
64     void EnterLearnMode(u1 /* command */ ) {}; // Override and set lernMode to command
65     void cancelLearnMode() { learnMode = NOLEARNMODE; }
66     void ResetToDefault();
67     virtual std::string getHardwareKeyName(u8 hardwareKey) = 0;
68
69
70     const static u4 NOLEARNMODE = 256;
71     // Not buttons
72     const static u1 NA_LEARN    = 101;
73     const static u1 NA_NONE     = 98;
74     const static u1 NA_UNKNOWN  = 99;
75
76     // Problem common buttons
77     const static u1 VOLUMEUP    = 16;
78     const static u1 VOLUMEDOWN  = 17;
79     const static u1 CHANNELUP   = 32;
80     const static u1 CHANNELDOWN = 33;
81
82     // Common buttons
83     const static u1 ZERO        = 0;
84     const static u1 ONE         = 1;
85     const static u1 TWO         = 2;
86     const static u1 THREE       = 3;
87     const static u1 FOUR        = 4;
88     const static u1 FIVE        = 5;
89     const static u1 SIX         = 6;
90     const static u1 SEVEN       = 7;
91     const static u1 EIGHT       = 8;
92     const static u1 NINE        = 9;
93     const static u1 POWER       = 61;
94     const static u1 GO          = 59;
95     const static u1 BACK        = 31;
96     const static u1 MENU        = 13;
97     const static u1 RED         = 11;
98     const static u1 GREEN       = 46;
99     const static u1 YELLOW      = 56;
100     const static u1 BLUE        = 41;
101     const static u1 MUTE        = 15;
102     const static u1 RADIO       = 12; // The unlabelled button on old
103     const static u1 REVERSE     = 50;
104     const static u1 PLAY        = 53;
105     const static u1 FORWARD     = 52;
106     const static u1 RECORD      = 55;
107     const static u1 STOP        = 54;
108     const static u1 PAUSE       = 48;
109     const static u1 SKIPBACK    = 36;
110     const static u1 SKIPFORWARD = 30;
111     const static u1 OK          = 37;
112
113     // Old remote only
114     const static u1 FULL        = 60;
115
116     // New remote only
117     const static u1 TV          = 28;
118     const static u1 VIDEOS      = 24;
119     const static u1 MUSIC       = 25;
120     const static u1 PICTURES    = 26;
121     const static u1 GUIDE       = 27;
122     const static u1 UP          = 20;
123     const static u1 DOWN        = 21;
124     const static u1 LEFT        = 22;
125     const static u1 RIGHT       = 23;
126     const static u1 PREVCHANNEL = 18;
127     const static u1 STAR        = 10;
128     const static u1 HASH        = 14;
129
130     // Android only
131     const static u1 PLAYPAUSE   = 201;
132     // cec only
133     const static u1 POWERON     = 202;
134     const static u1 POWEROFF    = 203;
135
136   protected:
137     virtual const char* modName()=0;
138     RemoteTranslationList translist;
139     int learnMode{NOLEARNMODE};
140
141     virtual u1 TranslateHWCFixed(u8 code) = 0;
142     u1 TranslateHWCList(u8 code);
143     u1 TranslateHWC(u8 code);
144 };
145
146 #endif