-rw-r--r-- | pwmanager/pwmanager/ipc.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h index ccdaafb..e5a496d 100644 --- a/pwmanager/pwmanager/ipc.h +++ b/pwmanager/pwmanager/ipc.h @@ -20,10 +20,14 @@ #ifndef __PWM_IPC_H #define __PWM_IPC_H +#include <qobject.h> #include <unistd.h> -#include <qobject.h> +#ifndef PWM_EMBEDDED #include <stdio.h> +#else +#include <qsocket.h> +#endif class QSocketNotifier; @@ -44,8 +48,13 @@ public: /** send data to the other socket end * (To the connected ipc object) */ +#ifndef PWM_EMBEDDED void send(const char *buf, size_t size) { write(sock[0], buf, size); } +#else + void send(const char *buf, size_t size) + { qSock->writeBlock(buf, size); } +#endif signals: /** a line is available */ @@ -56,18 +65,25 @@ protected slots: void receiveData(int s); protected: - /** full-duplex socket file desciptors */ - int sock[2]; +#ifndef PWM_EMBEDDED /** stream on "this" end of the socket (sock[0]) */ FILE *stream; + /** current receive buffer size */ + size_t rdBufSize; +#else + QSocket* qSock; + /** current receive buffer size */ + unsigned int rdBufSize; +#endif + + /** full-duplex socket file desciptors */ + int sock[2]; /** socket notifier */ QSocketNotifier *notifier; /** are we the host or the client object? */ bool host; /** receive buffer */ char *rdBuf; - /** current receive buffer size */ - size_t rdBufSize; }; #endif // __PWM_IPC_H |