21 #include "musapplicationmanager.h" |
21 #include "musapplicationmanager.h" |
22 #include "musmanagercommon.h" |
22 #include "musmanagercommon.h" |
23 #include "musmanagerservercommon.h" |
23 #include "musmanagerservercommon.h" |
24 #include "mussessionproperties.h" |
24 #include "mussessionproperties.h" |
25 #include "musuid.hrh" |
25 #include "musuid.hrh" |
26 #include "mussettings.h" |
|
27 /* PS keys related to NMusSessionInformationApi defined here */ |
|
28 #include "mussesseioninformationapi.h" |
|
29 #include "muscleanupresetanddestroy.h" |
|
30 #include "lcengine.h" |
|
31 |
26 |
32 #include <apacmdln.h> |
27 #include <apacmdln.h> |
33 #include <apgtask.h> |
28 #include <apgtask.h> |
|
29 //#include <badesca.h> |
34 #include <e32cmn.h> |
30 #include <e32cmn.h> |
35 #include <e32property.h> |
31 #include <e32property.h> |
36 #include <utf.h> |
|
37 #include <apadef.h> |
|
38 |
|
39 |
32 |
40 // CONSTANTS |
33 // CONSTANTS |
41 _LIT8( KDefaultEngineName, "MultimediaSharing" ); |
34 |
42 _LIT( KMusUiProcessName, "musui.exe" ); |
|
43 |
35 |
44 // ----------------------------------------------------------------------------- |
36 // ----------------------------------------------------------------------------- |
45 // CMusApplicationManager::NewL |
37 // CMusApplicationManager::NewL |
46 // ----------------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------------- |
47 // |
39 // |
200 MDesCArray& aSessionParameters ) |
197 MDesCArray& aSessionParameters ) |
201 { |
198 { |
202 MUS_LOG2( "mus: [MUSSRV] -> \ |
199 MUS_LOG2( "mus: [MUSSRV] -> \ |
203 CMusApplicationManager::WriteSessionPropertiesL( %d, %d )", |
200 CMusApplicationManager::WriteSessionPropertiesL( %d, %d )", |
204 ( TInt ) aUseCase, ( TInt ) aStatus ); |
201 ( TInt ) aUseCase, ( TInt ) aStatus ); |
205 TRAPD( error, |
202 |
206 if ( aUseCase == MultimediaSharing::EMusLiveVideo && |
|
207 MultimediaSharingSettings::VideoDirectionL() == |
|
208 MusSettingsKeys::ETwoWayVideo ) |
|
209 { |
|
210 MUS_LOG( "mus: [MUSSRV] UseCase MultimediaSharing::EMusTwoWayVideo" ); |
|
211 aUseCase = MultimediaSharing::EMusTwoWayVideo; |
|
212 } |
|
213 ) |
|
214 if ( error == KErrNoMemory ) |
|
215 { |
|
216 User::Leave( error ); |
|
217 } |
|
218 // set use case property |
203 // set use case property |
219 SetPropertyL( NMusSessionApi::KUseCase, ( TInt ) aUseCase ); |
204 SetPropertyL( NMusSessionApi::KUseCase, |
|
205 ( TInt ) aUseCase ); |
220 |
206 |
221 WriteSessionPropertiesL( aStatus, aSessionParameters ); |
207 WriteSessionPropertiesL( aStatus, aSessionParameters ); |
222 |
208 |
223 |
209 |
224 MUS_LOG( "mus: [MUSSRV] <- \ |
210 MUS_LOG( "mus: [MUSSRV] <- \ |
269 |
255 |
270 // contact name |
256 // contact name |
271 SetPropertyL( NMusSessionApi::KContactName, |
257 SetPropertyL( NMusSessionApi::KContactName, |
272 aSessionParameters.MdcaPoint( KContactName ) ); |
258 aSessionParameters.MdcaPoint( KContactName ) ); |
273 |
259 |
274 // fast mode |
260 // set status property |
275 TInt fastMode; |
|
276 User::LeaveIfError( RProperty::Get( NMusSessionApi::KCategoryUid, |
|
277 NMusSessionApi::KFastMode, |
|
278 fastMode ) ); |
|
279 if ( fastMode != MusSettingsKeys::EFastModeDisabled ) |
|
280 { |
|
281 lex.Assign( aSessionParameters.MdcaPoint( KFastMode ) ); |
|
282 lex.Val( val ); |
|
283 SetPropertyL( NMusSessionApi::KFastMode, val ); |
|
284 } |
|
285 else |
|
286 { |
|
287 MUS_LOG( "mus: [MUSSRV] fast mode disabled, do not update it" ); |
|
288 } |
|
289 |
|
290 // set status property |
|
291 SetStatusL( aStatus ); |
261 SetStatusL( aStatus ); |
|
262 |
|
263 // set privacy property |
|
264 lex.Assign( aSessionParameters.MdcaPoint( KPrivacyStatus ) ); |
|
265 lex.Val( val ); |
|
266 |
|
267 SetPropertyL( NMusSessionApi::KPrivacyStatus, val ); |
292 |
268 |
293 MUS_LOG( "mus: [MUSSRV] <- \ |
269 MUS_LOG( "mus: [MUSSRV] <- \ |
294 CMusApplicationManager::WriteSessionPropertiesL()" ); |
270 CMusApplicationManager::WriteSessionPropertiesL()" ); |
295 } |
271 } |
296 |
272 |
390 aValue ) ); |
366 aValue ) ); |
391 |
367 |
392 MUS_LOG( "mus: [MUSSRV] <- CMusApplicationManager::SetPropertyL()" ); |
368 MUS_LOG( "mus: [MUSSRV] <- CMusApplicationManager::SetPropertyL()" ); |
393 } |
369 } |
394 |
370 |
395 // ----------------------------------------------------------------------------- |
371 |
396 // Reads the callprovider description from the PS key |
372 // ----------------------------------------------------------------------------- |
397 // return aProvider will have the proper callprovider name. |
373 // |
398 // ----------------------------------------------------------------------------- |
374 // ----------------------------------------------------------------------------- |
399 // |
375 // |
400 void CMusApplicationManager::CallProviderL(TDes8& aProvider) |
376 TApaTask CMusApplicationManager::GetApaTask() |
401 { |
377 { |
402 MUS_LOG( "mus: [MUSSRV] -> CMusApplicationManager::CallProviderL"); |
378 MUS_LOG( "mus: [MUSSRV] <> CMusApplicationManager::GetApaTask()" ); |
403 const TInt KMusMgrMaxPluginNameLen = 256; |
379 TUid appUid; |
404 TBuf<KMusMgrMaxPluginNameLen> pluginName; |
380 appUid.iUid = KMusUiUid; |
405 |
381 return TApaTaskList( iWsSession ).FindApp( appUid ); |
406 User::LeaveIfError(RProperty::Get( |
382 } |
407 NMusSessionInformationApi::KCategoryUid, |
|
408 NMusSessionInformationApi::KMUSCallProvider, |
|
409 pluginName )); |
|
410 User::LeaveIfError( |
|
411 CnvUtfConverter::ConvertFromUnicodeToUtf8( aProvider, pluginName )); |
|
412 |
|
413 MUS_LOG( "mus: [MUSSRV] <- CMusApplicationManager::CallProviderL"); |
|
414 } |
|
415 |
|
416 // ----------------------------------------------------------------------------- |
|
417 // Resolves name of the ecom plugin which implements the livecomms engine api |
|
418 // by using the callprovider |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 void CMusApplicationManager::ResolvePluginNameL(TDes8& aPluginName) |
|
422 { |
|
423 MUS_LOG( "mus: [MUSSRV] -> CMusApplicationManager::ResolvePluginNameL"); |
|
424 |
|
425 TBuf8<RProperty::KMaxPropertySize> providerName ; |
|
426 |
|
427 // Read the call provider name |
|
428 CallProviderL( providerName ); |
|
429 |
|
430 RImplInfoPtrArray pluginArray; |
|
431 MusCleanupResetAndDestroy<RImplInfoPtrArray>::PushL( pluginArray ); |
|
432 |
|
433 TEComResolverParams resolverParams; |
|
434 |
|
435 resolverParams.SetDataType ( providerName ); |
|
436 resolverParams.SetWildcardMatch (ETrue); |
|
437 |
|
438 // Use default plugin even if listing fails |
|
439 TRAPD( err, |
|
440 REComSession::ListImplementationsL(KLcEngineInterfaceUid, resolverParams, pluginArray) ); |
|
441 MUS_LOG1( "mus: [MUSSRV] List implementations compl:%d", err ); |
|
442 if ( err == KErrNoMemory ) |
|
443 { |
|
444 User::Leave( err ); |
|
445 } |
|
446 |
|
447 if( pluginArray.Count() > 0 ) |
|
448 { |
|
449 CImplementationInformation* info = pluginArray[ 0 ]; |
|
450 __ASSERT_ALWAYS( aPluginName.MaxLength() >= info->DataType().Length(), |
|
451 User::Leave( KErrArgument ) ); |
|
452 aPluginName.Copy( info->DataType() ); |
|
453 } |
|
454 else |
|
455 { |
|
456 __ASSERT_ALWAYS( aPluginName.MaxLength() >= KDefaultEngineName().Length(), |
|
457 User::Leave( KErrArgument ) ); |
|
458 aPluginName.Copy( KDefaultEngineName() ); |
|
459 } |
|
460 CleanupStack::PopAndDestroy();//pluginArray |
|
461 MUS_LOG( "mus: [MUSSRV] <- CMusApplicationManager::ResolvePluginNameL"); |
|
462 } |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // Creates command line used when starting application. |
|
466 // ----------------------------------------------------------------------------- |
|
467 // |
|
468 HBufC* CMusApplicationManager::CreateCommandLineArgsLC() |
|
469 { |
|
470 MUS_LOG( "mus: [MUSSRV] -> CMusApplicationManager::CreateCommandLineLC"); |
|
471 |
|
472 TBuf8<KMusMgrMaxPluginNameLen> pluginNameUtf8; |
|
473 ResolvePluginNameL( pluginNameUtf8 ); |
|
474 |
|
475 MUS_LOG_TDESC8( "mus: [MUSSRV] Plugin name:", pluginNameUtf8 ); |
|
476 |
|
477 HBufC* commandLineArgs = HBufC::NewLC( KMusMgrMaxPluginNameLen ); |
|
478 TPtr commandLineArgsPtr( commandLineArgs->Des() ); |
|
479 User::LeaveIfError( |
|
480 CnvUtfConverter::ConvertToUnicodeFromUtf8( |
|
481 commandLineArgsPtr, pluginNameUtf8 ) ); |
|
482 |
|
483 MUS_LOG_TDESC( "mus: [MUSSRV] <- command line args:", commandLineArgsPtr ); |
|
484 |
|
485 return commandLineArgs; |
|
486 } |
|
487 |
|
488 // End of File |
|