61 // C++ default constructor can NOT contain any code, that |
59 // C++ default constructor can NOT contain any code, that |
62 // might leave. |
60 // might leave. |
63 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
64 // |
62 // |
65 CAccSrvConnectionController::CAccSrvConnectionController() |
63 CAccSrvConnectionController::CAccSrvConnectionController() |
66 : CActive( EPriorityStandard ), |
64 : iPolicy( NULL ), |
67 iPolicy( NULL ), |
|
68 iServerModel( NULL ), |
65 iServerModel( NULL ), |
69 iNotificationQueue( NULL ), |
66 iNotificationQueue( NULL ), |
70 iConnectionStatusHandler( NULL ), |
67 iConnectionStatusHandler( NULL ), |
71 iModeHandler( NULL ), |
68 iModeHandler( NULL ), |
72 iASYProxyHandler( NULL ), |
69 iASYProxyHandler( NULL ), |
73 iShowNotes( EFalse ), |
70 iWiredConnPublisher( NULL ) |
74 iWiredConnPublisher( NULL ), |
|
75 iReplyPck( iReplyValue) |
|
76 { |
71 { |
77 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::CAccSrvConnectionController()" ); |
72 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::CAccSrvConnectionController()" ); |
78 |
|
79 CActiveScheduler::Add( this );//Add the active object to the active scheduler |
|
80 |
73 |
81 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::CAccSrvConnectionController - return" ); |
74 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::CAccSrvConnectionController - return" ); |
82 } |
75 } |
83 |
76 |
84 |
77 |
164 |
157 |
165 // Handlers must be deleted after iPolicy and iASYProxyHandler |
158 // Handlers must be deleted after iPolicy and iASYProxyHandler |
166 // (used from handlers). |
159 // (used from handlers). |
167 iConnectionHandler.ResetAndDestroy(); |
160 iConnectionHandler.ResetAndDestroy(); |
168 |
161 |
169 if ( iNotifier.Handle() ) |
|
170 { |
|
171 iNotifier.Close(); |
|
172 } |
|
173 Cancel(); |
|
174 |
|
175 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::~CAccSrvConnectionController - return" ); |
162 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::~CAccSrvConnectionController - return" ); |
176 } |
163 } |
177 |
164 |
178 |
165 |
179 // ----------------------------------------------------------------------------- |
166 // ----------------------------------------------------------------------------- |
275 else |
262 else |
276 { |
263 { |
277 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectL() New connection" ); |
264 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectL() New connection" ); |
278 |
265 |
279 // Store ThreadId for ASY handling |
266 // Store ThreadId for ASY handling |
280 iServerModel->StoreASYThreadID( aCallerThreadID, aGenericID.UniqueID() ); |
267 iServerModel->StoreASYThreadIDL( aCallerThreadID, aGenericID.UniqueID() ); |
281 |
268 |
282 iServerModel->AddPhysicalConnectionL( aGenericID ); |
269 iServerModel->AddPhysicalConnectionL( aGenericID ); |
283 |
270 |
284 iWiredConnPublisher->HandleConnectL( aGenericID ); |
271 iWiredConnPublisher->HandleConnectL( aGenericID ); |
285 |
272 |
709 void CAccSrvConnectionController::PromoteToConnectedL( |
696 void CAccSrvConnectionController::PromoteToConnectedL( |
710 const TAccPolGenericID& aGenericID ) |
697 const TAccPolGenericID& aGenericID ) |
711 { |
698 { |
712 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::PromoteToConnectedL()" ); |
699 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::PromoteToConnectedL()" ); |
713 |
700 |
714 iServerModel->RemovePhysicalConnection( aGenericID ); //Move GID from physical connection array |
701 if( KErrNotFound != iServerModel->RemovePhysicalConnection( aGenericID )) //Move GID from physical connection array |
715 iServerModel->AddConnectionL( aGenericID ); //to connection array |
702 { |
716 |
703 iServerModel->AddConnectionL( aGenericID ); //to connection array |
717 iNotificationQueue->CompleteControlMessageL( ENewAccessoryConnected, |
704 |
718 KErrNone, |
705 iNotificationQueue->CompleteControlMessageL( ENewAccessoryConnected, |
719 aGenericID.UniqueID() ); |
706 KErrNone, |
720 |
707 aGenericID.UniqueID() ); |
721 iConnectionStatusHandler->IssueRequest(); |
708 |
|
709 iConnectionStatusHandler->IssueRequest(); |
|
710 } |
722 |
711 |
723 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::PromoteToConnectedL - return void" ); |
712 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::PromoteToConnectedL - return void" ); |
724 } |
713 } |
725 |
714 |
726 // ----------------------------------------------------------------------------- |
715 // ----------------------------------------------------------------------------- |
815 iNotificationQueue->CompleteControlMessageL( EAccessoryConnectionStatusChanged, |
804 iNotificationQueue->CompleteControlMessageL( EAccessoryConnectionStatusChanged, |
816 KErrNone, |
805 KErrNone, |
817 KErrNotFound ); |
806 KErrNotFound ); |
818 iSettingsHandler->ConnectionStatusChangedL( genericIDArray ); |
807 iSettingsHandler->ConnectionStatusChangedL( genericIDArray ); |
819 |
808 |
820 // Able to show notes |
|
821 iShowNotes = ETrue; |
|
822 iModeHandler->IssueRequest(); |
809 iModeHandler->IssueRequest(); |
823 |
810 |
824 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionStatusChangedL - return void" ); |
811 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionStatusChangedL - return void" ); |
825 } |
812 } |
826 |
813 |
882 { |
869 { |
883 iNotificationQueue->CompleteControlMessageL( EAccessoryModeChanged, |
870 iNotificationQueue->CompleteControlMessageL( EAccessoryModeChanged, |
884 KErrNone, |
871 KErrNone, |
885 KErrNotFound ); |
872 KErrNotFound ); |
886 } |
873 } |
887 |
|
888 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleAccessoryModeChangedL - Show information note!" ); |
|
889 |
|
890 TBool showNote( EFalse ); |
|
891 TInt noteValue( 0 ); |
|
892 |
|
893 switch ( accMode.iAccessoryMode ) |
|
894 { |
|
895 case EAccModeWiredHeadset: |
|
896 case EAccModeWiredCarKit: |
|
897 case EAccModeTextDevice: |
|
898 case EAccModeLoopset: |
|
899 case EAccModeMusicStand: |
|
900 case EAccModeTVOut: |
|
901 case EAccModeHeadphones: |
|
902 { |
|
903 TAccPolGenericID genericID; |
|
904 iServerModel->GetLastConnectedAccessoryL( genericID ); |
|
905 TUint32 num = genericID.SubblockCaps(); |
|
906 if ( genericID.PhysicalConnectionCaps() != KPCHDMI ) // No info note for HDMI |
|
907 { |
|
908 if( num & KSBAudioSubblock ) |
|
909 { |
|
910 CCapValue* capValue = iServerModel->CapabilityStorage().GetCapability( genericID, KAccIntegratedAudioInput ); |
|
911 if( iInformationNoteDefault ) |
|
912 { |
|
913 noteValue = iInformationNoteDefault; |
|
914 showNote = ETrue; |
|
915 } |
|
916 if( !capValue && !iInformationNoteDefault ) |
|
917 { |
|
918 showNote = ETrue; |
|
919 } |
|
920 } |
|
921 else |
|
922 { |
|
923 if( iInformationNoteDefault ) |
|
924 { |
|
925 noteValue = iInformationNoteDefault; |
|
926 showNote = ETrue; |
|
927 } |
|
928 } |
|
929 } |
|
930 } |
|
931 break; |
|
932 default: |
|
933 { |
|
934 showNote = EFalse; |
|
935 } |
|
936 break; |
|
937 } |
|
938 |
|
939 if ( showNote && iShowNotes ) |
|
940 { |
|
941 if( iServerModel->IdleDetected() ) |
|
942 { |
|
943 if ( iNotifier.Handle() ) |
|
944 { |
|
945 iNotifier.Close(); |
|
946 } |
|
947 if( IsActive() ) |
|
948 { |
|
949 Cancel(); |
|
950 } |
|
951 |
|
952 //connect to notifier |
|
953 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleAccessoryModeChangedL - notifier.Connect" ); |
|
954 TInt err = iNotifier.Connect(); |
|
955 if(err != KErrNone) |
|
956 { |
|
957 //ok if cannot show note, this is possible during boot |
|
958 COM_TRACE_1( "[AccFW:AccServer] CAccSrvConnectionController::HandleAccessoryModeChangedL - Couldn't connect to notifier: err = %d", err); |
|
959 } |
|
960 else |
|
961 { |
|
962 TPckg<TInt> valuePckg( noteValue ); |
|
963 iStatus = KRequestPending; |
|
964 iNotifier.StartNotifierAndGetResponse( |
|
965 iStatus, |
|
966 KAccFwUiNoteNotifierUid, |
|
967 valuePckg, |
|
968 iReplyPck); |
|
969 SetActive(); |
|
970 } |
|
971 } |
|
972 //reset values |
|
973 iShowNotes = EFalse; |
|
974 iInformationNoteUID = 0; |
|
975 iInformationNoteDefault = 0; |
|
976 } |
|
977 } |
874 } |
978 else |
875 else |
979 { |
876 { |
980 // Accessory Mode was allready up-to-date, |
877 // Accessory Mode was allready up-to-date, |
981 // no need to complete Accessory Mode changed notification. |
878 // no need to complete Accessory Mode changed notification. |
994 const TUint32 aDefaultValue ) |
891 const TUint32 aDefaultValue ) |
995 { |
892 { |
996 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::SetDefaultAccessoryInformation()" ); |
893 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::SetDefaultAccessoryInformation()" ); |
997 iInformationNoteUID = aGenericID.UniqueID(); |
894 iInformationNoteUID = aGenericID.UniqueID(); |
998 iInformationNoteDefault = aDefaultValue; |
895 iInformationNoteDefault = aDefaultValue; |
999 } |
|
1000 |
|
1001 // ----------------------------------------------------------------------------- |
|
1002 // CAccSrvConnectionController::RunL |
|
1003 // ----------------------------------------------------------------------------- |
|
1004 // |
|
1005 void CAccSrvConnectionController::RunL() |
|
1006 { |
|
1007 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::RunL()" ); |
|
1008 |
|
1009 iNotifier.Close(); |
|
1010 } |
|
1011 |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // CAccSrvConnectionController::DoCancel |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // |
|
1016 void CAccSrvConnectionController::DoCancel() |
|
1017 { |
|
1018 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::DoCancel()" ); |
|
1019 |
|
1020 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::DoCancel - return void" ); |
|
1021 } |
896 } |
1022 |
897 |
1023 // ----------------------------------------------------------------------------- |
898 // ----------------------------------------------------------------------------- |
1024 // CAccSrvConnectionController::RegisterControlMessageL |
899 // CAccSrvConnectionController::RegisterControlMessageL |
1025 // ----------------------------------------------------------------------------- |
900 // ----------------------------------------------------------------------------- |