|
1 /* |
|
2 * Copyright (c) 2005 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: Class implements IMPS factory interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CCAImpsFactory.h" |
|
22 #include "CCAImpsGroupClient.h" |
|
23 #include "CCAImpsFundClient.h" |
|
24 #include "CCAImpsImClient.h" |
|
25 #include "CCAImpsAccessClient.h" |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CCAImpsFactory::CCAImpsFactory |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CCAImpsFactory::CCAImpsFactory() |
|
36 { |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CCAImpsFactory::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CCAImpsFactory::ConstructL() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CCAImpsFactory::NewL |
|
50 // Two-phased constructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CCAImpsFactory* CCAImpsFactory::NewL() |
|
54 { |
|
55 CCAImpsFactory* self = new ( ELeave ) CCAImpsFactory; |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop( self ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 // Destructor |
|
64 CCAImpsFactory::~CCAImpsFactory() |
|
65 { |
|
66 Unregister(); |
|
67 |
|
68 delete iAccessClient; |
|
69 delete iImClient; |
|
70 delete iGroupClient; |
|
71 delete iFundClient; |
|
72 |
|
73 if ( iConnected ) |
|
74 { |
|
75 iImpsEng.Close(); |
|
76 } |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CCAImpsFactory::CreateAccessClientL |
|
81 // Creates new concrete access client if not created earlier. |
|
82 // (other items were commented in a header). |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 MCAImpsAccessClient* CCAImpsFactory::CreateAccessClientL() |
|
86 { |
|
87 if ( !iAccessClient ) |
|
88 { |
|
89 iAccessClient = CCAImpsAccessClient::NewL( iImpsEng ); |
|
90 } |
|
91 |
|
92 return iAccessClient; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CCAImpsFactory::CreateImClientL |
|
97 // Creates new concrete IM client if not created earlier. |
|
98 // (other items were commented in a header). |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 MCAImpsImClient* CCAImpsFactory::CreateImClientL() |
|
102 { |
|
103 if ( !iImClient ) |
|
104 { |
|
105 iImClient = CCAImpsImClient::NewL( iImpsEng ); |
|
106 } |
|
107 |
|
108 return iImClient; |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CCAImpsFactory::CreateGroupClientL |
|
113 // Creates new concrete group client if not created earlier. |
|
114 // (other items were commented in a header). |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 MCAImpsGroupClient* CCAImpsFactory::CreateGroupClientL() |
|
118 { |
|
119 if ( ! iGroupClient ) |
|
120 { |
|
121 iGroupClient = CCAImpsGroupClient::NewL( iImpsEng ); |
|
122 } |
|
123 return iGroupClient; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CCAImpsFactory::CreateFundClientL |
|
128 // Creates new concrete fundamental client if not created earlier. |
|
129 // (other items were commented in a header). |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 MCAImpsFundClient* CCAImpsFactory::CreateFundClientL() |
|
133 { |
|
134 if ( ! iFundClient ) |
|
135 { |
|
136 iFundClient = CCAImpsFundClient::NewL( iImpsEng ); |
|
137 } |
|
138 return iFundClient; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CCAImpsFactory::RegisterL |
|
143 // Signals all interfaces to register themselfs to WV Engine. |
|
144 // (other items were commented in a header). |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CCAImpsFactory::RegisterL() |
|
148 { |
|
149 if ( iAccessClient ) |
|
150 { |
|
151 iAccessClient->InterfaceL(); |
|
152 } |
|
153 |
|
154 if ( iImClient ) |
|
155 { |
|
156 iImClient->InterfaceL(); |
|
157 } |
|
158 |
|
159 if ( iGroupClient ) |
|
160 { |
|
161 iGroupClient->InterfaceL(); |
|
162 } |
|
163 |
|
164 if ( iFundClient ) |
|
165 { |
|
166 iFundClient->InterfaceL(); |
|
167 } |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CCAImpsFactory::Unregister |
|
172 // Signals all interfaces to unregister themselfs from WV Engine. |
|
173 // (other items were commented in a header). |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CCAImpsFactory::Unregister() |
|
177 { |
|
178 if ( iAccessClient ) |
|
179 { |
|
180 iAccessClient->Unregister(); |
|
181 } |
|
182 |
|
183 if ( iImClient ) |
|
184 { |
|
185 iImClient->Unregister(); |
|
186 } |
|
187 |
|
188 if ( iGroupClient ) |
|
189 { |
|
190 iGroupClient->Unregister(); |
|
191 } |
|
192 |
|
193 if ( iFundClient ) |
|
194 { |
|
195 iFundClient->Unregister(); |
|
196 } |
|
197 |
|
198 if ( iConnected ) |
|
199 { |
|
200 iImpsEng.Close(); |
|
201 iConnected = EFalse; |
|
202 } |
|
203 } |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // CCAImpsFactory::ConnectL |
|
207 // Connects to IMPS engine (server) |
|
208 // (other items were commented in a header). |
|
209 // ----------------------------------------------------------------------------- |
|
210 // |
|
211 void CCAImpsFactory::ConnectL() |
|
212 { |
|
213 if ( !iConnected ) |
|
214 { |
|
215 User::LeaveIfError( iImpsEng.Connect() ); |
|
216 iConnected = ETrue; |
|
217 } |
|
218 } |
|
219 |
|
220 // End of File |