|
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: GS utilities. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GSECOMNOTIFIER_H |
|
20 #define GSECOMNOTIFIER_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <ecom/ecom.h> |
|
24 |
|
25 |
|
26 |
|
27 /** |
|
28 * Utility class to capsulate active object observing ECOM events. |
|
29 * MGSEComObserver is provided as easy callback when GS related ECOM events |
|
30 * occur. |
|
31 * |
|
32 * @lib GSFramework.lib |
|
33 * @since S60 5.0 |
|
34 */ |
|
35 class MGSEComObserver |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Not really used yet. To provide more extendability. |
|
41 */ |
|
42 enum TEComEvent |
|
43 { |
|
44 EPluginRemoved, |
|
45 EPluginAdded |
|
46 }; |
|
47 |
|
48 public: |
|
49 virtual void HandleEComEvent( TEComEvent aEvent ) = 0; |
|
50 }; |
|
51 |
|
52 |
|
53 /** |
|
54 * Utility class capsulating active object for observing ECOM events. |
|
55 * |
|
56 * @lib GSFramework.lib |
|
57 * @since S60 5.0 |
|
58 */ |
|
59 NONSHARABLE_CLASS( CGSEComNotifier ) : public CActive |
|
60 { |
|
61 public: |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * |
|
66 * @param aObserver Callback object. |
|
67 * @param aImplInfo Initial list of ECOM interfaces against which new list |
|
68 * is compared when ECOM events occur. |
|
69 */ |
|
70 IMPORT_C static CGSEComNotifier* NewL( MGSEComObserver* aObserver, |
|
71 RImplInfoPtrArray aImplInfo ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 IMPORT_C virtual ~CGSEComNotifier(); |
|
77 |
|
78 protected: // from CActive |
|
79 |
|
80 /** |
|
81 * See base class. |
|
82 */ |
|
83 void DoCancel(); |
|
84 |
|
85 /** |
|
86 * See base class. |
|
87 */ |
|
88 void RunL(); |
|
89 |
|
90 /** |
|
91 * See base class. |
|
92 */ |
|
93 TInt RunError( TInt aError ); |
|
94 |
|
95 protected: |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * C++ Constructor. |
|
101 * |
|
102 * @param aObserver Callback object. |
|
103 * @param aImplInfo Initial list of ECOM interfaces against which new list |
|
104 * is compared when ECOM events occur. |
|
105 */ |
|
106 CGSEComNotifier( MGSEComObserver* aObserver, |
|
107 RImplInfoPtrArray aImplInfo ); |
|
108 |
|
109 /** |
|
110 * 2nd phase constructor. |
|
111 */ |
|
112 void ConstructL(); |
|
113 |
|
114 /** |
|
115 * Issues new request. |
|
116 */ |
|
117 void IssueRequest(); |
|
118 |
|
119 /** |
|
120 * @return Difference between old and new list of GS-plugins. Negative |
|
121 * number means plugins are removed, positive means plugins are |
|
122 * added, 0 means no change in plugin count. |
|
123 */ |
|
124 TInt PluginCountDeltaL(); |
|
125 |
|
126 private: // data |
|
127 |
|
128 // Callback. |
|
129 MGSEComObserver* iObserver; |
|
130 |
|
131 // ECom handle. |
|
132 REComSession iEComSession; |
|
133 |
|
134 // Stored original plugin info. This will be compared against latest info |
|
135 // for any changes. |
|
136 RImplInfoPtrArray iOriginalImplInfo; |
|
137 |
|
138 }; |
|
139 |
|
140 |
|
141 #endif // GSECOMNOTIFIER_H |