radioengine/utils/src/cradiopubsubimp.cpp
changeset 13 46974bebc798
equal deleted inserted replaced
0:f3d95d9c00ab 13:46974bebc798
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "radiouid.hrh"
       
    19 
       
    20 #include "cradioenginelogger.h"
       
    21 #include "radiointernalpskeys.h"
       
    22 
       
    23 #include "mradiocontroleventobserver.h"
       
    24 #include "cradiopubsub.h"
       
    25 #include "cradiopubsubimp.h"
       
    26 #include "radioengineutils.h"
       
    27 
       
    28 // This has to be the last include. 
       
    29 #ifdef STUB_CONSTELLATION
       
    30 #   include "RadioStubManager.h"
       
    31 #   define KRadioPSUid KStub_KRadioPSUid
       
    32 #endif //STUB_CONSTELLATION
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CRadioPubSubImp::CRadioPubSubImp()
       
    41     {
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 void CRadioPubSubImp::ConstructL()
       
    49     {
       
    50     RadioEngineUtils::InitializeL();
       
    51     LOG_METHOD_AUTO;
       
    52 
       
    53     // Define data properties.
       
    54     DefinePropertyL( KRadioPSDataChannel,               RProperty::EInt,    ETrue );
       
    55     DefinePropertyL( KRadioPSDataFrequency,             RProperty::EInt,    ETrue );
       
    56     DefinePropertyL( KRadioPSDataRadioPowerState,       RProperty::EInt,    ETrue );
       
    57     DefinePropertyL( KRadioPSDataVolume,                RProperty::EInt,    ETrue );
       
    58     DefinePropertyL( KRadioPSDataChannelDataChanged,    RProperty::EInt,    ETrue );
       
    59     DefinePropertyL( KRadioPSDataTuningState,           RProperty::EInt,    ETrue );
       
    60     DefinePropertyL( KRadioPSDataRadioMuteState,        RProperty::EInt,    ETrue );
       
    61     DefinePropertyL( KRadioPSDataApplicationRunning,    RProperty::EInt,    ETrue );
       
    62     DefinePropertyL( KRadioPSDataHeadsetStatus,         RProperty::EInt,    ETrue );
       
    63     DefinePropertyL( KRadioPSDataFrequencyDecimalCount, RProperty::EInt,    ETrue );
       
    64     DefinePropertyL( KRadioPSDataLoudspeakerStatus,     RProperty::EInt,    ETrue );
       
    65     DefinePropertyL( KRadioPSDataRdsProgramService,     RProperty::EText,   ETrue );
       
    66     DefinePropertyL( KRadioPSDataRdsRadioText,          RProperty::EText,   ETrue );
       
    67     DefinePropertyL( KRadioPSDataChannelName,           RProperty::EText,   ETrue );
       
    68     DefinePropertyL( KRadioPSDataActivePresetListCount, RProperty::EInt,    ETrue );
       
    69     DefinePropertyL( KRadioPSDataActivePresetListFocus, RProperty::EInt,    ETrue );
       
    70     DefinePropertyL( KRadioPSDataRadioAntennaState,     RProperty::EInt,    ETrue );
       
    71 
       
    72     // Define control properties.
       
    73     DefinePropertyL( KRadioPSControlStepToChannel,      RProperty::EInt, EFalse );
       
    74     DefinePropertyL( KRadioPSControlSetChannel,         RProperty::EInt, EFalse );
       
    75     DefinePropertyL( KRadioPSControlSeek,               RProperty::EInt, EFalse );
       
    76     DefinePropertyL( KRadioPSControlStepToFrequency,    RProperty::EInt, EFalse );
       
    77     DefinePropertyL( KRadioPSControlSetFrequency,       RProperty::EInt, EFalse );
       
    78     DefinePropertyL( KRadioPSControlAdjustVolume ,      RProperty::EInt, EFalse );
       
    79     DefinePropertyL( KRadioPSControlSetRadioMuteState,  RProperty::EInt, EFalse );
       
    80     DefinePropertyL( KRadioPSControlSetAudioOutput,     RProperty::EInt, EFalse );
       
    81 
       
    82     // Observe control properties.
       
    83     CreatePropertyObserverL( KRadioPSControlStepToChannel,      CRadioPropertyObserver::ERadioPropertyInt );
       
    84     CreatePropertyObserverL( KRadioPSControlSetChannel,         CRadioPropertyObserver::ERadioPropertyInt );
       
    85     CreatePropertyObserverL( KRadioPSControlSeek,               CRadioPropertyObserver::ERadioPropertyInt );
       
    86     CreatePropertyObserverL( KRadioPSControlStepToFrequency,    CRadioPropertyObserver::ERadioPropertyInt );
       
    87     CreatePropertyObserverL( KRadioPSControlSetFrequency,       CRadioPropertyObserver::ERadioPropertyInt );
       
    88     CreatePropertyObserverL( KRadioPSControlAdjustVolume,       CRadioPropertyObserver::ERadioPropertyInt );
       
    89     CreatePropertyObserverL( KRadioPSControlSetRadioMuteState,  CRadioPropertyObserver::ERadioPropertyInt );
       
    90     CreatePropertyObserverL( KRadioPSControlSetAudioOutput,     CRadioPropertyObserver::ERadioPropertyInt );
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 CRadioPubSubImp* CRadioPubSubImp::NewL()
       
    98     {
       
    99     CRadioPubSubImp* self = new ( ELeave ) CRadioPubSubImp();
       
   100     CleanupStack::PushL( self );
       
   101     self->ConstructL();
       
   102     CleanupStack::Pop( self );
       
   103     return self;
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 CRadioPubSubImp::~CRadioPubSubImp()
       
   111     {
       
   112     iPropertyArray.ResetAndDestroy();
       
   113 
       
   114     DeleteProperty( KRadioPSDataChannel );
       
   115     DeleteProperty( KRadioPSDataFrequency );
       
   116     DeleteProperty( KRadioPSDataRadioPowerState );
       
   117     DeleteProperty( KRadioPSDataVolume );
       
   118     DeleteProperty( KRadioPSDataChannelDataChanged );
       
   119     DeleteProperty( KRadioPSDataTuningState );
       
   120     DeleteProperty( KRadioPSDataRadioMuteState );
       
   121     DeleteProperty( KRadioPSDataApplicationRunning );
       
   122     DeleteProperty( KRadioPSDataHeadsetStatus );
       
   123     DeleteProperty( KRadioPSDataFrequencyDecimalCount );
       
   124     DeleteProperty( KRadioPSDataLoudspeakerStatus );
       
   125     DeleteProperty( KRadioPSDataRdsProgramService );
       
   126     DeleteProperty( KRadioPSDataRdsRadioText );
       
   127     DeleteProperty( KRadioPSDataChannelName );
       
   128     DeleteProperty( KRadioPSDataActivePresetListCount );
       
   129     DeleteProperty( KRadioPSDataActivePresetListFocus );
       
   130     DeleteProperty( KRadioPSDataRadioAntennaState );
       
   131 
       
   132     DeleteProperty( KRadioPSControlStepToChannel );
       
   133     DeleteProperty( KRadioPSControlSetChannel );
       
   134     DeleteProperty( KRadioPSControlSeek );
       
   135     DeleteProperty( KRadioPSControlStepToFrequency );
       
   136     DeleteProperty( KRadioPSControlSetFrequency );
       
   137     DeleteProperty( KRadioPSControlAdjustVolume );
       
   138     DeleteProperty( KRadioPSControlSetRadioMuteState );
       
   139     DeleteProperty( KRadioPSControlSetAudioOutput );
       
   140 
       
   141     RadioEngineUtils::Release();
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // Defines a property.
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 void CRadioPubSubImp::DefinePropertyL( TUint aKey, TInt aAttr, TBool aDataProperty ) const
       
   149     {
       
   150     _LIT_SECURITY_POLICY_PASS( KRadioExternalAccessPolicy );
       
   151     _LIT_SECURITY_POLICY_S0( KRadioInternalAccessPolicy, KUidRadioApplication );
       
   152 
       
   153     TInt err = KErrNone;
       
   154     if ( aDataProperty )
       
   155         {
       
   156         // For data properties, grant read access for all, but write access only for radio application
       
   157         err = RProperty::Define( KRadioPSUid, aKey, aAttr, KRadioExternalAccessPolicy, KRadioInternalAccessPolicy );
       
   158         }
       
   159     else
       
   160         {
       
   161         // For control properties, grant read access only for radio application, but write access for all
       
   162         err = RProperty::Define( KRadioPSUid, aKey, aAttr, KRadioInternalAccessPolicy, KRadioExternalAccessPolicy );
       
   163         }
       
   164 
       
   165     if ( err && err != KErrAlreadyExists )
       
   166         {
       
   167         LOG_FORMAT( "CRadioPubSubImp::DefinePropertyL: Leaving with %d", err );
       
   168         User::Leave( err );
       
   169         }
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // Deletes a property
       
   174 // ---------------------------------------------------------------------------
       
   175 //
       
   176 void CRadioPubSubImp::DeleteProperty( TUint aKey ) const
       
   177     {
       
   178     RProperty::Delete( KRadioPSUid, aKey );
       
   179     }
       
   180 
       
   181 // ---------------------------------------------------------------------------
       
   182 // Creates a property observer
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 void CRadioPubSubImp::CreatePropertyObserverL( const TUint aKey,
       
   186                                                const TInt aPropertyType )
       
   187     {
       
   188     CRadioPropertyObserver* observer = CRadioPropertyObserver::NewL( *this, KRadioPSUid,
       
   189                     aKey, static_cast<CRadioPropertyObserver::TRadioPropertyType>( aPropertyType ) );
       
   190 
       
   191     if ( iPropertyArray.Append( observer ) == KErrNone )
       
   192         {
       
   193         observer->ActivateL();
       
   194         }
       
   195     else
       
   196         {
       
   197         delete observer;
       
   198         observer = NULL;
       
   199         }
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // Gets the integer value stored in a property.
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 TBool CRadioPubSubImp::Get( TUint aKey, TInt& aValue ) const
       
   207     {
       
   208     return RProperty::Get( KRadioPSUid, aKey, aValue ) == KErrNone;
       
   209     }
       
   210 
       
   211 // ---------------------------------------------------------------------------
       
   212 // Sets a property's value.
       
   213 // ---------------------------------------------------------------------------
       
   214 //
       
   215 TBool CRadioPubSubImp::Set( TUint aKey, TInt aValue ) const
       
   216     {
       
   217     return RProperty::Set( KRadioPSUid, aKey, aValue ) == KErrNone;
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 // Sets a text property value
       
   222 // ---------------------------------------------------------------------------
       
   223 //
       
   224 TBool CRadioPubSubImp::Set( TUint aKey, const TDesC& aValue ) const
       
   225     {
       
   226     return RProperty::Set( KRadioPSUid, aKey, aValue ) == KErrNone;
       
   227     }
       
   228 
       
   229 // ---------------------------------------------------------------------------
       
   230 //
       
   231 // ---------------------------------------------------------------------------
       
   232 //
       
   233 void CRadioPubSubImp::HandlePropertyChangeL( const TUid& aCategory,
       
   234                                              const TUint aKey,
       
   235                                              const TInt aValue )
       
   236     {
       
   237     LOG_FORMAT( "CRadioPubSubImp::HandlePropertyChangeL: Category: %d, Key: %u. Value: %d",
       
   238                                                 aCategory.iUid, aKey, aValue );
       
   239 
       
   240     if ( aCategory != KRadioPSUid )
       
   241         {
       
   242         LOG( "CRadioPubSubImp::HandlePropertyChangeL: Unknown category. Leaving" );
       
   243         User::Leave( KErrArgument );
       
   244         }
       
   245 
       
   246     if ( !iObserver )
       
   247         {
       
   248         return;
       
   249         }
       
   250 
       
   251     if ( aKey == KRadioPSControlStepToChannel )
       
   252         {
       
   253         if ( aValue == ERadioPSStepToChannelUp )
       
   254             {
       
   255             iObserver->StepToChannelL( RadioEngine::ERadioUp );
       
   256             }
       
   257         else if ( aValue == ERadioPSStepToChannelDown )
       
   258             {
       
   259             iObserver->StepToChannelL( RadioEngine::ERadioDown );
       
   260             }
       
   261         }
       
   262     else if ( aKey == KRadioPSControlSetChannel )
       
   263         {
       
   264         if ( aValue > 0 )
       
   265             {
       
   266             iObserver->SetChannelL( aValue );
       
   267             }
       
   268         }
       
   269     else if ( aKey == KRadioPSControlSeek )
       
   270         {
       
   271         if ( aValue == ERadioPSSeekUp )
       
   272             {
       
   273             iObserver->SeekL( RadioEngine::ERadioUp );
       
   274             }
       
   275         else if ( aValue == ERadioPSSeekDown )
       
   276             {
       
   277             iObserver->SeekL( RadioEngine::ERadioDown );
       
   278             }
       
   279         }
       
   280     else if ( aKey == KRadioPSControlStepToFrequency )
       
   281         {
       
   282         if ( aValue == ERadioPSStepToFrequencyUp )
       
   283             {
       
   284             iObserver->StepToFrequencyL( RadioEngine::ERadioUp );
       
   285             }
       
   286         else if ( aValue == ERadioPSStepToFrequencyDown )
       
   287             {
       
   288             iObserver->StepToFrequencyL( RadioEngine::ERadioDown );
       
   289             }
       
   290         }
       
   291     else if ( aKey == KRadioPSControlSetFrequency )
       
   292         {
       
   293         if ( aValue > 0 )
       
   294             {
       
   295             iObserver->SetFrequencyL( aValue );
       
   296             }
       
   297         }
       
   298     else if ( aKey == KRadioPSControlAdjustVolume )
       
   299         {
       
   300         if ( aValue == ERadioPSIncreaseVolume )
       
   301             {
       
   302             iObserver->AdjustVolumeL( RadioEngine::ERadioIncVolume );
       
   303             }
       
   304         else if ( aValue == ERadioPSDecreaseVolume )
       
   305             {
       
   306             iObserver->AdjustVolumeL( RadioEngine::ERadioDecVolume );
       
   307             }
       
   308         }
       
   309     else if ( aKey == KRadioPSControlSetRadioMuteState )
       
   310         {
       
   311         if ( aValue == ERadioPSMuteStateOn )
       
   312             {
       
   313             iObserver->MuteL( ETrue );
       
   314             }
       
   315         else if ( aValue == ERadioPSMuteStateOff )
       
   316             {
       
   317             iObserver->MuteL( EFalse );
       
   318             }
       
   319         }
       
   320     else if ( aKey == KRadioPSControlSetAudioOutput )
       
   321         {
       
   322         if ( aValue == ERadioPSAudioOutputHeadset )
       
   323             {
       
   324             iObserver->SetAudioRouteL( RadioEngine::ERadioHeadset );
       
   325             }
       
   326         else if ( aValue == ERadioPSAudioOutputSpeaker )
       
   327             {
       
   328             iObserver->SetAudioRouteL( RadioEngine::ERadioSpeaker );
       
   329             }
       
   330         }
       
   331     }
       
   332 
       
   333 // ---------------------------------------------------------------------------
       
   334 //
       
   335 // ---------------------------------------------------------------------------
       
   336 //
       
   337 TBool CRadioPubSubImp::PublishChannel( TInt aChannelId ) const
       
   338     {
       
   339     LOG_FORMAT( "CRadioPubSubImp::PublishChannel ( aChannelId = %d )", aChannelId );
       
   340 
       
   341     TInt oldChannelId = 0;
       
   342     if ( Get( KRadioPSDataChannel, oldChannelId ) && aChannelId != oldChannelId )
       
   343         {
       
   344         return Set( KRadioPSDataChannel, aChannelId );
       
   345         }
       
   346     return EFalse;
       
   347     }
       
   348 
       
   349 // ---------------------------------------------------------------------------
       
   350 //
       
   351 // ---------------------------------------------------------------------------
       
   352 //
       
   353 TBool CRadioPubSubImp::PublishFrequency( TUint32 aFreq ) const
       
   354     {
       
   355     LOG_FORMAT( "CRadioPubSubImp::PublishFrequency ( aFreq = %u )", aFreq );
       
   356 
       
   357     TInt oldFreq = 0;
       
   358     if ( Get( KRadioPSDataFrequency, oldFreq ) && aFreq != oldFreq )
       
   359         {
       
   360         return Set( KRadioPSDataFrequency, aFreq );
       
   361         }
       
   362     return EFalse;
       
   363     }
       
   364 
       
   365 // ---------------------------------------------------------------------------
       
   366 //
       
   367 // ---------------------------------------------------------------------------
       
   368 //
       
   369 TBool CRadioPubSubImp::PublishPowerState( TBool aPowerOn ) const
       
   370     {
       
   371     LOG_FORMAT( "CRadioPubSubImp::PublishStateL ( aPowerOn = %d )", aPowerOn );
       
   372     // If VR process gets killed, power on state remains published.
       
   373     // Must not compare state transition here, because then power on might not be published.
       
   374     TRadioPSRadioPowerState newState = aPowerOn ? ERadioPSRadioPowerOn : ERadioPSRadioPowerOff;
       
   375     return Set( KRadioPSDataRadioPowerState, newState );
       
   376     }
       
   377 
       
   378 // ---------------------------------------------------------------------------
       
   379 //
       
   380 // ---------------------------------------------------------------------------
       
   381 //
       
   382 TBool CRadioPubSubImp::PublishVolume( TInt aVol ) const
       
   383     {
       
   384     LOG_FORMAT( "CRadioPubSubImp::PublishVolume ( aVol = %d )", aVol );
       
   385 
       
   386     TInt oldVol = 0;
       
   387     if ( Get( KRadioPSDataVolume, oldVol ) && aVol != oldVol )
       
   388         {
       
   389         return Set( KRadioPSDataVolume, aVol );
       
   390         }
       
   391     return EFalse;
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 //
       
   396 // ---------------------------------------------------------------------------
       
   397 //
       
   398 TBool CRadioPubSubImp::PublishChannelDataChanged( TInt aChannelId ) const
       
   399     {
       
   400     LOG_FORMAT( "CRadioPubSubImp::PublishChannelDataChangedL ( aChannelId = %d )", aChannelId );
       
   401 
       
   402     // Channel data changed notifications are allowed for the same channel multiple times, as the same channel's
       
   403     // data can be changed many times in a row.
       
   404 
       
   405     return Set( KRadioPSDataChannelDataChanged, aChannelId );
       
   406     }
       
   407 
       
   408 // ---------------------------------------------------------------------------
       
   409 //
       
   410 // ---------------------------------------------------------------------------
       
   411 //
       
   412 TBool CRadioPubSubImp::PublishTuningState( TRadioPSTuningState aTuningState ) const
       
   413     {
       
   414     LOG_FORMAT( "CRadioPubSubImp::PublishSeekingStateL ( aTuningState = %d )", aTuningState );
       
   415 
       
   416     TInt oldState = 0;
       
   417     if ( Get( KRadioPSDataTuningState, oldState ) && aTuningState != oldState )
       
   418         {
       
   419         return Set( KRadioPSDataTuningState, aTuningState );
       
   420         }
       
   421     return EFalse;
       
   422     }
       
   423 
       
   424 // ---------------------------------------------------------------------------
       
   425 //
       
   426 // ---------------------------------------------------------------------------
       
   427 //
       
   428 TBool CRadioPubSubImp::PublishRadioMuteState( TBool aMuted ) const
       
   429     {
       
   430     LOG_FORMAT( "CRadioPubSubImp::PublishMuteStateL ( aMuted = %d )", aMuted );
       
   431 
       
   432     TRadioPSRadioMuteState newState = aMuted ? ERadioPSMuteStateOn : ERadioPSMuteStateOff;
       
   433 
       
   434     TInt oldState = 0;
       
   435     if ( Get( KRadioPSDataRadioMuteState, oldState ) && oldState != newState )
       
   436         {
       
   437         return Set( KRadioPSDataRadioMuteState, newState );
       
   438         }
       
   439     return EFalse;
       
   440     }
       
   441 
       
   442 // ---------------------------------------------------------------------------
       
   443 //
       
   444 // ---------------------------------------------------------------------------
       
   445 //
       
   446 TBool CRadioPubSubImp::PublishApplicationRunningState( TRadioPSApplicationRunningState aRunningState ) const
       
   447     {
       
   448     LOG_FORMAT( "CRadioPubSubImp::PublishApplicationRunningStateL ( aRunningState = %d )", aRunningState );
       
   449     // If VR process gets killed, wrong running state remains published.
       
   450     // Must not compare state transition here, because then application start might not be published.
       
   451     return Set( KRadioPSDataApplicationRunning, aRunningState );
       
   452     }
       
   453 
       
   454 // ---------------------------------------------------------------------------
       
   455 //
       
   456 // ---------------------------------------------------------------------------
       
   457 //
       
   458 TBool CRadioPubSubImp::PublishHeadsetStatus( TRadioPSHeadsetStatus aHeadsetStatus ) const
       
   459     {
       
   460     LOG_FORMAT( "CRadioPubSubImp::PublishHeadsetStatusL ( aHeadsetStatus = %d )", aHeadsetStatus );
       
   461 
       
   462     TInt oldStatus = 0;
       
   463     if ( Get( KRadioPSDataHeadsetStatus, oldStatus ) && aHeadsetStatus != oldStatus )
       
   464         {
       
   465         return Set( KRadioPSDataHeadsetStatus, aHeadsetStatus );
       
   466         }
       
   467     return EFalse;
       
   468     }
       
   469 
       
   470 // ---------------------------------------------------------------------------
       
   471 //
       
   472 // ---------------------------------------------------------------------------
       
   473 //
       
   474 TBool CRadioPubSubImp::PublishFrequencyDecimalCount( TRadioPSFrequencyDecimalCount aDecimalCount ) const
       
   475     {
       
   476     LOG_FORMAT( "CRadioPubSubImp::PublishFrequencyDecimalCountL ( aDecimalCount = %d )", aDecimalCount );
       
   477 
       
   478     TInt oldCount = 0;
       
   479     if ( Get( KRadioPSDataFrequencyDecimalCount, oldCount ) && aDecimalCount != oldCount )
       
   480         {
       
   481         return Set( KRadioPSDataFrequencyDecimalCount, aDecimalCount );
       
   482         }
       
   483     return EFalse;
       
   484     }
       
   485 
       
   486 // ---------------------------------------------------------------------------
       
   487 //
       
   488 // ---------------------------------------------------------------------------
       
   489 //
       
   490 TBool CRadioPubSubImp::PublishLoudspeakerStatus( TRadioPSLoudspeakerStatus aLoudspeakerStatus ) const
       
   491     {
       
   492     LOG_FORMAT( "CRadioPubSubImp::PublishLoudspeakerStatusL ( aLoudspeakerStatus = %d )", aLoudspeakerStatus );
       
   493     TInt oldStatus = 0;
       
   494     if ( Get( KRadioPSDataLoudspeakerStatus, oldStatus ) && oldStatus != aLoudspeakerStatus )
       
   495         {
       
   496         return Set( KRadioPSDataLoudspeakerStatus, aLoudspeakerStatus );
       
   497         }
       
   498     return EFalse;
       
   499     }
       
   500 
       
   501 // ---------------------------------------------------------------------------
       
   502 //
       
   503 // ---------------------------------------------------------------------------
       
   504 //
       
   505 TBool CRadioPubSubImp::PublishRdsProgramService( const TDesC& aProgramService ) const
       
   506     {
       
   507     return Set( KRadioPSDataRdsProgramService, aProgramService );
       
   508     }
       
   509 
       
   510 // ---------------------------------------------------------------------------
       
   511 //
       
   512 // ---------------------------------------------------------------------------
       
   513 //
       
   514 TBool CRadioPubSubImp::PublishRdsRadioText( const TDesC& aRadioText ) const
       
   515     {
       
   516     return Set( KRadioPSDataRdsRadioText, aRadioText );
       
   517     }
       
   518 
       
   519 // ---------------------------------------------------------------------------
       
   520 //
       
   521 // ---------------------------------------------------------------------------
       
   522 //
       
   523 TBool CRadioPubSubImp::PublishChannelName( const TDesC& aName ) const
       
   524     {
       
   525     return Set( KRadioPSDataChannelName, aName );
       
   526     }
       
   527 
       
   528 // ---------------------------------------------------------------------------
       
   529 //
       
   530 // ---------------------------------------------------------------------------
       
   531 //
       
   532 TBool CRadioPubSubImp::PublishActivePreseListCount( TInt aCount ) const
       
   533     {
       
   534     return Set( KRadioPSDataActivePresetListCount, aCount );
       
   535     }
       
   536 
       
   537 // ---------------------------------------------------------------------------
       
   538 //
       
   539 // ---------------------------------------------------------------------------
       
   540 //
       
   541 TBool CRadioPubSubImp::PublishActivePreseListFocus( TInt aIndex ) const
       
   542     {
       
   543     return Set( KRadioPSDataActivePresetListFocus, aIndex );
       
   544     }
       
   545 
       
   546 // ---------------------------------------------------------------------------
       
   547 //
       
   548 // ---------------------------------------------------------------------------
       
   549 //
       
   550 TBool CRadioPubSubImp::PublishAntennaState( TRadioPSRadioAntennaState aState ) const
       
   551     {
       
   552     return Set( KRadioPSDataRadioAntennaState, aState );
       
   553     }
       
   554 
       
   555 // ---------------------------------------------------------------------------
       
   556 //
       
   557 // ---------------------------------------------------------------------------
       
   558 //
       
   559 void CRadioPubSubImp::SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver )
       
   560     {
       
   561     iObserver = aControlEventObserver;
       
   562     }