IPHeartBeat.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* 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 IPHEARTBEAT_H
#define IPHEARTBEAT_H
#include <QObject>
#include <QMap>
#include <QSocketNotifier>
extern "C" {
#include "iphbd/libiphb.h"
}
namespace Buteo {
class IPHeartBeat : public QObject
{
Q_OBJECT
struct BeatStruct {
int sockfd;
QSocketNotifier *sockNotifier;
iphb_t iphbHandle;
};
public:
IPHeartBeat(QObject *aParent);
virtual ~IPHeartBeat();
bool setHeartBeat(const QString &aProfName, ushort aMinWaitTime, ushort aMaxWaitTime);
void removeWait(const QString &aProfName);
void removeAllWaits();
signals:
void onHeartBeat(QString aProfName);
private slots:
void internalBeatTriggered(int aSockFd);
private:
bool getProfNameFromFd(int aSockFd, QString &aProfName);
private:
QMap<QString, BeatStruct> iBeatsWaiting;
#ifdef SYNCFW_UNIT_TESTS
friend class IPHeartBeatTest;
#endif
};
}
#endif
Buteo::IPHeartBeat::IPHeartBeat
IPHeartBeat(QObject *aParent)
Constructor.
Definition IPHeartBeat.cpp:29
Buteo::IPHeartBeat::removeWait
void removeWait(const QString &aProfName)
Removes heart beat waiting for a profile.
Definition IPHeartBeat.cpp:59
Buteo::IPHeartBeat::removeAllWaits
void removeAllWaits()
Removes heart beat waiting for all profiles.
Definition IPHeartBeat.cpp:42
Buteo::IPHeartBeat::onHeartBeat
void onHeartBeat(QString aProfName)
This signal will be emitted when a heartbeat for particular profile is triggered.
Buteo::IPHeartBeat::setHeartBeat
bool setHeartBeat(const QString &aProfName, ushort aMinWaitTime, ushort aMaxWaitTime)
Schedules a heartbeat for this profile between minWaitTime and maxWaitTime.
Definition IPHeartBeat.cpp:97
Buteo::IPHeartBeat::~IPHeartBeat
virtual ~IPHeartBeat()
Destructor.
Definition IPHeartBeat.cpp:35
QMap
Definition SyncBackupAdaptor.h:41