author | ulf69 <ulf69> | 2004-09-15 17:53:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 17:53:22 (UTC) |
commit | d3925ba5bd25224bc4a60d3d6a107c464994a1ea (patch) (unidiff) | |
tree | 60f69da1d2b79ee3081e7ef5c09a46470ca6eda0 /pwmanager/pwmanager/ipc.h | |
parent | ce83a3479d23b9e8a59c745ccd0a0b14f64ef4e8 (diff) | |
download | kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.zip kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.gz kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.bz2 |
initial revision
-rw-r--r-- | pwmanager/pwmanager/ipc.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h new file mode 100644 index 0000000..ccdaafb --- a/dev/null +++ b/pwmanager/pwmanager/ipc.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2004 by Michael Buesch * | ||
4 | * email: mbuesch@freenet.de * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License version 2 * | ||
8 | * as published by the Free Software Foundation. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | |||
12 | /*************************************************************************** | ||
13 | * copyright (C) 2004 by Ulf Schenk | ||
14 | * This file is originaly based on version 1.0.1 of pwmanager | ||
15 | * and was modified to run on embedded devices that run microkde | ||
16 | * | ||
17 | * $Id$ | ||
18 | **************************************************************************/ | ||
19 | |||
20 | #ifndef __PWM_IPC_H | ||
21 | #define __PWM_IPC_H | ||
22 | |||
23 | #include <unistd.h> | ||
24 | |||
25 | #include <qobject.h> | ||
26 | #include <stdio.h> | ||
27 | |||
28 | class QSocketNotifier; | ||
29 | |||
30 | /** very simple interprocess communication class */ | ||
31 | class Ipc : public QObject | ||
32 | { | ||
33 | Q_OBJECT | ||
34 | public: | ||
35 | /** create a new Ipc communication object */ | ||
36 | Ipc(); | ||
37 | /** create a new Ipc communication object and | ||
38 | * connect it to "ipc" | ||
39 | */ | ||
40 | Ipc(const Ipc *ipc); | ||
41 | /** destructor */ | ||
42 | ~Ipc(); | ||
43 | |||
44 | /** send data to the other socket end | ||
45 | * (To the connected ipc object) | ||
46 | */ | ||
47 | void send(const char *buf, size_t size) | ||
48 | { write(sock[0], buf, size); } | ||
49 | |||
50 | signals: | ||
51 | /** a line is available */ | ||
52 | void lineAvailable(const char *buf, size_t size); | ||
53 | |||
54 | protected slots: | ||
55 | /** received data on socket */ | ||
56 | void receiveData(int s); | ||
57 | |||
58 | protected: | ||
59 | /** full-duplex socket file desciptors */ | ||
60 | int sock[2]; | ||
61 | /** stream on "this" end of the socket (sock[0]) */ | ||
62 | FILE *stream; | ||
63 | /** socket notifier */ | ||
64 | QSocketNotifier *notifier; | ||
65 | /** are we the host or the client object? */ | ||
66 | bool host; | ||
67 | /** receive buffer */ | ||
68 | char *rdBuf; | ||
69 | /** current receive buffer size */ | ||
70 | size_t rdBufSize; | ||
71 | }; | ||
72 | |||
73 | #endif // __PWM_IPC_H | ||