mpxmusicplayer/mediakeyhandler/src/mpxmediakeyhandlerimp.cpp
branchRCL_3
changeset 17 70a8526f03f2
parent 15 a1247965635c
child 18 56b11cf8addb
equal deleted inserted replaced
15:a1247965635c 17:70a8526f03f2
    25 #include <AknUtils.h>
    25 #include <AknUtils.h>
    26 #include <eikenv.h>
    26 #include <eikenv.h>
    27 #include <bautils.h>
    27 #include <bautils.h>
    28 #include <StringLoader.h>
    28 #include <StringLoader.h>
    29 #include <apgwgnam.h>
    29 #include <apgwgnam.h>
       
    30 #include <utf.h>
    30 
    31 
    31 #ifdef UPNP_INCLUDED
    32 #ifdef UPNP_INCLUDED
    32 #include <upnpcopycommand.h>  
    33 #include <upnpcopycommand.h>  
    33 #endif
    34 #endif
    34 
    35 
    66 const TInt KMPXMaxVolume(100);		// Max volume used in volume popup
    67 const TInt KMPXMaxVolume(100);		// Max volume used in volume popup
    67 const TInt KMPXVolumeSteps(1);
    68 const TInt KMPXVolumeSteps(1);
    68 const TInt KTenStepsVolume = 10;   
    69 const TInt KTenStepsVolume = 10;   
    69 const TInt KTwentyStepsVolume = 20;
    70 const TInt KTwentyStepsVolume = 20;
    70 
    71 
       
    72 const TRemConCoreApiOperationId KSupportedCoreFeatures[] = {
       
    73         ERemConCoreApiVolumeUp,
       
    74         ERemConCoreApiVolumeDown,
       
    75         ERemConCoreApiPlay,
       
    76         ERemConCoreApiStop,
       
    77         ERemConCoreApiPause,
       
    78         ERemConCoreApiRewind,
       
    79         ERemConCoreApiFastForward,
       
    80         ERemConCoreApiForward,
       
    81         ERemConCoreApiBackward,
       
    82         ERemConCoreApiPausePlayFunction
       
    83 };
       
    84 
    71 _LIT( KMPXMediaKeyHandlerRscPath, "mpxmediakeyhandler.rsc" );
    85 _LIT( KMPXMediaKeyHandlerRscPath, "mpxmediakeyhandler.rsc" );
    72 
    86 
    73 
    87 
    74 // ======== MEMBER FUNCTIONS ========
    88 // ======== MEMBER FUNCTIONS ========
    75 
    89 
   103     BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
   117     BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
   104     iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
   118     iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
   105 
   119 
   106     // Register to remote control framework
   120     // Register to remote control framework
   107     iInterfaceSelector = CRemConInterfaceSelector::NewL();
   121     iInterfaceSelector = CRemConInterfaceSelector::NewL();
   108     iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
   122 
       
   123     // For AVRCP 1.4 support, pass the core features to the target API. 
       
   124     TInt entrySize = sizeof( KSupportedCoreFeatures[0] );
       
   125     TRemConCoreApiOperationId* entries = (TRemConCoreApiOperationId*) &KSupportedCoreFeatures[0];
       
   126     TInt count = sizeof( KSupportedCoreFeatures ) / entrySize;
       
   127     RArray<TRemConCoreApiOperationId> coreFeatures( entrySize, entries, count );
       
   128     iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this, coreFeatures );
       
   129 
   109     // For handling AVRCP 1.3 metadata
   130     // For handling AVRCP 1.3 metadata
   110     iMetaDataHandler = MMPXMetaDataHandler::NewL(*iInterfaceSelector);
   131     iMetaDataHandler = MMPXMetaDataHandler::NewL(*iInterfaceSelector);
   111     iInterfaceSelector->OpenTargetL();
   132     
       
   133     // For AVRCP 1.4 support, make the player named. 
       
   134     HBufC* avsrcname = StringLoader::LoadLC( R_MPX_AVSRC_NAME_TEXT );
       
   135     HBufC8* avsrcname8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( avsrcname->Des() );
       
   136     CleanupStack::PushL( avsrcname8 );
       
   137     iInterfaceSelector->OpenTargetL(ERemConAudioPlayer, ERemConNoSubType, *avsrcname8);
       
   138     CleanupStack::PopAndDestroy( avsrcname8 );
       
   139     CleanupStack::PopAndDestroy( avsrcname );
   112     iResponseHandler = CMPXRemConKeyResponse::NewL( *iCoreTarget );
   140     iResponseHandler = CMPXRemConKeyResponse::NewL( *iCoreTarget );
   113 
   141 
   114     // Timer for implementing repeat
   142     // Timer for implementing repeat
   115     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   143     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   116 
   144