]> git.vomp.tv Git - vompclient.git/blob - remote.h
Remove thread from videoomx, Code cleanup, Fix remote keys (could crash server!).
[vompclient.git] / remote.h
1 /*
2     Copyright 2004-2005 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, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef REMOTE_H
22 #define REMOTE_H
23
24 #include <stdio.h>
25 #include <map>
26
27 #include "defines.h"
28 #include "abstractoption.h"
29
30
31 using namespace std;
32 typedef map<ULLONG,UCHAR> RemoteTranslationList;
33
34 class Remote: public AbstractOption
35 {
36   public:
37     Remote();
38     virtual ~Remote();
39     static Remote* getInstance();
40
41     bool addOptionPagesToWTB(WTabBar *wtb);
42     bool loadOptionsfromServer(VDR* vdr);
43     bool saveOptionstoServer();
44
45     void setRemoteType(UCHAR type);
46     void setHWCtoCommand(ULLONG hcw,UCHAR command);
47     void unsetHWC(ULLONG hcw);
48     void LoadKeysConfig(VDR *vdr,const char*keynum);
49     void SaveKeysConfig();
50     void EnterLearningMode(UCHAR command);
51
52     virtual int init(char *devName)=0;
53     virtual int shutdown()=0;
54     virtual UCHAR getButtonPress(int how)=0;
55     virtual void clearBuffer()=0;
56
57     virtual bool mayHaveFewButtons() {return false;};
58
59     virtual void InitHWCListwithDefaults();
60     virtual char* HCWDesc(ULLONG hcw);
61     const char *CommandDesc(UCHAR number);
62     char *CommandTranslateStr(UCHAR command);
63     virtual const char*HardcodedTranslateStr(UCHAR command);
64     void EnterLearnMode(UCHAR command);
65     void ResetToDefault();
66
67     const static ULONG NOLEARNMODE = 256;
68     // Not buttons
69     const static UCHAR NA_LEARN    = 101;
70     const static UCHAR NA_NONE     = 98;
71     const static UCHAR NA_UNKNOWN  = 99;
72     const static UCHAR NA_SIGNAL   = 100;
73     const static UCHAR DF_UP       = 94;
74     const static UCHAR DF_DOWN     = 95;
75     const static UCHAR DF_LEFT     = 96;
76     const static UCHAR DF_RIGHT    = 97;
77
78     // Problem common buttons
79     const static UCHAR VOLUMEUP    = 16;
80     const static UCHAR VOLUMEDOWN  = 17;
81     const static UCHAR CHANNELUP   = 32;
82     const static UCHAR CHANNELDOWN = 33;
83
84     // Common buttons
85     const static UCHAR ZERO        = 0;
86     const static UCHAR ONE         = 1;
87     const static UCHAR TWO         = 2;
88     const static UCHAR THREE       = 3;
89     const static UCHAR FOUR        = 4;
90     const static UCHAR FIVE        = 5;
91     const static UCHAR SIX         = 6;
92     const static UCHAR SEVEN       = 7;
93     const static UCHAR EIGHT       = 8;
94     const static UCHAR NINE        = 9;
95     const static UCHAR POWER       = 61;
96     const static UCHAR GO          = 59;
97     const static UCHAR BACK        = 31;
98     const static UCHAR MENU        = 13;
99     const static UCHAR RED         = 11;
100     const static UCHAR GREEN       = 46;
101     const static UCHAR YELLOW      = 56;
102     const static UCHAR BLUE        = 41;
103     const static UCHAR MUTE        = 15;
104     const static UCHAR RADIO       = 12; // The unlabelled button on old
105     const static UCHAR REVERSE     = 50;
106     const static UCHAR PLAY        = 53;
107     const static UCHAR FORWARD     = 52;
108     const static UCHAR RECORD      = 55;
109     const static UCHAR STOP        = 54;
110     const static UCHAR PAUSE       = 48;
111     const static UCHAR SKIPBACK    = 36;
112     const static UCHAR SKIPFORWARD = 30;
113     const static UCHAR OK          = 37;
114
115     // Old remote only
116     const static UCHAR FULL        = 60;
117
118     // New remote only
119     const static UCHAR TV          = 28;
120     const static UCHAR VIDEOS      = 24;
121     const static UCHAR MUSIC       = 25;
122     const static UCHAR PICTURES    = 26;
123     const static UCHAR GUIDE       = 27;
124     const static UCHAR UP          = 20;
125     const static UCHAR DOWN        = 21;
126     const static UCHAR LEFT        = 22;
127     const static UCHAR RIGHT       = 23;
128     const static UCHAR PREVCHANNEL = 18;
129     const static UCHAR STAR        = 10;
130     const static UCHAR HASH        = 14;
131
132     // Android only
133     const static UCHAR PLAYPAUSE       = 201;
134
135
136     // Remote types
137     const static UCHAR OLDREMOTE   = 1;
138     const static UCHAR NEWREMOTE   = 2;
139
140   protected:
141     virtual UCHAR TranslateHWCFixed(ULLONG code);
142     UCHAR TranslateHWCList(ULLONG code);
143     UCHAR TranslateHWC(ULLONG code);
144     
145
146     ULONG learnmode;
147     static Remote* instance;
148     UCHAR remoteType;
149     RemoteTranslationList translist;
150 };
151
152 #endif