File: virtualconsole.h

package info (click to toggle)
vdr-plugin-console 0.6.0-25
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 400 kB
  • ctags: 373
  • sloc: ansic: 7,282; sh: 143; makefile: 99
file content (85 lines) | stat: -rw-r--r-- 1,442 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * virtualconsole.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */


#ifndef __VIRTUALCONSOLE_H__
#define __VIRTUALCONSOLE_H__


#include <sys/ioctl.h>
#include <termios.h>

#include <vdr/tools.h>
#include <vdr/remote.h>

#include "ipc.h"
#include "terminalemulation.h"


#define INPUT_BUFSIZE 1024





class cConsTerminalEmulation;
class cConsConsoles;



class cConsVirtualConsole
: public cListObject,
  public IConsWaitable
{

  friend class cConsConsoles;

private:

  unsigned char _buf[INPUT_BUFSIZE + 1];

  volatile int _childPid;
  int _master;
  bool _isOpen;

  char* _title;

  cConsTerminalEmulation _screen;

private:
  bool Open(const char* command, char* const argv[]);
  bool ConsoleWaitPid(volatile int& pid, int timeoutMs);
  bool HandleOutput();


public:
  cConsVirtualConsole(const char* title, const char* command, char* const argv[]);
  virtual ~cConsVirtualConsole();

  bool IsOpen();

  bool Close();
  void HasClosed(bool force = false);

  void setTerminalSize(int charW, int charH, int pixelW, int pixelH);

  void Write(const unsigned char* data, int len);

  const char* getTitle() { return _title; }
  cConsTerminalEmulation& getScreen() { return _screen; }
  pid_t getChildPid() { return _childPid; }

// IConsWaitable
  virtual int SignalToWaitFor() const { return _master; }
};



#endif // __VIRTUALCONSOLE_H__