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