fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp
changeset 0 f3d95d9c00ab
child 8 3cb097cb90f8
equal deleted inserted replaced
-1:000000000000 0:f3d95d9c00ab
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implementation for the FM Radio Content Publisher Plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <AknUtils.h>
       
    19 #include <bautils.h>
       
    20 #include <coemain.h>
       
    21 #include <data_caging_path_literals.hrh>
       
    22 #include <data_caging_paths_strings.hrh>
       
    23 #include <e32cmn.h>
       
    24 #include <ecom/implementationproxy.h>
       
    25 #include <liwvariant.h>
       
    26 #include <StringLoader.h>
       
    27 #include <aknsconstants.hrh>
       
    28 #include <AknsItemID.h>
       
    29 #include <fmradiomcpplugin.rsg>
       
    30 #include <fmradio.mbg>
       
    31 
       
    32 #include "fmradioactionhandler.h"
       
    33 #include "fmradioactionhandler.hrh"
       
    34 #include "fmradioactionhandlerdefs.h"
       
    35 #include "fmradioactiveidleengine.h"
       
    36 #include "fmradioactiveidleenginenotifyhandler.h"
       
    37 #include "fmradiodefines.h"
       
    38 #include "debug.h"
       
    39 #include "fmradiomcpplugin.h"
       
    40 #include "fmradiomcpplugin.hrh"
       
    41 #include "AknsConstants.h"
       
    42 
       
    43 _LIT( KFMRadioMifFileName, "fmradio.mif" );
       
    44 _LIT( KFMRadioMifDir, "\\resource\\apps\\" );
       
    45 
       
    46 _LIT( KFMRadioMCPPluginResourceFileName, "fmradiomcpplugin.rsc" );
       
    47 _LIT8( KFMRadioPluginUid, "plugin_id" );
       
    48 _LIT8( KFMRadioData, "data" );
       
    49 _LIT8( KType, "type" );
       
    50 
       
    51 const TUint KFMRadioPrevious        = 0x001; //000000000001
       
    52 const TUint KFMRadioNext            = 0x002; //000000000010
       
    53 const TUint KFMRadioMute            = 0x004; //000000000100
       
    54 const TUint KFMRadioUnmute          = 0x008; //000000001000
       
    55 const TUint KFMRadioPreviousDimmed  = 0x010; //000000010000
       
    56 const TUint KFMRadioNextDimmed      = 0x020; //000000100000
       
    57 const TUint KFMRadioMuteDimmed      = 0x040; //000001000000
       
    58 const TUint KFMRadioUnmuteDimmed    = 0x080; //000010000000
       
    59 
       
    60 CFMRadioMCPPlugin* CFMRadioMCPPlugin::NewL( MMCPPluginObserver* aObserver )
       
    61     {
       
    62     CFMRadioMCPPlugin* self = new ( ELeave ) CFMRadioMCPPlugin( aObserver );
       
    63     CleanupStack::PushL( self );
       
    64 
       
    65     self->ConstructL();
       
    66     
       
    67     CleanupStack::Pop( self );
       
    68     return self;
       
    69     }
       
    70 
       
    71 CFMRadioMCPPlugin::~CFMRadioMCPPlugin()
       
    72     {
       
    73     if ( iResourceOffset > 0 )
       
    74         {
       
    75         CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
       
    76         }
       
    77 
       
    78     delete iEngine;
       
    79     iNowPlayingText.Close();
       
    80     iLastPlayedText.Close();
       
    81     iAntennaNotConnectedText.Close();
       
    82     iTuningText.Close();
       
    83     iSavedStationFormat.Close();
       
    84     iSavedStationFormatNoName.Close();
       
    85     iFrequencyFormat.Close();
       
    86     iSavedStationFormatMenu.Close();
       
    87     iSavedStationFormatNoNameMenu.Close();
       
    88     iFrequencyFormatMenu.Close();
       
    89     
       
    90     iMifFileName.Close();
       
    91     }
       
    92 
       
    93 CFMRadioMCPPlugin::CFMRadioMCPPlugin( MMCPPluginObserver* aObserver )
       
    94     : iObserver( aObserver )
       
    95     {
       
    96     }
       
    97 
       
    98 void CFMRadioMCPPlugin::ConstructL()
       
    99     {
       
   100     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::ConstructL" )));
       
   101     InitializeResourceLoadingL();
       
   102     
       
   103     CCoeEnv* coeEnv = CCoeEnv::Static();
       
   104 
       
   105     iNowPlayingText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_NOW_PLAYING, coeEnv ) );
       
   106     iLastPlayedText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_LAST_PLAYED, coeEnv ) );
       
   107     
       
   108     iAntennaNotConnectedText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_CON_HEADSET, coeEnv ) );
       
   109     iTuningText.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_TUNING, coeEnv ) );
       
   110     iSavedStationFormat.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_STATION_SAVED, coeEnv ) );
       
   111     iSavedStationFormatNoName.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_STATION_SAVED_FREQ, coeEnv ) );
       
   112     iFrequencyFormat.Assign( StringLoader::LoadL( R_QTN_FMRADIO_WIDGET_NOTSAVED_FREQUENCY, coeEnv ) );
       
   113     
       
   114     iSavedStationFormatMenu.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_PLAYING_SAVED_WITH_NAME, coeEnv ) );
       
   115     iSavedStationFormatNoNameMenu.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_PLAYING_SAVED_WITHOUT_NAME, coeEnv ) );
       
   116     iFrequencyFormatMenu.Assign( StringLoader::LoadL( R_QTN_FMRADIO_SUITE_PLAYING_NOT_SAVED, coeEnv ) );
       
   117     
       
   118     // Release the resource file, because we don't want to keep file handle open.
       
   119     // That would prevent updating the binary with SIS. 
       
   120     if ( iResourceOffset > 0 )
       
   121         {
       
   122         coeEnv->DeleteResourceFile( iResourceOffset );
       
   123         iResourceOffset = 0;
       
   124         }
       
   125     
       
   126     TFindFile finder( coeEnv->FsSession() );
       
   127     TInt err = finder.FindByDir( KFMRadioMifFileName, KFMRadioMifDir );
       
   128     if ( err == KErrNone )
       
   129         {
       
   130         iMifFileName.CreateL( finder.File() );
       
   131         }
       
   132     
       
   133     iEngine = CFMRadioActiveIdleEngine::NewL( *this );
       
   134     iEngine->ActivateL();
       
   135     
       
   136     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::ConstructL - Exiting." )));    
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // Initialize resource file for loading resources.
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CFMRadioMCPPlugin::InitializeResourceLoadingL()
       
   144     {
       
   145     CCoeEnv* coeEnv = CCoeEnv::Static();
       
   146     RFs fs( coeEnv->FsSession() );
       
   147     TFileName fileName; 
       
   148     TFileName baseResource;
       
   149     TFindFile finder( fs );
       
   150     TLanguage language( ELangNone );
       
   151     
       
   152     TParsePtrC parse( KFMRadioMCPPluginResourceFileName );
       
   153     _LIT( resourceFileWildExt, ".r*" );
       
   154 
       
   155     // Make sure to find all resource files, not only .rsc files as it may be so
       
   156     // that there is only .r01, .r02, etc. files available
       
   157     fileName.Copy( parse.Name() );
       
   158     fileName.Append( resourceFileWildExt );
       
   159 
       
   160     // TFindFile applies search order that is from 
       
   161     // drive Y to A, then Z
       
   162     CDir* entries = NULL;
       
   163     TInt err = finder.FindWildByDir( fileName , KDC_RESOURCE_FILES_DIR, entries );
       
   164     delete entries;
       
   165     entries = NULL;
       
   166     TBool found = EFalse;
       
   167     while ( !found && err == KErrNone )
       
   168         {
       
   169         // Found file
       
   170         fileName.Zero();
       
   171         TParsePtrC foundPath( finder.File() );
       
   172         fileName.Copy( foundPath.DriveAndPath() );
       
   173         fileName.Append( KFMRadioMCPPluginResourceFileName );
       
   174         BaflUtils::NearestLanguageFile( fs, fileName, language );
       
   175         if ( language != ELangNone && BaflUtils::FileExists( fs, fileName ) )
       
   176             {
       
   177             found = ETrue;
       
   178             iResourceOffset = coeEnv->AddResourceFileL( fileName );
       
   179             }
       
   180         else
       
   181             {
       
   182             if ( language == ELangNone &&
       
   183                  !baseResource.Compare( KNullDesC ) &&
       
   184                  BaflUtils::FileExists( fs, fileName ) )
       
   185                 {
       
   186                 baseResource.Copy( fileName );
       
   187                 }
       
   188             err = finder.FindWild( entries );
       
   189             delete entries;
       
   190             entries = NULL;
       
   191             }
       
   192         }
       
   193 
       
   194     if ( !found && baseResource.Compare( KNullDesC ) )
       
   195         {
       
   196         // If we found *.rsc then better to use that than nothing
       
   197         if ( BaflUtils::FileExists( fs, baseResource ) )
       
   198             {
       
   199             iResourceOffset = coeEnv->AddResourceFileL( baseResource );
       
   200             found = ETrue;
       
   201             }
       
   202         }
       
   203 
       
   204     if( !found )
       
   205         {
       
   206         User::Leave( KErrNotFound );
       
   207         }
       
   208     }
       
   209 
       
   210 void CFMRadioMCPPlugin::Deactivate()
       
   211     {
       
   212     iActive = EFalse;
       
   213     }
       
   214 
       
   215 void CFMRadioMCPPlugin::ActivateL()
       
   216     {
       
   217     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::ActivateL()" )));
       
   218     iActive = ETrue;
       
   219     iObserver->BecameActiveL( this );
       
   220     
       
   221     iObserver->PublishTextL( this, EMusicWidgetDefaultText, KNullDesC );
       
   222 
       
   223     iObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
       
   224                     KAknsIIDQgnIndiRadioDefault, 
       
   225                     iMifFileName, 
       
   226                     EMbmFmradioQgn_indi_radio_default, 
       
   227                     EMbmFmradioQgn_indi_radio_default_mask);
       
   228 
       
   229     iObserver->PublishImageL( this, EMusicWidgetImage1,
       
   230                     KAknsIIDQgnIndiRadioDefault, 
       
   231                     iMifFileName, 
       
   232                     EMbmFmradioQgn_indi_radio_default, 
       
   233                     EMbmFmradioQgn_indi_radio_default_mask);
       
   234 
       
   235     InstallFMRadioCommandActionL( KFMRadioCommandValueStartNowPlaying, EMusicWidgetTrigger1 );
       
   236     InstallFMRadioCommandActionL( KFMRadioCommandValueStartNowPlaying, EMusicMenuMusicInfoTrigger );
       
   237     HandleChannelChangeL( iEngine->Channel() );
       
   238     }
       
   239 
       
   240 // ---------------------------------------------------------------------------
       
   241 // CFMRadioMCPPlugin::UpdatePublishedToolBarL
       
   242 // ---------------------------------------------------------------------------
       
   243 //
       
   244 void CFMRadioMCPPlugin::UpdatePublishedToolBarL( TUint aToolBarState )
       
   245     {
       
   246     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - Entering." ))); 
       
   247     if ( iActive )
       
   248         {
       
   249         TAknsItemID iconId;
       
   250         if ( KFMRadioPrevious & aToolBarState )
       
   251             {
       
   252             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 1 Enter" ))); 
       
   253             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbPrev );
       
   254             iObserver->PublishImageL( this, 
       
   255                                       EMusicWidgetToolbarB1, 
       
   256                                       iconId, 
       
   257                                       iMifFileName, 
       
   258                                       EMbmFmradioQgn_prop_image_tb_prev, 
       
   259                                       EMbmFmradioQgn_prop_image_tb_prev_mask );
       
   260             InstallFMRadioCommandActionL( KFMRadioCommandValueStepPrevious, EMusicWidgetTB1Trigger );
       
   261             iTbPreviousState = KFMRadioPrevious;
       
   262             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 1 Exit" ))); 
       
   263             }
       
   264 
       
   265         if ( KFMRadioPreviousDimmed & aToolBarState )
       
   266             {
       
   267             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 2 Enter" )));
       
   268             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbPrevDimmed ); 
       
   269             iObserver->PublishImageL( this, 
       
   270                                       EMusicWidgetToolbarB1, 
       
   271                                       iconId,
       
   272                                       iMifFileName, 
       
   273                                       EMbmFmradioQgn_prop_image_tb_prev_dimmed, 
       
   274                                       EMbmFmradioQgn_prop_image_tb_prev_dimmed_mask );
       
   275             InstallEmptyActionL( EMusicWidgetTB1Trigger );
       
   276             iTbPreviousState = KFMRadioPreviousDimmed; 
       
   277             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 2 Exit" ))); 
       
   278             }
       
   279         
       
   280         if ( KFMRadioNext & aToolBarState )
       
   281             {
       
   282             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 3 Enter" ))); 
       
   283             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbNext );
       
   284             iObserver->PublishImageL( this, 
       
   285                                       EMusicWidgetToolbarB3, 
       
   286                                       iconId, 
       
   287                                       iMifFileName, 
       
   288                                       EMbmFmradioQgn_prop_image_tb_next, 
       
   289                                       EMbmFmradioQgn_prop_image_tb_next_mask );
       
   290             InstallFMRadioCommandActionL( KFMRadioCommandValueStepNext, EMusicWidgetTB3Trigger );
       
   291             iTbNextState = KFMRadioNext;
       
   292             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 3 Exit" ))); 
       
   293             }
       
   294         
       
   295         if ( KFMRadioNextDimmed & aToolBarState )
       
   296             {
       
   297             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 4 Enter" ))); 
       
   298             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnPropImageTbNextDimmed );
       
   299             iObserver->PublishImageL( this, 
       
   300                                       EMusicWidgetToolbarB3, 
       
   301                                       iconId, 
       
   302                                       iMifFileName, 
       
   303                                       EMbmFmradioQgn_prop_image_tb_next_dimmed, 
       
   304                                       EMbmFmradioQgn_prop_image_tb_next_dimmed_mask );
       
   305             InstallEmptyActionL( EMusicWidgetTB3Trigger );
       
   306             iTbNextState = KFMRadioNextDimmed;            
       
   307             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 4 Exit" ))); 
       
   308             }
       
   309         
       
   310         if ( KFMRadioMute & aToolBarState )
       
   311             {
       
   312             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 5 Enter" ))); 
       
   313             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSound );
       
   314             iObserver->PublishImageL( this, 
       
   315                                       EMusicWidgetToolbarB2, 
       
   316                                       iconId, 
       
   317                                       iMifFileName, 
       
   318                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound, 
       
   319                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_mask );
       
   320             InstallFMRadioCommandActionL( KFMRadioCommandValueUnmute, EMusicWidgetTB2Trigger );
       
   321             iTbMuteUnmuteState = KFMRadioMute;
       
   322             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 5 Exit" ))); 
       
   323             }
       
   324         
       
   325         if ( KFMRadioUnmute & aToolBarState )
       
   326             {
       
   327             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 6 Enter" ))); 
       
   328             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSoundMuted );
       
   329             iObserver->PublishImageL( this,
       
   330                                       EMusicWidgetToolbarB2,
       
   331                                       iconId,
       
   332                                       iMifFileName,
       
   333                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted,
       
   334                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted_mask );
       
   335             InstallFMRadioCommandActionL( KFMRadioCommandValueMute, EMusicWidgetTB2Trigger );
       
   336             iTbMuteUnmuteState = KFMRadioUnmute;            
       
   337             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 6 Exit" ))); 
       
   338             }
       
   339         
       
   340         if ( KFMRadioMuteDimmed & aToolBarState )
       
   341             {
       
   342             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 7 Enter" ))); 
       
   343             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSoundDimmed );
       
   344             iObserver->PublishImageL( this, 
       
   345                                       EMusicWidgetToolbarB2, 
       
   346                                       iconId, 
       
   347                                       iMifFileName, 
       
   348                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_dimmed, 
       
   349                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_dimmed_mask );
       
   350             InstallEmptyActionL( EMusicWidgetTB2Trigger );
       
   351             iTbMuteUnmuteState = KFMRadioMuteDimmed; 
       
   352             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 7 Exit" ))); 
       
   353             }
       
   354         
       
   355         if ( KFMRadioUnmuteDimmed & aToolBarState )
       
   356             {
       
   357             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 8 Enter" ))); 
       
   358             iconId.Set( EAknsMajorGeneric, EAknsMinorGenericQgnIndiMusicWidgetTbRadioSoundMutedDimmed );
       
   359             iObserver->PublishImageL( this, 
       
   360                                       EMusicWidgetToolbarB2, 
       
   361                                       iconId, 
       
   362                                       iMifFileName, 
       
   363                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted_dimmed, 
       
   364                                       EMbmFmradioQgn_indi_music_widget_tb_radio_sound_muted_dimmed_mask );
       
   365             InstallEmptyActionL( EMusicWidgetTB2Trigger );
       
   366             iTbMuteUnmuteState = KFMRadioUnmuteDimmed;
       
   367             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdatePublishedToolBarL - 8 Exit" ))); 
       
   368             }
       
   369         }
       
   370     }
       
   371 
       
   372 // ---------------------------------------------------------------------------
       
   373 // CFMRadioMCPPlugin::UpdateToolBarL
       
   374 // ---------------------------------------------------------------------------
       
   375 //
       
   376 void CFMRadioMCPPlugin::UpdateToolBarL( TBool aForceApplicationClosing )
       
   377     {
       
   378     if ( iActive )
       
   379         {
       
   380         TUint muteDimmedState = iEngine->MuteState() == EFMRadioPSMuteStateOn ?
       
   381                 KFMRadioUnmuteDimmed : KFMRadioMuteDimmed;
       
   382         // Update Next and Previous buttons.
       
   383         if ( iEngine->AntennaStatus() == EFMRadioPSHeadsetDisconnected )
       
   384             {
       
   385             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 1" )));
       
   386             UpdatePublishedToolBarL( KFMRadioPreviousDimmed | muteDimmedState |  KFMRadioNextDimmed);
       
   387             return;
       
   388             }
       
   389         else if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning || aForceApplicationClosing )
       
   390             {
       
   391             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 2" )));
       
   392             UpdatePublishedToolBarL( KFMRadioPreviousDimmed | muteDimmedState |  KFMRadioNextDimmed);
       
   393             return;
       
   394             }
       
   395         else if ( iEngine->PowerState() != EFMRadioPSRadioPowerOn )
       
   396             {
       
   397             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 3" )));
       
   398             UpdatePublishedToolBarL( KFMRadioPreviousDimmed | muteDimmedState |  KFMRadioNextDimmed);
       
   399             return;
       
   400             }
       
   401         else if ( iEngine->TuningState() != EFMRadioPSTuningUninitialized )
       
   402             {
       
   403             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 4" )));
       
   404             UpdatePublishedToolBarL( KFMRadioPreviousDimmed |  KFMRadioNextDimmed );
       
   405             }
       
   406         else if ( iPresetCount > 1 || ( iPresetCount == 1 && iEngine->Channel() == KErrNotFound ) )
       
   407             {
       
   408             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 5" )));
       
   409             UpdatePublishedToolBarL( KFMRadioPrevious | KFMRadioNext );
       
   410             }
       
   411         else
       
   412             {
       
   413             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 6" )));
       
   414             UpdatePublishedToolBarL( KFMRadioPreviousDimmed | KFMRadioNextDimmed );
       
   415             }
       
   416 
       
   417         // Update Mute/Unmute button
       
   418         if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning || aForceApplicationClosing )
       
   419             {
       
   420             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 7" )));
       
   421             UpdatePublishedToolBarL( muteDimmedState );
       
   422             }
       
   423         else if ( iEngine->TuningState() != EFMRadioPSTuningUninitialized )
       
   424             {
       
   425             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 8" )));
       
   426             UpdatePublishedToolBarL( muteDimmedState );
       
   427             }
       
   428         else
       
   429             {
       
   430             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateToolBarL - 9" )));
       
   431             HandleMuteStateChangeL( iEngine->MuteState() );
       
   432             }
       
   433         }
       
   434     }
       
   435 // ---------------------------------------------------------------------------
       
   436 // CFMRadioMCPPlugin::UpdateMusicWidgetTextL
       
   437 // ---------------------------------------------------------------------------
       
   438 //
       
   439 void CFMRadioMCPPlugin::UpdateMusicWidgetTextL( TBool aForceApplicationClosing )
       
   440     {
       
   441     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL" )));
       
   442     if ( iActive )
       
   443         {
       
   444         TInt rightToLeftCharWidth = AknLayoutUtils::LayoutMirrored() ? sizeof(TText16) : 0;
       
   445         
       
   446         // Homescreen publishing
       
   447         if ( iEngine->AntennaStatus() == EFMRadioPSHeadsetDisconnected && !aForceApplicationClosing )
       
   448             {
       
   449             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing HS antenna not connected: \"%S\""), &iAntennaNotConnectedText ));        
       
   450             iObserver->PublishTextL( this, EMusicWidgetText1, iAntennaNotConnectedText );
       
   451             }
       
   452         else if ( iEngine->TuningState() != EFMRadioPSTuningUninitialized && !aForceApplicationClosing )
       
   453             {
       
   454             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing HS tuning: \"%S\""), &iTuningText ));        
       
   455             iObserver->PublishTextL( this, EMusicWidgetText1, iTuningText );
       
   456             }
       
   457         else if ( iPresetCount && iEngine->Channel() != KErrNotFound )
       
   458             {
       
   459             if( iEngine->ChannelName().Length() )
       
   460                 {
       
   461                 // Station saved and name is available
       
   462                 RBuf name;
       
   463                 // For widget
       
   464                 // Preserve space for the channel name, format string and maximum index number
       
   465                 name.CreateL( iEngine->ChannelName().Length() + 
       
   466                               iSavedStationFormat.Length() + 
       
   467                               KDefaultRealWidth + 
       
   468                               rightToLeftCharWidth );
       
   469                 name.CleanupClosePushL();
       
   470                 StringLoader::Format( name, iSavedStationFormat, KErrNotFound, iEngine->Channel() + 1 );
       
   471                 
       
   472                 HBufC* tempName = name.AllocL();
       
   473                 StringLoader::Format( name, *tempName, KErrNotFound, iEngine->ChannelName() );
       
   474                 delete tempName;
       
   475                 tempName = NULL;
       
   476                 
       
   477                 if ( rightToLeftCharWidth )
       
   478                     {
       
   479                     //E.g. 1. Name -> Name .1
       
   480                     name.Insert( 0, KRightToLeftMark );
       
   481                     }
       
   482                 
       
   483                 FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Widget saved station: \"%S\""), &name ));
       
   484                 iObserver->PublishTextL( this, EMusicWidgetText1, name );
       
   485                 CleanupStack::PopAndDestroy(); // name
       
   486 
       
   487                 // For Music Suite
       
   488                 // Preserve space for the channel name, format string and maximum index number
       
   489                 name.CreateL( iEngine->ChannelName().Length() + 
       
   490                               iSavedStationFormatMenu.Length() + 
       
   491                               KDefaultRealWidth + 
       
   492                               rightToLeftCharWidth );
       
   493                 name.CleanupClosePushL();
       
   494                 StringLoader::Format( name, iSavedStationFormatMenu, KErrNotFound, iEngine->Channel() + 1 );
       
   495                 
       
   496                 tempName = name.AllocL();
       
   497                 StringLoader::Format( name, *tempName, KErrNotFound, iEngine->ChannelName() );
       
   498                 delete tempName;
       
   499                 tempName = NULL;
       
   500                 
       
   501                 if ( rightToLeftCharWidth )
       
   502                     {
       
   503                     //E.g. 1. Name -> Name .1
       
   504                     name.Insert( 0, KRightToLeftMark );
       
   505                     }
       
   506                 
       
   507                 FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Suite saved station: \"%S\""), &name ));
       
   508                 iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, name );
       
   509                 CleanupStack::PopAndDestroy(); // name
       
   510                 }
       
   511             else
       
   512                 {
       
   513                 // Station saved, but name for it is not available
       
   514                 HBufC* frequencyString = FrequencyStringLC( iEngine->Frequency() );
       
   515                 RBuf formattedFrequency;
       
   516                 
       
   517                 // For widget
       
   518                 formattedFrequency.CreateL( iSavedStationFormatNoName.Length() + 
       
   519                                             frequencyString->Length() + 
       
   520                                             KDefaultRealWidth + 
       
   521                                             rightToLeftCharWidth );
       
   522                 formattedFrequency.CleanupClosePushL();
       
   523                 StringLoader::Format( formattedFrequency, iSavedStationFormatNoName, KErrNotFound, iEngine->Channel() + 1 );
       
   524                 
       
   525                 HBufC* tempFrequency = formattedFrequency.AllocL();
       
   526                 StringLoader::Format( formattedFrequency, *tempFrequency, KErrNotFound, *frequencyString );
       
   527                 delete tempFrequency;
       
   528                 tempFrequency = NULL;
       
   529                 AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
       
   530 
       
   531                 if ( rightToLeftCharWidth )
       
   532                     {
       
   533                     //E.g. 1. Name -> Name .1
       
   534                     formattedFrequency.Insert( 0, KRightToLeftMark );
       
   535                     }
       
   536 
       
   537                 FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Widget saved station with frequency: \"%S\""), &formattedFrequency ));
       
   538                 iObserver->PublishTextL( this, EMusicWidgetText1, formattedFrequency );
       
   539                 CleanupStack::PopAndDestroy(); // formattedFrequency
       
   540                 
       
   541                 // For Music Suite
       
   542                 formattedFrequency.CreateL( iSavedStationFormatNoNameMenu.Length() + 
       
   543                                             frequencyString->Length() + 
       
   544                                             KDefaultRealWidth + 
       
   545                                             rightToLeftCharWidth );
       
   546                 formattedFrequency.CleanupClosePushL();
       
   547                 StringLoader::Format( formattedFrequency, iSavedStationFormatNoNameMenu, KErrNotFound, iEngine->Channel() + 1 );
       
   548                 
       
   549                 tempFrequency = formattedFrequency.AllocL();
       
   550                 StringLoader::Format( formattedFrequency, *tempFrequency, KErrNotFound, *frequencyString );
       
   551                 delete tempFrequency;
       
   552                 tempFrequency = NULL;
       
   553                 
       
   554                 AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
       
   555                 if ( rightToLeftCharWidth )
       
   556                     {
       
   557                     //E.g. 1. Name -> Name .1
       
   558                     formattedFrequency.Insert( 0, KRightToLeftMark );
       
   559                     }
       
   560 
       
   561                 FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Suite saved station with frequency: \"%S\""), &formattedFrequency ));
       
   562                 iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, formattedFrequency );
       
   563                 CleanupStack::PopAndDestroy( 2, frequencyString ); // formattedFrequency, frequencyString
       
   564                 }
       
   565             }
       
   566         else if ( iEngine->RDSProgramService().Length() > 0 )
       
   567             {
       
   568             FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing HS PS name: \"%S\""), &iEngine->RDSProgramService() ));
       
   569             iObserver->PublishTextL( this, EMusicWidgetText1, iEngine->RDSProgramService() );
       
   570             iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, iEngine->RDSProgramService() );
       
   571             }
       
   572         else
       
   573             {
       
   574             TInt currentFrequency = iEngine->Frequency();
       
   575             // publish only valid frequency
       
   576             if ( currentFrequency > 0 )
       
   577                 {
       
   578                 HBufC* frequencyString = FrequencyStringLC( currentFrequency );
       
   579                 
       
   580                 RBuf formattedFrequency;
       
   581                 // For widget
       
   582                 // Preserve space for the format string and maximum index number
       
   583                 formattedFrequency.CreateL( iFrequencyFormat.Length() + 
       
   584                                             frequencyString->Length() + 
       
   585                                             rightToLeftCharWidth );
       
   586                 formattedFrequency.CleanupClosePushL();
       
   587                 StringLoader::Format( formattedFrequency, iFrequencyFormat, KErrNotFound, *frequencyString );
       
   588                 AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
       
   589                
       
   590                 if ( rightToLeftCharWidth )
       
   591                     {
       
   592                     //E.g. 1. Name -> Name .1
       
   593                     formattedFrequency.Insert( 0, KRightToLeftMark );
       
   594                     }
       
   595                 
       
   596                 FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Widget frequency: \"%S\""), &formattedFrequency ));
       
   597                 iObserver->PublishTextL( this, EMusicWidgetText1, formattedFrequency );
       
   598                 CleanupStack::PopAndDestroy(); // formattedFrequency
       
   599                 
       
   600                 // For Music Suite
       
   601                 // Preserve space for the format string and maximum index number
       
   602                 formattedFrequency.CreateL( iFrequencyFormatMenu.Length() + 
       
   603                                             frequencyString->Length() + 
       
   604                                             rightToLeftCharWidth );
       
   605                 formattedFrequency.CleanupClosePushL();
       
   606                 StringLoader::Format( formattedFrequency, iFrequencyFormatMenu, KErrNotFound, *frequencyString );
       
   607                 AknTextUtils::LanguageSpecificNumberConversion( formattedFrequency );
       
   608                
       
   609                 if ( rightToLeftCharWidth )
       
   610                     {
       
   611                     //E.g. 1. Name -> Name .1
       
   612                     formattedFrequency.Insert( 0, KRightToLeftMark );
       
   613                     }
       
   614                 
       
   615                 FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::UpdateMusicWidgetTextL - Publishing Music Suite frequency: \"%S\""), &formattedFrequency ));
       
   616                 iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, formattedFrequency );
       
   617                 CleanupStack::PopAndDestroy( 2, frequencyString ); // formattedFrequency, frequencyString
       
   618                 }
       
   619             else
       
   620                 {
       
   621                 // Publish empty text instead of 0.00 MHz
       
   622                 iObserver->PublishTextL( this, EMusicWidgetText1, KNullDesC );
       
   623                 iObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, KNullDesC );
       
   624                 }
       
   625             }
       
   626         if( iEngine->PowerState() == EFMRadioPSRadioPowerOn && !aForceApplicationClosing )
       
   627             {
       
   628             iObserver->PublishTextL( this, EMusicMenuMusicInfoLine1, iNowPlayingText );
       
   629             }
       
   630         else
       
   631             {
       
   632             iObserver->PublishTextL( this, EMusicMenuMusicInfoLine1, iLastPlayedText );
       
   633             }
       
   634         }
       
   635     }
       
   636 
       
   637 // ---------------------------------------------------------------------------
       
   638 // CFMRadioMCPPlugin::FrequencyStringLC
       
   639 // ---------------------------------------------------------------------------
       
   640 //
       
   641 HBufC* CFMRadioMCPPlugin::FrequencyStringLC( TInt aFrequency )
       
   642     {
       
   643     TReal frequency = static_cast<TReal>( aFrequency / static_cast<TReal>( KHzConversionFactor ));
       
   644     TRealFormat format( KFrequencyMaxLength, iEngine->FrequencyDecimalCount() );
       
   645     TBuf<KDefaultRealWidth> frequencyString;
       
   646     frequencyString.Num( frequency, format );
       
   647     
       
   648     return frequencyString.AllocLC();
       
   649     }
       
   650 
       
   651 void CFMRadioMCPPlugin::HandleRadioVolumeChangeL( TInt /* aVolume */ )
       
   652     {
       
   653     }
       
   654 
       
   655 void CFMRadioMCPPlugin::HandleTuningStateChangeL( TFMRadioPSTuningState FDEBUGVAR( aTuningState ) )
       
   656     {
       
   657     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleTuningStateChangeL: aTuningState=[%d]"), aTuningState));
       
   658 
       
   659     if ( iActive )
       
   660         {
       
   661         UpdateMusicWidgetTextL();
       
   662         UpdateToolBarL();
       
   663         }
       
   664  
       
   665     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleTuningStateChangeL - Exiting." )));    
       
   666     }
       
   667 
       
   668 void CFMRadioMCPPlugin::HandleFrequencyChangeL( TInt FDEBUGVAR( aFrequency ) )
       
   669     {
       
   670     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleFrequencyChangeL: aFrequency=%d"), aFrequency));
       
   671     }
       
   672 
       
   673 void CFMRadioMCPPlugin::HandleChannelChangeL( TInt FDEBUGVAR( aId ) )
       
   674     {
       
   675     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelChangeL: aId=[%d]"), aId ));  
       
   676     if ( iActive )
       
   677         {
       
   678         UpdateMusicWidgetTextL();
       
   679         UpdateToolBarL();
       
   680         }
       
   681     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelChangeL - Exiting." ))); 
       
   682     }
       
   683 
       
   684 void CFMRadioMCPPlugin::HandleChannelModifyL( TInt aId )
       
   685     {
       
   686     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelModifyL: aId=[%d]"), aId ));
       
   687     if ( iActive && aId == iEngine->Channel() )
       
   688         {
       
   689         UpdateMusicWidgetTextL();
       
   690         }
       
   691     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelModifyL - Exiting." )));
       
   692     }
       
   693 
       
   694 void CFMRadioMCPPlugin::HandleMuteStateChangeL( TFMRadioPSRadioMuteState aMuteState )
       
   695     {
       
   696     if ( iActive )
       
   697         {
       
   698         switch( aMuteState )
       
   699             {
       
   700             case EFMRadioPSMuteStateOn:
       
   701                 if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning )
       
   702                     {
       
   703                     UpdatePublishedToolBarL( KFMRadioUnmuteDimmed );
       
   704                     }
       
   705                 else
       
   706                     {
       
   707                     UpdatePublishedToolBarL( KFMRadioUnmute );
       
   708                     }
       
   709                 break;
       
   710             case EFMRadioPSMuteStateOff:
       
   711             case EFMRadioPSMuteStateUninitialized:
       
   712                 if ( iEngine->ApplicationRunningState() != EFMRadioPSApplicationRunning )
       
   713                     {
       
   714                     UpdatePublishedToolBarL( KFMRadioMuteDimmed );
       
   715                     }
       
   716                  else
       
   717                     {
       
   718                     UpdatePublishedToolBarL( KFMRadioMute );
       
   719                     }
       
   720                 break;
       
   721             default:break;
       
   722             }
       
   723         }    
       
   724     }
       
   725 
       
   726 void CFMRadioMCPPlugin::HandleApplicationRunningStateChangeL( TFMRadioPSApplicationRunningState aRunningState )
       
   727     {
       
   728     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleApplicationRunningStateChangeL - aRunningState=%d"), aRunningState ));
       
   729     
       
   730     switch ( aRunningState )
       
   731         {
       
   732         case EFMRadioPSApplicationRunning:
       
   733             break;
       
   734         case EFMRadioPSApplicationClosing:
       
   735             UpdateMusicWidgetTextL( ETrue );
       
   736             UpdateToolBarL( ETrue );
       
   737             Deactivate();
       
   738             break;
       
   739         default:
       
   740             break;
       
   741         }
       
   742     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleApplicationRunningStateChangeL - Exiting." )));
       
   743     }
       
   744 
       
   745 void CFMRadioMCPPlugin::HandleFrequencyDecimalCountChangeL( TFMRadioPSFrequencyDecimalCount /* aDecimalCount */ )
       
   746     {
       
   747     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleFrequencyDecimalCountChangeL." )));    
       
   748     if ( iActive )
       
   749         {
       
   750         UpdateMusicWidgetTextL();
       
   751         }
       
   752     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleFrequencyDecimalCountChangeL - Exiting." )));  
       
   753     }
       
   754 
       
   755 void CFMRadioMCPPlugin::HandleAntennaStatusChangeL( TFMRadioPSHeadsetStatus /*aAntennaStatus*/ )
       
   756     {
       
   757     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleAntennaStatusChangeL - Enter")));    
       
   758     if ( iActive )
       
   759         {
       
   760         UpdateMusicWidgetTextL();
       
   761         UpdateToolBarL();
       
   762         }
       
   763     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleAntennaStatusChangeL - Exiting.")));    
       
   764     }
       
   765 
       
   766 void CFMRadioMCPPlugin::HandlePresetListCountChangeL( TInt aPresetCount )
       
   767     {
       
   768     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePresetListCountChangeL(%d) - Enter"), aPresetCount));    
       
   769     iPresetCount = aPresetCount;
       
   770     if ( iActive )
       
   771         {
       
   772         if( !aPresetCount )
       
   773             {
       
   774             UpdateMusicWidgetTextL();
       
   775             }
       
   776         UpdateToolBarL();
       
   777         }
       
   778     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePresetListCountChangeL - Exiting.")));    
       
   779     }
       
   780 
       
   781 void CFMRadioMCPPlugin::HandlePresetListFocusChangeL( TInt FDEBUGVAR( aPresetFocus ) )
       
   782     {
       
   783     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePresetListFocusChangeL - %d"), aPresetFocus ));    
       
   784     }
       
   785 
       
   786 void CFMRadioMCPPlugin::HandleRDSProgramServiceChangeL( const TDesC& /*aProgramService*/ )
       
   787     {
       
   788     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleRDSProgramServiceChangeL." )));    
       
   789     if ( iActive )
       
   790         {
       
   791         UpdateMusicWidgetTextL();
       
   792         }
       
   793     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleRDSProgramServiceChangeL - Exiting." )));    
       
   794     }
       
   795 
       
   796 void CFMRadioMCPPlugin::HandleRDSRadioTextChangeL( const TDesC& /*aRdsText*/ )
       
   797     {
       
   798     }
       
   799 
       
   800 void CFMRadioMCPPlugin::HandleChannelNameChangeL( const TDesC& /*aName*/ )
       
   801     {
       
   802     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandleChannelNameChangeL." )));    
       
   803     }
       
   804 
       
   805 void CFMRadioMCPPlugin::HandlePowerStateChangeL( TFMRadioPSRadioPowerState aPowerState )
       
   806     {
       
   807     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePowerStateChangeL(%d)."), aPowerState ));
       
   808     if( aPowerState == EFMRadioPSRadioPowerOn )
       
   809         {
       
   810         ActivateL();
       
   811         }
       
   812     if ( iActive )
       
   813         {
       
   814         UpdateMusicWidgetTextL();
       
   815         UpdateToolBarL();
       
   816         }
       
   817     FTRACE(FPrint(_L(" *** S60 FMRadio -- CFMRadioMCPPlugin::HandlePowerStateChangeL - Exiting." ))); 
       
   818     }
       
   819 
       
   820 void CFMRadioMCPPlugin::InstallEmptyActionL( TMCPTriggerDestination aDestination )
       
   821     {
       
   822     CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
       
   823     iObserver->PublishActionL( this, aDestination, mapTrigger );
       
   824     CleanupStack::PopAndDestroy( mapTrigger );
       
   825     }
       
   826 
       
   827 void CFMRadioMCPPlugin::InstallFMRadioCommandActionL( const TDesC& aCommand, TMCPTriggerDestination aDestination )
       
   828     {
       
   829     CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
       
   830     CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
       
   831 
       
   832     mapTrigger->InsertL( KFMRadioPluginUid, TLiwVariant( TUid::Uid( KFMRadioActionHandlerImplementationUid ) ) );
       
   833     mapData->InsertL( KType, TLiwVariant( aCommand ) );
       
   834     mapData->InsertL( KFMRadioCommand , TLiwVariant( aCommand ) );
       
   835     mapTrigger->InsertL( KFMRadioData, TLiwVariant( mapData ) );
       
   836     
       
   837     if ( iActive )
       
   838         {
       
   839         iObserver->PublishActionL( this, aDestination, mapTrigger );
       
   840         }
       
   841     
       
   842     CleanupStack::PopAndDestroy( mapData );
       
   843     CleanupStack::PopAndDestroy( mapTrigger );
       
   844     }
       
   845 
       
   846 /** Provides a key-value pair table, that is used to identify the correct construction function for the requested interface. */
       
   847 const TImplementationProxy KFMRadioMCPPluginImplementationTable[] =
       
   848     {
       
   849     IMPLEMENTATION_PROXY_ENTRY( KFMRadioMCPPluginImplementationUid, CFMRadioMCPPlugin::NewL )
       
   850     };
       
   851 
       
   852 const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount );
       
   853 
       
   854 // ---------------------------------------------------------------------------
       
   855 // Returns the implementations provided by this ECOM plugin DLL.
       
   856 // ---------------------------------------------------------------------------
       
   857 //
       
   858 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   859     {
       
   860     aTableCount = sizeof( KFMRadioMCPPluginImplementationTable ) / sizeof( TImplementationProxy );
       
   861     return KFMRadioMCPPluginImplementationTable;
       
   862     }