|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PUSHTIMERCONTAINER_H |
|
20 #define PUSHTIMERCONTAINER_H |
|
21 |
|
22 #include "pushdbhandler.h" |
|
23 #include "timerserverinterface.h" |
|
24 |
|
25 namespace java |
|
26 { |
|
27 namespace util |
|
28 { |
|
29 class Uid; |
|
30 } |
|
31 |
|
32 namespace push |
|
33 { |
|
34 |
|
35 /** |
|
36 * This interface provides callback operation which informs expiration of the timer |
|
37 * for automatic launch of the application. |
|
38 */ |
|
39 class PushTimerListener |
|
40 { |
|
41 public: |
|
42 |
|
43 virtual ~PushTimerListener() {} |
|
44 |
|
45 /** |
|
46 * This callback operation is called if alarm expired for application's |
|
47 * automatic launch. |
|
48 * @param aUid UID of the application. |
|
49 * @param aAlarmTime alarm time(= epoch time) of the MIDlet in milliseconds. |
|
50 */ |
|
51 virtual void timerExpired(const java::util::Uid& aUid, |
|
52 const long long& aAlarmTime) = 0; |
|
53 |
|
54 /** |
|
55 * This operation deletes alarm of the application from the db. |
|
56 * This operation does not thrown any exception. |
|
57 * @param aUid UID of the application. |
|
58 */ |
|
59 virtual void deleteAlarm(const java::util::Uid& aUid) = 0; |
|
60 }; |
|
61 |
|
62 class TimerData |
|
63 { |
|
64 public: |
|
65 |
|
66 TimerData(const java::util::Uid& aUid, |
|
67 const java::captain::JavaTime& aTime, |
|
68 int aTimerId); |
|
69 |
|
70 ~TimerData(); |
|
71 |
|
72 TimerData(const TimerData&); |
|
73 |
|
74 TimerData &operator=(const TimerData&); |
|
75 |
|
76 java::util::Uid mUid; |
|
77 java::captain::JavaTime mTime; |
|
78 int mTimerId; |
|
79 }; |
|
80 |
|
81 /** |
|
82 * This interface provides functionality for setting timer for automatic launch |
|
83 * of the application. This interface is needed because timer implementation is |
|
84 * different depending on OS system. |
|
85 */ |
|
86 class PushTimerContainer : public java::captain::TimerServerEventsInterface |
|
87 { |
|
88 public: |
|
89 |
|
90 PushTimerContainer(java::captain::TimerServerInterface& aTimerServer, |
|
91 PushTimerListener& aListener); |
|
92 |
|
93 virtual ~PushTimerContainer(); |
|
94 |
|
95 /** |
|
96 * @param aListener Ownership of this argument is not given to the user. |
|
97 */ |
|
98 //void setListener(PushTimerListener* aListener); |
|
99 |
|
100 /** |
|
101 * This operation provides alarm information. |
|
102 * @param aList List of alarm times. Note: Implementation must not |
|
103 * delete content of the list. |
|
104 */ |
|
105 void setAlarmTimers(std::list<DbAlarmData>& aList); |
|
106 |
|
107 /** |
|
108 * Returns alarm time by UID of the application. |
|
109 * @param aUid UID of the application. |
|
110 * @return alarm Time by UID of the application. 0 is returned if alarm time |
|
111 * by UId is not found. |
|
112 */ |
|
113 long long getAlarmTime(const java::util::Uid& aUid); |
|
114 |
|
115 /** |
|
116 * This operation cancels pending timer of the application. |
|
117 * @param aUid UID of the application. |
|
118 * @throws This operation does not throw exception. |
|
119 */ |
|
120 void cancelAlarm(const java::util::Uid& aUid); |
|
121 |
|
122 /** |
|
123 * @return current time in milliseconds |
|
124 * since 00:00:00 UTC (Coordinated Universal Time), January 1 1970. |
|
125 */ |
|
126 long long getCurrentTime(); |
|
127 |
|
128 java::captain::TimerServerInterface& getTimerServerInterface() const; |
|
129 |
|
130 //TimerServerEventsInterface |
|
131 virtual void timerTimeout(const int& aTimerId); |
|
132 |
|
133 private: |
|
134 |
|
135 //Datamembers. |
|
136 java::captain::TimerServerInterface& mTimerServer; |
|
137 PushTimerListener& mListener; |
|
138 typedef std::list<TimerData> TimerList_t; |
|
139 typedef std::list<TimerData>::iterator TimerListIter_t; |
|
140 TimerList_t mTimerList; |
|
141 |
|
142 //Not implemented. |
|
143 PushTimerContainer(const PushTimerContainer &x); |
|
144 PushTimerContainer &operator=(const PushTimerContainer &x); |
|
145 |
|
146 }; |
|
147 |
|
148 } //end namespace push |
|
149 } //end namespace java |
|
150 |
|
151 #endif // PUSHTIMERCONTAINER_H |