97 iPolicy = CAccPolAccessoryPolicy::NewL( &iServerModel->CapabilityStorage()); |
97 iPolicy = CAccPolAccessoryPolicy::NewL( &iServerModel->CapabilityStorage()); |
98 iNotificationQueue = CAccSrvNotificationQueue::NewL(); |
98 iNotificationQueue = CAccSrvNotificationQueue::NewL(); |
99 iConnectionStatusHandler = CAccSrvConnectionStatusHandler::NewL( this ); |
99 iConnectionStatusHandler = CAccSrvConnectionStatusHandler::NewL( this ); |
100 iModeHandler = CAccSrvModeHandler::NewL( this ); |
100 iModeHandler = CAccSrvModeHandler::NewL( this ); |
101 iASYProxyHandler = CAccSrvASYProxyHandler::NewL( this ); |
101 iASYProxyHandler = CAccSrvASYProxyHandler::NewL( this ); |
102 iSettingsHandler = CAccSrvSettingsHandler::NewL( this, *aServerModel ); |
102 iSettingsHandler = CAccSrvSettingsHandler::NewL( this, *aServerModel, iPolicy ); |
103 iWiredConnPublisher = CAccSrvWiredConnectionPublisher::NewL(); |
103 iWiredConnPublisher = CAccSrvWiredConnectionPublisher::NewL(); |
104 TRAPD( err, iChargingContextController = CAccSrvChargingContextController::NewL() ); |
104 TRAPD( err, iChargingContextController = CAccSrvChargingContextController::NewL() ); |
105 if ( err != KErrNone ) // Server does not need to die on charging context fail. |
105 if ( err != KErrNone ) // Server does not need to die on charging context fail. |
106 { |
106 { |
107 COM_TRACE_1( "[AccFW:AccServer] CAccSrvConnectionController::ConstructL - CAccSrvChargingContextController err %d", err ); |
107 COM_TRACE_1( "[AccFW:AccServer] CAccSrvConnectionController::ConstructL - CAccSrvChargingContextController err %d", err ); |
455 TRACE_ASSERT_ALWAYS; //iConnectionHandler array is not in sync |
455 TRACE_ASSERT_ALWAYS; //iConnectionHandler array is not in sync |
456 } |
456 } |
457 |
457 |
458 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionUpdateValidationL - return void" ); |
458 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionUpdateValidationL - return void" ); |
459 } |
459 } |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // CAccSrvConnectionController::HandleConnectionUpdateValidationL |
|
463 // ----------------------------------------------------------------------------- |
|
464 // |
|
465 void CAccSrvConnectionController::HandleConnectionUpdateValidationL( |
|
466 const TAccPolGenericID& aGenericID, |
|
467 TAccPolGenericID& aOldGenericId, |
|
468 const CAccSrvSettingsHandler* aCaller, |
|
469 TInt aError ) |
|
470 { |
|
471 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionUpdateValidationL()" ); |
|
472 |
|
473 TInt err ( KErrNone ); |
|
474 TAccSrvConnection isValidConnection(EAccSrvConnect); |
|
475 TBool isConnected( iServerModel->IsConnected( aGenericID ) ); |
|
476 |
|
477 if( KErrNone == aError ) |
|
478 { |
|
479 isValidConnection = iPolicy->IsValidConnectionL( aGenericID, err ); |
|
480 } |
|
481 else |
|
482 { |
|
483 err = aError; |
|
484 isValidConnection = EAccSrvDeny; |
|
485 } |
|
486 |
|
487 if( iServerModel->FindAndRemoveCancelledConnectAccessory( aGenericID.UniqueID() ) ) |
|
488 { |
|
489 //Connection of this accessory is cancelled. |
|
490 err = KErrCancel; |
|
491 isValidConnection = EAccSrvDeny; |
|
492 } |
|
493 |
|
494 switch( isValidConnection ) |
|
495 { |
|
496 case EAccSrvDetect: |
|
497 { |
|
498 } |
|
499 break; |
|
500 |
|
501 case EAccSrvConnect: |
|
502 { |
|
503 if( isConnected ) |
|
504 { |
|
505 //update connection generic id array |
|
506 iServerModel->UpdateConnectionL( aGenericID); |
|
507 |
|
508 // Complete all possible connection status related requests |
|
509 iNotificationQueue->CompleteControlMessageL( EAccessoryConnectionStatusChanged, |
|
510 KErrNone, |
|
511 aGenericID.UniqueID() ); |
|
512 iNotificationQueue->CompleteControlMessageL( EAccessoryDisconnected, |
|
513 KErrNone, |
|
514 aOldGenericId.UniqueID() ); |
|
515 iNotificationQueue->CompleteControlMessageL( ENewAccessoryConnected, |
|
516 KErrNone, |
|
517 aGenericID.UniqueID() ); |
|
518 } |
|
519 |
|
520 } |
|
521 break; |
|
522 |
|
523 case EAccSrvDeny: |
|
524 { |
|
525 iServerModel->RemovePhysicalConnection( aGenericID ); |
|
526 iServerModel->RemoveASYThreadID( aGenericID.UniqueID() );//Remove ThreadID GID mapping |
|
527 iServerModel->CapabilityStorage().RemoveCapabilityList( aGenericID); |
|
528 |
|
529 |
|
530 } |
|
531 break; |
|
532 |
|
533 default: |
|
534 { |
|
535 TRACE_ASSERT_ALWAYS;//unhandled enum |
|
536 } |
|
537 break; |
|
538 } |
|
539 |
|
540 iNotificationQueue->CompleteControlMessageL( EConnectAccessory, |
|
541 err, |
|
542 aGenericID.UniqueID() ); |
|
543 |
|
544 |
|
545 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionUpdateValidationL - return void" ); |
|
546 } |
|
547 |
|
548 |
460 |
549 |
461 // ----------------------------------------------------------------------------- |
550 // ----------------------------------------------------------------------------- |
462 // CAccSrvConnectionController::ConnectionHandlingCancel |
551 // CAccSrvConnectionController::ConnectionHandlingCancel |
463 // ----------------------------------------------------------------------------- |
552 // ----------------------------------------------------------------------------- |
464 // |
553 // |