- Main Page
- Classes
- Files

- File List

blobiohandler.h
1 /*
2 * This file is part of signon
3 *
4 * Copyright (C) 2009-2011 Nokia Corporation.
5 *
6 * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
7 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24 #ifndef BLOBIOHANDLER_H
25 #define BLOBIOHANDLER_H
26
27 #include <QObject>
28 #include <QIODevice>
29 #include <QVariantMap>
30 #include <QSocketNotifier>
31
32 namespace SignOn {
33
34 class BlobIOHandler: public QObject
35 {
36 Q_OBJECT
37
38 public:
39 BlobIOHandler(QIODevice *inputChannel,
40 QIODevice *outputChannel,
41 QObject *parent = 0);
42 //sync call
43 bool sendData(const QVariantMap &map);
44 //async call
45 void receiveData(int expectedDataSize);
46
47 void setReadChannelSocketNotifier(QSocketNotifier *notifier);
48
49 public Q_SLOTS:
50 void readBlob();
51
52 Q_SIGNALS:
53 void dataReceived(const QVariantMap &map);
54 void error();
55
56 private:
57 void setReadNotificationEnabled(bool enable);
58
59 QByteArray variantMapToByteArray(const QVariantMap &map);
60 QVariantMap byteArrayToVariantMap(const QByteArray &array);
61 QVector<QByteArray> pageByteArray(const QByteArray &array);
62
63 public:
64 QIODevice *m_readChannel;
65 QIODevice *m_writeChannel;
66 QByteArray m_blobBuffer;
67 QSocketNotifier *m_readNotifier;
68 int m_blobSize;
69 };
70
71 }
72
73 #endif //BLOBIOHANDLER_H
SignOn::BlobIOHandler
Definition: blobiohandler.h:34