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