summaryrefslogtreecommitdiffstats
path: root/src/mobility/mobilitymanager.h
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-05-03 14:05:09 +0200
committerChristian Kamm <christian.d.kamm@nokia.com>2010-05-03 14:05:09 +0200
commitb471ca62a783d80ebe4b1253d1768e251cc1b3d4 (patch)
tree7d96f96fdd963fbc1308463428e2465a291f241d /src/mobility/mobilitymanager.h
Initial import.
Diffstat (limited to 'src/mobility/mobilitymanager.h')
-rw-r--r--src/mobility/mobilitymanager.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/src/mobility/mobilitymanager.h b/src/mobility/mobilitymanager.h
new file mode 100644
index 0000000..0888f3d
--- /dev/null
+++ b/src/mobility/mobilitymanager.h
@@ -0,0 +1,130 @@
+/**************************************************************************
+**
+** This file is part of Qt Simulator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef MOBILITY_H
+#define MOBILITY_H
+
+#include "sensorsui.h"
+#include "systeminfonetworkui.h"
+#include "systeminfostorageui.h"
+#include "systeminfogenericui.h"
+
+#include <remotecontrolwidget/locationui.h>
+
+#include <systeminfo/qsysteminfodata_simulator_p.h>
+#include <location/qgeopositioninfodata_simulator_p.h>
+#include <mobilitysimulator/mobilityconnection_p.h>
+#include <contacts/engines/qcontactmemorybackenddata_simulator_p.h>
+#include <contacts/engines/qcontactmemorybackenddata_simulator_p.h>
+#include <../plugins/sensors/simulator/qsensordata_simulator_p.h>
+
+class QLocalSocket;
+class QLocalServer;
+class MobilityData;
+class MobilityClient;
+namespace QtMobility {
+ class QContactManager;
+ class QContact;
+}
+// Required to give some slots below a connectable signature.
+using namespace QtMobility;
+
+class MobilityServer : public QObject
+{
+ Q_OBJECT
+public:
+ explicit MobilityServer(MobilityData *mobility, QObject *parent = 0);
+ ~MobilityServer();
+
+private slots:
+ void newConnection();
+
+private:
+ void removeClient(MobilityClient *c);
+
+ QLocalServer *mServer;
+ QList<MobilityClient *> mClients;
+
+ MobilityData *mMobility;
+
+ friend class MobilityClient;
+};
+
+class MobilityClient : public QObject
+{
+ Q_OBJECT
+public:
+ MobilityClient(qint64 pid, QLocalSocket *receiveSocket, MobilityServer *server);
+ ~MobilityClient();
+
+public slots:
+ void sendSystemStorageInfo(const StorageSystemInfoUi::StorageData &data);
+ void sendSystemGenericInfo(const GenericSystemInfoUi::GenericData &data);
+ void sendSystemNetworkInfo(const NetworkSystemInfoUi::NetworkData &data);
+
+ void sendLocationData(const LocationUi::LocationData &data);
+
+ void sendContactData(const QContactManager &manager);
+
+ void sendSensorsData(const SensorsUi::SensorsData &data);
+
+private slots:
+ void disconnect();
+ void readyRead();
+
+ void sendAddedContacts(const QList<QContactLocalId> &);
+ void sendChangedContacts(const QList<QContactLocalId> &);
+ void sendRemovedContacts(const QList<QContactLocalId> &);
+ void sendRelationshipsFor(const QList<QContactLocalId> &);
+
+ // called remotely
+ void setRequestsSystemInfo();
+ void setRequestsLocationInfo();
+ void setRequestsContactInfo();
+ void setRequestsSensors();
+ void triggerContactDataResend();
+
+ QtMobility::Simulator::SaveContactReply requestSaveContact(const QtMobility::QContact &contact);
+ int requestRemoveContact(uint id);
+ QtMobility::Simulator::SaveRelationshipReply requestSaveRelationship(const QtMobility::QContactRelationship &relationship);
+ int requestRemoveRelationship(const QtMobility::QContactRelationship &relationship);
+
+private:
+ qint64 mPid;
+ QLocalSocket *mReceiveSocket;
+ QLocalSocket *mSendSocket;
+ QByteArray mReadBuffer;
+ MobilityServer *mMobilityServer;
+
+ bool mNotifyClientOnContactsChange;
+
+ static int contactsClientsCount;
+};
+
+#endif // MOBILITY_H