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" |
26 |
31 |
27 #include <apacmdln.h> |
32 #include <apacmdln.h> |
28 #include <apgtask.h> |
33 #include <apgtask.h> |
29 //#include <badesca.h> |
|
30 #include <e32cmn.h> |
34 #include <e32cmn.h> |
31 #include <e32property.h> |
35 #include <e32property.h> |
|
36 #include <utf.h> |
|
37 #include <apadef.h> |
|
38 |
32 |
39 |
33 // CONSTANTS |
40 // CONSTANTS |
34 |
41 _LIT8( KDefaultEngineName, "MultimediaSharing" ); |
|
42 _LIT( KMusUiProcessName, "musui.exe" ); |
35 |
43 |
36 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
37 // CMusApplicationManager::NewL |
45 // CMusApplicationManager::NewL |
38 // ----------------------------------------------------------------------------- |
46 // ----------------------------------------------------------------------------- |
39 // |
47 // |
197 MDesCArray& aSessionParameters ) |
200 MDesCArray& aSessionParameters ) |
198 { |
201 { |
199 MUS_LOG2( "mus: [MUSSRV] -> \ |
202 MUS_LOG2( "mus: [MUSSRV] -> \ |
200 CMusApplicationManager::WriteSessionPropertiesL( %d, %d )", |
203 CMusApplicationManager::WriteSessionPropertiesL( %d, %d )", |
201 ( TInt ) aUseCase, ( TInt ) aStatus ); |
204 ( TInt ) aUseCase, ( TInt ) aStatus ); |
202 |
205 TRAPD( error, |
|
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 } |
203 // set use case property |
218 // set use case property |
204 SetPropertyL( NMusSessionApi::KUseCase, |
219 SetPropertyL( NMusSessionApi::KUseCase, ( TInt ) aUseCase ); |
205 ( TInt ) aUseCase ); |
|
206 |
220 |
207 WriteSessionPropertiesL( aStatus, aSessionParameters ); |
221 WriteSessionPropertiesL( aStatus, aSessionParameters ); |
208 |
222 |
209 |
223 |
210 MUS_LOG( "mus: [MUSSRV] <- \ |
224 MUS_LOG( "mus: [MUSSRV] <- \ |
255 |
269 |
256 // contact name |
270 // contact name |
257 SetPropertyL( NMusSessionApi::KContactName, |
271 SetPropertyL( NMusSessionApi::KContactName, |
258 aSessionParameters.MdcaPoint( KContactName ) ); |
272 aSessionParameters.MdcaPoint( KContactName ) ); |
259 |
273 |
260 // set status property |
274 // fast mode |
|
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 |
261 SetStatusL( aStatus ); |
291 SetStatusL( aStatus ); |
262 |
|
263 // set privacy property |
|
264 lex.Assign( aSessionParameters.MdcaPoint( KPrivacyStatus ) ); |
|
265 lex.Val( val ); |
|
266 |
|
267 SetPropertyL( NMusSessionApi::KPrivacyStatus, val ); |
|
268 |
292 |
269 MUS_LOG( "mus: [MUSSRV] <- \ |
293 MUS_LOG( "mus: [MUSSRV] <- \ |
270 CMusApplicationManager::WriteSessionPropertiesL()" ); |
294 CMusApplicationManager::WriteSessionPropertiesL()" ); |
271 } |
295 } |
272 |
296 |
366 aValue ) ); |
390 aValue ) ); |
367 |
391 |
368 MUS_LOG( "mus: [MUSSRV] <- CMusApplicationManager::SetPropertyL()" ); |
392 MUS_LOG( "mus: [MUSSRV] <- CMusApplicationManager::SetPropertyL()" ); |
369 } |
393 } |
370 |
394 |
371 |
395 // ----------------------------------------------------------------------------- |
372 // ----------------------------------------------------------------------------- |
396 // Reads the callprovider description from the PS key |
373 // |
397 // return aProvider will have the proper callprovider name. |
374 // ----------------------------------------------------------------------------- |
398 // ----------------------------------------------------------------------------- |
375 // |
399 // |
376 TApaTask CMusApplicationManager::GetApaTask() |
400 void CMusApplicationManager::CallProviderL(TDes8& aProvider) |
377 { |
401 { |
378 MUS_LOG( "mus: [MUSSRV] <> CMusApplicationManager::GetApaTask()" ); |
402 MUS_LOG( "mus: [MUSSRV] -> CMusApplicationManager::CallProviderL"); |
379 TUid appUid; |
403 const TInt KMusMgrMaxPluginNameLen = 256; |
380 appUid.iUid = KMusUiUid; |
404 TBuf<KMusMgrMaxPluginNameLen> pluginName; |
381 return TApaTaskList( iWsSession ).FindApp( appUid ); |
405 |
382 } |
406 User::LeaveIfError(RProperty::Get( |
|
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 |