2 Copyright 2020 Chris Tallon; 2012 Marten Richter
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/>.
21 #include "wremoteconfig.h"
23 #include "inputlinux.h"
30 InputMan* InputMan::instance = NULL;
42 InputMan* InputMan::getInstance()
51 #ifdef VOMP_PLATFORM_RASPBERRY
52 inputLinux = new InputLinux();
53 i1 = inputLinux->init();
54 if (!i1) { delete inputLinux; inputLinux = NULL; }
56 // inputCEC = new InputCEC();
57 // i2 = inputCEC->init();
58 // if (!i2) { delete inputCEC; inputCEC = NULL; }
63 Log::getInstance()->log("InputMan", Log::CRIT, "InputMan could not init any input module");
71 bool InputMan::start()
77 i1 = inputLinux->start();
85 if (inputLinux) inputLinux->stop();
88 void InputMan::shutdown()
90 Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start");
94 Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - Linux");
96 inputLinux->shutdown();
103 Log::getInstance()->log("InputMan", Log::DEBUG, "Shutdown start - CEC");
104 inputCEC->shutdown();
112 bool InputMan::mayHaveFewButtons()
114 // 052 returned true if remotelinux was in effect - linux or CEC. What was it for?
116 if (inputLinux || inputCEC) return true;
120 bool InputMan::handlesVolume()
122 if (!inputCEC) return false;
123 return inputCEC->handlesVolume();
126 void InputMan::volumeUp()
128 if (inputCEC) inputCEC->volumeUp();
131 void InputMan::volumeDown()
133 if (inputCEC) inputCEC->volumeDown();
136 void InputMan::volumeMute()
138 if (inputCEC) inputCEC->volumeMute();
141 void InputMan::changePowerState(bool powerOn)
143 if (inputCEC) inputCEC->changePowerState(powerOn);
146 bool InputMan::addOptionsToPanes(int panenumber, Options* options, WOptionPane* pane)
148 if (inputLinux) inputLinux->addOptionsToPanes(panenumber, options, pane);
149 if (inputCEC) inputCEC->addOptionsToPanes(panenumber, options, pane);
151 return true; // FIXME
154 bool InputMan::addOptionPagesToWTB(WTabBar *wtb)
156 //if (inputLinux) inputLinux->addOptionPagesToWTB(wtb);
157 //if (inputCEC) inputCEC->addOptionPagesToWTB(wtb);
159 WRemoteConfig* wrc = new WRemoteConfig();
160 wtb->addTab(tr("Remote Control"), wrc);
162 return true; // FIXME
165 bool InputMan::saveOptionstoServer()
167 if (inputLinux) inputLinux->saveOptionstoServer();
168 if (inputCEC) inputCEC->saveOptionstoServer();
170 return true; // FIXME
173 const char* InputMan::CommandDesc(UCHAR number)
177 case Input::VOLUMEUP:
178 return tr("Volume Up");
179 case Input::VOLUMEDOWN:
180 return tr("Volume Down");
181 case Input::CHANNELUP:
182 return tr("Channel up");
183 case Input::CHANNELDOWN:
184 return tr("Channel down");
226 return tr("Reverse");
230 return tr("Forward");
237 case Input::SKIPBACK:
238 return tr("Skip back");
239 case Input::SKIPFORWARD:
240 return tr("Skip forward");
244 return tr("Fullscreen");
251 case Input::PICTURES:
252 return tr("Pictures");
263 case Input::PREVCHANNEL:
264 return tr("Previous Channel");
269 case Input::PLAYPAUSE:
270 return tr("Play/Pause");