|
1 /* |
|
2 * Copyright (c) 2004-2007 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: Stub class of CMusAvaInterface to support unit testing. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cmusavainterfacestub.h" |
|
20 #include "musavaavailabilitystub.h" |
|
21 #include "mmusavasettingsstub.h" |
|
22 #include "musavaavailability.h" |
|
23 #include "musavaavailabilityobserverimp.h" |
|
24 |
|
25 const MMusAvaObserver::TAvailabilityName KMinimumAvailability |
|
26 = MMusAvaObserver::EMusAvaBearerStatus; |
|
27 |
|
28 const MMusAvaObserver::TAvailabilityName KMandatoryAvailability |
|
29 = MMusAvaObserver::EMusAvaNameRegistration; |
|
30 |
|
31 const MMusAvaObserver::TAvailabilityName KExtensionAvailability |
|
32 = MMusAvaObserver::EMusAvaOptionHandler; |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 |
|
37 CMusAvaInterface2* CMusAvaInterface2::NewL() |
|
38 { |
|
39 CMusAvaInterface2* self = new( ELeave ) CMusAvaInterface2(); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop( self ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 CMusAvaInterface2::~CMusAvaInterface2() |
|
48 { |
|
49 iAvailabilities.ResetAndDestroy(); |
|
50 iAvailabilities.Close(); |
|
51 delete iSettings; |
|
52 delete iMusAvailObs; |
|
53 } |
|
54 |
|
55 |
|
56 CMusAvaInterface2::CMusAvaInterface2() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 void CMusAvaInterface2::ConstructL() |
|
62 { |
|
63 iSettings = new(ELeave)CMusAvaSettings2(); |
|
64 iSettings->ConstructL(); |
|
65 // Create network availability stub |
|
66 iMusAvailObs = CMusAvaAvailabilityObserverImp::NewL(); |
|
67 CMusAvaAvailabilityStub* stub = CMusAvaAvailabilityStub::NewLC( *iMusAvailObs, *iSettings ); |
|
68 iAvailabilities.AppendL( stub ); |
|
69 CleanupStack::Pop( stub ); |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Requests the implementation to provide availabilites. |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 void CMusAvaInterface2::Availability() |
|
78 { |
|
79 |
|
80 } |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Called by the ECOM framework when MusAvailability Plug-in is request |
|
85 // retuns setting interface for the client. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 MMusAvaSettings& CMusAvaInterface2::Settings() |
|
89 { |
|
90 return *iSettings; |
|
91 } |
|
92 |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // Called by the ECOM framework when MusAvailability Plug-in is for |
|
96 // setting Observer interface for the client. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CMusAvaInterface2::SetObserver( MMusAvaObserver& aObserver ) |
|
100 { |
|
101 iObserver = &aObserver; |
|
102 } |
|
103 |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // Called by the ECOM framework when MusAvailability Plug-in is request |
|
107 // to investigate availabilites for the client. |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CMusAvaInterface2::StartL() |
|
111 { |
|
112 |
|
113 } |
|
114 |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // Called by the ECOM framework when MusAvailability Plug-in is request |
|
118 // to stop investigate or monitoring availabilites for the client. |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CMusAvaInterface2::Stop() |
|
122 { |
|
123 } |
|
124 |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // tbd |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 MMusAvaObserver::TAvailabilityName CMusAvaInterface2::CurrentAvailability() |
|
131 { |
|
132 return iCurrentAvailability; |
|
133 } |
|
134 |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // tbd |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 MMusAvaObserver::TAvailabilityStatus CMusAvaInterface2::AvailabilityStatus() |
|
141 { |
|
142 return iAvailabilityStatus; |
|
143 } |
|
144 |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // tbd |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 TBool CMusAvaInterface2::MinimumAvailability() |
|
151 { |
|
152 return iCurrentAvailability > KMinimumAvailability; |
|
153 } |
|
154 |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // tbd |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 TBool CMusAvaInterface2::MandatoryAvailability() |
|
161 { |
|
162 return iCurrentAvailability > KMandatoryAvailability; |
|
163 } |
|
164 |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // tbd |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 TBool CMusAvaInterface2::ExtensionAvailability() |
|
171 { |
|
172 return iCurrentAvailability > KExtensionAvailability; |
|
173 } |
|
174 |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // tbd |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 TBool CMusAvaInterface2::Available( |
|
181 MMusAvaObserver::TAvailabilityName aAvailability ) |
|
182 { |
|
183 return iCurrentAvailability > aAvailability |
|
184 || ( iCurrentAvailability == aAvailability |
|
185 && MMusAvaObserver::EMusAvaStatusAvailable == iAvailabilityStatus ); |
|
186 } |
|
187 |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // tbd |
|
191 // ----------------------------------------------------------------------------- |
|
192 // |
|
193 MMusAvaObserver::TAvailabilityStatus CMusAvaInterface2::AvailabilityState( |
|
194 MMusAvaObserver::TAvailabilityName aAvailability ) |
|
195 { |
|
196 for ( TInt i = 0; i < iAvailabilities.Count(); i++ ) |
|
197 { |
|
198 if ( iAvailabilities[i]->Name() == aAvailability ) |
|
199 { |
|
200 return iAvailabilities[i]->State(); |
|
201 } |
|
202 } |
|
203 return MMusAvaObserver::EMusAvaStatusNotExecuted; |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 void CMusAvaInterface2::PrepareForReceivedInviteL() |
|
211 { |
|
212 for ( TInt i = 0; i < iAvailabilities.Count(); i++ ) |
|
213 { |
|
214 iAvailabilities[i]->PrepareForReceivedInviteL(); |
|
215 } |
|
216 } |
|
217 |
|
218 void CMusAvaInterface2::AvailabilityChanged( |
|
219 TAvailabilityName aName, |
|
220 TAvailabilityStatus aStatus ) |
|
221 { |
|
222 |
|
223 } |
|
224 |
|
225 void CMusAvaInterface2::AvailabilityError( |
|
226 TAvailabilityName aName, |
|
227 TAvailabilityStatus aStatus ) |
|
228 { |
|
229 |
|
230 } |
|
231 |
|
232 void CMusAvaInterface2::SetSettingsObserver( MMusAvaSettingsObserver& aObserver ) |
|
233 { |
|
234 } |
|
235 |
|
236 // ======== GLOBAL FUNCTIONS ======== |
|
237 |
|
238 |
|
239 CImplementationInformation::CImplementationInformation() |
|
240 { |
|
241 |
|
242 } |
|
243 |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CImplementationInformation::~CImplementationInformation |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 CImplementationInformation::~CImplementationInformation() |
|
250 { |
|
251 delete iData; |
|
252 delete iDisplayName; |
|
253 delete iOpaqueData; |
|
254 } |
|
255 |
|
256 CImplementationInformation* CImplementationInformation::NewL( |
|
257 TUid aUid, |
|
258 TInt aVersion, |
|
259 HBufC* aName, |
|
260 HBufC8* aDataType, |
|
261 HBufC8* aOpaqueData, |
|
262 TDriveUnit aDrive, |
|
263 TBool aRomOnly, |
|
264 TBool aRomBased) |
|
265 { |
|
266 CImplementationInformation* self = new(ELeave)CImplementationInformation(); |
|
267 CleanupStack::PushL(self); |
|
268 self->iData = aDataType; |
|
269 self->iDisplayName = aName; |
|
270 self->iOpaqueData = aOpaqueData; |
|
271 CleanupStack::Pop(self); |
|
272 return self; |
|
273 //return new (ELeave) CImplementationInformation(); |
|
274 } |
|
275 |
|
276 void REComSession::DestroyedImplementation( TUid ) |
|
277 { |
|
278 |
|
279 } |
|
280 |
|
281 |
|
282 void REComSession::ListImplementationsL( |
|
283 TUid /*aInterfaceUid*/, |
|
284 RImplInfoPtrArray &aImplInfoArray ) |
|
285 { |
|
286 TUid uid = { 0x10101010 }; |
|
287 TDriveUnit drive; |
|
288 HBufC* name( NULL ); |
|
289 HBufC8* type( NULL ); |
|
290 |
|
291 CImplementationInformation* info = |
|
292 CImplementationInformation::NewL( uid, |
|
293 1, |
|
294 name, |
|
295 type, |
|
296 type, |
|
297 drive, |
|
298 EFalse, |
|
299 EFalse ); |
|
300 CleanupStack::PushL( info ); |
|
301 |
|
302 aImplInfoArray.AppendL( info ); |
|
303 |
|
304 CleanupStack::Pop( info ); |
|
305 |
|
306 } |
|
307 |
|
308 |
|
309 TAny* REComSession::CreateImplementationL( |
|
310 TUid /*aImplementationUid*/, |
|
311 TInt32 /*aDtorIDKey*/ ) |
|
312 { |
|
313 return CMusAvaInterface2::NewL(); |
|
314 } |
|
315 |
|
316 |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // REComSession::ListImplementationsL |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 void REComSession::ListImplementationsL( |
|
323 TUid aInterfaceUid, |
|
324 const TEComResolverParams& resolverParams, |
|
325 RImplInfoPtrArray& aImplInfoArray) |
|
326 { |
|
327 _LIT8(KDefaultEngineName,"MultimediaSharing"); |
|
328 |
|
329 TUid uid(aInterfaceUid); |
|
330 TInt version = 1; |
|
331 HBufC* name = _L("dummy").AllocLC(); |
|
332 HBufC8* dataType = _L8("MultimediaSharing").AllocLC(); |
|
333 HBufC8* opaqueData = _L8("dummy").AllocLC(); |
|
334 TDriveUnit drive; |
|
335 TBool romOnly(ETrue); |
|
336 TBool romBased(ETrue); |
|
337 CImplementationInformation* info = |
|
338 CImplementationInformation::NewL(uid,version,name,dataType, |
|
339 opaqueData,drive,romOnly,romBased); |
|
340 CleanupStack::Pop(3); |
|
341 CleanupStack::PushL(info); |
|
342 aImplInfoArray.AppendL(info); |
|
343 CleanupStack::Pop(info); |
|
344 } |
|
345 |
|
346 // End of File |
|
347 |