|
1 /* |
|
2 * Copyright (c) 2002-2009 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's side session class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "AccSrvMainSession.h" |
|
21 #include "AccClientServerMessages.h" |
|
22 #include "acc_debug.h" |
|
23 #include <e32svr.h> |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 extern void PanicClient( const RMessage2& aMessage, TAccServerError aPanic ); |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 |
|
36 // MODULE DATA STRUCTURES |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // ============================= LOCAL FUNCTIONS =============================== |
|
43 |
|
44 // ============================ MEMBER FUNCTIONS =============================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CAccSrvMainSession::CAccSrvMainSession |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CAccSrvMainSession::CAccSrvMainSession( |
|
53 CAccSrvConnectionController* aConnectionController, |
|
54 CAccSrvServerModel* aServerModel ) |
|
55 : iAccServer( NULL ), |
|
56 iObjectIx( NULL ), |
|
57 iObjectCon( NULL ), |
|
58 iProxy( NULL ), |
|
59 iConnectionController( aConnectionController ), |
|
60 iServerModel( aServerModel ) |
|
61 { |
|
62 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::CAccSrvMainSession(0x%x)", &aConnectionController ); |
|
63 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::CAccSrvMainSession()" ); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CAccSrvMainSession::ConstructL |
|
68 // Symbian 2nd phase constructor can leave. |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 void CAccSrvMainSession::ConstructL( CAccServer* aServer, CASYProxyAPI* aProxy ) |
|
72 { |
|
73 COM_TRACE_2( "[AccFW:AccServer] CAccSrvMainSession::ConstructL(0x%x, 0x%x)", &aServer, &aProxy ); |
|
74 |
|
75 iAccServer = aServer; |
|
76 iObjectCon = iAccServer->NewContainerL(); |
|
77 iObjectIx = CObjectIx::NewL(); |
|
78 iProxy = aProxy; |
|
79 |
|
80 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::ConstructL - return void" ); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CAccSrvMainSession::NewL |
|
85 // Two-phased constructor. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 CAccSrvMainSession* CAccSrvMainSession::NewL( |
|
89 RThread& aClient, |
|
90 CAccServer& aServer, |
|
91 CASYProxyAPI* aProxy, |
|
92 CAccSrvConnectionController* aConnectionController, |
|
93 CAccSrvServerModel* aServerModel ) |
|
94 { |
|
95 COM_TRACE_4( "[AccFW:AccServer] CAccSrvMainSession::NewL(0x%x, 0x%x, 0x%x, 0x%x)", &aClient, &aServer, &aProxy, &aConnectionController ); |
|
96 |
|
97 CAccSrvMainSession* self = CAccSrvMainSession::NewLC( |
|
98 aClient, |
|
99 aServer, |
|
100 aProxy, |
|
101 aConnectionController, |
|
102 aServerModel ); |
|
103 CleanupStack::Pop( self ); |
|
104 |
|
105 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::NewL - return 0x%x", self ); |
|
106 return self; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CAccSrvMainSession::NewLC |
|
111 // Two-phased constructor. |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 CAccSrvMainSession* CAccSrvMainSession::NewLC( |
|
115 RThread& /*aClient*/, |
|
116 CAccServer& aServer, |
|
117 CASYProxyAPI* aProxy, |
|
118 CAccSrvConnectionController* aConnectionController, |
|
119 CAccSrvServerModel* aServerModel ) |
|
120 { |
|
121 COM_TRACE_3( "[AccFW:AccServer] CAccSrvMainSession::NewLC( 0x%x, 0x%x, 0x%x)", &aServer, &aProxy, &aConnectionController ); |
|
122 |
|
123 CAccSrvMainSession* self = |
|
124 new ( ELeave ) CAccSrvMainSession( aConnectionController, aServerModel ); |
|
125 |
|
126 CleanupStack::PushL( self ) ; |
|
127 self->ConstructL( &aServer, aProxy ); |
|
128 |
|
129 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::NewLC - return 0x%x", self ); |
|
130 return self; |
|
131 } |
|
132 |
|
133 // Destructor |
|
134 CAccSrvMainSession::~CAccSrvMainSession() |
|
135 { |
|
136 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::~CAccSrvMainSession()" ); |
|
137 |
|
138 if ( iObjectIx ) |
|
139 { |
|
140 delete iObjectIx; |
|
141 } |
|
142 if ( iAccServer && iObjectCon ) |
|
143 { |
|
144 iAccServer->RemoveContainer( iObjectCon ); // Remove and delete the container |
|
145 } |
|
146 |
|
147 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::~CAccSrvMainSession - return()" ); |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CAccSrvMainSession::ServiceL |
|
152 // Calls request handling functions. |
|
153 // (other items were commented in a header). |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 void CAccSrvMainSession::ServiceL( const RMessage2& aMessage ) |
|
157 { |
|
158 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::ServiceL()" ); |
|
159 |
|
160 TInt function = aMessage.Function(); |
|
161 |
|
162 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::ServiceL - function == 0x%x", function ); |
|
163 |
|
164 TInt err( KErrNone ); |
|
165 |
|
166 TRAP( err, DispatchMessageL( aMessage ) ); |
|
167 |
|
168 switch ( function ) |
|
169 { |
|
170 case EAccSrvCreateSubSessionAccessoryMode: |
|
171 case EAccSrvCreateSubSessionAccessorySettings: |
|
172 case EAccSrvCreateSubSessionAccessoryConnection: |
|
173 case EAccSrvCreateSubSessionAccessoryControl: |
|
174 case EAccSrvCreateSubSessionAccessorySingleConnection: |
|
175 case EAccSrvCreateSubSessionAccessoryBTControl: |
|
176 case EAccSrvCreateSubSessionAccessoryAudioControl: |
|
177 case EAccSrvCreateSubSessionAccessoryAsyComms: |
|
178 case EAccSrvCloseSubSessionAccessoryMode: |
|
179 case EAccSrvCloseSubSessionAccessorySettings: |
|
180 case EAccSrvCloseSubSessionAccessoryConnection: |
|
181 case EAccSrvCloseSubSessionAccessoryControl: |
|
182 case EAccSrvCloseSubSessionAccessorySingleConnection: |
|
183 case EAccSrvCloseSubSessionAccessoryBTControl: |
|
184 case EAccSrvCloseSubSessionAccessoryAudioControl: |
|
185 case EAccSrvCloseSubSessionAccessoryAsyComms: |
|
186 case EAccSrvGetAccessoryConnectionStatus: |
|
187 case EAccSrvCancelNotifyAccessoryConnectionStatusChanged: |
|
188 case EAccSrvCancelNotifyNewAccessoryConnected: |
|
189 case EAccSrvCancelNotifyAccessoryDisconnected: |
|
190 case EAccSrvCancelNotifyAccessoryValueChanged: |
|
191 case EAccSrvGetSubblockNameArray: |
|
192 case EAccSrvCancelNotifyAccessoryModeChanged: |
|
193 case EAccSrvGetSupportedHWDevices: |
|
194 case EAccSrvGetHWDeviceSettings: |
|
195 case EAccSrvSetHWDeviceSettings: |
|
196 case EAccSrvGetAccessoryModeSetting: |
|
197 case EAccSrvSetAccessoryModeSetting: |
|
198 case EAccSrvGetAccessoryModeSettings: |
|
199 case EAccSrvSetAccessoryModeSettings: |
|
200 case EAccSrvConnectAccessory2: |
|
201 case EAccSrvDisconnectAccessory: |
|
202 case EAccSrvAccessoryValueChangedTBoolNotify: |
|
203 case EAccSrvBTAccessoryValueChangedTBoolNotify: |
|
204 case EAccSrvBTAccessoryValueChangedTIntNotify: |
|
205 case EAccSrvAccessoryValueChangedTIntNotify: |
|
206 case EAccSrvAccessoryValueChangedObjectNotify: |
|
207 case EAccSrvCancelConnectAccessory: |
|
208 case EAccSrvCancelDisconnectAccessory: |
|
209 case EAccSrvBluetoothDisconnectAccessory: |
|
210 case EAccSrvBluetoothAudioLinkOpenResp: |
|
211 case EAccSrvBluetoothAudioLinkCloseResp: |
|
212 case EAccSrvBluetoothAudioLinkOpenedNotify: |
|
213 case EAccSrvBluetoothAudioLinkClosedNotify: |
|
214 case EAccSrvCancelNotifyBluetoothAudioLinkOpenReq: |
|
215 case EAccSrvCancelNotifyBluetoothAudioLinkCloseReq: |
|
216 case EAccSrvAudioRoutingStatusNotify: |
|
217 case EAccSrvCancelAccessoryAudioLinkOpen: |
|
218 case EAccSrvCancelAccessoryAudioLinkClose: |
|
219 case EAccSrvCancelNotifyAccessoryAudioLinkOpened: |
|
220 case EAccSrvCancelNotifyAccessoryAudioLinkClosed: |
|
221 case EAccSrvCancelNotifyProcessCommand: |
|
222 case EAccSrvProcessResponseTBool: |
|
223 case EAccSrvProcessResponseTInt: |
|
224 case EAccSrvProcessResponseTDes: |
|
225 case EAccSrvProcessResponseObject: |
|
226 case EAccSrvCancelGetAccessoryMode: |
|
227 case EAccSrvCancelGetAccessoryConnectionStatus: |
|
228 case EAccSrvGetObjectBuffer: |
|
229 case EAccSrvGetObjectValue: |
|
230 { |
|
231 |
|
232 if( aMessage.Handle() ) |
|
233 { |
|
234 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::ServiceL - message completed, reason=%d", err ); |
|
235 WriteL( aMessage, function, err );//Update iFlags parameter to client side |
|
236 aMessage.Complete( err ); |
|
237 } |
|
238 } |
|
239 break; |
|
240 |
|
241 case EAccSrvBluetoothConnectAccessory: |
|
242 case EAccSrvNotifyAccessoryAudioLinkOpened: |
|
243 case EAccSrvNotifyAccessoryAudioLinkClosed: |
|
244 case EAccSrvNotifyBluetoothAudioLinkOpenReq: |
|
245 case EAccSrvNotifyBluetoothAudioLinkCloseReq: |
|
246 case EAccSrvNotifyNewAccessoryConnected: |
|
247 case EAccSrvNotifyAccessoryDisconnected: |
|
248 case EAccSrvNotifyAccessoryValueChangedTBool: |
|
249 case EAccSrvNotifyAccessoryValueChangedTInt: |
|
250 case EAccSrvNotifyAccessoryValueChangedObject: |
|
251 case EAccSrvNotifyAccessoryConnectionStatusChanged: |
|
252 case EAccSrvNotifyAccessoryModeChanged: |
|
253 case EAccSrvAccessoryAudioLinkOpen: |
|
254 case EAccSrvAccessoryAudioLinkClose: |
|
255 case EAccSrvNotifyProcessCommand: |
|
256 case EAccSrvGetAccessoryMode: |
|
257 case EAccSrvGetAccessoryModeAsync: |
|
258 case EAccSrvGetAccessoryConnectionStatusAsync: |
|
259 case EAccSrvSetValueTBool: |
|
260 case EAccSrvSetValueTInt: |
|
261 case EAccSrvSetValueObject: |
|
262 case EAccSrvGetValueTBool: |
|
263 case EAccSrvGetValueTInt: |
|
264 case EAccSrvGetValueTDes8: |
|
265 case EAccSrvGetValueObjectBase: |
|
266 { |
|
267 if (err != KErrNone) |
|
268 { |
|
269 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::ServiceL - message completed with error %d", err ); |
|
270 // These messages are completed in subsessions (on time). |
|
271 // In case of error, completion is done here with |
|
272 // appropriate error code. |
|
273 WriteL( aMessage, function, err );//Update iFlags parameter to client side |
|
274 aMessage.Complete( err ); |
|
275 } |
|
276 } |
|
277 break; |
|
278 |
|
279 default: |
|
280 { |
|
281 TRACE_ASSERT_ALWAYS; |
|
282 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::ServiceL - unhandled function: 0x%x", function ); |
|
283 PanicClient( aMessage, EAccServerErrorNotSupported ); |
|
284 } |
|
285 break; |
|
286 |
|
287 } //switch |
|
288 |
|
289 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::ServiceL - return void" ); |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CAccSrvMainSession::DispatchMessageL |
|
294 // Handles messages |
|
295 // (other items were commented in a header). |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 void CAccSrvMainSession::DispatchMessageL( const RMessage2& aMessage ) |
|
299 { |
|
300 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::DispatchMessageL()" ); |
|
301 |
|
302 TInt function = aMessage.Function(); |
|
303 |
|
304 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::DispatchMessageL - function = 0x%x", function ); |
|
305 |
|
306 CAccSrvSubBase* subSession = NULL; |
|
307 |
|
308 switch ( function ) |
|
309 { |
|
310 case EAccSrvCreateSubSessionAccessoryMode: |
|
311 case EAccSrvCreateSubSessionAccessorySettings: |
|
312 case EAccSrvCreateSubSessionAccessoryConnection: |
|
313 case EAccSrvCreateSubSessionAccessoryControl: |
|
314 case EAccSrvCreateSubSessionAccessorySingleConnection: |
|
315 case EAccSrvCreateSubSessionAccessoryBTControl: |
|
316 case EAccSrvCreateSubSessionAccessoryAudioControl: |
|
317 case EAccSrvCreateSubSessionAccessoryAsyComms: |
|
318 |
|
319 NewSubSessionL( aMessage); |
|
320 return; |
|
321 |
|
322 case EAccSrvCloseSubSessionAccessoryMode: |
|
323 case EAccSrvCloseSubSessionAccessorySettings: |
|
324 case EAccSrvCloseSubSessionAccessoryConnection: |
|
325 case EAccSrvCloseSubSessionAccessoryControl: |
|
326 case EAccSrvCloseSubSessionAccessorySingleConnection: |
|
327 case EAccSrvCloseSubSessionAccessoryBTControl: |
|
328 case EAccSrvCloseSubSessionAccessoryAudioControl: |
|
329 case EAccSrvCloseSubSessionAccessoryAsyComms: |
|
330 |
|
331 CloseSubSessionL( aMessage ); |
|
332 return; |
|
333 |
|
334 default: |
|
335 { |
|
336 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::DispatchMessageL - subsession specific request" ); |
|
337 } |
|
338 break; |
|
339 } |
|
340 |
|
341 // Request is subsession specific |
|
342 subSession = REINTERPRET_CAST( CAccSrvSubBase*, iObjectIx->At( aMessage.Int3() ) ); |
|
343 |
|
344 if ( subSession ) |
|
345 { |
|
346 subSession->DispatchMessageL( aMessage ); |
|
347 } |
|
348 else |
|
349 { |
|
350 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::DispatchMessageL - subsession specific create/connect" ); |
|
351 aMessage.Panic( KAccServerPanicCategory, EAccServerErrorBadDescriptor );//Panics the client |
|
352 } |
|
353 |
|
354 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::DispatchMessageL - return void" ); |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // CAccSrvMainSession::NewSubSessionL |
|
359 // |
|
360 // (other items were commented in a header). |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 void CAccSrvMainSession::NewSubSessionL( const RMessage2& aMessage ) |
|
364 { |
|
365 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::NewSubSessionL()" ); |
|
366 |
|
367 TInt handle( 0 ); |
|
368 TInt type ( aMessage.Function() ); |
|
369 CObject* session = NULL; |
|
370 |
|
371 // No need to restrict number of Sub-Sessions |
|
372 // Number of Sessions should be restricted instead (to 1/client thread) |
|
373 |
|
374 switch ( type ) |
|
375 { |
|
376 case EAccSrvCreateSubSessionAccessoryMode: |
|
377 { |
|
378 session = CAccSrvSubMode::NewL( iProxy, iConnectionController, iServerModel ); |
|
379 break; |
|
380 } |
|
381 |
|
382 case EAccSrvCreateSubSessionAccessorySettings: |
|
383 { |
|
384 session = CAccSrvSubSettings::NewL( iProxy, iConnectionController, iServerModel ); |
|
385 break; |
|
386 } |
|
387 |
|
388 case EAccSrvCreateSubSessionAccessorySingleConnection: |
|
389 { |
|
390 session = CAccSrvSubSingleConnection::NewL( |
|
391 iProxy, |
|
392 iConnectionController, |
|
393 iServerModel ); |
|
394 break; |
|
395 } |
|
396 |
|
397 case EAccSrvCreateSubSessionAccessoryConnection: |
|
398 { |
|
399 session = CAccSrvSubConnection::NewL( iProxy, iConnectionController, iServerModel ); |
|
400 break; |
|
401 } |
|
402 |
|
403 case EAccSrvCreateSubSessionAccessoryControl: |
|
404 { |
|
405 session = CAccSrvSubControl::NewL( iProxy, iConnectionController, iServerModel ); |
|
406 break; |
|
407 } |
|
408 |
|
409 case EAccSrvCreateSubSessionAccessoryBTControl: |
|
410 { |
|
411 session = CAccSrvSubBTControl::NewL( iProxy, iConnectionController, iServerModel ); |
|
412 break; |
|
413 } |
|
414 |
|
415 case EAccSrvCreateSubSessionAccessoryAudioControl: |
|
416 { |
|
417 //Get the thread ID of the caller |
|
418 TUint callerThreadID( 0 ); |
|
419 TPckg<TUint> callerThreadIDPckg( callerThreadID ); |
|
420 aMessage.Read( 0, callerThreadIDPckg ); |
|
421 |
|
422 session = CAccSrvSubAudioControl::NewL( iProxy, |
|
423 iConnectionController, |
|
424 iServerModel, |
|
425 callerThreadID ); |
|
426 break; |
|
427 } |
|
428 |
|
429 case EAccSrvCreateSubSessionAccessoryAsyComms: |
|
430 { |
|
431 //Get the thread ID of the ASY |
|
432 TUint ASYThreadID( 0 ); |
|
433 TPckg<TUint> ASYThreadIDPckg( ASYThreadID ); |
|
434 aMessage.Read( 0, ASYThreadIDPckg ); |
|
435 |
|
436 // Main service UID of the ASY |
|
437 TUid mainServiceUid( TUid::Null() ); |
|
438 TPckg<TUid> mainServiceUidPckg( mainServiceUid ); |
|
439 aMessage.Read( 1, mainServiceUidPckg ); |
|
440 |
|
441 session = CAccSrvSubAsyComms::NewL( iProxy, |
|
442 iConnectionController, |
|
443 iServerModel, |
|
444 ASYThreadID, |
|
445 mainServiceUid ); |
|
446 break; |
|
447 } |
|
448 |
|
449 default: |
|
450 TRACE_ASSERT_ALWAYS; |
|
451 User::Leave( KErrGeneral ); |
|
452 break; |
|
453 } |
|
454 |
|
455 CleanupStack::PushL( session ); |
|
456 iObjectCon->AddL( session ); |
|
457 CleanupStack::Pop( session ); |
|
458 |
|
459 TRAPD( error, handle = iObjectIx->AddL( session ) ); |
|
460 if ( error ) |
|
461 { |
|
462 // AddL didn't complete successfully. |
|
463 // Remove object from container and delete object. |
|
464 iObjectCon->Remove( session ); |
|
465 User::Leave( error ); |
|
466 } |
|
467 |
|
468 // Package to pass information to the client |
|
469 TPckgC<TInt> handlePckg( handle ); |
|
470 |
|
471 // Send handle to the client |
|
472 TRAP( error, aMessage.WriteL( KAccServHandlePos, handlePckg ) ); |
|
473 if ( error ) |
|
474 { |
|
475 // Destroy newly created subsession, nobody needs it now |
|
476 iObjectIx->Remove( handle ); |
|
477 } |
|
478 |
|
479 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::NewSubSessionL - return void" ); |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CAccSrvMainSession::CloseSubSessionL |
|
484 // |
|
485 // (other items were commented in a header). |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void CAccSrvMainSession::CloseSubSessionL( const RMessage2& aMessage ) |
|
489 { |
|
490 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::CloseSubSessionL()" ); |
|
491 |
|
492 COM_TRACE_1( "[AccFW:AccServer] CAccSrvMainSession::CloseSubSessionL - aMessage.Int3() = 0x%x", aMessage.Int3() ); |
|
493 iObjectIx->AtL( aMessage.Int3() ); |
|
494 iObjectIx->Remove( aMessage.Int3() ); |
|
495 |
|
496 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::CloseSubSessionL - return void" ); |
|
497 } |
|
498 |
|
499 // ----------------------------------------------------------------------------- |
|
500 // CAccSrvMainSession::WriteL |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 void CAccSrvMainSession::WriteL( const RMessage2& aMessage, TInt aFunction, TInt aErr ) |
|
504 { |
|
505 COM_TRACE_2( "[AccFW:AccServer] CAccSrvMainSession::WriteL(func=%d err=%d)", aFunction, aErr ); |
|
506 |
|
507 TInt flag( 0 ); |
|
508 TInt flags( 0 ); |
|
509 TPckg<TInt> flagsPckg( flags ); |
|
510 |
|
511 if ( KErrNone == aErr ) |
|
512 { |
|
513 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::WriteL - no need to update flags - return void" ); |
|
514 return;//In succesfull case, iFlags parameter is updated in subsessions |
|
515 } |
|
516 |
|
517 switch ( aFunction ) |
|
518 { |
|
519 case EAccSrvAccessoryAudioLinkOpen: |
|
520 { |
|
521 flag = KAccSrvAccessoryAudioLinkOpenBit; |
|
522 } |
|
523 break; |
|
524 case EAccSrvAccessoryAudioLinkClose: |
|
525 { |
|
526 flag = KAccSrvAccessoryAudioLinkCloseBit; |
|
527 } |
|
528 break; |
|
529 case EAccSrvNotifyAccessoryAudioLinkOpened: |
|
530 { |
|
531 flag = KAccSrvNotifyAccessoryAudioLinkOpenedBit; |
|
532 } |
|
533 break; |
|
534 case EAccSrvNotifyAccessoryAudioLinkClosed: |
|
535 { |
|
536 flag = KAccSrvNotifyAccessoryAudioLinkClosedBit; |
|
537 } |
|
538 break; |
|
539 case EAccSrvBluetoothConnectAccessory: |
|
540 { |
|
541 flag = KAccSrvConnectBTAccessoryBit; |
|
542 } |
|
543 break; |
|
544 case EAccSrvBluetoothDisconnectAccessory: |
|
545 { |
|
546 flag = KAccSrvDisconnectBTAccessoryBit; |
|
547 } |
|
548 break; |
|
549 case EAccSrvNotifyBluetoothAudioLinkOpenReq: |
|
550 { |
|
551 flag = KAccSrvNotifyBluetoothAudioLinkOpenReqBit; |
|
552 } |
|
553 break; |
|
554 case EAccSrvNotifyBluetoothAudioLinkCloseReq: |
|
555 { |
|
556 flag = KAccSrvNotifyBluetoothAudioLinkCloseReqBit; |
|
557 } |
|
558 break; |
|
559 case EAccSrvGetAccessoryConnectionStatusAsync: |
|
560 { |
|
561 flag = KAccSrvGetAccessoryConnectionStatusBit; |
|
562 } |
|
563 break; |
|
564 case EAccSrvNotifyAccessoryConnectionStatusChanged: |
|
565 { |
|
566 flag = KAccSrvNotifyAccConnStatusChangedBit; |
|
567 } |
|
568 break; |
|
569 case EAccSrvGetAccessoryModeAsync: |
|
570 { |
|
571 flag = KAccSrvGetAccessoryModeBit; |
|
572 } |
|
573 break; |
|
574 case EAccSrvNotifyAccessoryModeChanged: |
|
575 { |
|
576 flag = KAccSrvNotifyAccessoryModeChangedBit; |
|
577 } |
|
578 break; |
|
579 case EAccSrvNotifyNewAccessoryConnected: |
|
580 { |
|
581 flag = KAccSrvNotifyNewAccessoryConnectedBit; |
|
582 } |
|
583 break; |
|
584 case EAccSrvNotifyAccessoryDisconnected: |
|
585 { |
|
586 flag = KAccSrvNotifyAccessoryDisconnectedBit; |
|
587 } |
|
588 break; |
|
589 case EAccSrvNotifyAccessoryValueChangedTBool: |
|
590 { |
|
591 flag = KAccSrvNotifyAccessoryValueChangedTBoolBit; |
|
592 } |
|
593 break; |
|
594 case EAccSrvNotifyAccessoryValueChangedTInt: |
|
595 { |
|
596 flag = KAccSrvNotifyAccessoryValueChangedTIntBit; |
|
597 } |
|
598 break; |
|
599 case EAccSrvNotifyAccessoryValueChangedObject: |
|
600 { |
|
601 flag = KAccSrvNotifyAccessoryValueChangedObjectBit; |
|
602 } |
|
603 break; |
|
604 case EAccSrvDisconnectAccessory: |
|
605 { |
|
606 flag = KAccSrvDisconnectAccessoryBit; |
|
607 } |
|
608 break; |
|
609 case EAccSrvConnectAccessory2: |
|
610 { |
|
611 flag = KAccSrvDisconnectAccessoryBit; |
|
612 } |
|
613 break; |
|
614 default: |
|
615 { |
|
616 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::WriteL - no need to update flags for this msg - return void" ); |
|
617 return; |
|
618 } |
|
619 } |
|
620 |
|
621 aMessage.ReadL( KAccServParamPosThird, flagsPckg );//It's allways argument number 2 which is used in client side |
|
622 flags = flags & (~flag);//Turn bit number flag to zero |
|
623 aMessage.Write( KAccServParamPosThird, flagsPckg ); |
|
624 |
|
625 COM_TRACE_( "[AccFW:AccServer] CAccSrvMainSession::WriteL - flags updated - return void" ); |
|
626 } |
|
627 |
|
628 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
629 |
|
630 // End of File |