ButeoSynchronizationFramework
SyncAlarmInventory.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 
24 
25 #ifndef SYNCALARMINVENTORY_H
26 #define SYNCALARMINVENTORY_H
27 
28 #include <QObject>
29 #include <QDateTime>
30 #include <QtSql>
31 
37 class SyncAlarmInventory : public QObject
38 {
39  Q_OBJECT
40 
41  public:
45 
48 
53  bool init();
54 
60  int addAlarm(QDateTime alarmTime);
61 
67  bool removeAlarm(int alarmId);
68 
72  void removeAllAlarms();
73 
74  signals:
78  void triggerAlarm(int alarmId);
79 
80  private:
81  /* Deletes the alarm from DB */
82  bool deleteAlarmFromDb( int alarmName );
83 
84  /* Method to add an alarm to the database */
85  int addAlarmToDb( QDateTime timeStamp );
86 
87  /* Method to fetch the database handle */
88  QSqlDatabase* getDbHandle();
89 
90  /* Timer object to keep tracke of alarm timers */
91  QTimer* iTimer;
92 
93  /* Current alarm that is under work */
94  int currentAlarm;
95 
96  /* Number of times that the alarm triggers */
97  int triggerCount;
98 
99  /* Database handle */
100  QSqlDatabase iDbHandle;
101 
102  /* Database connection name */
103  QString iConnectionName;
104 
105  private slots:
107  void timerTriggered();
108 };
109 
110 #endif
void removeAllAlarms()
Definition: SyncAlarmInventory.cpp:174
int addAlarm(QDateTime alarmTime)
Method to add an alarm.
Definition: SyncAlarmInventory.cpp:108
~SyncAlarmInventory()
Definition: SyncAlarmInventory.cpp:93
bool init()
Creates and Initialize the alarms database. also Creates the timers Please call this function to make...
Definition: SyncAlarmInventory.cpp:45
SyncAlarmInventory()
Definition: SyncAlarmInventory.cpp:37
void triggerAlarm(int alarmId)
Signal triggered when an alarm expired.
Definition: moc_SyncAlarmInventory.cpp:131
bool removeAlarm(int alarmId)
Definition: SyncAlarmInventory.cpp:165
Class for storing alarms.
Definition: SyncAlarmInventory.h:37