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