|
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: Server-side sub-session of Accessory Audio Control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "AccSrvSubAudioControl.h" |
|
22 #include "acc_debug.h" |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 |
|
34 // MODULE DATA STRUCTURES |
|
35 |
|
36 // LOCAL FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // ============================= LOCAL FUNCTIONS =============================== |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CAccSrvSubAudioControl::CAccSrvSubAudioControl |
|
46 // C++ default constructor can NOT contain any code, that |
|
47 // might leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CAccSrvSubAudioControl::CAccSrvSubAudioControl( |
|
51 CASYProxyAPI* aProxy, |
|
52 CAccSrvConnectionController* aConnectionController, |
|
53 CAccSrvServerModel* aServerModel, |
|
54 TUint aCallerThreadID ) |
|
55 : CAccSrvSubControl ( aProxy, aConnectionController, aServerModel ), |
|
56 iCallerThreadID( aCallerThreadID ) |
|
57 { |
|
58 } |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CAccSrvSubAudioControl::ConstructL |
|
61 // Symbian 2nd phase constructor can leave. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void CAccSrvSubAudioControl::ConstructL() |
|
65 { |
|
66 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::ConstructL()" ); |
|
67 |
|
68 CAccSrvSubControl::ConstructL(); |
|
69 |
|
70 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::ConstructL() - return void" ); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CAccSrvSubAudioControl::NewL |
|
75 // Two-phased constructor. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 |
|
79 CAccSrvSubAudioControl* CAccSrvSubAudioControl::NewL( |
|
80 CASYProxyAPI* aProxy, |
|
81 CAccSrvConnectionController* aConnectionController, |
|
82 CAccSrvServerModel* aServerModel, |
|
83 TUint aCallerThreadID ) |
|
84 { |
|
85 if ( !aProxy ) |
|
86 { |
|
87 User::Leave( KErrArgument ); |
|
88 } |
|
89 |
|
90 CAccSrvSubAudioControl* self = new (ELeave) CAccSrvSubAudioControl( aProxy, |
|
91 aConnectionController, |
|
92 aServerModel, |
|
93 aCallerThreadID ); |
|
94 |
|
95 CleanupStack::PushL( self ); |
|
96 self->ConstructL(); |
|
97 CleanupStack::Pop( self ); |
|
98 |
|
99 return self; |
|
100 } |
|
101 |
|
102 // Destructor |
|
103 CAccSrvSubAudioControl::~CAccSrvSubAudioControl() |
|
104 { |
|
105 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::~CAccSrvSubAudioControl()" ); |
|
106 |
|
107 RMessage2 dummy; |
|
108 |
|
109 CAccSrvSubAudioControl::CancelAccessoryAudioLinkOpen( dummy );//For iAccessoryAudioLinkOpenMsg |
|
110 CAccSrvSubAudioControl::CancelAccessoryAudioLinkClose( dummy );//For iAccessoryAudioLinkCloseMsg |
|
111 CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkOpened( dummy );//For iNotifyAccessoryAudioLinkOpenedMsg |
|
112 CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkClosed( dummy );//For iNotifyAccessoryAudioLinkClosedMsg |
|
113 |
|
114 if ( iServerModel ) |
|
115 { |
|
116 iServerModel->SetAudioLinkOpenCancelled( EFalse ); |
|
117 iServerModel->SetAudioLinkCloseCancelled( EFalse ); |
|
118 } |
|
119 |
|
120 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::~CAccSrvSubAudioControl - return void" ); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CAccSrvSubAudioControl::NotifyAccessoryAudioLinkOpened |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CAccSrvSubAudioControl::NotifyAccessoryAudioLinkOpened( const RMessage2& aMessage ) |
|
128 { |
|
129 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::NotifyAccessoryAudioLinkOpened()" ); |
|
130 |
|
131 iConnectionController->NotificationQueue().RegisterControlMessage( EAccessoryAudioLinkOpened, |
|
132 this ); |
|
133 |
|
134 iNotifyAccessoryAudioLinkOpenedMsg = aMessage;//Store RMessage2 for future completion |
|
135 |
|
136 // If message is null, there is no pending request and no filtering needed |
|
137 if ( !iAccessoryAudioLinkOpenMsg.IsNull() ) |
|
138 { |
|
139 //NotifyAccessoryAudioLinkOpened() notification is filtered |
|
140 //for AccessoryAudioLinkOpen() caller thread. |
|
141 //In this case NotifyAccessoryAudioLinkOpened() notification |
|
142 //is ordered after AccessoryAudioLinkOpen() is sent. |
|
143 iConnectionController->ServerModel().SetMsgThreadIDFilter( iCallerThreadID, |
|
144 EAccessoryAudioLinkOpened ); |
|
145 } |
|
146 |
|
147 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::NotifyAccessoryAudioLinkOpened - return void" ); |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CAccSrvSubAudioControl::NotifyAccessoryAudioLinkClosed |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CAccSrvSubAudioControl::NotifyAccessoryAudioLinkClosed( const RMessage2& aMessage ) |
|
155 { |
|
156 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::NotifyAccessoryAudioLinkClosed()" ); |
|
157 |
|
158 iConnectionController->NotificationQueue().RegisterControlMessage( EAccessoryAudioLinkClosed, |
|
159 this ); |
|
160 iNotifyAccessoryAudioLinkClosedMsg = aMessage;//Store RMessage2 for future completion |
|
161 |
|
162 // If message is null, there is no pending request and no filtering needed |
|
163 if ( !iAccessoryAudioLinkCloseMsg.IsNull() ) |
|
164 { |
|
165 //NotifyAccessoryAudioLinkClosed() notification is filtered |
|
166 //for AccessoryAudioLinkClose() caller thread. |
|
167 //In this case NotifyAccessoryAudioLinkClosed() notification |
|
168 //is ordered after AccessoryAudioLinkClose() is sent. |
|
169 iConnectionController->ServerModel().SetMsgThreadIDFilter( iCallerThreadID, |
|
170 EAccessoryAudioLinkClosed ); |
|
171 } |
|
172 |
|
173 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::NotifyAccessoryAudioLinkClosed - return void" ); |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CAccSrvSubAudioControl::AccessoryAudioLinkOpenL |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CAccSrvSubAudioControl::AccessoryAudioLinkOpenL( const RMessage2& aMessage ) |
|
181 { |
|
182 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::AccessoryAudioLinkOpenL()" ); |
|
183 |
|
184 TAccPolGenericID genericID; |
|
185 TAccSrvGenericIDPckg genericIDPckg( genericID ); |
|
186 TAccAudioType audioType( EAccMonoAudio ); // Initialization value |
|
187 TAccSrvAudioTypePckg audioTypePckg( audioType ); |
|
188 |
|
189 aMessage.ReadL( KAccServParamPosFirst, genericIDPckg ); |
|
190 aMessage.ReadL( KAccServParamPosSecond, audioTypePckg ); |
|
191 |
|
192 //Precondition |
|
193 iServerModel->IsConnectedL( genericID );//Leaves with KErrArgument if the accessory is not connected |
|
194 |
|
195 iServerModel->SetAudioType( audioType );//Notice, This works for single client (Server model can store only one value) |
|
196 |
|
197 iConnectionController->NotificationQueue().RegisterControlMessage( EAccessoryAudioLinkOpen, |
|
198 this ); |
|
199 |
|
200 TInt bluetoothAudioLinkOpenReqs( iConnectionController->NotificationQueue().ControlMessagesWaiting( EBluetoothAudioLinkOpenReq ) ); |
|
201 if ( bluetoothAudioLinkOpenReqs > 0 ) |
|
202 { |
|
203 //Send bluetooth audio link notification now. |
|
204 iServerModel->SetBluetoothAudioLinkOpenReqPostponed( EFalse ); |
|
205 iConnectionController->NotificationQueue().CompleteControlMessageL( EBluetoothAudioLinkOpenReq, |
|
206 KErrNone, |
|
207 genericID.UniqueID() ); |
|
208 } |
|
209 else |
|
210 { |
|
211 //There was not any bluetooth audio link notification waiting at the moment. |
|
212 //Bluetooth audio link will be opened immediately when bluetooth audio link notification is set. |
|
213 //See EAccSrvNotifyBluetoothAudioLinkOpenReq handling from the control. |
|
214 iServerModel->SetBluetoothAudioLinkOpenReqPostponed( ETrue ); |
|
215 } |
|
216 |
|
217 iAccessoryAudioLinkOpenMsg = aMessage;//Store RMessage2 for future completion |
|
218 |
|
219 // If message is null, there is no pending request and no filtering needed |
|
220 if ( !iNotifyAccessoryAudioLinkOpenedMsg.IsNull() ) |
|
221 { |
|
222 //NotifyAccessoryAudioLinkOpened notification() is filtered |
|
223 //for AccessoryAudioLinkOpen() caller thread |
|
224 iConnectionController->ServerModel().SetMsgThreadIDFilter( iCallerThreadID, |
|
225 EAccessoryAudioLinkOpened ); |
|
226 } |
|
227 |
|
228 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::AccessoryAudioLinkOpenL - return void" ); |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CAccSrvSubAudioControl::AccessoryAudioLinkCloseL |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 void CAccSrvSubAudioControl::AccessoryAudioLinkCloseL( const RMessage2& aMessage ) |
|
236 { |
|
237 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubBaseConnection::AccessoryAudioLinkCloseL()" ); |
|
238 |
|
239 TAccPolGenericID genericID; |
|
240 TAccSrvGenericIDPckg genericIDPckg( genericID ); |
|
241 TAccAudioType audioType( EAccMonoAudio ); // Initialization value |
|
242 TAccSrvAudioTypePckg audioTypePckg( audioType ); |
|
243 |
|
244 aMessage.ReadL( KAccServParamPosFirst, genericIDPckg ); |
|
245 aMessage.ReadL( KAccServParamPosSecond, audioTypePckg ); |
|
246 |
|
247 //Precondition |
|
248 iServerModel->IsConnectedL( genericID );//Leaves with KErrArgument if the accessory is not connected |
|
249 |
|
250 iServerModel->SetAudioType( audioType );//Notice, This works for single client (Server model can store only one value) |
|
251 |
|
252 iConnectionController->NotificationQueue().RegisterControlMessage( |
|
253 EAccessoryAudioLinkClose, |
|
254 this ); |
|
255 |
|
256 iConnectionController->NotificationQueue().CompleteControlMessageL( |
|
257 EBluetoothAudioLinkCloseReq, |
|
258 KErrNone, |
|
259 genericID.UniqueID() ); |
|
260 |
|
261 iAccessoryAudioLinkCloseMsg = aMessage;//Store RMessage2 for future completion |
|
262 |
|
263 // If message is null, there is no pending request and no filtering needed |
|
264 if ( !iNotifyAccessoryAudioLinkClosedMsg.IsNull() ) |
|
265 { |
|
266 //NotifyAccessoryAudioLinkClosed() notification is filtered |
|
267 //for AccessoryAudioLinkClose() caller thread |
|
268 iConnectionController->ServerModel().SetMsgThreadIDFilter( |
|
269 iCallerThreadID, |
|
270 EAccessoryAudioLinkClosed ); |
|
271 } |
|
272 |
|
273 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubBaseConnection::AccessoryAudioLinkCloseL - return void" ); |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CAccSrvSubAudioControl::AudioRoutingStatusNotifyL |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 void CAccSrvSubAudioControl::AudioRoutingStatusNotifyL( const RMessage2& aMessage ) |
|
281 { |
|
282 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::AudioRoutingStatusNotifyL()" ); |
|
283 |
|
284 TAccPolGenericID genericID; |
|
285 TPckgBuf<TBool> activeAudioPckgBuf; |
|
286 TAccSrvGenericIDPckg genericIDPckg( genericID ); |
|
287 |
|
288 aMessage.ReadL( KAccServParamPosFirst, activeAudioPckgBuf ); |
|
289 aMessage.ReadL( KAccServParamPosSecond, genericIDPckg ); |
|
290 |
|
291 iConnectionController->HandleAccessoryModeChangedL( genericID.UniqueID(), |
|
292 activeAudioPckgBuf() ); |
|
293 |
|
294 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::AudioRoutingStatusNotifyL - return void" ); |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CAccSrvSubAudioControl::CancelAccessoryAudioLinkOpen |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 void CAccSrvSubAudioControl::CancelAccessoryAudioLinkOpen( |
|
302 const RMessage2& /*aMessage*/ ) |
|
303 { |
|
304 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelAccessoryAudioLinkOpen()" ); |
|
305 |
|
306 // If message is null, there is nothing to cancel |
|
307 if ( !iAccessoryAudioLinkOpenMsg.IsNull() ) |
|
308 { |
|
309 iConnectionController->NotificationQueue().CancelControlMessage( |
|
310 EAccessoryAudioLinkOpen, |
|
311 this ); |
|
312 |
|
313 //AccessoryAudioLinkOpen() request is cancelled |
|
314 //-> NO filtering needed for NotifyAccessoryAudioLinkOpened() |
|
315 iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
316 iCallerThreadID, |
|
317 EAccessoryAudioLinkOpened ); |
|
318 |
|
319 Write( iAccessoryAudioLinkOpenMsg, KAccSrvAccessoryAudioLinkOpenBit ); |
|
320 iAccessoryAudioLinkOpenMsg.Complete( KErrCancel ); |
|
321 iServerModel->SetAudioLinkOpenCancelled( ETrue ); |
|
322 } |
|
323 |
|
324 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelAccessoryAudioLinkOpen - return void" ); |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CAccSrvSubAudioControl::CancelAccessoryAudioLinkClose |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 void CAccSrvSubAudioControl::CancelAccessoryAudioLinkClose( |
|
332 const RMessage2& /*aMessage*/ ) |
|
333 { |
|
334 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelAccessoryAudioLinkClose()" ); |
|
335 |
|
336 // If message is null, there is nothing to cancel |
|
337 if ( !iAccessoryAudioLinkCloseMsg.IsNull() ) |
|
338 { |
|
339 iConnectionController->NotificationQueue().CancelControlMessage( EAccessoryAudioLinkClose, |
|
340 this ); |
|
341 |
|
342 //AccessoryAudioLinkClose() request is cancelled |
|
343 //-> NO filtering needed for NotifyAccessoryAudioLinkClosed() |
|
344 iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
345 iCallerThreadID, EAccessoryAudioLinkClosed ); |
|
346 |
|
347 Write( iAccessoryAudioLinkCloseMsg, KAccSrvAccessoryAudioLinkCloseBit ); |
|
348 iAccessoryAudioLinkCloseMsg.Complete( KErrCancel ); |
|
349 iServerModel->SetAudioLinkCloseCancelled( ETrue ); |
|
350 } |
|
351 |
|
352 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelAccessoryAudioLinkClose - return void" ); |
|
353 } |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkOpened |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkOpened( |
|
360 const RMessage2& /*aMessage*/ ) |
|
361 { |
|
362 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkOpened()" ); |
|
363 |
|
364 // If message is null, there is nothing to cancel |
|
365 if( !iNotifyAccessoryAudioLinkOpenedMsg.IsNull() ) |
|
366 { |
|
367 iConnectionController->NotificationQueue().CancelControlMessage( |
|
368 EAccessoryAudioLinkOpened, this ); |
|
369 |
|
370 //NotifyAccessoryAudioLinkOpened() notification order is cancelled |
|
371 //-> NO filtering needed for that message |
|
372 iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
373 iCallerThreadID, EAccessoryAudioLinkOpened ); |
|
374 |
|
375 Write( iNotifyAccessoryAudioLinkOpenedMsg, KAccSrvNotifyAccessoryAudioLinkOpenedBit ); |
|
376 iNotifyAccessoryAudioLinkOpenedMsg.Complete( KErrCancel ); |
|
377 } |
|
378 |
|
379 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkOpened - return void" ); |
|
380 } |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkClosed |
|
384 // ----------------------------------------------------------------------------- |
|
385 // |
|
386 void CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkClosed( |
|
387 const RMessage2& /*aMessage*/ ) |
|
388 { |
|
389 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkClosed()" ); |
|
390 |
|
391 // If message is null, there is nothing to cancel |
|
392 if( !iNotifyAccessoryAudioLinkClosedMsg.IsNull() ) |
|
393 { |
|
394 iConnectionController->NotificationQueue().CancelControlMessage( |
|
395 EAccessoryAudioLinkClosed, this ); |
|
396 |
|
397 //NotifyAccessoryAudioLinkClosed() notification order is cancelled |
|
398 //-> NO filtering needed for that message |
|
399 iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
400 iCallerThreadID, EAccessoryAudioLinkClosed ); |
|
401 |
|
402 Write( iNotifyAccessoryAudioLinkClosedMsg, KAccSrvNotifyAccessoryAudioLinkClosedBit ); |
|
403 iNotifyAccessoryAudioLinkClosedMsg.Complete( KErrCancel ); |
|
404 } |
|
405 |
|
406 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::CancelNotifyAccessoryAudioLinkClosed - return void" ); |
|
407 } |
|
408 |
|
409 // ----------------------------------------------------------------------------- |
|
410 // CAccSrvSubAudioControl::DispatchMessageL |
|
411 // Handles client request. If request is not handled here, it is passed to |
|
412 // parent class for handling |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 void CAccSrvSubAudioControl::DispatchMessageL( const RMessage2& aMessage ) |
|
416 { |
|
417 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::DispatchMessageL()" ); |
|
418 |
|
419 TInt function = aMessage.Function(); |
|
420 |
|
421 switch ( function ) |
|
422 { |
|
423 case EAccSrvNotifyAccessoryAudioLinkOpened: |
|
424 { |
|
425 NotifyAccessoryAudioLinkOpened( aMessage ); |
|
426 break; |
|
427 } |
|
428 case EAccSrvNotifyAccessoryAudioLinkClosed: |
|
429 { |
|
430 NotifyAccessoryAudioLinkClosed( aMessage ); |
|
431 break; |
|
432 } |
|
433 case EAccSrvAccessoryAudioLinkOpen: |
|
434 { |
|
435 AccessoryAudioLinkOpenL( aMessage ); |
|
436 break; |
|
437 } |
|
438 case EAccSrvAccessoryAudioLinkClose: |
|
439 { |
|
440 AccessoryAudioLinkCloseL( aMessage ); |
|
441 break; |
|
442 } |
|
443 case EAccSrvAudioRoutingStatusNotify: |
|
444 { |
|
445 AudioRoutingStatusNotifyL( aMessage ); |
|
446 break; |
|
447 } |
|
448 case EAccSrvCancelAccessoryAudioLinkOpen: |
|
449 { |
|
450 CancelAccessoryAudioLinkOpen( aMessage ); |
|
451 break; |
|
452 } |
|
453 case EAccSrvCancelAccessoryAudioLinkClose: |
|
454 { |
|
455 CancelAccessoryAudioLinkClose( aMessage ); |
|
456 break; |
|
457 } |
|
458 case EAccSrvCancelNotifyAccessoryAudioLinkOpened: |
|
459 { |
|
460 CancelNotifyAccessoryAudioLinkOpened( aMessage ); |
|
461 break; |
|
462 } |
|
463 case EAccSrvCancelNotifyAccessoryAudioLinkClosed: |
|
464 { |
|
465 CancelNotifyAccessoryAudioLinkClosed( aMessage ); |
|
466 break; |
|
467 } |
|
468 default: |
|
469 { |
|
470 // Not handled here, pass to base class |
|
471 CAccSrvSubControl::DispatchMessageL( aMessage ); |
|
472 break; |
|
473 } |
|
474 } // switch( function ) |
|
475 |
|
476 COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAudioControl::DispatchMessageL - return void" ); |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CAccSrvSubAudioControl::CompleteMessageL |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 TBool CAccSrvSubAudioControl::CompleteMessageL( TMsgID aMsgID, |
|
484 TInt aErrorCode, |
|
485 TInt aUniqueID ) |
|
486 { |
|
487 COM_TRACE_3( "[AccFW:AccServer] CAccSrvSubAudioControl::CompleteMessageL(MsgID=%d Err=%d UniqueID=%d)", aMsgID, aErrorCode, aUniqueID ); |
|
488 |
|
489 TBool messageConsumption( EFalse );// Return value tells should this subsession be removed from the queue |
|
490 |
|
491 switch ( aMsgID ) |
|
492 { |
|
493 case EAccessoryAudioLinkOpen: |
|
494 { |
|
495 if( KErrNone != aErrorCode ) |
|
496 { |
|
497 //Release NotifyAccessoryAudioLinkOpened() filtering in error case. |
|
498 //BluetoothAudioLinkOpenedNotify() message is never sent in error case |
|
499 iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
500 iCallerThreadID, |
|
501 EAccessoryAudioLinkOpened ); |
|
502 } |
|
503 //Complete outstanding AccessoryAudioLinkOpen request |
|
504 Write( iAccessoryAudioLinkOpenMsg, KAccSrvAccessoryAudioLinkOpenBit ); |
|
505 iAccessoryAudioLinkOpenMsg.Complete( aErrorCode ); |
|
506 messageConsumption = ETrue; |
|
507 } |
|
508 break; |
|
509 |
|
510 case EAccessoryAudioLinkClose: |
|
511 { |
|
512 if( KErrNone != aErrorCode ) |
|
513 { |
|
514 //Release NotifyAccessoryAudioLinkClosed() filtering in error case. |
|
515 //BluetoothAudioLinkClosedNotify() message is never sent in error case |
|
516 iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
517 iCallerThreadID, |
|
518 EAccessoryAudioLinkClosed ); |
|
519 } |
|
520 //Complete outstanding AccessoryAudioLinkClose request |
|
521 Write( iAccessoryAudioLinkCloseMsg, KAccSrvAccessoryAudioLinkCloseBit ); |
|
522 iAccessoryAudioLinkCloseMsg.Complete( aErrorCode ); |
|
523 messageConsumption = ETrue; |
|
524 } |
|
525 break; |
|
526 |
|
527 case EAccessoryAudioLinkOpened: |
|
528 { |
|
529 // Nothing is done here if filter is set, i.e. NotifyAccessoryAudioLinkOpened() |
|
530 // notification was ordered from the same thread that AccessoryAudioLinkOpen() was called |
|
531 if ( !iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
532 iCallerThreadID, |
|
533 EAccessoryAudioLinkOpened ) ) |
|
534 { |
|
535 //Complete outstanding NotifyAccessoryAudioLinkOpened request |
|
536 //Notice, This works for single client (Server model can store only one value) |
|
537 TAccAudioType audioType( iConnectionController->ServerModel().AudioType() ); |
|
538 TAccPolGenericID genericID; |
|
539 iConnectionController->ServerModel().FindWithUniqueIDL( aUniqueID, genericID ); |
|
540 TAccSrvGenericIDPckg genericIDPckg( genericID ); |
|
541 TAccSrvAudioTypePckg audioTypePckg( audioType ); |
|
542 |
|
543 COM_TRACE_1( "[AccFW:AccServer] CAccSrvSubAudioControl::CompleteMessageL - Opened AudioType=%d)", audioType ); |
|
544 |
|
545 iNotifyAccessoryAudioLinkOpenedMsg.WriteL( KAccServParamPosFirst, genericIDPckg ); |
|
546 iNotifyAccessoryAudioLinkOpenedMsg.WriteL( KAccServParamPosSecond, audioTypePckg ); |
|
547 Write( iNotifyAccessoryAudioLinkOpenedMsg, |
|
548 KAccSrvNotifyAccessoryAudioLinkOpenedBit ); |
|
549 |
|
550 iNotifyAccessoryAudioLinkOpenedMsg.Complete( aErrorCode ); |
|
551 messageConsumption = ETrue; |
|
552 } |
|
553 } |
|
554 break; |
|
555 |
|
556 case EAccessoryAudioLinkClosed: |
|
557 { |
|
558 // Nothing is done here if filter is set, i.e. NotifyAccessoryAudioLinkClosed() |
|
559 // notification was ordered from the same thread that AccessoryAudioLinkClose() was called |
|
560 if ( !iConnectionController->ServerModel().FindAndDeleteMsgThreadIDFilter( |
|
561 iCallerThreadID, |
|
562 EAccessoryAudioLinkClosed ) ) |
|
563 { |
|
564 //Complete outstanding NotifyAccessoryAudioLinkClosed request |
|
565 //Notice, This works for single client (Server model can store only one value) |
|
566 TAccAudioType audioType( iConnectionController->ServerModel().AudioType() ); |
|
567 TAccPolGenericID genericID; |
|
568 iConnectionController->ServerModel().FindWithUniqueIDL( aUniqueID, genericID ); |
|
569 TAccSrvGenericIDPckg genericIDPckg( genericID ); |
|
570 TAccSrvAudioTypePckg audioTypePckg( audioType ); |
|
571 |
|
572 COM_TRACE_1( "[AccFW:AccServer] CAccSrvSubAudioControl::CompleteMessageL - Closed AudioType=%d)", audioType ); |
|
573 |
|
574 iNotifyAccessoryAudioLinkClosedMsg.WriteL( KAccServParamPosFirst, genericIDPckg ); |
|
575 iNotifyAccessoryAudioLinkClosedMsg.WriteL( KAccServParamPosSecond, audioTypePckg ); |
|
576 Write( iNotifyAccessoryAudioLinkClosedMsg, |
|
577 KAccSrvNotifyAccessoryAudioLinkClosedBit ); |
|
578 |
|
579 iNotifyAccessoryAudioLinkClosedMsg.Complete( aErrorCode ); |
|
580 messageConsumption = ETrue; |
|
581 } |
|
582 } |
|
583 break; |
|
584 |
|
585 default: |
|
586 { |
|
587 //Pass handling to parent class |
|
588 messageConsumption = CAccSrvSubControl::CompleteMessageL( aMsgID, |
|
589 aErrorCode, |
|
590 aUniqueID ); |
|
591 } |
|
592 } |
|
593 |
|
594 COM_TRACE_1( "[AccFW:AccServer] CAccSrvSubAudioControl::CompleteMessageL - return 0x%x", messageConsumption ); |
|
595 |
|
596 return messageConsumption; |
|
597 } |
|
598 |
|
599 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
600 |
|
601 // End of File |