tsrc/musenginestub/inc/musengtelephoneutils.h
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
equal deleted inserted replaced
21:33a5d2bbf6fc 22:73a1feb507fb
    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>
    29 
    30 
    30 // FORWARD DECLARATIONS
    31 // FORWARD DECLARATIONS
    31 //class CRepository;
    32 class CRepository;
    32 //class CTelephonyAudioRouting;
    33 class CTelephonyAudioRouting;
       
    34 class CPhCltCommandHandler;
       
    35 class MMusEngAudioRoutingObserver;
    33 
    36 
    34 /**
    37 /**
    35 *
    38 * Utility class to handle all phone related requests:
    36 * @lib musengine.lib
    39 * Audio routing, volume control and microphone muting.
    37 * @since S60 v3.2
       
    38 */
    40 */
    39 class CMusEngTelephoneUtils : public CBase
    41 class CMusEngTelephoneUtils : public CActive,
    40                               //public MTelephonyAudioRoutingObserver
    42                               public MTelephonyAudioRoutingObserver
    41     {
    43     {
    42     public:
    44     MUS_UNITTEST( UT_CMusEngTelephoneUtils )
    43 
    45     MUS_UNITTEST( UT_CMusEngSession )
    44         /**
    46 	
    45         *
    47 	public: 
    46         * @since S60 v3.2
    48 		
    47         */
    49 		/**
    48         static CMusEngTelephoneUtils* NewL();
    50    		*
    49 
    51         */
    50         /**
    52 		static CMusEngTelephoneUtils* NewL();
    51         *
    53 
    52         * @since S60 v3.2
    54 		/**
    53         */
    55    		*
    54         ~CMusEngTelephoneUtils();
    56         */
    55 
    57 		~CMusEngTelephoneUtils();
    56 
    58 
    57     public: // API
    59 
    58 
    60 	public: // API
    59         /**
    61 	
    60         *
    62 	    /**
    61         * @since S60 v3.2
    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 
       
    69 		/**
       
    70    		* Changes the audio routing between loudspeaker and handset.
       
    71    		*  
       
    72    		* @param aShowDialog if ETrue, user is notified about new audio routing
    62         */
    73         */
    63         void LoudspeakerL( TBool aEnable, TBool aShowDialog );
    74         void LoudspeakerL( TBool aEnable, TBool aShowDialog );
    64 
    75 
    65         /**
    76 		/**
    66         *
    77    		*
    67         * @since S60 v3.2
    78         */
    68         */
    79 		TBool IsLoudSpeakerEnabled() const;
    69         TBool IsLoudSpeakerEnabled() const;
    80 		
    70 
    81 		/**
    71         /**
    82    		*
    72         *
    83         */
    73         * @since S60 v3.2
    84 		TInt GetVolumeL() const;
    74         */
    85 
    75         TInt GetVolumeL() const;
    86 		/**
    76 
    87    		*
    77         /**
    88         */
    78         *
    89 		void SetVolumeL( TInt aVolume );
    79         * @since S60 v3.2
    90 		
    80         */
    91 		/**
    81         void SetVolumeL( TInt aVolume );
    92         * Mutes CS call microphone.
    82 
    93         */
    83 
    94         void MuteMicL( TBool aMute );
    84 
    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 
       
   123         /**
       
   124          * Available outputs have changed
       
   125          */
       
   126         void AvailableOutputsChanged( 
       
   127                         CTelephonyAudioRouting& aTelephonyAudioRouting );
       
   128     
       
   129         /**
       
   130          * Some other application has changed audio output routing
       
   131          */
       
   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         */
       
   146         void DoSetOutputL( CTelephonyAudioRouting::TAudioOutput aAudioOutput );
       
   147         
    85     private:
   148     private:
    86 
   149 
    87         /**
   150 		/**
    88         *
   151    		* Default C++ constructor
    89         * @since S60 v3.2
   152         */
    90         */
   153 		CMusEngTelephoneUtils();
    91         CMusEngTelephoneUtils();
   154 
    92 
   155 		/**
    93         /**
   156    		* 2nd phase constructor
    94         *
   157         */
    95         * @since S60 v3.2
   158 		void ConstructL();
    96         */
   159 
    97         void ConstructL();
   160 
    98 
   161 	private: // HELPER
    99 
   162 	
   100     private: // HELPER
   163 		/**
   101 
   164    		* Checks that volume value is between 1 and 10.
   102         /**
   165    		*
   103         *
   166    		* @return validated volume value
   104         * @since S60 v3.2
   167         */
   105         */
   168 		TInt ValidateVolume( const TInt aVolume ) const;
   106         TInt ValidateVolume( const TInt aVolume ) const;
   169 		
   107 
   170 
   108 
   171     private: // DATA
   109     public: // DATA
   172 
   110 
   173         /**
   111         /**
   174         *  Stores the audio routing state at startup.
   112          *  Stores the audio routing state at startup.
   175         */
   113          */
   176         CTelephonyAudioRouting::TAudioOutput iAudioOutputAtStartup;
   114         //CTelephonyAudioRouting::TAudioOutput iAudioOutputAtStartup;
   177         
   115 
       
   116         /**
   178         /**
   117         * Telephony audio routing instance. Owned.
   179         * Telephony audio routing instance. Owned.
   118         */
   180         */
   119         //CTelephonyAudioRouting* iTelephonyAudioRouting;
   181         CTelephonyAudioRouting* iTelephonyAudioRouting;
   120 
   182 
   121         /**
   183         /**
   122         * Central repository. Owned.
   184         * Central repository. Owned.
   123         *
   185         */
   124         * @since S60 v3.2
   186         CRepository* iRepository;
   125         */
   187 
   126         //CRepository* iRepository;
   188         /**
   127 
   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         
   128     };
   200     };
   129 
   201 
   130 
   202 
   131 #endif // MUSENGTELEPHONEUTILS_H
   203 #endif // MUSENGTELEPHONEUTILS_H