allow burning DVDs with multiple titles where playback automatically jumps to the...
[enigma2.git] / lib / base / console.h
1 #ifndef __LIB_BASE_CONSOLE_H__
2 #define __LIB_BASE_CONSOLE_H__
3
4 #include "Python.h"
5 #include <string>
6 #include <lib/base/ebase.h>
7 #include <lib/python/connections.h>
8 #include <queue>
9
10 #ifndef SWIG
11 struct queue_data
12 {
13         queue_data( char *data, int len )
14                 :data(data), len(len)
15         {
16         }
17         char *data;
18         int len;
19 };
20 #endif
21
22 class eConsoleAppContainer: public Object
23 {
24 #ifndef SWIG
25         int fd[3];
26         int pid;
27         int killstate;
28         std::string m_cwd;
29         std::queue<struct queue_data> outbuf;
30         eSocketNotifier *in, *out, *err;
31         void readyRead(int what);
32         void readyErrRead(int what);
33         void readyWrite(int what);
34         void closePipes();
35 #endif
36 public:
37         eConsoleAppContainer();
38         int setCWD( const char *path );
39         int execute( const char *str );
40         int execute( const char *cmdline, const char *const argv[] );
41         int execute( PyObject *cmdline, PyObject *args );
42         ~eConsoleAppContainer();
43         int getPID() { return pid; }
44         void kill();
45         void sendCtrlC();
46         void write( const char *data, int len );
47         void write( PyObject *data );
48         bool running() { return (fd[0]!=-1) && (fd[1]!=-1) && (fd[2]!=-1); }
49         PSignal1<void, const char*> dataAvail;
50         PSignal1<void,int> dataSent;
51         PSignal1<void,int> appClosed;
52 };
53
54 #endif // __LIB_BASE_CONSOLE_H__