|
1 /* |
|
2 * Copyright (c) 2006 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: Plugin monitor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXPLUGINMONITOR_H |
|
20 #define CMPXPLUGINMONITOR_H |
|
21 |
|
22 #include <ecom/ecom.h> |
|
23 #include <badesca.h> |
|
24 #include <mpxpluginmonitorobserver.h> |
|
25 |
|
26 /** |
|
27 * Monitors a designated plugin interface. When a plugin for that interface is |
|
28 * added or removed, if a client is interested in the event, client will be |
|
29 * notified through MMPXPluginMonitorObserver interface. |
|
30 * |
|
31 * @lib mpxcommon.lib |
|
32 */ |
|
33 class CMPXPluginMonitor : public CActive |
|
34 { |
|
35 |
|
36 public: |
|
37 /** |
|
38 * Two-phased constructor. |
|
39 * |
|
40 * @since S60 3.2.3 |
|
41 * @param aInterfaceUid The UID of the plugin interface to be monitored by |
|
42 * this instance of CMPXPluginMonitor |
|
43 * @return Constructed object |
|
44 */ |
|
45 IMPORT_C static CMPXPluginMonitor* NewL(const TUid& aInterfaceUid); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 * |
|
50 * @since S60 3.2.3 |
|
51 */ |
|
52 IMPORT_C ~CMPXPluginMonitor(); |
|
53 |
|
54 /** |
|
55 * Add a observer. |
|
56 * |
|
57 * @since S60 3.2.3 |
|
58 * @param aObs observer to be added |
|
59 */ |
|
60 void AddObserverL(MMPXPluginMonitorObserver& aObs); |
|
61 |
|
62 /** |
|
63 * Remove a observer. |
|
64 * |
|
65 * @since S60 3.2.3 |
|
66 * @param aObs observer to be removed |
|
67 */ |
|
68 void RemoveObserverL(MMPXPluginMonitorObserver& aObs); |
|
69 |
|
70 /** |
|
71 * Request to notify all observers that they should unload a specified plugin |
|
72 * because it is being updated. |
|
73 * |
|
74 * @since S60 3.2.3 |
|
75 * @param aPluginUid plugin that is being updated |
|
76 */ |
|
77 void NotifyUnload(const TUid& aPluginUid); |
|
78 |
|
79 private: |
|
80 |
|
81 /** |
|
82 * 2nd phase contructor. |
|
83 * |
|
84 * @since S60 3.2.3 |
|
85 */ |
|
86 void ConstructL(); |
|
87 |
|
88 /** |
|
89 * C++ constructor. |
|
90 * |
|
91 * @since S60 3.2.3 |
|
92 * @param aInterfaceUid The UID of the plugin interface to be monitored by |
|
93 * this instance of CMPXPluginMonitor |
|
94 */ |
|
95 CMPXPluginMonitor(const TUid& aInterfaceUid); |
|
96 |
|
97 /** |
|
98 * From CActive. |
|
99 * Handles an active object's request completion event. |
|
100 * |
|
101 * @since S60 3.2.3 |
|
102 */ |
|
103 void RunL(); |
|
104 |
|
105 /** |
|
106 * From CActive. |
|
107 * Handles a leave occurring in the request completion event handler RunL(). |
|
108 * |
|
109 * @since S60 3.2.3 |
|
110 * @param aError error code |
|
111 * @return system error code |
|
112 */ |
|
113 TInt RunError(TInt aError); |
|
114 |
|
115 /** |
|
116 * From CActive. |
|
117 * Implements cancellation of an outstanding request. |
|
118 * |
|
119 * @since S60 3.2.3 |
|
120 */ |
|
121 void DoCancel(); |
|
122 |
|
123 private: |
|
124 TUid iInterfaceUid; |
|
125 RPointerArray<MMPXPluginMonitorObserver> iObservers; // items not owned |
|
126 REComSession iECs; |
|
127 }; |
|
128 |
|
129 #endif // CMPXPLUGINMONITOR_H |