phoneengine/audiohandling/inc/cpeaudiodata.h
branchRCL_3
changeset 25 5266b1f337bd
parent 24 41a7f70b3818
equal deleted inserted replaced
24:41a7f70b3818 25:5266b1f337bd
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  This file contains the header file of the class CPEAudioData
    14 * Description:  This file contains the header file of the class CPEAudioData 
    15 *                 which is the interface class for Audio Handling Module
    15 *                 which is the interface class for Audio Handling Module
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    21 #define CPEAUDIODATA_H
    21 #define CPEAUDIODATA_H
    22 
    22 
    23 //  INCLUDES
    23 //  INCLUDES
    24 #include "mpeaudiodata.h"
    24 #include "mpeaudiodata.h"
    25 #include <PSVariables.h>
    25 #include <PSVariables.h>
    26 
    26  
    27 #include <TelephonyAudioRouting.h>
    27 #include <TelephonyAudioRouting.h>
    28 #include <tmseffect.h>
       
    29 #include <tmseffectobsrvr.h>
       
    30 
       
    31 
       
    32 // CONSTANTS
    28 // CONSTANTS
    33 // None.
    29 // None.
    34 
    30 
    35 // MACROS
    31 // MACROS
    36 // None.
    32 // None.
    38 // DATA TYPES
    34 // DATA TYPES
    39 // None.
    35 // None.
    40 
    36 
    41 // FUNCTION PROTOTYPES
    37 // FUNCTION PROTOTYPES
    42 // None.
    38 // None.
    43 
       
    44 using namespace TMS;
       
    45 
    39 
    46 // FORWARD DECLARATIONS
    40 // FORWARD DECLARATIONS
    47 class MPEPhoneModelInternal;
    41 class MPEPhoneModelInternal;
    48 class CPEAudioDtmfTonePlayer;
    42 class CPEAudioDtmfTonePlayer;
    49 class CPEAudioRoutingMonitor;
    43 class CPEAudioRoutingMonitor;
    50 class CPECallAudioRoutingHandler;
    44 class CPECallAudioRoutingHandler;
    51 class CPEAudioFactory;
    45 class CPEAudioFactory;
    52 class CTelephonyAudioRouting;
    46 class CTelephonyAudioRouting;
    53 class CPEAudioEffect;
       
    54 
    47 
    55 // CLASS DECLARATION
    48 // CLASS DECLARATION
    56 
    49 
    57 /**
    50 /**
    58 *  This file contains the header file of the class CPEAudioData,
    51 *  This file contains the header file of the class CPEAudioData, 
    59 *  which is an interface class to audio
    52 *  which is an interface class to audio 
    60 *  properties of the system
    53 *  properties of the system
    61 *
    54 *
    62 *  @lib audiohandling.lib
    55 *  @lib audiohandling.lib
    63 *  @since S60_5.0
    56 *  @since S60_5.0
    64 */
    57 */
    65 class CPEAudioData : public CBase,
    58 class CPEAudioData: 
    66                      public MPEAudioData,
    59         public CBase, 
    67                      public TMSEffectObserver
    60         public MPEAudioData 
    68     {
    61     {
    69 
    62     
    70     public:
    63     public:
    71 
    64 
    72         /**
    65         /**
    73         * Destructor.
    66         * Destructor.
    74         */
    67         */
    80         * C++ default constructor.
    73         * C++ default constructor.
    81         */
    74         */
    82         CPEAudioData( MPEPhoneModelInternal& aPhoneModel );
    75         CPEAudioData( MPEPhoneModelInternal& aPhoneModel );
    83 
    76 
    84     public: // from MPEAudioData
    77     public: // from MPEAudioData
    85 
    78        
    86         /**
    79         /**
    87         * Retrieves Audio mute synchronously.
    80         * Retrieves Audio mute synchronously.
    88         * @param  aAudioMute, audio mute is returned in this parameter.
    81         * @param  aAudioMute, audio mute is returned in this parameter.
    89         */
    82         */
    90         IMPORT_C void GetAudioMuteSync( TBool& aAudioMute ) const;
    83         IMPORT_C void GetAudioMuteSync( TBool& aAudioMute ) const;
    92         /**
    85         /**
    93         * Retrieves Audio volume synchronously.
    86         * Retrieves Audio volume synchronously.
    94         * @param  aAudioVolume, audio volume is returned in this parameter.
    87         * @param  aAudioVolume, audio volume is returned in this parameter.
    95         */
    88         */
    96         IMPORT_C void GetAudioVolumeSync( TInt& aAudioVolume ) const;
    89         IMPORT_C void GetAudioVolumeSync( TInt& aAudioVolume ) const;
    97 
    90                 
    98         /**
    91         /**
    99         * Makes synchronous request to set Audio Mute.
    92         * Makes synchronous request to set Audio Mute.
   100         * @param  aAudioMute, mute to be set.
    93         * @param  aAudioMute, mute to be set.
   101         */
    94         */
   102         IMPORT_C void SetAudioMuteSync( const TBool aAudioMute );
    95         IMPORT_C void SetAudioMuteSync( const TBool aAudioMute );
   111         * Makes request to Telephony Audio Routing to set audio output path
   104         * Makes request to Telephony Audio Routing to set audio output path
   112         * @param aOutput, audio output path
   105         * @param aOutput, audio output path
   113         * @param aShowNote, audio note status
   106         * @param aShowNote, audio note status
   114         * @return KErrNone or possible errorcode.
   107         * @return KErrNone or possible errorcode.
   115         */
   108         */
   116         IMPORT_C TInt SetAudioOutput(
   109         IMPORT_C TInt SetAudioOutput( 
   117             const TPEAudioOutput aOutput,
   110             const TPEAudioOutput aOutput,
   118             TBool aShowNote );
   111             TBool aShowNote );
   119 
   112   
   120         /**
   113         /**
   121         * Gets volume levels, audio mute, audio mode and audio volume
   114         * Gets volume levels, audio mute, audio mode and audio volume 
   122         * at startup and starts monitors.
   115         * at startup and starts monitors.
   123         * @param  None.
   116         * @param  None.
   124         * @return None.
   117         * @return None.
   125         */
   118         */
   126         IMPORT_C void StartUp();
   119         IMPORT_C void StartUp();
   127 
   120   
       
   121         /**
       
   122         * Sets default volume level if muted when call ended
       
   123         */
       
   124         IMPORT_C void SetDefaultVolume();
       
   125  
   128         /**
   126         /**
   129         * Handles call audio route preference changed
   127         * Handles call audio route preference changed
   130         */
   128         */
   131         IMPORT_C TInt CallAudioRoutePreferenceChanged();
   129         IMPORT_C TInt CallAudioRoutePreferenceChanged();
   132 
   130      
   133         /**
   131         /**
   134         * Initialises call audio route when call is alerting or answered
   132         * Initialises call audio route when call is alerting or answered
   135         */
   133         */
   136         IMPORT_C TInt HandleCallStarting( TBool aVideoCall );
   134         IMPORT_C TInt HandleCallStarting( TBool aVideoCall );
   137 
   135         
   138         /**
   136         /**
   139         * Initialises energency call audio route
   137         * Initialises energency call audio route
   140         */
   138         */
   141         IMPORT_C TInt HandleEnergencyCallStarting();
   139         IMPORT_C TInt HandleEnergencyCallStarting();
   142 
   140         
   143         /**
   141         /**
   144         * Ends call audio route when call disconnected
   142         * Ends call audio route when call disconnected
   145         */
   143         */
   146         IMPORT_C void HandleCallEnding();
   144         IMPORT_C void HandleCallEnding();
   147 
   145     
   148     public: // new
   146     public: // new
   149 
   147         
   150         /**
   148         /**
   151         * Sends AudioHandlingError message to PhoneEngine and saves
   149         * Sends AudioHandlingError message to PhoneEngine and saves 
   152         * errorcode to member variable.
   150         * errorcode to member variable.
   153         * @param  aErrorCode, errorcode that is saved to member variable.
   151         * @param  aErrorCode, errorcode that is saved to member variable.
   154         * @return None.
   152         * @return None.
   155         */
   153         */
   156         void SendErrorMessage( const TInt aErrorCode );
   154         void SendErrorMessage( const TInt aErrorCode );
   158         /**
   156         /**
   159         * Forwards message given as parameter to PhoneEngine.
   157         * Forwards message given as parameter to PhoneEngine.
   160         * @param  aMessage, message to be forwarded.
   158         * @param  aMessage, message to be forwarded.
   161         * @return None.
   159         * @return None.
   162         */
   160         */
   163         void SendMessage(
   161         void SendMessage( 
   164             const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage );
   162             const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage );
   165 
   163 
   166         /**
   164         /**
   167         * Forwards message given as parameter to Phone Engine
   165         * Forwards message given as parameter to Phone Engine
   168         * @param  aMessage, message to be forwarded.
   166         * @param  aMessage, message to be forwarded.
   169         * @param  aOutput, audio output path that is saved in member variable.
   167         * @param  aOutput, audio output path that is saved in member variable.
   170         * @return None.
   168         * @return None.
   171         */
   169         */
   172         void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage,
   170         void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, 
   173                           const CTelephonyAudioRouting::TAudioOutput aOutput );
   171                           const CTelephonyAudioRouting::TAudioOutput aOutput );
   174 
   172 
   175         /**
   173         /**
   176         * Forwards message given as parameter to Phone Engine
   174         * Forwards message given as parameter to Phone Engine
   177         * @param  aMessage, message to be forwarded.
   175         * @param  aMessage, message to be forwarded.
   178         * @param  aOutput, audio output path that is saved in member variable.
   176         * @param  aOutput, audio output path that is saved in member variable.
   179         * @return None.
   177         * @return None.
   180         */
   178         */
   181         void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage,
   179         void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, 
   182                           CTelephonyAudioRouting& aTelephonyAudioRouting );
   180                           CTelephonyAudioRouting& aTelephonyAudioRouting );
   183 
   181 
   184         /**
   182         /**
   185         * Sets value of audio routing preference
   183         * Sets value of audio routing preference
   186         */
   184         */        
   187         void SetRoutePreference( TBool aShowNote );
   185         void SetRoutePreference( TBool aShowNote );
   188 
   186 
   189         /**
   187         /**
   190         * Return value of audio routing preference
   188         * Return value of audio routing preference
   191         */
   189         */
   192         CTelephonyAudioRouting::TAudioOutput RoutePreference();
   190         CTelephonyAudioRouting::TAudioOutput RoutePreference();
   193 
   191         
   194         /**
   192         /**
   195         * Return value of previous output
   193         * Return value of previous output
   196         */
   194         */        
   197         CTelephonyAudioRouting::TAudioOutput PreviousOutput();
   195         CTelephonyAudioRouting::TAudioOutput PreviousOutput();
   198 
   196         
   199         /**
   197         /**
   200         * Return value of current output
   198         * Return value of current output
   201         */
   199         */        
   202         CTelephonyAudioRouting::TAudioOutput Output();
   200         CTelephonyAudioRouting::TAudioOutput Output();
   203 
   201  
   204         /**
   202         /**
   205         * Return status of wired accessory availability
   203         * Return status of wired accessory availability
   206         */
   204         */
   207         TBool IsWiredAvailable();
   205         TBool IsWiredAvailable();
   208 
   206         
   209         /**
   207         /**
   210         * Return status of BT accessory availability
   208         * Return status of BT accessory availability
   211         */
   209         */        
   212         TBool IsBTAvailable();
   210         TBool IsBTAvailable();
   213 
   211 
   214         /**
   212         /**
   215         * Return status of TTY accessory availability
   213         * Return status of TTY accessory availability
   216         */
   214         */        
   217         TBool IsTTYAvailable();
   215         TBool IsTTYAvailable();
   218 
   216         
   219         /**
   217         /**
   220         * Set new audio route to TAR
   218         * Set new audio route to TAR
   221         */
   219         */
   222         void SetTAROutput( CTelephonyAudioRouting::TAudioOutput aOutput,
   220         void SetTAROutput( CTelephonyAudioRouting::TAudioOutput aOutput,
   223                            TBool aShowNote );
   221                            TBool aShowNote );
   224 
   222      
   225         /**
       
   226          * From TMSEffectObserver
       
   227          */
       
   228     void EffectsEvent(const TMSEffect& tmseffect, TMSSignalEvent event);
       
   229 
   223 
   230     protected:
   224     protected:
   231 
   225 
   232         /**
   226         /**
   233         * By default Symbian 2nd phase constructor is private, but we use
   227         * By default Symbian 2nd phase constructor is private, but we use 
   234         * it at generalized class.
   228         * it at generalized class.
   235         */
   229         */
   236         void ConstructL( CPEAudioFactory& aAudioFactory );
   230         void ConstructL( CPEAudioFactory& aAudioFactory ); 
   237 
   231 
   238     protected:  // New functions
   232     protected:  // New functions
   239 
   233         
   240         /**
   234         /**
   241          * Updates volume on DataStore and if aSendMsg==ETrue sends
   235          * Protected function for derived classes to implement for
   242          * notification to engine monitor.
   236          * extended volume handling. Default implementation is empty.
   243          * @since S60 v5.0
   237          * @since S60 v5.0
   244          * @param aVolume New volume value.
   238          * @param aVolume New volume value.
   245          * @param aSendMsg ETrue will send notification.
       
   246          */
   239          */
   247         virtual void DoHandleVolumeChange( TInt aVolume, TBool aSendMsg=EFalse );
   240         virtual void DoHandleVolumeChange( TInt aVolume );
   248 
   241      
   249     private:
   242     private:
   250 
   243     
   251         /**
   244         /**
   252         * Gets all audio volume value and update member variable
   245         * Gets all audio volume values from reporitory and update member variables
   253         */
   246         */
   254         void InitializeAudioVolume();
   247         void InitializeAudioVolumes();
   255 
   248         
   256 
   249                        
   257         /**
   250         /**
   258         * Makes request to Telephony Audio Routing to get available audio outputs
   251         * Makes request to Telephony Audio Routing to get available audio outputs
   259         * @return list of available outputs
   252         * @return list of available outputs
   260         */
   253         */
   261         TArray< TPEAudioOutput> GetAvailableOutputs(
   254         TArray< TPEAudioOutput> GetAvailableOutputs( 
   262                 CTelephonyAudioRouting& aTelephonyAudioRouting );
   255                 CTelephonyAudioRouting& aTelephonyAudioRouting );
   263 
   256 
   264         /**
   257         /**
   265         * Converts TAR route value to PE value
   258         * Converts TAR route value to PE value
   266         */
   259         */
   267         TPEAudioOutput ConvertToPE( CTelephonyAudioRouting::TAudioOutput aOutput );
   260         TPEAudioOutput ConvertToPE( CTelephonyAudioRouting::TAudioOutput aOutput );
   268 
   261 
   269         /**
   262         /**
   270         * Converts PE route value to TAR value
   263         * Converts PE route value to TAR value
   271         */
   264         */        
   272         CTelephonyAudioRouting::TAudioOutput ConvertToTAR( TPEAudioOutput aOutput );
   265         CTelephonyAudioRouting::TAudioOutput ConvertToTAR( TPEAudioOutput aOutput );
       
   266         /**
       
   267         * Return status of mic mute
       
   268         */
       
   269         TBool IsMuted() const;
   273 
   270 
   274     protected:
   271     protected:
   275         // CPhoneModel object which owns this object.
   272         // CPhoneModel object which owns this object. 
   276         MPEPhoneModelInternal& iPhoneModel;
   273         MPEPhoneModelInternal& iPhoneModel;
   277         // Audio Routing Monitor
   274         // Audio Routing Monitor
   278         CPEAudioRoutingMonitor* iAudioRoutingMonitor;
   275         CPEAudioRoutingMonitor* iAudioRoutingMonitor;
   279         // Audio Routing Handler
   276         // Audio Routing Handler
   280         CPECallAudioRoutingHandler* iAudioRoutingHandler;
   277         CPECallAudioRoutingHandler* iAudioRoutingHandler;
   282         CTelephonyAudioRouting* iAudioRouting;
   279         CTelephonyAudioRouting* iAudioRouting;
   283         // Available Audio Outputs
   280         // Available Audio Outputs
   284         RArray<TPEAudioOutput> iPEavailableOutputs;
   281         RArray<TPEAudioOutput> iPEavailableOutputs;
   285         //Flag to indicate whether is Call audio route initialized
   282         //Flag to indicate whether is Call audio route initialized
   286         TBool iRouteInitialized;
   283         TBool iRouteInitialized;
   287 
   284         #ifdef __WINSCW__
   288         CPEAudioEffect* iAudioEffect;
   285         // dummy implementation for WINSCW
       
   286         TInt  iVolume;
       
   287         TBool iMute; 
       
   288         #endif        
       
   289         // HeadSet Mode Audio volume
       
   290         TInt iHeadSetVolume;
       
   291         // Loudspeaker Mode Audio volume
       
   292         TInt iLoudspeakerVolume;
       
   293         // ETrue when audio output changed 
       
   294         TBool iAudioOutputChanged; 
   289      };
   295      };
   290 
   296 
   291 #endif      // CPEAUDIODATA_H
   297 #endif      // CPEAUDIODATA_H  
   292 
   298             
   293 // End of File
   299 // End of File