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