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