Buteo Synchronization Framework
TransportTracker.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 * 2019 Updated to use bluez5 by deloptes@gmail.com
6 *
7 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.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
25#ifndef TRANSPORTTRACKER_H_
26#define TRANSPORTTRACKER_H_
27
28#include "SyncCommonDefs.h"
29#include <QObject>
30#include <QMap>
31#include <QMutex>
32#include <QDBusVariant>
33#include <QDBusConnection>
34
35#ifdef HAVE_BLUEZ_5
36#include <BtCommon.h>
37#endif
38
39namespace Buteo {
40
41class USBModedProxy;
42class NetworkManager;
43
44
49class TransportTracker : public QObject
50{
51 Q_OBJECT
52
53public:
54
59 TransportTracker(QObject *aParent = 0);
60
62 virtual ~TransportTracker();
63
69 bool isConnectivityAvailable(Sync::ConnectivityType aType) const;
70
71signals:
72
78 void connectivityStateChanged(Sync::ConnectivityType aType, bool aState);
79
85 void networkStateChanged(bool aState, Sync::InternetConnectionType aType);
86
89 void sessionConnected();
90
93 void sessionError();
94
95private slots:
96
97 void onUsbStateChanged(bool aConnected);
98
99#ifdef HAVE_BLUEZ_5
100 void onBtStateChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
101
102 void onBtInterfacesAdded(const QDBusObjectPath &path, const InterfacesMap &interfaces);
103
104 void onBtInterfacesRemoved(const QDBusObjectPath &path, const QStringList &interfaces);
105#endif
106
107 void onInternetStateChanged(bool aConnected, Sync::InternetConnectionType aType);
108
109private:
110
111 QMap<Sync::ConnectivityType, bool> iTransportStates;
112
113 USBModedProxy *iUSBProxy;
114
115 NetworkManager *iInternet;
116 QDBusConnection iSystemBus;
117 QString iDefaultBtAdapter;
118
119 mutable QMutex iMutex;
120
126 void updateState(Sync::ConnectivityType aType, bool aState);
127
128#ifdef SYNCFW_UNIT_TESTS
129 friend class TransportTrackerTest;
130 friend class SynchronizerTest;
131#endif
132
133#ifdef HAVE_BLUEZ_5
134 bool btConnectivityStatus();
135#endif
136
137};
138
139} // namespace Buteo
140
141#endif /* TRANSPORTTRACKER_H_ */
Class for managing network sessions.
Definition NetworkManager.h:43
Class for tracking transport states.
Definition TransportTracker.h:50
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)
Signal emitted when a connectivity state changes.
Definition moc_TransportTracker.cpp:195
bool isConnectivityAvailable(Sync::ConnectivityType aType) const
Checks the state of the given connectivity type.
Definition TransportTracker.cpp:121
void sessionError()
Signal emitted when opening a network session fails.
Definition moc_TransportTracker.cpp:215
virtual ~TransportTracker()
Destructor.
Definition TransportTracker.cpp:116
void sessionConnected()
Signal emitted when a network session is successfully opened.
Definition moc_TransportTracker.cpp:209
void networkStateChanged(bool aState, Sync::InternetConnectionType aType)
Signal emitted when a n/w state changes.
Definition moc_TransportTracker.cpp:202
Proxy class for interface com.meego.usb_moded
Definition USBModedProxy.h:50
Definition SyncBackupAdaptor.h:41