]> git.vomp.tv Git - vompclient.git/blob - remote.h
Connection failure detection
[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 <unistd.h>
26 #include <fcntl.h>
27
28 #include "defines.h"
29 #include "log.h"
30
31 class Remote
32 {
33   public:
34     Remote();
35     ~Remote();
36     static Remote* getInstance();
37
38     int init(char *devName);
39     int shutdown();
40     int getDevice();
41     void setRemoteType(UCHAR type);
42     UCHAR getButtonPress(int how);
43     void clearBuffer();
44
45     // Not buttons
46     const static UCHAR NA_NONE     = 98;
47     const static UCHAR NA_UNKNOWN  = 99;
48     const static UCHAR NA_SIGNAL   = 100;
49     const static UCHAR DF_UP       = 94;
50     const static UCHAR DF_DOWN     = 95;
51     const static UCHAR DF_LEFT     = 96;
52     const static UCHAR DF_RIGHT    = 97;
53
54     // Problem common buttons
55     const static UCHAR VOLUMEUP    = 16;
56     const static UCHAR VOLUMEDOWN  = 17;
57     const static UCHAR CHANNELUP   = 32;
58     const static UCHAR CHANNELDOWN = 33;
59
60     // Common buttons
61     const static UCHAR ZERO        = 0;
62     const static UCHAR ONE         = 1;
63     const static UCHAR TWO         = 2;
64     const static UCHAR THREE       = 3;
65     const static UCHAR FOUR        = 4;
66     const static UCHAR FIVE        = 5;
67     const static UCHAR SIX         = 6;
68     const static UCHAR SEVEN       = 7;
69     const static UCHAR EIGHT       = 8;
70     const static UCHAR NINE        = 9;
71     const static UCHAR POWER       = 61;
72     const static UCHAR GO          = 59;
73     const static UCHAR BACK        = 31;
74     const static UCHAR MENU        = 13;
75     const static UCHAR RED         = 11;
76     const static UCHAR GREEN       = 46;
77     const static UCHAR YELLOW      = 56;
78     const static UCHAR BLUE        = 41;
79     const static UCHAR MUTE        = 15;
80     const static UCHAR RADIO       = 12; // The unlabelled button on old
81     const static UCHAR REVERSE     = 50;
82     const static UCHAR PLAY        = 53;
83     const static UCHAR FORWARD     = 52;
84     const static UCHAR RECORD      = 55;
85     const static UCHAR STOP        = 54;
86     const static UCHAR PAUSE       = 48;
87     const static UCHAR SKIPBACK    = 36;
88     const static UCHAR SKIPFORWARD = 30;
89     const static UCHAR OK          = 37;
90
91     // Old remote only
92     const static UCHAR FULL        = 60;
93
94     // New remote only
95     const static UCHAR TV          = 28;
96     const static UCHAR VIDEOS      = 24;
97     const static UCHAR MUSIC       = 25;
98     const static UCHAR PICTURES    = 26;
99     const static UCHAR GUIDE       = 27;
100     const static UCHAR UP          = 20;
101     const static UCHAR DOWN        = 21;
102     const static UCHAR LEFT        = 22;
103     const static UCHAR RIGHT       = 23;
104     const static UCHAR PREVCHANNEL = 18;
105     const static UCHAR STAR        = 10;
106     const static UCHAR HASH        = 14;
107
108     // Remote types
109     const static UCHAR OLDREMOTE   = 1;
110     const static UCHAR NEWREMOTE   = 2;
111
112   private:
113     static Remote* instance;
114     int initted;
115     int device;
116     struct timeval tv;
117     UCHAR remoteType;
118 };
119
120 #endif