equal
deleted
inserted
replaced
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <aknsoundsystem.h> |
20 #include <aknsoundsystem.h> |
21 #include <aknappui.h> |
21 #include <aknappui.h> |
|
22 #include <AccessoryServer.h> //RAccessoryServer |
|
23 #include <AccessoryConnection.h> //RAccessoryConnection |
22 |
24 |
23 #include <centralrepository.h> |
25 #include <centralrepository.h> |
24 |
26 |
25 #include <StringLoader.h> |
27 #include <StringLoader.h> |
26 #include <AudioPreference.h> |
28 #include <AudioPreference.h> |
65 delete iAudioPlayer; |
67 delete iAudioPlayer; |
66 } |
68 } |
67 |
69 |
68 delete iStartSound; |
70 delete iStartSound; |
69 delete iConfirmationSound; |
71 delete iConfirmationSound; |
|
72 delete iBtStartSound; |
70 |
73 |
71 iObserver = NULL; |
74 iObserver = NULL; |
72 |
75 |
73 RUBY_DEBUG0( "CTonePlayer::~CTonePlayer EXIT" ); |
76 RUBY_DEBUG0( "CTonePlayer::~CTonePlayer EXIT" ); |
74 } |
77 } |
102 client->Get( KSRSFPlaybackVolume, iVolume ); |
105 client->Get( KSRSFPlaybackVolume, iVolume ); |
103 CleanupStack::PopAndDestroy( client ); |
106 CleanupStack::PopAndDestroy( client ); |
104 |
107 |
105 iStartSound = StringLoader::LoadL( R_VOICE_START_SOUND_PATH ); |
108 iStartSound = StringLoader::LoadL( R_VOICE_START_SOUND_PATH ); |
106 iConfirmationSound = StringLoader::LoadL( R_VOICE_CONFIRMATION_SOUND_PATH ); |
109 iConfirmationSound = StringLoader::LoadL( R_VOICE_CONFIRMATION_SOUND_PATH ); |
|
110 iBtStartSound = StringLoader::LoadL( R_VOICE_BT_START_SOUND_PATH ); |
|
111 iBTAcc = EFalse; |
|
112 |
|
113 ChekcAccesoryStatusL(); |
107 } |
114 } |
108 |
115 |
109 // --------------------------------------------------------- |
116 // --------------------------------------------------------- |
110 // CTonePlayer::RegisterObserver |
117 // CTonePlayer::RegisterObserver |
111 // Sets the observer |
118 // Sets the observer |
133 iAudioPlayer->Close(); |
140 iAudioPlayer->Close(); |
134 |
141 |
135 if ( aSid == EAvkonSIDNameDiallerStartTone ) |
142 if ( aSid == EAvkonSIDNameDiallerStartTone ) |
136 { |
143 { |
137 RUBY_DEBUG0( "CTonePlayer::InitToneL - case: EAvkonSIDNameDiallerStartTone" ); |
144 RUBY_DEBUG0( "CTonePlayer::InitToneL - case: EAvkonSIDNameDiallerStartTone" ); |
138 |
145 TInt err = KErrNone; |
139 TRAPD( err, iAudioPlayer->OpenFileL( *iStartSound ) ); |
146 if ( iBTAcc ) |
|
147 { |
|
148 TRAP( err, iAudioPlayer->OpenFileL( *iBtStartSound ) ); |
|
149 } |
|
150 else |
|
151 { |
|
152 TRAP( err, iAudioPlayer->OpenFileL( *iStartSound ) ); |
|
153 } |
140 if ( err ) |
154 if ( err ) |
141 { |
155 { |
142 RUBY_ERROR1( "CTonePlayer::InitToneL - err [%d]", err ); |
156 RUBY_ERROR1( "CTonePlayer::InitToneL - err [%d]", err ); |
143 |
157 |
144 // Cannot play sound, but observer still needs to be notified |
158 // Cannot play sound, but observer still needs to be notified |
246 } |
260 } |
247 |
261 |
248 return volume; |
262 return volume; |
249 } |
263 } |
250 |
264 |
|
265 // --------------------------------------------------------- |
|
266 // CTonePlayer::ChekcAccesoryStatus |
|
267 // --------------------------------------------------------- |
|
268 // |
|
269 void CTonePlayer::ChekcAccesoryStatusL() |
|
270 { |
|
271 // Connection to the accessory server |
|
272 RAccessoryServer accessoryServer; |
|
273 // Subsession for server |
|
274 RAccessoryConnection accessoryConnection; |
|
275 //Generic ID array for accessories |
|
276 TAccPolGenericIDArray accessoryArray; |
|
277 |
|
278 TInt err = KErrNone; |
|
279 //connect to accessory server |
|
280 err = accessoryServer.Connect(); |
|
281 if ( err == KErrNone ) |
|
282 { |
|
283 //create subsession to accessory server |
|
284 err = accessoryConnection.CreateSubSession( accessoryServer ); |
|
285 if ( err == KErrNone ) |
|
286 { |
|
287 accessoryConnection.GetAccessoryConnectionStatus( accessoryArray ); |
|
288 |
|
289 TAccPolGenericID genId; |
|
290 for ( TInt i = 0; i < accessoryArray.Count(); i++ ) |
|
291 { |
|
292 genId = accessoryArray.GetGenericIDL( i ); |
|
293 |
|
294 if ( genId.PhysicalConnectionCaps( KPCBluetooth ) && |
|
295 ( genId.DeviceTypeCaps( KDTHeadset ) || genId.DeviceTypeCaps( KDTCarKit ) ) ) |
|
296 { |
|
297 iBTAcc = ETrue; |
|
298 } |
|
299 } |
|
300 } |
|
301 } |
|
302 |
|
303 accessoryConnection.CloseSubSession(); |
|
304 accessoryServer.Close(); |
|
305 } |
|
306 |
251 // End of File |
307 // End of File |
252 |
308 |