radioengine/utils/inc/cradiopubsubimp.h
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 26 6bcf277166c1
parent 33 11b6825f0862
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
     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 #ifndef CRADIOPUBSUBIMP_H
       
    18 #define CRADIOPUBSUBIMP_H
       
    19 
       
    20 // User includes
       
    21 #include "cradiopubsub.h"
       
    22 #include "cradiopropertyobserver.h"
       
    23 
       
    24 /**
       
    25  *  Publish & Subscribe interface of Radio Application.
       
    26  */
       
    27 NONSHARABLE_CLASS( CRadioPubSubImp ) : public CRadioPubSub
       
    28                                      , public MRadioPropertyChangeObserver
       
    29     {
       
    30 public:
       
    31 
       
    32     static CRadioPubSubImp* NewL();
       
    33 
       
    34     ~CRadioPubSubImp();
       
    35 
       
    36 private:
       
    37 
       
    38     CRadioPubSubImp();
       
    39 
       
    40     void ConstructL();
       
    41 
       
    42 // from base class CRadioPubSub
       
    43 
       
    44     TBool PublishChannel( TInt aChannelId ) const;
       
    45     TBool PublishFrequency( TUint32 aFreq ) const;
       
    46     TBool PublishPowerState( TBool aPowerOn ) const;
       
    47     TBool PublishVolume( TInt aVol ) const;
       
    48     TBool PublishChannelDataChanged( TInt aChannelId ) const;
       
    49     TBool PublishTuningState( TRadioPSTuningState aTuningState ) const;
       
    50     TBool PublishRadioMuteState( TBool aMuted ) const;
       
    51     TBool PublishApplicationRunningState( TRadioPSApplicationRunningState aRunningState ) const;
       
    52     TBool PublishHeadsetStatus( TRadioPSHeadsetStatus aHeadsetStatus ) const;
       
    53     TBool PublishFrequencyDecimalCount( TRadioPSFrequencyDecimalCount aDecimalCount ) const;
       
    54     TBool PublishLoudspeakerStatus( TRadioPSLoudspeakerStatus aLoudspeakerStatus ) const;
       
    55     TBool PublishRdsProgramService( const TDesC& aProgramService ) const;
       
    56     TBool PublishRdsRadioText( const TDesC& aRadioText ) const;
       
    57     TBool PublishChannelName( const TDesC& aName ) const;
       
    58     TBool PublishActivePreseListCount( TInt aCount ) const;
       
    59     TBool PublishActivePreseListFocus( TInt aIndex ) const;
       
    60     TBool PublishAntennaState( TRadioPSRadioAntennaState aState ) const;
       
    61     void SetControlEventObserver( MRadioControlEventObserver* aControlEventObserver );
       
    62 
       
    63 // from base class MVRPropertyChangeObserver
       
    64 
       
    65     void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue );
       
    66     void HandlePropertyChangeL( const TUid& /*aCategory*/, const TUint /*aKey*/, const TDesC8& /*aValue*/ ) {}
       
    67     void HandlePropertyChangeL( const TUid& /*aCategory*/, const TUint /*aKey*/, const TDesC& /*aValue*/ ) {}
       
    68     void HandlePropertyChangeErrorL( const TUid& /*aCategory*/, const TUint /*aKey*/, TInt /*aError*/ ) {}
       
    69 
       
    70 // New functions
       
    71 
       
    72     /**
       
    73      * Defines a property.
       
    74      *
       
    75      * @param aKey The key of the property.
       
    76      * @param aAttr Attributes of the property.
       
    77      * @param aDataProperty ETrue if the property is a data property, EFalse
       
    78      * if it is a control property
       
    79      */
       
    80     void DefinePropertyL( TUint aKey, TInt aAttr, TBool aDataProperty ) const;
       
    81 
       
    82     /**
       
    83      * Deletes a property.
       
    84      *
       
    85      * @param aKey The key of the property.
       
    86      */
       
    87     void DeleteProperty( TUint aKey ) const;
       
    88 
       
    89     /**
       
    90      * Creates a property observer
       
    91      *
       
    92      * @param aKey Property key
       
    93      * @param aPropertyType Property type
       
    94      */
       
    95     void CreatePropertyObserverL( const TUint aKey, const TInt aPropertyType );
       
    96 
       
    97     /**
       
    98      * Gets the integer value stored in a property.
       
    99      *
       
   100      * @param    aKey    The key of the property.
       
   101      * @return   The value contained in the property.
       
   102      */
       
   103     TBool Get( TUint aKey, TInt& aValue ) const;
       
   104 
       
   105     /**
       
   106      * Sets the value in an integer property.
       
   107      *
       
   108      * @param    aKey    The key of the property.
       
   109      * @param    aValue  The value to set.
       
   110      */
       
   111     TBool Set( TUint aKey, TInt aValue ) const;
       
   112 
       
   113     /**
       
   114      * Sets the value in a text property.
       
   115      *
       
   116      * @param    aKey    The key of the property.
       
   117      * @param    aValue  The value to set.
       
   118      */
       
   119     TBool Set( TUint aKey, const TDesC& aValue ) const;
       
   120 
       
   121 private: // data
       
   122 
       
   123     /**
       
   124      * Pointer to observer in UI side, can be NULL. Not owned.
       
   125      */
       
   126     MRadioControlEventObserver*           iObserver;
       
   127 
       
   128     /**
       
   129      * An array of handlers to P&S interface.
       
   130      */
       
   131     RPointerArray<CRadioPropertyObserver> iPropertyArray;
       
   132 
       
   133     };
       
   134 
       
   135 #endif // CRADIOPUBSUBIMP_H