-rw-r--r-- | pwmanager/pwmanager/ipc.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h index 7bfca02..3248283 100644 --- a/pwmanager/pwmanager/ipc.h +++ b/pwmanager/pwmanager/ipc.h | |||
@@ -8,85 +8,85 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 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 | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __PWM_IPC_H | 20 | #ifndef __PWM_IPC_H |
21 | #define __PWM_IPC_H | 21 | #define __PWM_IPC_H |
22 | 22 | ||
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #ifndef _WIN32_ | 24 | #ifndef _WIN32_ |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | #else | 26 | #else |
27 | #include <io.h> | 27 | #include <io.h> |
28 | #endif | 28 | #endif |
29 | #ifndef PWM_EMBEDDED | 29 | #ifndef PWM_EMBEDDED |
30 | #include <stdio.h> | 30 | #include <stdio.h> |
31 | #else | 31 | #else |
32 | #include <qsocket.h> | 32 | #include <q3socket.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | class QSocketNotifier; | 35 | class QSocketNotifier; |
36 | 36 | ||
37 | /** very simple interprocess communication class */ | 37 | /** very simple interprocess communication class */ |
38 | class Ipc : public QObject | 38 | class Ipc : public QObject |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | /** create a new Ipc communication object */ | 42 | /** create a new Ipc communication object */ |
43 | Ipc(); | 43 | Ipc(); |
44 | /** create a new Ipc communication object and | 44 | /** create a new Ipc communication object and |
45 | * connect it to "ipc" | 45 | * connect it to "ipc" |
46 | */ | 46 | */ |
47 | Ipc(const Ipc *ipc); | 47 | Ipc(const Ipc *ipc); |
48 | /** destructor */ | 48 | /** destructor */ |
49 | ~Ipc(); | 49 | ~Ipc(); |
50 | 50 | ||
51 | /** send data to the other socket end | 51 | /** send data to the other socket end |
52 | * (To the connected ipc object) | 52 | * (To the connected ipc object) |
53 | */ | 53 | */ |
54 | #ifndef PWM_EMBEDDED | 54 | #ifndef PWM_EMBEDDED |
55 | void send(const char *buf, size_t size) | 55 | void send(const char *buf, size_t size) |
56 | { write(sock[0], buf, size); } | 56 | { write(sock[0], buf, size); } |
57 | #else | 57 | #else |
58 | void send(const char *buf, size_t size) | 58 | void send(const char *buf, size_t size) |
59 | { qSock->writeBlock(buf, size); } | 59 | { qSock->writeBlock(buf, size); } |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | /** a line is available */ | 63 | /** a line is available */ |
64 | void lineAvailable(const char *buf, size_t size); | 64 | void lineAvailable(const char *buf, size_t size); |
65 | 65 | ||
66 | protected slots: | 66 | protected slots: |
67 | /** received data on socket */ | 67 | /** received data on socket */ |
68 | void receiveData(int s); | 68 | void receiveData(int s); |
69 | 69 | ||
70 | protected: | 70 | protected: |
71 | #ifndef PWM_EMBEDDED | 71 | #ifndef PWM_EMBEDDED |
72 | /** stream on "this" end of the socket (sock[0]) */ | 72 | /** stream on "this" end of the socket (sock[0]) */ |
73 | FILE *stream; | 73 | FILE *stream; |
74 | /** current receive buffer size */ | 74 | /** current receive buffer size */ |
75 | size_t rdBufSize; | 75 | size_t rdBufSize; |
76 | #else | 76 | #else |
77 | QSocket* qSock; | 77 | Q3Socket* qSock; |
78 | /** current receive buffer size */ | 78 | /** current receive buffer size */ |
79 | unsigned int rdBufSize; | 79 | unsigned int rdBufSize; |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | /** full-duplex socket file desciptors */ | 82 | /** full-duplex socket file desciptors */ |
83 | int sock[2]; | 83 | int sock[2]; |
84 | /** socket notifier */ | 84 | /** socket notifier */ |
85 | QSocketNotifier *notifier; | 85 | QSocketNotifier *notifier; |
86 | /** are we the host or the client object? */ | 86 | /** are we the host or the client object? */ |
87 | bool host; | 87 | bool host; |
88 | /** receive buffer */ | 88 | /** receive buffer */ |
89 | char *rdBuf; | 89 | char *rdBuf; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | #endif // __PWM_IPC_H | 92 | #endif // __PWM_IPC_H |