]> git.vomp.tv Git - vompclient.git/blob - remote.h
New options screen system, new remote control handling, and all other
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 "log.h"
29
30 using namespace std;
31 typedef map<ULLONG,UCHAR> RemoteTranslationList;
32
33 class Remote
34 {
35   public:
36     Remote();
37     virtual ~Remote();
38     static Remote* getInstance();
39
40     void setRemoteType(UCHAR type);
41     void setHWCtoCommand(ULLONG hcw,UCHAR command);
42     void unsetHWC(ULLONG hcw);
43     void LoadKeysConfig(char *cfg);
44     char *SaveKeysConfig();
45     void EnterLearningMode(UCHAR command);
46
47     virtual int init(char *devName)=0;
48     virtual int shutdown()=0;
49     virtual UCHAR getButtonPress(int how)=0;
50     virtual void clearBuffer()=0;
51
52     virtual void InitHWCListwithDefaults();
53     virtual char* HCWDesc(ULLONG hcw);
54     const char *CommandDesc(UCHAR number);
55     char *CommandTranslateStr(UCHAR command);
56     virtual const char*HardcodedTranslateStr(UCHAR command);
57     void EnterLearnMode(UCHAR command);
58     void ResetToDefault();
59
60     const static ULONG NOLEARNMODE = 256;
61     // Not buttons
62     const static UCHAR NA_LEARN    = 101;
63     const static UCHAR NA_NONE     = 98;
64     const static UCHAR NA_UNKNOWN  = 99;
65     const static UCHAR NA_SIGNAL   = 100;
66     const static UCHAR DF_UP       = 94;
67     const static UCHAR DF_DOWN     = 95;
68     const static UCHAR DF_LEFT     = 96;
69     const static UCHAR DF_RIGHT    = 97;
70
71     // Problem common buttons
72     const static UCHAR VOLUMEUP    = 16;
73     const static UCHAR VOLUMEDOWN  = 17;
74     const static UCHAR CHANNELUP   = 32;
75     const static UCHAR CHANNELDOWN = 33;
76
77     // Common buttons
78     const static UCHAR ZERO        = 0;
79     const static UCHAR ONE         = 1;
80     const static UCHAR TWO         = 2;
81     const static UCHAR THREE       = 3;
82     const static UCHAR FOUR        = 4;
83     const static UCHAR FIVE        = 5;
84     const static UCHAR SIX         = 6;
85     const static UCHAR SEVEN       = 7;
86     const static UCHAR EIGHT       = 8;
87     const static UCHAR NINE        = 9;
88     const static UCHAR POWER       = 61;
89     const static UCHAR GO          = 59;
90     const static UCHAR BACK        = 31;
91     const static UCHAR MENU        = 13;
92     const static UCHAR RED         = 11;
93     const static UCHAR GREEN       = 46;
94     const static UCHAR YELLOW      = 56;
95     const static UCHAR BLUE        = 41;
96     const static UCHAR MUTE        = 15;
97     const static UCHAR RADIO       = 12; // The unlabelled button on old
98     const static UCHAR REVERSE     = 50;
99     const static UCHAR PLAY        = 53;
100     const static UCHAR FORWARD     = 52;
101     const static UCHAR RECORD      = 55;
102     const static UCHAR STOP        = 54;
103     const static UCHAR PAUSE       = 48;
104     const static UCHAR SKIPBACK    = 36;
105     const static UCHAR SKIPFORWARD = 30;
106     const static UCHAR OK          = 37;
107
108     // Old remote only
109     const static UCHAR FULL        = 60;
110
111     // New remote only
112     const static UCHAR TV          = 28;
113     const static UCHAR VIDEOS      = 24;
114     const static UCHAR MUSIC       = 25;
115     const static UCHAR PICTURES    = 26;
116     const static UCHAR GUIDE       = 27;
117     const static UCHAR UP          = 20;
118     const static UCHAR DOWN        = 21;
119     const static UCHAR LEFT        = 22;
120     const static UCHAR RIGHT       = 23;
121     const static UCHAR PREVCHANNEL = 18;
122     const static UCHAR STAR        = 10;
123     const static UCHAR HASH        = 14;
124
125     // Remote types
126     const static UCHAR OLDREMOTE   = 1;
127     const static UCHAR NEWREMOTE   = 2;
128
129   protected:
130     virtual UCHAR TranslateHWCFixed(ULLONG code);
131     UCHAR TranslateHWCList(ULLONG code);
132     UCHAR TranslateHWC(ULLONG code);
133
134     ULONG learnmode;
135     static Remote* instance;
136     UCHAR remoteType;
137     RemoteTranslationList translist;
138 };
139
140 #endif