|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // lbsrootapi.h |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalTechnology |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __LBS_PROCESSSUPERVISOR_H__ |
|
27 #define __LBS_PROCESSSUPERVISOR_H__ |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <e32def.h> |
|
31 #include <e32cmn.h> |
|
32 #include <e32std.h> |
|
33 #include <e32property.h> |
|
34 #include "lbsprocessuiddefs.h" |
|
35 |
|
36 /** |
|
37 * Class which allows processes to register to be notified for closedown, |
|
38 * and to confirm closedown when it is completed. |
|
39 */ |
|
40 class RLbsProcessSupervisor |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Values for closedown request property which indicate whether the |
|
45 * process is to close itself down or reset itself. |
|
46 */ |
|
47 enum TProcessSignal |
|
48 { |
|
49 EProcessSignalUnknown = 0, |
|
50 EProcessCloseDown, |
|
51 EProcessReset |
|
52 }; |
|
53 |
|
54 public: |
|
55 IMPORT_C static void InitializeL(); |
|
56 IMPORT_C static void ShutDownL(); |
|
57 |
|
58 IMPORT_C RLbsProcessSupervisor(); |
|
59 IMPORT_C void OpenL(TUid aModuleId); |
|
60 IMPORT_C void Close(); |
|
61 |
|
62 IMPORT_C void CloseDownProcess(); |
|
63 IMPORT_C void ResetProcess(); |
|
64 |
|
65 void NotifyCloseDownRequest(TRequestStatus& aStatus); |
|
66 IMPORT_C void CancelNotifyCloseDownRequest(); |
|
67 |
|
68 TInt ProcessSignal(); |
|
69 |
|
70 private: |
|
71 RProperty iRequestCloseDown; |
|
72 TUid iModuleId; |
|
73 }; |
|
74 |
|
75 /** |
|
76 * Mixin class defining a function implemented by LBS processes/servers started |
|
77 * by LBS Root and which is called when the process/server is to close itself |
|
78 * down |
|
79 */ |
|
80 class MLbsProcessCloseDown |
|
81 { |
|
82 public: |
|
83 virtual void OnProcessCloseDown() = 0; |
|
84 }; |
|
85 |
|
86 /** |
|
87 * Mixin class defining a function implemented by LBS processes/servers started |
|
88 * by LBS Root and which is called when the process/server is to 'reset' itself |
|
89 * (e.g. clear internal cache, state variable). This is expected mainly to be |
|
90 * used for test purposes. |
|
91 */ |
|
92 class MLbsProcessReset |
|
93 { |
|
94 public: |
|
95 virtual void OnProcessReset() = 0; |
|
96 }; |
|
97 |
|
98 |
|
99 class CLbsCloseDownRequestDetector : public CActive |
|
100 { |
|
101 public: |
|
102 // Not all process need to implement a reset function, so allow a default |
|
103 // value of NULL for the reset observer. |
|
104 IMPORT_C static CLbsCloseDownRequestDetector* NewL( |
|
105 MLbsProcessCloseDown* aCloseDownObserver, |
|
106 TUid aProcessUid, |
|
107 MLbsProcessReset* aResetObserver = NULL); |
|
108 ~CLbsCloseDownRequestDetector(); |
|
109 |
|
110 protected: |
|
111 CLbsCloseDownRequestDetector(MLbsProcessCloseDown* aCloseDown, |
|
112 MLbsProcessReset* aResetObserver); |
|
113 void ConstructL(TUid aProcessUid); |
|
114 |
|
115 protected: |
|
116 //From CActive |
|
117 virtual void RunL(); |
|
118 virtual void DoCancel(); |
|
119 |
|
120 private: |
|
121 RLbsProcessSupervisor iLbsSupervisor; |
|
122 MLbsProcessCloseDown* iCloseDownObserver; |
|
123 MLbsProcessReset* iResetObserver; |
|
124 }; |
|
125 |
|
126 #endif //__LBS_PROCESSSUPERVISOR_H__ |