tsrc/musenginestub/inc/musengtelephoneutils.h
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    18 
    18 
    19 #ifndef MUSENGTELEPHONEUTILS_H
    19 #ifndef MUSENGTELEPHONEUTILS_H
    20 #define MUSENGTELEPHONEUTILS_H
    20 #define MUSENGTELEPHONEUTILS_H
    21 
    21 
    22 
    22 
    23 #include "musunittesting.h"
    23 //#include "musunittesting.h"
    24 
    24 
    25 // SYSTEM
    25 // SYSTEM
    26 #include <e32base.h>
    26 #include <e32base.h>
    27 #include <mtelephonyaudioroutingobserver.h>
    27 //#include <mtelephonyaudioroutingobserver.h>
    28 #include <telephonyaudiorouting.h>
    28 //#include <telephonyaudiorouting.h>
    29 #include <rphcltserver.h>
       
    30 
    29 
    31 // FORWARD DECLARATIONS
    30 // FORWARD DECLARATIONS
    32 class CRepository;
    31 //class CRepository;
    33 class CTelephonyAudioRouting;
    32 //class CTelephonyAudioRouting;
    34 class CPhCltCommandHandler;
       
    35 class MMusEngAudioRoutingObserver;
       
    36 
    33 
    37 /**
    34 /**
    38 * Utility class to handle all phone related requests:
    35 *
    39 * Audio routing, volume control and microphone muting.
    36 * @lib musengine.lib
       
    37 * @since S60 v3.2
    40 */
    38 */
    41 class CMusEngTelephoneUtils : public CActive,
    39 class CMusEngTelephoneUtils : public CBase
    42                               public MTelephonyAudioRoutingObserver
    40                               //public MTelephonyAudioRoutingObserver
    43     {
    41     {
    44     MUS_UNITTEST( UT_CMusEngTelephoneUtils )
    42     public:
    45     MUS_UNITTEST( UT_CMusEngSession )
    43 
    46 	
    44         /**
    47 	public: 
    45         *
    48 		
    46         * @since S60 v3.2
    49 		/**
       
    50    		*
       
    51         */
    47         */
    52 		static CMusEngTelephoneUtils* NewL();
    48         static CMusEngTelephoneUtils* NewL();
    53 
    49 
    54 		/**
    50         /**
    55    		*
    51         *
       
    52         * @since S60 v3.2
    56         */
    53         */
    57 		~CMusEngTelephoneUtils();
    54         ~CMusEngTelephoneUtils();
    58 
    55 
    59 
    56 
    60 	public: // API
    57     public: // API
    61 	
       
    62 	    /**
       
    63         * Checks if audio routing can be changed using LoudspeakerL
       
    64         * 
       
    65         * @return ETrue if audio routing can be changed using LoudspeakerL
       
    66         */
       
    67         TBool AudioRoutingCanBeChanged();
       
    68 
    58 
    69 		/**
    59         /**
    70    		* Changes the audio routing between loudspeaker and handset.
    60         *
    71    		*  
    61         * @since S60 v3.2
    72    		* @param aShowDialog if ETrue, user is notified about new audio routing
       
    73         */
    62         */
    74         void LoudspeakerL( TBool aEnable, TBool aShowDialog );
    63         void LoudspeakerL( TBool aEnable, TBool aShowDialog );
    75 
    64 
    76 		/**
    65         /**
    77    		*
    66         *
       
    67         * @since S60 v3.2
    78         */
    68         */
    79 		TBool IsLoudSpeakerEnabled() const;
    69         TBool IsLoudSpeakerEnabled() const;
    80 		
       
    81 		/**
       
    82    		*
       
    83         */
       
    84 		TInt GetVolumeL() const;
       
    85 
       
    86 		/**
       
    87    		*
       
    88         */
       
    89 		void SetVolumeL( TInt aVolume );
       
    90 		
       
    91 		/**
       
    92         * Mutes CS call microphone.
       
    93         */
       
    94         void MuteMicL( TBool aMute );
       
    95         
       
    96         /**
       
    97         * Returns current CS call mic mute state.
       
    98         */
       
    99         TBool IsMicMutedL();
       
   100     
       
   101         /**
       
   102         * Sets audio routing observer. Can be set to NULL in order to indicate
       
   103         * ending of observing changes in audio routing.
       
   104         */
       
   105         void SetAudioRoutingObserver( MMusEngAudioRoutingObserver* aObserver );
       
   106                                         
       
   107     
       
   108     private: // inherited from CActive
       
   109 
       
   110 		/**
       
   111    		*
       
   112         */
       
   113         void RunL();
       
   114         
       
   115 		/**
       
   116    		* Cancels outstanding request to phone client
       
   117         */
       
   118         void DoCancel();
       
   119             
       
   120 		
       
   121     private: // MTelephonyAudioRoutingObserver functions
       
   122 
    70 
   123         /**
    71         /**
   124          * Available outputs have changed
    72         *
   125          */
    73         * @since S60 v3.2
   126         void AvailableOutputsChanged( 
    74         */
   127                         CTelephonyAudioRouting& aTelephonyAudioRouting );
    75         TInt GetVolumeL() const;
   128     
    76 
   129         /**
    77         /**
   130          * Some other application has changed audio output routing
    78         *
   131          */
    79         * @since S60 v3.2
   132         void OutputChanged( 
       
   133                         CTelephonyAudioRouting& aTelephonyAudioRouting );
       
   134     
       
   135         /**
       
   136          * Our request to change audio output routing has completed
       
   137          */
       
   138         void SetOutputComplete( 
       
   139                         CTelephonyAudioRouting& aTelephonyAudioRouting,
       
   140                         TInt aError );
       
   141     
       
   142         /**
       
   143         * Set output if setting is currently allowed. Leaves with KErrAccessDenied
       
   144         * if setting is not allowed.
       
   145         */
    80         */
   146         void DoSetOutputL( CTelephonyAudioRouting::TAudioOutput aAudioOutput );
    81         void SetVolumeL( TInt aVolume );
   147         
    82 
       
    83 
       
    84 
   148     private:
    85     private:
   149 
    86 
   150 		/**
    87         /**
   151    		* Default C++ constructor
    88         *
       
    89         * @since S60 v3.2
   152         */
    90         */
   153 		CMusEngTelephoneUtils();
    91         CMusEngTelephoneUtils();
   154 
    92 
   155 		/**
    93         /**
   156    		* 2nd phase constructor
    94         *
       
    95         * @since S60 v3.2
   157         */
    96         */
   158 		void ConstructL();
    97         void ConstructL();
   159 
    98 
   160 
    99 
   161 	private: // HELPER
   100     private: // HELPER
   162 	
       
   163 		/**
       
   164    		* Checks that volume value is between 1 and 10.
       
   165    		*
       
   166    		* @return validated volume value
       
   167         */
       
   168 		TInt ValidateVolume( const TInt aVolume ) const;
       
   169 		
       
   170 
       
   171     private: // DATA
       
   172 
   101 
   173         /**
   102         /**
   174         *  Stores the audio routing state at startup.
   103         *
       
   104         * @since S60 v3.2
   175         */
   105         */
   176         CTelephonyAudioRouting::TAudioOutput iAudioOutputAtStartup;
   106         TInt ValidateVolume( const TInt aVolume ) const;
   177         
   107 
       
   108 
       
   109     public: // DATA
       
   110 
       
   111         /**
       
   112          *  Stores the audio routing state at startup.
       
   113          */
       
   114         //CTelephonyAudioRouting::TAudioOutput iAudioOutputAtStartup;
       
   115 
   178         /**
   116         /**
   179         * Telephony audio routing instance. Owned.
   117         * Telephony audio routing instance. Owned.
   180         */
   118         */
   181         CTelephonyAudioRouting* iTelephonyAudioRouting;
   119         //CTelephonyAudioRouting* iTelephonyAudioRouting;
   182 
   120 
   183         /**
   121         /**
   184         * Central repository. Owned.
   122         * Central repository. Owned.
       
   123         *
       
   124         * @since S60 v3.2
   185         */
   125         */
   186         CRepository* iRepository;
   126         //CRepository* iRepository;
   187 
   127 
   188         /**
       
   189         * Command handler for muting the microphone
       
   190         */        
       
   191         CPhCltCommandHandler* iPhoneCommandHandler;
       
   192         
       
   193         /**
       
   194         * Not owned.
       
   195         */
       
   196         MMusEngAudioRoutingObserver* iAudioRoutingObserver;
       
   197 
       
   198         TBool iShowDialog;
       
   199         
       
   200     };
   128     };
   201 
   129 
   202 
   130 
   203 #endif // MUSENGTELEPHONEUTILS_H
   131 #endif // MUSENGTELEPHONEUTILS_H