]> git.vomp.tv Git - vompclient.git/blob - inputcec.h
Rename TCP class to TCPOld
[vompclient.git] / inputcec.h
1  /*
2     Copyright 2004-2020 Chris Tallon; 2012 Marten Richter
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 INPUTCEC_H
21 #define INPUTCEC_H
22
23 #include <libcec/cec.h>
24
25 #include "input.h"
26
27 class InputCEC : public Input
28 {
29   public:
30     bool init();
31     void shutdown();
32
33     bool handlesVolume() { return cechandlesvolume; };
34     void volumeUp();
35     void volumeDown();
36     void volumeMute();
37     void changePowerState(bool poweron);
38
39     bool loadOptionsFromServer(VDR* vdr);
40     bool saveOptionstoServer();
41     bool addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane);
42     bool handleOptionChanges(Option* option);
43
44     std::string getHardwareKeyName(int hardwareKey);
45     const char* getHardCodedHardwareKeyNamesForVompKey(UCHAR vompKey);
46
47   private:
48     static constexpr const char* myModName = "InputCEC";
49     const char* modName() { return myModName; }
50     void InitKeymap();
51     void InitHWCListwithDefaults();
52     UCHAR TranslateHWCFixed(int code);
53
54     bool cechandlesvolume{};
55
56     CEC::ICECAdapter* cec_adap{};
57     CEC::libcec_configuration cec_config;
58     CEC::ICECCallbacks cec_callbacks;
59
60     void incomingCECkey(int keys);
61     void incomingPowerkey(UCHAR key);
62
63     static InputCEC* instance;
64     static void cecLogMessage(void *param, const CEC::cec_log_message* message);
65     static void cecKeyPress(void*param, const CEC::cec_keypress* key);
66     static void cecCommand(void *param, const CEC::cec_command* command);
67     static void cecConfigurationChanged(void *param, const CEC::libcec_configuration* config);
68     static void cecSourceActivated(void*param, const CEC::cec_logical_address address, const uint8_t activated);
69 };
70
71 #endif