|
1 /* |
|
2 * Copyright (c) 2009 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: This header contains the class which creates the condition schedule. |
|
15 * |
|
16 */ |
|
17 #ifndef __DMEVENTSCHEDULER_H__ |
|
18 #define __DMEVENTSCHEDULER_H__ |
|
19 |
|
20 // System Includes |
|
21 #include <e32base.h> |
|
22 #include <e32def.h> |
|
23 #include <csch_cli.h> // RScheduler |
|
24 #include <schinfo.h> // TSchedulerItemRef, TTaskInfo... |
|
25 |
|
26 //User includes |
|
27 #include "DmEventServiceBase.h" |
|
28 #include "DmEventNotifierCommon.h" |
|
29 #include "DmEventNotifierInternal.h" |
|
30 |
|
31 const TUid KAppDmEventNotifierUid = TUid::Uid(KAppUidDmEventNotifier); //UID3 from .mmp file |
|
32 |
|
33 //Forward declarations |
|
34 class CSwInstallObserver; |
|
35 |
|
36 /** |
|
37 * Install scheduler is responsible for creating the condition schedules and notifying server |
|
38 * when they expire |
|
39 * |
|
40 * @since S60 v5.2 |
|
41 */ |
|
42 NONSHARABLE_CLASS(CDmEventScheduler) : public CBase |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** Two phase construction **/ |
|
48 static CDmEventScheduler* NewL(); |
|
49 |
|
50 static CDmEventScheduler* NewLC(); |
|
51 |
|
52 /** Destructor **/ |
|
53 virtual ~CDmEventScheduler(); |
|
54 |
|
55 /** Member functions **/ |
|
56 /** |
|
57 * This function creates all the condition schedule required by the services |
|
58 * |
|
59 * @since S60 v5.2 |
|
60 * @param aService - the service to be scheduled. If not specified all will be |
|
61 * scheduled |
|
62 * @return None. Can leave with system wide errors |
|
63 */ |
|
64 void CreateConditionScheduleL(CDmEventServiceBase* aService = NULL); |
|
65 |
|
66 /** |
|
67 * This function creates one condition schedule with task for a service |
|
68 * |
|
69 * @since S60 v5.2 |
|
70 * @param aSchedulerItem - A unique id for the schedule |
|
71 * @param aScheduler - Task schedule client side interface |
|
72 * @param aDefaultRunTime - Task schedule time |
|
73 * @param aNewTaskId - The new task in after it is created |
|
74 * @param aConditions - The condition array |
|
75 * @param aService - The service base pointer |
|
76 * @return KErrNone or system wide error |
|
77 */ |
|
78 TInt CreateConditionScheduleWithTaskL (TSchedulerItemRef& aSchedulerItem, |
|
79 RScheduler& aScheduler, |
|
80 const TTsTime& aDefaultRunTime, |
|
81 TInt& aNewTaskId, |
|
82 CArrayFixFlat<TTaskSchedulerCondition>* &aConditions, |
|
83 CDmEventServiceBase* aService); |
|
84 |
|
85 /** |
|
86 * This function will wait until a service operation is complete. For example, during software uninstallation |
|
87 * this function returns only when the uninstallation is complete. |
|
88 * |
|
89 * @since S60 v5.2 |
|
90 * @param aTaskName - Name of the task |
|
91 * @return None. Can leave with system wide error |
|
92 */ |
|
93 void WaitAndCreateConditionScheduleL(TName aTaskName); |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * Default constructor |
|
99 * |
|
100 * @since S60 v5.2 |
|
101 * @param NOne |
|
102 * @return |
|
103 */ |
|
104 CDmEventScheduler(); |
|
105 |
|
106 /** |
|
107 * Constructs member variables |
|
108 * |
|
109 * @since S60 v5.2 |
|
110 * @return None. Can leave with system wide error. |
|
111 */ |
|
112 void ConstructL(); |
|
113 |
|
114 /** |
|
115 * Deletes any outstanding task and schedule |
|
116 * |
|
117 * @since S60 v5.2 |
|
118 * @return None. Can leave with system wide error |
|
119 */ |
|
120 void DeleteScheduleL(); |
|
121 |
|
122 /** |
|
123 * Creates the condition array for the provided service |
|
124 * |
|
125 * @since S60 v5.2 |
|
126 * @param aService - the service for which condition array is to be created |
|
127 * @return Condition array. Can leave with system wide errors. |
|
128 */ |
|
129 CSchConditionArray* CreateConditionLC(CDmEventServiceBase* aService); |
|
130 |
|
131 /** |
|
132 * Finds the expired service when scheduler triggers it. |
|
133 * |
|
134 * @since S60 v5.2 |
|
135 * @param aTaskName - the task name of the expired schedule |
|
136 * @return base class pointer of the service |
|
137 */ |
|
138 CDmEventServiceBase* FindExpiredService(TName& aTaskName); |
|
139 |
|
140 /** |
|
141 * This functions notifies other registered servers when a service expires |
|
142 * |
|
143 * @since S60 v5.2 |
|
144 * @param aServiceId - the service that has expired |
|
145 * @param aOpn - the operation the service has undergone |
|
146 * @return None. Can leave with system wide errors |
|
147 */ |
|
148 void NotifyRegisteredServersL(THandlerServiceId aServiceId, THandlerOperation aOpn); |
|
149 |
|
150 /** |
|
151 * Checks whether the schedule is already created or not |
|
152 * |
|
153 * @since S60 v5.2 |
|
154 * @return ETrue if schedule is already created; otherwise EFalse. Can leave |
|
155 * with system wide errors. |
|
156 */ |
|
157 TBool IsScheduleEnabledL(); |
|
158 |
|
159 /** |
|
160 * Once schedule is created successfully, this function is called to set the |
|
161 * schedule as enabled. otherwise it is called with disabled. |
|
162 * |
|
163 * @since S60 v5.2 |
|
164 * @param Status of the schedule |
|
165 * @return None. System wide errors |
|
166 */ |
|
167 void SetScheduleEnabledL(TBool aValue); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * The client side symbian scheduler |
|
173 */ |
|
174 RScheduler iScheduler; |
|
175 |
|
176 /** |
|
177 * The scheduler item reference |
|
178 */ |
|
179 TSchedulerItemRef iConditionScheduleHandle; |
|
180 |
|
181 /** |
|
182 * Array to hold the services objects |
|
183 */ |
|
184 TFixedArray<CDmEventServiceBase*, KMaxServices> iServices; |
|
185 |
|
186 }; |
|
187 |
|
188 #endif // __DMEVENTSCHEDULER_H__ |