| 1 | /* |
| 2 | * Copyright (C) 2014 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of lomiri-online-accounts-ui and lomiri-online-accounts- |
| 7 | * service |
| 8 | * |
| 9 | * This program is free software: you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU General Public License version 3, as published |
| 11 | * by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 15 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE. See the GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #ifndef OAU_IPC_H |
| 23 | #define OAU_IPC_H |
| 24 | |
| 25 | #include <QObject> |
| 26 | |
| 27 | class QByteArray; |
| 28 | class QIODevice; |
| 29 | |
| 30 | #define OAU_OPERATION_CODE "code" |
| 31 | #define OAU_OPERATION_CODE_PROCESS "process" |
| 32 | #define OAU_OPERATION_CODE_REGISTER_HANDLER "newHandler" |
| 33 | #define OAU_OPERATION_CODE_REQUEST_FINISHED "finished" |
| 34 | #define OAU_OPERATION_CODE_REQUEST_FAILED "failed" |
| 35 | #define OAU_OPERATION_ID "id" |
| 36 | #define OAU_OPERATION_DATA "data" |
| 37 | #define OAU_OPERATION_DELAY "delay" |
| 38 | #define OAU_OPERATION_INTERFACE "interface" |
| 39 | #define OAU_OPERATION_CLIENT_PROFILE "profile" |
| 40 | #define OAU_OPERATION_ERROR_NAME "errname" |
| 41 | #define OAU_OPERATION_ERROR_MESSAGE "errmsg" |
| 42 | #define OAU_OPERATION_HANDLER_ID "handlerId" |
| 43 | #define OAU_REQUEST_MATCH_KEY "X-RequestHandler" |
| 44 | |
| 45 | namespace OnlineAccountsUi { |
| 46 | |
| 47 | class IpcPrivate; |
| 48 | class Ipc: public QObject |
| 49 | { |
| 50 | Q_OBJECT |
| 51 | |
| 52 | public: |
| 53 | Ipc(QObject *parent = 0); |
| 54 | ~Ipc(); |
| 55 | |
| 56 | void setChannels(QIODevice *readChannel, QIODevice *writeChannel); |
| 57 | void write(const QByteArray &data); |
| 58 | |
| 59 | Q_SIGNALS: |
| 60 | void dataReady(QByteArray &data); |
| 61 | |
| 62 | private: |
| 63 | IpcPrivate *d_ptr; |
| 64 | Q_DECLARE_PRIVATE(Ipc) |
| 65 | }; |
| 66 | |
| 67 | }; // namespace |
| 68 | |
| 69 | #endif // OAU_IPC_H |