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 |
815 iNotificationQueue->CompleteControlMessageL( EAccessoryConnectionStatusChanged, |
802 iNotificationQueue->CompleteControlMessageL( EAccessoryConnectionStatusChanged, |
816 KErrNone, |
803 KErrNone, |
817 KErrNotFound ); |
804 KErrNotFound ); |
818 iSettingsHandler->ConnectionStatusChangedL( genericIDArray ); |
805 iSettingsHandler->ConnectionStatusChangedL( genericIDArray ); |
819 |
806 |
820 // Able to show notes |
|
821 iShowNotes = ETrue; |
|
822 iModeHandler->IssueRequest(); |
807 iModeHandler->IssueRequest(); |
823 |
808 |
824 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionStatusChangedL - return void" ); |
809 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::HandleConnectionStatusChangedL - return void" ); |
825 } |
810 } |
826 |
811 |
882 { |
867 { |
883 iNotificationQueue->CompleteControlMessageL( EAccessoryModeChanged, |
868 iNotificationQueue->CompleteControlMessageL( EAccessoryModeChanged, |
884 KErrNone, |
869 KErrNone, |
885 KErrNotFound ); |
870 KErrNotFound ); |
886 } |
871 } |
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 } |
872 } |
978 else |
873 else |
979 { |
874 { |
980 // Accessory Mode was allready up-to-date, |
875 // Accessory Mode was allready up-to-date, |
981 // no need to complete Accessory Mode changed notification. |
876 // no need to complete Accessory Mode changed notification. |
994 const TUint32 aDefaultValue ) |
889 const TUint32 aDefaultValue ) |
995 { |
890 { |
996 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::SetDefaultAccessoryInformation()" ); |
891 COM_TRACE_( "[AccFW:AccServer] CAccSrvConnectionController::SetDefaultAccessoryInformation()" ); |
997 iInformationNoteUID = aGenericID.UniqueID(); |
892 iInformationNoteUID = aGenericID.UniqueID(); |
998 iInformationNoteDefault = aDefaultValue; |
893 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 } |
894 } |
1022 |
895 |
1023 // ----------------------------------------------------------------------------- |
896 // ----------------------------------------------------------------------------- |
1024 // CAccSrvConnectionController::RegisterControlMessageL |
897 // CAccSrvConnectionController::RegisterControlMessageL |
1025 // ----------------------------------------------------------------------------- |
898 // ----------------------------------------------------------------------------- |