summaryrefslogtreecommitdiff
path: root/remote.h
blob: 1d0a1cce0c0ac2c76b86955a8f3dec0e9c75b06f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * remote.h: Interface to the Remote Control Unit
 *
 * See the main source file 'vdr.c' for copyright information and
 * how to reach the author.
 *
 * $Id: remote.h 1.5 2000/05/07 09:27:54 kls Exp $
 */

#ifndef __REMOTE_H
#define __REMOTE_H

#include <stdio.h>
#include <time.h>

class cRcIo {
private:
  int f;
  unsigned char dp, code, mode;
  unsigned short address;
  time_t t;
  int firstTime, lastTime;
  unsigned int lastCommand;
  int lastNumber;
  bool SendCommand(unsigned char Cmd);
  int ReceiveByte(bool Wait = true);
  bool SendByteHandshake(unsigned char c);
  bool SendByte(unsigned char c);
  bool Digit(int n, int v);
public:
  enum { modeH = 'h', modeB = 'b', modeS = 's' };
  cRcIo(char *DeviceName);
  ~cRcIo();
  bool InputAvailable(bool Wait = false);
  void Flush(int WaitSeconds = 0);
  bool SetCode(unsigned char Code, unsigned short Address);
  bool SetMode(unsigned char Mode);
  bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
  bool Number(int n, bool Hex = false);
  void SetPoints(unsigned char Dp, bool On);
  bool String(char *s);
  bool DetectCode(unsigned char *Code, unsigned short *Address);
  };

#endif //__REMOTE_H