Buteo Synchronization Framework: IPHeartBeat.h Source File

Buteo Synchronization Framework

IPHeartBeat.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23#ifndef IPHEARTBEAT_H
24#define IPHEARTBEAT_H
25
26#include <QObject>
27#include <QMap>
28#include <QSocketNotifier>
29extern "C" {
30#include "iphbd/libiphb.h"
31}
32
33namespace Buteo {
34
38 class IPHeartBeat : public QObject
39{
40 Q_OBJECT
41
43 struct BeatStruct {
44 int sockfd;
45 QSocketNotifier *sockNotifier;
46 iphb_t iphbHandle;
47 };
48
49public:
53 IPHeartBeat(QObject *aParent);
54
58 virtual ~IPHeartBeat();
59
68 bool setHeartBeat(const QString &aProfName, ushort aMinWaitTime, ushort aMaxWaitTime);
69
74 void removeWait(const QString &aProfName);
75
78 void removeAllWaits();
79
80signals:
81
86 void onHeartBeat(QString aProfName);
87
88
89private slots:
90
95 void internalBeatTriggered(int aSockFd);
96
97
98private:
99
106 bool getProfNameFromFd(int aSockFd, QString &aProfName);
107
108
109private:
110
112 QMap<QString, BeatStruct> iBeatsWaiting;
113
114#ifdef SYNCFW_UNIT_TESTS
115 friend class IPHeartBeatTest;
116#endif
117
118};
119
120}
121
122#endif
Buteo::IPHeartBeat
IPHeartBeat implementation.
Definition: IPHeartBeat.h:39
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< QString, BeatStruct >