|
1 /* |
|
2 * Copyright (c) 2002-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: Singleton Data Storage of Accessory Server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "AccSrvServerModel.h" |
|
22 #include "AccPolGenericIDAccessor.h" |
|
23 #include "AccPolGenericIDArrayAccessor.h" |
|
24 #include "AccPolAccessoryPolicy.h" |
|
25 #include "acc_debug.h" |
|
26 #include <e32std.h> |
|
27 |
|
28 // EXTERNAL DATA STRUCTURES |
|
29 |
|
30 // EXTERNAL FUNCTION PROTOTYPES |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // MACROS |
|
35 |
|
36 // LOCAL CONSTANTS AND MACROS |
|
37 |
|
38 // MODULE DATA STRUCTURES |
|
39 |
|
40 // LOCAL FUNCTION PROTOTYPES |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 |
|
44 // ============================= LOCAL FUNCTIONS =============================== |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CAccSrvServerModel::CAccSrvServerModel |
|
50 // C++ default constructor can NOT contain any code, that |
|
51 // might leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CAccSrvServerModel::CAccSrvServerModel() : |
|
55 iASYsLoadCompleted( EFalse ), |
|
56 iAudioType( EAccMonoAudio ), |
|
57 iValueDataObject( NULL, 0, 0 ), |
|
58 iAudioLinkOpenCancelled ( EFalse ), |
|
59 iAudioLinkCloseCancelled ( EFalse ), |
|
60 iSupportedDevices( 0 ), |
|
61 iIdleDetected( EFalse ) |
|
62 { |
|
63 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::CAccSrvServerModel()" ); |
|
64 |
|
65 iAccMode.iAccessoryMode = EAccModeHandPortable; |
|
66 iAccMode.iAudioOutputStatus = EFalse; |
|
67 iUniqueID = KErrUnknown; |
|
68 |
|
69 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::CAccSrvServerModel - return" ); |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CAccSrvServerModel::ConstructL |
|
74 // Symbian 2nd phase constructor can leave. |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CAccSrvServerModel::ConstructL() |
|
78 { |
|
79 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ConstructL()" ); |
|
80 |
|
81 iConnectionArray.Reset(); |
|
82 iPhysicalConnectionArray.Reset(); |
|
83 iRegisteredASYs.Reset(); |
|
84 iASYThreadID.Reset(); |
|
85 iASYUniqueID.Reset(); |
|
86 iThreadIDFilterArray.Reset(); |
|
87 |
|
88 iCapabilityStorage = CCapabilityStorage::NewL(); |
|
89 |
|
90 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ConstructL - return void" ); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CAccSrvServerModel::NewL |
|
95 // Two-phased constructor. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CAccSrvServerModel* CAccSrvServerModel::NewL() |
|
99 { |
|
100 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::NewL()" ); |
|
101 CAccSrvServerModel* self = new( ELeave ) CAccSrvServerModel; |
|
102 |
|
103 CleanupStack::PushL( self ); |
|
104 self->ConstructL(); |
|
105 CleanupStack::Pop( self ); |
|
106 |
|
107 return self; |
|
108 } |
|
109 |
|
110 // Destructor |
|
111 CAccSrvServerModel::~CAccSrvServerModel() |
|
112 { |
|
113 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::~CAccSrvServerModel()" ); |
|
114 |
|
115 if ( KErrNotFound != iLastDisconnectedAccessory.UniqueID() ) |
|
116 { |
|
117 //If iLastDisconnectedAccessory is not "empty", |
|
118 //then names/values are never removed from AccPolicyDB for that gid. |
|
119 TRACE_ASSERT_ALWAYS; |
|
120 } |
|
121 |
|
122 if ( iConnectionArray.Count() ) |
|
123 { |
|
124 // Not all connections cleared, assert. |
|
125 TRACE_ASSERT_ALWAYS; |
|
126 } |
|
127 |
|
128 if ( iPhysicalConnectionArray.Count() ) |
|
129 { |
|
130 //all possible gids must be handled properly, |
|
131 // i.e. names/values must be removed from AccPolicyDB |
|
132 // for every gid in iPhysicalConnectionArray |
|
133 TRACE_ASSERT_ALWAYS; |
|
134 } |
|
135 |
|
136 iConnectionArray.Close(); |
|
137 iPhysicalConnectionArray.Close(); |
|
138 iRegisteredASYs.Close(); |
|
139 iASYThreadID.Close(); |
|
140 iASYUniqueID.Close(); |
|
141 iThreadIDFilterArray.Close(); |
|
142 |
|
143 delete iCapabilityStorage; |
|
144 |
|
145 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::~CAccSrvServerModel - return" ); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CAccSrvServerModel::IsConnected |
|
150 // |
|
151 // Accessory is connected if it can be found from connection array. |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 TBool CAccSrvServerModel::IsConnected( const TAccPolGenericID& aGenericID ) const |
|
155 { |
|
156 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnected()" ); |
|
157 TBool ret( EFalse ); |
|
158 |
|
159 if ( KErrNotFound != FindGID( aGenericID, iConnectionArray ) ) |
|
160 { |
|
161 ret = ETrue; |
|
162 } |
|
163 |
|
164 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::IsConnected - return %d", ret ); |
|
165 return ret; |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CAccSrvServerModel::IsConnectedL |
|
170 // |
|
171 // Accessory is connected if it can be found from connection array. |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CAccSrvServerModel::IsConnectedL( const TAccPolGenericID& aGenericID ) const |
|
175 { |
|
176 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedL()" ); |
|
177 |
|
178 if ( !IsConnected( aGenericID ) ) |
|
179 { |
|
180 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedL - accessory is not connected" ); |
|
181 User::Leave( KErrArgument ); |
|
182 } |
|
183 |
|
184 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedL - return void" ); |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CAccSrvServerModel::IsConnectedOrDetectedL |
|
189 // |
|
190 // Accessory is connected if it can be found from connection array. |
|
191 // Accessory is detected if it can be found from physical connections array. |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 TBool CAccSrvServerModel::IsConnectedOrDetected( const TAccPolGenericID& aGenericID ) const |
|
195 { |
|
196 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedOrDetected()" ); |
|
197 |
|
198 TBool retval( EFalse ); |
|
199 |
|
200 if ( IsConnected( aGenericID ) || FindGID( aGenericID, iPhysicalConnectionArray ) >= 0 ) |
|
201 { |
|
202 retval = ETrue; |
|
203 } |
|
204 |
|
205 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedOrDetected - return void" ); |
|
206 return retval; |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CAccSrvServerModel::IsConnectedOrDetectedL |
|
211 // |
|
212 // Accessory is connected if it can be found from connection array. |
|
213 // Accessory is detected if it can be found from physical connections array. |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 void CAccSrvServerModel::IsConnectedOrDetectedL( const TAccPolGenericID& aGenericID ) const |
|
217 { |
|
218 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedOrDetectedL()" ); |
|
219 |
|
220 if ( !IsConnected( aGenericID ) ) |
|
221 { |
|
222 if ( KErrNotFound == FindGID( aGenericID, iPhysicalConnectionArray ) ) |
|
223 { |
|
224 User::Leave( KErrArgument ); |
|
225 } |
|
226 } |
|
227 |
|
228 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::IsConnectedOrDetectedL - return void" ); |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CAccSrvServerModel::FindGID |
|
233 // |
|
234 // Returns index to GID given as a parameter. |
|
235 // Comparison is done according HWDeviceID. |
|
236 // (Comparison can be made also according to the unique DB id) |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 TInt CAccSrvServerModel::FindGID( const TAccPolGenericID& aGenericID, |
|
240 const RArray<TAccPolGenericID>& aArray ) const |
|
241 { |
|
242 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindGID()" ); |
|
243 TInt index( KErrNotFound ); |
|
244 |
|
245 for ( TInt i( 0 ) ; i < aArray.Count() ; ++i ) |
|
246 { |
|
247 if ( aGenericID.UniqueID() == aArray.operator[](i).UniqueID() ) |
|
248 { |
|
249 index = i; |
|
250 break;// found matching GID (according to HWDeviceID) |
|
251 // ->no need to continue |
|
252 } |
|
253 } |
|
254 |
|
255 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::FindGID - return %d", index ); |
|
256 return index; |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CAccSrvServerModel::AddConnectionL |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 void CAccSrvServerModel::AddConnectionL( const TAccPolGenericID& aGenericID ) |
|
264 { |
|
265 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::AddConnectionL()" ); |
|
266 |
|
267 if ( iConnectionArray.Count() >= KMaxGenericIDInstances ) |
|
268 { |
|
269 User::Leave( KErrOverflow ); |
|
270 } |
|
271 else |
|
272 { |
|
273 iConnectionArray.InsertL( aGenericID, 0 );//i.e. last connected sccessory in index 0 |
|
274 TAccPolGenericIDAccessor::DebugPrint( aGenericID ); |
|
275 } |
|
276 |
|
277 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AddConnectionL - return void - current count = %d", iConnectionArray.Count() ); |
|
278 } |
|
279 |
|
280 // ----------------------------------------------------------------------------- |
|
281 // CAccSrvServerModel::UpdateConnectionL |
|
282 // ----------------------------------------------------------------------------- |
|
283 // |
|
284 void CAccSrvServerModel::UpdateConnectionL( const TAccPolGenericID& aGenericID ) |
|
285 { |
|
286 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::UpdateConnectionL()" ); |
|
287 |
|
288 RemoveConnectionL( aGenericID, EFalse ); |
|
289 AddConnectionL( aGenericID ); |
|
290 |
|
291 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::UpdateConnectionL - return void - current count = %d", iConnectionArray.Count() ); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CAccSrvServerModel::AddPhysicalConnectionL |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 void CAccSrvServerModel::AddPhysicalConnectionL( const TAccPolGenericID& aGenericID ) |
|
299 { |
|
300 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::AddPhysicalConnectionL()" ); |
|
301 |
|
302 if ( iPhysicalConnectionArray.Count() >= KMaxGenericIDInstances ) |
|
303 { |
|
304 User::Leave( KErrOverflow ); |
|
305 } |
|
306 else |
|
307 { |
|
308 iPhysicalConnectionArray.InsertL( aGenericID, 0 );//i.e. last connected sccessory in index 0 |
|
309 TAccPolGenericIDAccessor::DebugPrint( aGenericID ); |
|
310 } |
|
311 |
|
312 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AddPhysicalConnectionL - return void - current count = %d", iPhysicalConnectionArray.Count() ); |
|
313 } |
|
314 |
|
315 // ----------------------------------------------------------------------------- |
|
316 // CAccSrvServerModel::RemovePhysicalConnectionL |
|
317 // ----------------------------------------------------------------------------- |
|
318 // |
|
319 void CAccSrvServerModel::RemovePhysicalConnection( const TAccPolGenericID& aGenericID ) |
|
320 { |
|
321 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::RemovePhysicalConnection()" ); |
|
322 |
|
323 TInt index( FindGID( aGenericID, iPhysicalConnectionArray ) ); |
|
324 |
|
325 // KErrNotFound is not an error case since accessory can be detected |
|
326 // (stored in PhysicalConnection array) or connected (stored in Connection array) |
|
327 if ( KErrNotFound != index ) |
|
328 { |
|
329 iPhysicalConnectionArray.Remove( index ); |
|
330 } |
|
331 |
|
332 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::RemovePhysicalConnection - return void" ); |
|
333 } |
|
334 |
|
335 // ----------------------------------------------------------------------------- |
|
336 // CAccSrvServerModel::RemoveConnectionL |
|
337 // |
|
338 // Move disconnected gid to "iLastDisconnectedAccessory" for later |
|
339 // names/values removal from AccPolicyDB. |
|
340 // This is done while disconnecting accessory(aDisconnect=ETrue). |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 void CAccSrvServerModel::RemoveConnectionL( const TAccPolGenericID& aGenericID, |
|
344 TBool aDisconnect ) |
|
345 { |
|
346 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::RemoveConnectionL()" ); |
|
347 |
|
348 TInt index( FindGID( aGenericID, iConnectionArray ) ); |
|
349 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::RemoveConnectionL - handling index %x", index ); |
|
350 |
|
351 if ( aDisconnect ) |
|
352 { |
|
353 if ( KErrNotFound != iLastDisconnectedAccessory.UniqueID() ) |
|
354 { |
|
355 //If iLastDisconnectedAccessory is not "empty" and its overwritten, |
|
356 //then names/values are never removed from from AccPolicyDB for that gid. |
|
357 //This is an error. |
|
358 TRACE_ASSERT_ALWAYS; |
|
359 } |
|
360 |
|
361 if ( KErrNotFound != index ) |
|
362 { |
|
363 //This is not an error case since accessory can be |
|
364 //detected (stored in PhysicalConnection array) or |
|
365 //connected (stored in Connection array) |
|
366 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::RemoveConnectionL - GID stored" ); |
|
367 iLastDisconnectedAccessory = iConnectionArray[ index ]; |
|
368 } |
|
369 else |
|
370 { |
|
371 //Try to search accessory from Physical connection array |
|
372 TInt ind( FindGID( aGenericID, iPhysicalConnectionArray ) ); |
|
373 if ( KErrNotFound != ind ) |
|
374 { |
|
375 iLastDisconnectedAccessory = iPhysicalConnectionArray[ ind ]; |
|
376 } |
|
377 } |
|
378 } |
|
379 |
|
380 //Remove GID from connection array |
|
381 //KErrNotFound is not an error case since accessory can be detected |
|
382 //(stored in PhysicalConnection array) or connected (stored in Connection array) |
|
383 if ( KErrNotFound != index ) |
|
384 { |
|
385 iConnectionArray.Remove( index ); |
|
386 } |
|
387 |
|
388 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::RemoveConnectionL - return void" ); |
|
389 } |
|
390 |
|
391 // ----------------------------------------------------------------------------- |
|
392 // CAccSrvServerModel::CurrentConnectionStatusL |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 void CAccSrvServerModel::CurrentConnectionStatusL( |
|
396 TAccPolGenericIDArray& aGenericIDArray ) |
|
397 { |
|
398 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::CurrentConnectionStatusL(0x%x)", &aGenericIDArray ); |
|
399 |
|
400 if (iConnectionArray.Count() != 0 ) |
|
401 { |
|
402 TAccPolGenericIDArrayAccessor::ReplaceArrayL( aGenericIDArray, iConnectionArray ); |
|
403 } |
|
404 else |
|
405 { |
|
406 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::CurrentConnectionStatusL - No connected accessories" ); |
|
407 } |
|
408 |
|
409 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::CurrentConnectionStatusL - return void" ); |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // CAccSrvServerModel::FindWithUniqueIDL |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 void CAccSrvServerModel::FindWithUniqueIDL( TInt aUniqueID, |
|
417 TAccPolGenericID& aGenericID ) const |
|
418 { |
|
419 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindWithUniqueIDL()" ); |
|
420 |
|
421 TInt index( 0 ); |
|
422 TAccPolGenericIDArray genericIDArray; |
|
423 |
|
424 TAccPolGenericIDArrayAccessor::ReplaceArrayL( genericIDArray, iConnectionArray ); |
|
425 |
|
426 index = TAccPolGenericIDArrayAccessor::FindWithUniqueIDL( genericIDArray, |
|
427 aUniqueID ); |
|
428 |
|
429 if ( index < 0 ) |
|
430 { |
|
431 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindWithUniqueIDL - Unique ID not found" ); |
|
432 } |
|
433 else |
|
434 { |
|
435 aGenericID = iConnectionArray.operator[]( index ); |
|
436 } |
|
437 |
|
438 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindWithUniqueIDL - return void" ); |
|
439 } |
|
440 |
|
441 // ----------------------------------------------------------------------------- |
|
442 // CAccSrvServerModel::FindWithDeviceAddressL |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 TInt CAccSrvServerModel::FindWithDeviceAddressL( TUint64 aDeviceAddress, |
|
446 TInt& aUniqueID ) const |
|
447 { |
|
448 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindWithDeviceAddressL()" ); |
|
449 |
|
450 TInt index( 0 ); |
|
451 TAccPolGenericIDArray genericIDArray; |
|
452 |
|
453 TAccPolGenericIDArrayAccessor::ReplaceArrayL( genericIDArray, iConnectionArray ); |
|
454 |
|
455 index = TAccPolGenericIDArrayAccessor::FindWithDeviceAddressL( genericIDArray, |
|
456 aDeviceAddress ); |
|
457 |
|
458 if ( index < 0 ) |
|
459 { |
|
460 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindWithDeviceAddressL - Device Address not found" ); |
|
461 } |
|
462 else |
|
463 { |
|
464 aUniqueID = iConnectionArray.operator[]( index ).UniqueID(); |
|
465 } |
|
466 |
|
467 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::FindWithDeviceAddressL return %d", index ); |
|
468 return index; |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CAccSrvServerModel::AccessoryMode |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 TAccPolAccessoryMode CAccSrvServerModel::AccessoryMode() const |
|
476 { |
|
477 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::AccessoryMode()" ); |
|
478 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AccessoryMode - return 0x%x", iAccMode ); |
|
479 return iAccMode; |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CAccSrvServerModel::GetLastConnectedAccessoryL |
|
484 // |
|
485 // Last connected accessory is allways in index 0. |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void CAccSrvServerModel::GetLastConnectedAccessoryL( TAccPolGenericID& aGenericID ) const |
|
489 { |
|
490 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::GetLastConnectedAccessoryL()" ); |
|
491 |
|
492 if ( iConnectionArray.Count() != 0 ) |
|
493 { |
|
494 aGenericID = iConnectionArray[ 0 ]; |
|
495 } |
|
496 else |
|
497 { |
|
498 TRACE_ASSERT_ALWAYS; |
|
499 User::Leave( KErrGeneral ); |
|
500 } |
|
501 |
|
502 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::GetLastConnectedAccessoryL - return" ); |
|
503 } |
|
504 |
|
505 // ----------------------------------------------------------------------------- |
|
506 // CAccSrvServerModel::SetAccessoryMode |
|
507 // ----------------------------------------------------------------------------- |
|
508 // |
|
509 TBool CAccSrvServerModel::SetAccessoryMode( TAccPolAccessoryMode aAccMode, TInt aUniqueID ) |
|
510 { |
|
511 COM_TRACE_3( "[AccFW:AccServer] CAccSrvServerModel::SetAccessoryMode(mode=%d audio=%d uniqueid=%d)", aAccMode.iAccessoryMode, aAccMode.iAudioOutputStatus, aUniqueID ); |
|
512 TBool changed( EFalse ); |
|
513 |
|
514 if ( aAccMode.iAccessoryMode == iAccMode.iAccessoryMode |
|
515 && aAccMode.iAudioOutputStatus == iAccMode.iAudioOutputStatus |
|
516 && iUniqueID == aUniqueID ) |
|
517 { |
|
518 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetAccessoryMode - Mode not changed" ); |
|
519 } |
|
520 else |
|
521 { |
|
522 if ( KErrUnknown == aUniqueID ) |
|
523 { |
|
524 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetAccessoryMode - UniqueID not changed" ); |
|
525 iAccMode = aAccMode; |
|
526 changed = ETrue; |
|
527 } |
|
528 else |
|
529 { |
|
530 iUniqueID = aUniqueID; |
|
531 iAccMode = aAccMode; |
|
532 changed = ETrue; |
|
533 } |
|
534 } |
|
535 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetAccessoryMode - return %d", changed ); |
|
536 return changed; |
|
537 } |
|
538 |
|
539 // ----------------------------------------------------------------------------- |
|
540 // CAccSrvServerModel::SetASYsLoadCompleted |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 void CAccSrvServerModel::SetASYsLoadCompleted() |
|
544 { |
|
545 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetASYsLoadCompleted()" ); |
|
546 iASYsLoadCompleted = ETrue; |
|
547 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetASYsLoadCompleted" ); |
|
548 } |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CAccSrvServerModel::ASYsLoadCompleted |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 TBool CAccSrvServerModel::ASYsLoadCompleted() const |
|
555 { |
|
556 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ASYsLoadCompleted()" ); |
|
557 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::ASYsLoadCompleted return 0x%x", iASYsLoadCompleted ); |
|
558 return iASYsLoadCompleted; |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CAccSrvServerModel::AudioType() |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 TAccAudioType CAccSrvServerModel::AudioType() const |
|
566 { |
|
567 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::AudioType()" ); |
|
568 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AudioType - return 0x%x", iAudioType ); |
|
569 return iAudioType; |
|
570 } |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // CAccSrvServerModel::SetAudioType |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 void CAccSrvServerModel::SetAudioType( TAccAudioType aAudioType ) |
|
577 { |
|
578 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetAudioType(0x%x)", aAudioType ); |
|
579 iAudioType = aAudioType; |
|
580 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetAudioType - return void" ); |
|
581 } |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
|
584 // CAccSrvServerModel::DeviceType |
|
585 // ----------------------------------------------------------------------------- |
|
586 // |
|
587 TUint32 CAccSrvServerModel::DeviceType() const |
|
588 { |
|
589 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::DeviceType()" ); |
|
590 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::DeviceType() - return 0x%x", iDeviceType ); |
|
591 return iDeviceType; |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // CAccSrvServerModel::SetDeviceType |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 void CAccSrvServerModel::SetDeviceType( TUint32 aDeviceType ) |
|
599 { |
|
600 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetDeviceType(0x%x)", aDeviceType ); |
|
601 iDeviceType = aDeviceType; |
|
602 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetDeviceType - return void" ); |
|
603 } |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // CAccSrvServerModel::SupportedDevicesL |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 TUint32 CAccSrvServerModel::SupportedDevicesL() |
|
610 { |
|
611 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SupportedDevicesL()" ); |
|
612 //get supported devices from policy (only at first time) |
|
613 if ( !iSupportedDevices ) |
|
614 { |
|
615 CAccPolAccessoryPolicy * policy = CAccPolAccessoryPolicy::NewL( 0 ); |
|
616 CleanupStack::PushL( policy ); |
|
617 |
|
618 iSupportedDevices = policy->SupportedHWDevicesL(); |
|
619 |
|
620 CleanupStack::PopAndDestroy( policy ); |
|
621 } |
|
622 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SupportedDevicesL() - return supported devices" ); |
|
623 return iSupportedDevices; |
|
624 } |
|
625 |
|
626 // ----------------------------------------------------------------------------- |
|
627 // CAccSrvServerModel::LastDisconnectedAccessory |
|
628 // ----------------------------------------------------------------------------- |
|
629 // |
|
630 const TAccPolGenericID& CAccSrvServerModel::LastDisconnectedAccessory() |
|
631 { |
|
632 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::LastDisconnectedAccessory()" ); |
|
633 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::LastDisconnectedAccessory - return gid" ); |
|
634 return iLastDisconnectedAccessory; |
|
635 } |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // CAccSrvServerModel::ClearLastDisconnectedAccessory |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 void CAccSrvServerModel::ClearLastDisconnectedAccessory() |
|
642 { |
|
643 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ClearLastDisconnectedAccessory()" ); |
|
644 TAccPolGenericID emptyGid; |
|
645 iLastDisconnectedAccessory = emptyGid; |
|
646 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ClearLastDisconnectedAccessory - return void" ); |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CAccSrvServerModel::SetValueData |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CAccSrvServerModel::SetValueData( TAccPolGenericID& aGenericId, |
|
654 TAccPolNameRecord& aNameRecord, |
|
655 TAccValueTypeTInt aValueTint, |
|
656 TAccValueTypeTBool aValueTBool, |
|
657 TAccValueTypeObject aValueObject ) |
|
658 { |
|
659 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetValueData()" ); |
|
660 iValueDataGenericId = aGenericId; |
|
661 iValueDataNameRecord = aNameRecord; |
|
662 iValueDataTint = aValueTint; |
|
663 iValueDataTBool = aValueTBool; |
|
664 iValueDataObject.Set( aValueObject.iValue ); |
|
665 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetValueData - return void" ); |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // CAccSrvServerModel::ValueDataGid |
|
670 // ----------------------------------------------------------------------------- |
|
671 // |
|
672 TAccPolGenericID CAccSrvServerModel::ValueDataGid() const |
|
673 { |
|
674 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ValueDataGid()" ); |
|
675 return iValueDataGenericId; |
|
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CAccSrvServerModel::ValueDataNameRecord |
|
680 // ----------------------------------------------------------------------------- |
|
681 // |
|
682 TAccPolNameRecord CAccSrvServerModel::ValueDataNameRecord() const |
|
683 { |
|
684 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ValueDataNameRecord()" ); |
|
685 return iValueDataNameRecord; |
|
686 } |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CAccSrvServerModel::ValueDataTInt |
|
690 // ----------------------------------------------------------------------------- |
|
691 // |
|
692 TAccValueTypeTInt CAccSrvServerModel::ValueDataTInt() const |
|
693 { |
|
694 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ValueDataTInt()" ); |
|
695 return iValueDataTint; |
|
696 } |
|
697 |
|
698 // ----------------------------------------------------------------------------- |
|
699 // CAccSrvServerModel::ValueDataTBool |
|
700 // ----------------------------------------------------------------------------- |
|
701 // |
|
702 TAccValueTypeTBool CAccSrvServerModel::ValueDataTBool() const |
|
703 { |
|
704 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ValueDataTBool()" ); |
|
705 return iValueDataTBool; |
|
706 } |
|
707 |
|
708 // ----------------------------------------------------------------------------- |
|
709 // CAccSrvServerModel::ValueDataObject |
|
710 // ----------------------------------------------------------------------------- |
|
711 // |
|
712 TAccValueTypeObject CAccSrvServerModel::ValueDataObject() const |
|
713 { |
|
714 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::ValueDataObject()" ); |
|
715 TAccValueTypeObject valueTypeObject( iValueDataObject ); |
|
716 return valueTypeObject; |
|
717 } |
|
718 |
|
719 // ----------------------------------------------------------------------------- |
|
720 // CAccSrvServerModel::AddASYThreadId |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 void CAccSrvServerModel::AddASYThreadId( TUint aThreadID ) |
|
724 { |
|
725 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AddASYThreadId(%d)", aThreadID ); |
|
726 iRegisteredASYs.Append( aThreadID ); |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
|
730 // CAccSrvServerModel::StoreASYThreadID |
|
731 // |
|
732 // If aThreadID can be found from connected ASYs table (iRegisteredASYs), |
|
733 // mapping between aUniqueID and aThreadID can be made. |
|
734 // This means that ASY has made accessory connection and that ASY will serve |
|
735 // all request for that gineric ID. |
|
736 // ----------------------------------------------------------------------------- |
|
737 // |
|
738 void CAccSrvServerModel::StoreASYThreadID( TUint aThreadID, TInt aUniqueID ) |
|
739 { |
|
740 COM_TRACE_2( "[AccFW:AccServer] CAccSrvServerModel::StoreASYThreadID(%d %d)", aThreadID, aUniqueID ); |
|
741 if ( KErrNotFound == iRegisteredASYs.Find( aThreadID ) ) |
|
742 { |
|
743 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::StoreASYThreadID - Thread ID is not ASYs" ); |
|
744 } |
|
745 else |
|
746 { |
|
747 iASYThreadID.Append( aThreadID ); |
|
748 iASYUniqueID.Append( aUniqueID ); |
|
749 } |
|
750 } |
|
751 |
|
752 // ----------------------------------------------------------------------------- |
|
753 // CAccSrvServerModel::RemoveASYThreadID |
|
754 // ----------------------------------------------------------------------------- |
|
755 // |
|
756 void CAccSrvServerModel::RemoveASYThreadID( TInt aUniqueID ) |
|
757 { |
|
758 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::RemoveASYThreadID(%d)", aUniqueID ); |
|
759 TInt index( iASYUniqueID.Find( aUniqueID ) ); |
|
760 |
|
761 //If index is KErrNotFound, threadIDs are never stored in CAccSrvServerModel::StoreASYThreadID() |
|
762 if ( KErrNotFound != index ) |
|
763 { |
|
764 iASYThreadID.Remove( index ); |
|
765 iASYUniqueID.Remove( index ); |
|
766 } |
|
767 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::RemoveASYThreadID - return" ); |
|
768 } |
|
769 |
|
770 // ----------------------------------------------------------------------------- |
|
771 // CAccSrvServerModel::IsMyRequest |
|
772 // ----------------------------------------------------------------------------- |
|
773 // |
|
774 TBool CAccSrvServerModel::IsMyRequest( TUint aThreadID, TInt aUniqueID ) |
|
775 { |
|
776 COM_TRACE_2( "[AccFW:AccServer] CAccSrvServerModel::IsMyRequest(%d %d)", aThreadID, aUniqueID ); |
|
777 |
|
778 TBool ret( EFalse ); |
|
779 TInt index( iASYUniqueID.Find( aUniqueID ) ); |
|
780 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::IsMyRequest - handling index %d", index ); |
|
781 |
|
782 // If KErrNotFound, Generic ID / ASY thread ID mapping is not done |
|
783 // (because accessory connection is not made by ASY). |
|
784 if ( KErrNotFound != index ) |
|
785 { |
|
786 if ( iASYThreadID.operator[]( index ) == aThreadID ) |
|
787 { |
|
788 //match |
|
789 COM_TRACE_2( "[AccFW:AccServer] CAccSrvServerModel::IsMyRequest - found %d %d", iASYThreadID.operator[]( index ), iASYUniqueID.operator[]( index ) ); |
|
790 ret = ETrue; |
|
791 } |
|
792 } |
|
793 |
|
794 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::IsMyRequest - return %d", ret ); |
|
795 return ret; |
|
796 } |
|
797 |
|
798 // ----------------------------------------------------------------------------- |
|
799 // CAccSrvServerModel::SetMsgThreadIDFilter |
|
800 // ----------------------------------------------------------------------------- |
|
801 // |
|
802 void CAccSrvServerModel::SetMsgThreadIDFilter( TUint aThreadID, TMsgID aMsgID ) |
|
803 { |
|
804 COM_TRACE_2( "[AccFW:AccServer] CAccSrvServerModel::SetMsgThreadIDFilter(%d %d)", aThreadID, aMsgID ); |
|
805 |
|
806 TAccSrvThreadIDFilter threadIDFilter; |
|
807 threadIDFilter.iThreadID = aThreadID; |
|
808 threadIDFilter.iMsgID = aMsgID; |
|
809 |
|
810 iThreadIDFilterArray.Append( threadIDFilter ); |
|
811 |
|
812 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetMsgThreadIDFilter - count=%d - return void", iThreadIDFilterArray.Count() ); |
|
813 } |
|
814 |
|
815 // ----------------------------------------------------------------------------- |
|
816 // CAccSrvServerModel::FindAndDeleteMsgThreadIDFilter |
|
817 // ----------------------------------------------------------------------------- |
|
818 // |
|
819 TBool CAccSrvServerModel::FindAndDeleteMsgThreadIDFilter( TUint aThreadID, TMsgID aMsgID ) |
|
820 { |
|
821 COM_TRACE_2( "[AccFW:AccServer] CAccSrvServerModel::FindAndDeleteMsgThreadIDFilter(%d %d)", aThreadID, aMsgID ); |
|
822 |
|
823 TBool ret( EFalse ); |
|
824 TInt count( iThreadIDFilterArray.Count() ); |
|
825 |
|
826 for ( TInt i( 0 ) ; i < count ; ++i ) |
|
827 { |
|
828 if ( iThreadIDFilterArray.operator[](i).iThreadID == aThreadID && |
|
829 iThreadIDFilterArray.operator[](i).iMsgID == aMsgID ) |
|
830 { |
|
831 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::FindAndDeleteMsgThreadIDFilter - match found in index %d", i ); |
|
832 iThreadIDFilterArray.Remove( i ); |
|
833 ret = ETrue; |
|
834 break; |
|
835 } |
|
836 } |
|
837 |
|
838 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::FindAndDeleteMsgThreadIDFilter - return %d", ret ); |
|
839 return ret; |
|
840 } |
|
841 |
|
842 // ----------------------------------------------------------------------------- |
|
843 // CAccSrvServerModel::SetCancelledConnectAccessoryL (UniqueID) |
|
844 // ----------------------------------------------------------------------------- |
|
845 // |
|
846 void CAccSrvServerModel::SetCancelledConnectAccessoryL( TInt aUniqueID ) |
|
847 { |
|
848 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetCancelledConnectAccessoryL(%d)", aUniqueID ); |
|
849 TAccPolGenericIDArray genericIDArray; |
|
850 TInt index( KErrNotFound ); |
|
851 |
|
852 //Find the GenericID in question. |
|
853 //ConnectAccessory() can be cancelled only for accessories in detected state |
|
854 TAccPolGenericIDArrayAccessor::ReplaceArrayL( genericIDArray, iPhysicalConnectionArray ); |
|
855 index = TAccPolGenericIDArrayAccessor::FindWithUniqueIDL( genericIDArray, aUniqueID ); |
|
856 |
|
857 if ( index < 0 ) |
|
858 { |
|
859 //Connection of this accessory can not be cancelled |
|
860 } |
|
861 else |
|
862 { |
|
863 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetCancelledConnectAccessoryL - handling index %d", index ); |
|
864 iCancelledConnectAccessory.Append( genericIDArray.GetGenericIDL( index ).UniqueID() ); |
|
865 } |
|
866 |
|
867 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetCancelledConnectAccessoryL - return void" ); |
|
868 } |
|
869 |
|
870 // ----------------------------------------------------------------------------- |
|
871 // CAccSrvServerModel::SetCancelledConnectAccessoryL (DeviceAddress) |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 void CAccSrvServerModel::SetCancelledConnectAccessoryL( TUint64 aDeviceAddress ) |
|
875 { |
|
876 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetCancelledConnectAccessoryL(DeviceAddress)" ); |
|
877 TAccPolGenericIDArray genericIDArray; |
|
878 TInt index( KErrNotFound ); |
|
879 |
|
880 //Find the GenericID in question. |
|
881 //ConnectAccessory() can be cancelled only for accessories in detected state |
|
882 TAccPolGenericIDArrayAccessor::ReplaceArrayL( genericIDArray, |
|
883 iPhysicalConnectionArray ); |
|
884 |
|
885 index = TAccPolGenericIDArrayAccessor::FindWithDeviceAddressL( genericIDArray, |
|
886 aDeviceAddress ); |
|
887 |
|
888 if ( index < 0 ) |
|
889 { |
|
890 //Connection of this accessory can not be cancelled |
|
891 } |
|
892 else |
|
893 { |
|
894 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetCancelledConnectAccessoryL - handling index %d", index ); |
|
895 iCancelledConnectAccessory.Append( genericIDArray.GetGenericIDL( index ).UniqueID() ); |
|
896 } |
|
897 |
|
898 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetCancelledConnectAccessoryL - DeviceAddress - return void" ); |
|
899 } |
|
900 |
|
901 // ----------------------------------------------------------------------------- |
|
902 // CAccSrvServerModel::FindAndRemoveCancelledConnectAccessory |
|
903 // ----------------------------------------------------------------------------- |
|
904 // |
|
905 TBool CAccSrvServerModel::FindAndRemoveCancelledConnectAccessory( |
|
906 TInt aUniqueID ) |
|
907 { |
|
908 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::FindAndRemoveCancelledConnectAccessory()" ); |
|
909 TAccPolGenericIDArray genericIDArray; |
|
910 TInt index( KErrNotFound ); |
|
911 TBool ret( EFalse ); |
|
912 |
|
913 index = iCancelledConnectAccessory.Find( aUniqueID ); |
|
914 |
|
915 if ( index < 0 ) |
|
916 { |
|
917 //Connection is not cancelled |
|
918 } |
|
919 else |
|
920 { |
|
921 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::FindAndRemoveCancelledConnectAccessory - cancelled index %d", index ); |
|
922 iCancelledConnectAccessory.Remove( index ); |
|
923 ret = ETrue; |
|
924 } |
|
925 |
|
926 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::FindAndRemoveCancelledConnectAccessory - return %d", ret ); |
|
927 return ret; |
|
928 } |
|
929 |
|
930 // ----------------------------------------------------------------------------- |
|
931 // CAccSrvServerModel::FindAndRemoveCancelledConnectAccessory |
|
932 // ----------------------------------------------------------------------------- |
|
933 // |
|
934 CCapabilityStorage& CAccSrvServerModel::CapabilityStorage() |
|
935 { |
|
936 return *iCapabilityStorage; |
|
937 } |
|
938 |
|
939 // ----------------------------------------------------------------------------- |
|
940 // CAccSrvServerModel::SetAudioLinkOpenCancelled |
|
941 // ----------------------------------------------------------------------------- |
|
942 // |
|
943 void CAccSrvServerModel::SetAudioLinkOpenCancelled( TBool aCancelled ) |
|
944 { |
|
945 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetAudioLinkOpenCancelled(%d)", aCancelled ); |
|
946 iAudioLinkOpenCancelled = aCancelled; |
|
947 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetAudioLinkOpenCancelled - return void" ); |
|
948 } |
|
949 |
|
950 // ----------------------------------------------------------------------------- |
|
951 // CAccSrvServerModel::AudioLinkOpenCancelled |
|
952 // ----------------------------------------------------------------------------- |
|
953 // |
|
954 TBool CAccSrvServerModel::AudioLinkOpenCancelled() |
|
955 { |
|
956 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AudioLinkOpenCancelled()- return %d", iAudioLinkOpenCancelled ); |
|
957 return iAudioLinkOpenCancelled; |
|
958 } |
|
959 |
|
960 // ----------------------------------------------------------------------------- |
|
961 // CAccSrvServerModel::SetAudioLinkCloseCancelled |
|
962 // ----------------------------------------------------------------------------- |
|
963 // |
|
964 void CAccSrvServerModel::SetAudioLinkCloseCancelled( TBool aCancelled ) |
|
965 { |
|
966 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetAudioLinkCloseCancelled(%d)", aCancelled ); |
|
967 iAudioLinkCloseCancelled = aCancelled; |
|
968 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetAudioLinkCloseCancelled - return void" ); |
|
969 } |
|
970 |
|
971 // ----------------------------------------------------------------------------- |
|
972 // CAccSrvServerModel::AudioLinkCloseCancelled |
|
973 // ----------------------------------------------------------------------------- |
|
974 // |
|
975 TBool CAccSrvServerModel::AudioLinkCloseCancelled() |
|
976 { |
|
977 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::AudioLinkCloseCancelled() - return %d", iAudioLinkCloseCancelled ); |
|
978 return iAudioLinkCloseCancelled; |
|
979 } |
|
980 |
|
981 // ----------------------------------------------------------------------------- |
|
982 // CAccSrvServerModel::SetIdleDetected |
|
983 // ----------------------------------------------------------------------------- |
|
984 // |
|
985 void CAccSrvServerModel::SetIdleDetected() |
|
986 { |
|
987 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetIdleDetected()" ); |
|
988 |
|
989 //idle detected |
|
990 iIdleDetected = ETrue; |
|
991 |
|
992 if ( iIdleStatus ) |
|
993 { |
|
994 //complete outstanding requests |
|
995 User::RequestComplete( iIdleStatus, KErrNone ); |
|
996 } |
|
997 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetIdleDetected() - return void" ); |
|
998 } |
|
999 |
|
1000 // ----------------------------------------------------------------------------- |
|
1001 // CAccSrvServerModel::IdleDetected |
|
1002 // ----------------------------------------------------------------------------- |
|
1003 // |
|
1004 TBool CAccSrvServerModel::IdleDetected() |
|
1005 { |
|
1006 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::IdleDetected() - return %d", iIdleDetected ); |
|
1007 return iIdleDetected; |
|
1008 } |
|
1009 |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // CAccSrvServerModel::WaitForIdle |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // |
|
1014 TInt CAccSrvServerModel::WaitForIdle( TRequestStatus* iStatus) |
|
1015 { |
|
1016 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::WaitForIdle()" ); |
|
1017 |
|
1018 //idle already detected |
|
1019 if ( iIdleDetected ) |
|
1020 { |
|
1021 return KErrGeneral; |
|
1022 } |
|
1023 |
|
1024 iIdleStatus = iStatus; |
|
1025 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::WaitForIdle() - return" ); |
|
1026 return KErrNone; |
|
1027 } |
|
1028 |
|
1029 // ----------------------------------------------------------------------------- |
|
1030 // CAccSrvServerModel::CancelWaitForIdle |
|
1031 // ----------------------------------------------------------------------------- |
|
1032 // |
|
1033 void CAccSrvServerModel::CancelWaitForIdle() |
|
1034 { |
|
1035 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::CancelWaitForIdle()"); |
|
1036 if ( iIdleStatus ) |
|
1037 { |
|
1038 //complete outstanding requests |
|
1039 User::RequestComplete( iIdleStatus, KErrCancel ); |
|
1040 iIdleStatus = NULL; |
|
1041 } |
|
1042 } |
|
1043 |
|
1044 // ----------------------------------------------------------------------------- |
|
1045 // CAccSrvServerModel::BluetoothAudioLinkOpenReqPostponed |
|
1046 // ----------------------------------------------------------------------------- |
|
1047 // |
|
1048 TBool CAccSrvServerModel::BluetoothAudioLinkOpenReqPostponed() |
|
1049 { |
|
1050 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::BluetoothAudioLinkOpenReqPostponed() return %d", iBluetoothAudioLinkOpenReqPostponed ); |
|
1051 return iBluetoothAudioLinkOpenReqPostponed; |
|
1052 } |
|
1053 |
|
1054 // ----------------------------------------------------------------------------- |
|
1055 // CAccSrvServerModel::SetBluetoothAudioLinkOpenReqPostponed |
|
1056 // ----------------------------------------------------------------------------- |
|
1057 // |
|
1058 void CAccSrvServerModel::SetBluetoothAudioLinkOpenReqPostponed( TBool aValue ) |
|
1059 { |
|
1060 COM_TRACE_1( "[AccFW:AccServer] CAccSrvServerModel::SetBluetoothAudioLinkOpenReqPostponed(%d)", aValue ); |
|
1061 iBluetoothAudioLinkOpenReqPostponed = aValue; |
|
1062 COM_TRACE_( "[AccFW:AccServer] CAccSrvServerModel::SetBluetoothAudioLinkOpenReqPostponed() - return" ); |
|
1063 } |
|
1064 |
|
1065 // End of File |