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: implements the factory for creating engine |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CVIMPSTENGINEFACTORY_H |
|
19 #define __CVIMPSTENGINEFACTORY_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include "mvimpstenginefactory.h" |
|
24 #include <mspnotifychangeobserver.h> |
|
25 |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CVIMPSTEngineServiceTableFetcher; |
|
29 class MVIMPSTEngine; |
|
30 class CSPNotifyChange; |
|
31 class CVIMPSTEngineCVListener; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * Factory to create engine. |
|
36 * This class implements the factory for creating engine |
|
37 * |
|
38 * @lib vimpstengine.lib |
|
39 * @since S60 5.0 |
|
40 */ |
|
41 |
|
42 class CVIMPSTEngineFactory : public CBase, |
|
43 public MVIMPSTEngineFactory, |
|
44 public MSPNotifyChangeObserver |
|
45 { |
|
46 public: // Two-phased constructors and destructor |
|
47 |
|
48 /** |
|
49 * @returns a single instance of MVIMPSTEngineFactory |
|
50 */ |
|
51 IMPORT_C static MVIMPSTEngineFactory* InstanceL(); |
|
52 |
|
53 /** |
|
54 * Release |
|
55 * dont call delete |
|
56 */ |
|
57 IMPORT_C static void Release(); |
|
58 |
|
59 /** |
|
60 * c++ default destructor |
|
61 * dont call delete |
|
62 */ |
|
63 virtual ~CVIMPSTEngineFactory(); |
|
64 |
|
65 /** |
|
66 * return the engine instance for aServiceId. |
|
67 */ |
|
68 MVIMPSTEngine* GetEngine( TServiceId aServiceId ); |
|
69 |
|
70 private: |
|
71 |
|
72 /** |
|
73 * NewLC two phase constructor. |
|
74 * dont call delete call close |
|
75 */ |
|
76 static CVIMPSTEngineFactory* NewLC(); |
|
77 |
|
78 /** |
|
79 * Second phase construction |
|
80 * ConstructL |
|
81 */ |
|
82 void ConstructL(); |
|
83 |
|
84 /** |
|
85 * C++ constructor. |
|
86 */ |
|
87 CVIMPSTEngineFactory(); |
|
88 |
|
89 |
|
90 public: //From MVIMPSTEngineFactory |
|
91 /* |
|
92 * @ See MVIMPSTEngineFactory |
|
93 */ |
|
94 void GetServiceEnginePtr(RPointerArray<MVIMPSTEngine>& serviceIdArray) const; |
|
95 |
|
96 /* |
|
97 * @ See MVIMPSTEngineFactory |
|
98 */ |
|
99 TInt FindService( TUint aServiceId ) const; |
|
100 |
|
101 |
|
102 private: // From MSPNotifyChangeObserver |
|
103 |
|
104 /** |
|
105 * From MSPNotifyChangeObserver |
|
106 * Callback when service has changed |
|
107 * |
|
108 * @since S60 5.0 |
|
109 * @param aServiceId changed service |
|
110 * @return None |
|
111 */ |
|
112 void HandleNotifyChange( TServiceId aServiceId ); |
|
113 |
|
114 /** |
|
115 * From MSPNotifyChangeObserver |
|
116 * Callback when service error occures |
|
117 * |
|
118 * @since S60 5.0 |
|
119 * @param aError error code |
|
120 * @return None |
|
121 */ |
|
122 void HandleError( TInt aError ); |
|
123 |
|
124 /** |
|
125 * increament the reference count of engine |
|
126 * |
|
127 * @since S60 5.0 |
|
128 */ |
|
129 |
|
130 void IncreamentRefereneCount(); |
|
131 /** |
|
132 * decreament the reference count of engine |
|
133 * @return the number of ref count |
|
134 * @since S60 5.0 |
|
135 */ |
|
136 |
|
137 |
|
138 TInt DecreamentRefereneCount(); |
|
139 |
|
140 private : |
|
141 |
|
142 //owned pointer to service table entry |
|
143 CVIMPSTEngineServiceTableFetcher* iServiceTableFetcher; |
|
144 |
|
145 //owns array of services |
|
146 RPointerArray<MVIMPSTEngine> iServiceItems; |
|
147 |
|
148 // Own: service observer |
|
149 CSPNotifyChange* iSpNotifyChange; |
|
150 |
|
151 // owns : reference count |
|
152 TInt iReferenceCount; |
|
153 // owns, lister to rproperty defined by imcvengine. |
|
154 CVIMPSTEngineCVListener* iCVlistener; |
|
155 |
|
156 }; |
|
157 |
|
158 #endif //__CVIMPSTENGINEFACTORY_H |
|
159 |
|
160 // End of File |
|
161 |
|
162 |
|