TransportTracker.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* 2019 Updated to use bluez5 by deloptes@gmail.com
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef TRANSPORTTRACKER_H_
#define TRANSPORTTRACKER_H_
#include "SyncCommonDefs.h"
#include <QObject>
#include <QMap>
#include <QMutex>
#include <QDBusVariant>
#include <QDBusConnection>
#ifdef HAVE_BLUEZ_5
#include <BtCommon.h>
#endif
namespace Buteo {
class USBModedProxy;
class NetworkManager;
class TransportTracker : public QObject
{
Q_OBJECT
public:
TransportTracker(QObject *aParent = 0);
virtual ~TransportTracker();
bool isConnectivityAvailable(Sync::ConnectivityType aType) const;
signals:
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState);
void networkStateChanged(bool aState, Sync::InternetConnectionType aType);
void sessionConnected();
void sessionError();
private slots:
void onUsbStateChanged(bool aConnected);
#ifdef HAVE_BLUEZ_5
void onBtStateChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
void onBtInterfacesAdded(const QDBusObjectPath &path, const InterfacesMap &interfaces);
void onBtInterfacesRemoved(const QDBusObjectPath &path, const QStringList &interfaces);
#endif
void onInternetStateChanged(bool aConnected, Sync::InternetConnectionType aType);
private:
QMap<Sync::ConnectivityType, bool> iTransportStates;
USBModedProxy *iUSBProxy;
NetworkManager *iInternet;
QDBusConnection iSystemBus;
QString iDefaultBtAdapter;
mutable QMutex iMutex;
void updateState(Sync::ConnectivityType aType, bool aState);
#ifdef SYNCFW_UNIT_TESTS
friend class TransportTrackerTest;
friend class SynchronizerTest;
#endif
#ifdef HAVE_BLUEZ_5
bool btConnectivityStatus();
#endif
};
} // namespace Buteo
#endif /* TRANSPORTTRACKER_H_ */
Buteo::NetworkManager
Class for managing network sessions.
Definition NetworkManager.h:44
Buteo::TransportTracker::connectivityStateChanged
void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)
Signal emitted when a connectivity state changes.
Buteo::TransportTracker::isConnectivityAvailable
bool isConnectivityAvailable(Sync::ConnectivityType aType) const
Checks the state of the given connectivity type.
Definition TransportTracker.cpp:121
Buteo::TransportTracker::sessionError
void sessionError()
Signal emitted when opening a network session fails.
Buteo::TransportTracker::~TransportTracker
virtual ~TransportTracker()
Destructor.
Definition TransportTracker.cpp:116
Buteo::TransportTracker::sessionConnected
void sessionConnected()
Signal emitted when a network session is successfully opened.
Buteo::TransportTracker::networkStateChanged
void networkStateChanged(bool aState, Sync::InternetConnectionType aType)
Signal emitted when a n/w state changes.
Buteo::TransportTracker::TransportTracker
TransportTracker(QObject *aParent=0)
Constructor.
Definition TransportTracker.cpp:38
Buteo::USBModedProxy
Proxy class for interface com.meego.usb_moded
Definition USBModedProxy.h:50
QMap
Definition SyncBackupAdaptor.h:41