phoneplugins/csplugin/inc/cspaudiohandler.h
changeset 27 2f8f8080a020
parent 21 92ab7f8d0eab
child 51 f39ed5e045e0
equal deleted inserted replaced
22:6bb1b21d2484 27:2f8f8080a020
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2  * Copyright (c) 2007-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".
     8 *
     8  *
     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:  Declarations for class CSPAudioHandler
    14  * Description:  Declarations for class CSPAudioHandler
    15 *
    15  *
    16 */
    16  */
    17 
       
    18 
    17 
    19 #ifndef CSPAUDIOHANDLER_H
    18 #ifndef CSPAUDIOHANDLER_H
    20 #define CSPAUDIOHANDLER_H
    19 #define CSPAUDIOHANDLER_H
    21 
    20 
    22 #include <e32base.h>
    21 #include <e32base.h>
    23 #include <sounddevice.h>
       
    24 
    22 
    25 #include "mcsppubsubobserver.h"
    23 class TmsHandler;
    26 #include "mcspcenrepobserver.h"
    24 /**
       
    25  * Handles call adding from calls not done by the plugin.
       
    26  *
       
    27  */
       
    28 class CSPAudioHandler : public CBase
       
    29     {
       
    30 public:
       
    31     //Constructors and descructor
       
    32 
       
    33     /**
       
    34      * Two-phased constructing for the monitor.
       
    35      *
       
    36      * @param aObserver the observer for getting notification
       
    37      * @param aLine the line to monitor
       
    38      * @param aLineId line identifier
       
    39      */
       
    40     static CSPAudioHandler* NewL();
       
    41 
       
    42     /**
       
    43      * C++ default destructor.
       
    44      */
       
    45     virtual ~CSPAudioHandler();
       
    46 
       
    47     /**
       
    48      * Start audio streams.
       
    49      */
       
    50     void Start();
       
    51 
       
    52     /**
       
    53      * Stop audio streams.
       
    54      */
       
    55     void Stop();
       
    56 
       
    57 protected:
       
    58     // From CActive
       
    59     /**
       
    60      * From CActive
       
    61      * RunL
       
    62      */
       
    63     void RunL();
       
    64 
       
    65     /**
       
    66      * From CActive
       
    67      * Catches errors if RunL leaves
       
    68      * @param aError error code
       
    69      * @return error code
       
    70      */
       
    71     TInt RunError(TInt aError);
       
    72 
       
    73     /**
       
    74      * From CActive
       
    75      * Cancels the monitor
       
    76      */
       
    77     void DoCancel();
       
    78 
       
    79 private:
       
    80     /**
       
    81      * C++ default constructor
       
    82      * @param aObserver the observer for status change (incoming call)
       
    83      * @param aLine the line associated with the call
       
    84      * @param aLineId line identifier
       
    85      */
       
    86     CSPAudioHandler();
       
    87 
       
    88     /**
       
    89      * Constructs the monitor in the second phase.
       
    90      */
       
    91     void ConstructL();
       
    92 
       
    93 private:
       
    94     // data
    27 
    95 
    28 
    96 
    29 class CSPPubSubListener;
    97     /**
    30 class CSPCenRepListener;
    98      * Audio streams handler.
    31 class CSPAudioStreams;
    99      */
       
   100     TmsHandler* iTmsHandler;
    32 
   101 
    33 /**
   102     /**
    34 * Handles call adding from calls not done by the plugin.
   103      * Call count
    35 *
   104      */
    36 */
   105     TInt iCallCount;
    37 class CSPAudioHandler: public CBase,
   106     };
    38                        public MCSPPubSubObserver,
       
    39                        public MCSPCenRepObserver,
       
    40                        public MDevSoundObserver
       
    41     {
       
    42     
       
    43     public: //Constructors and descructor    
       
    44     
       
    45         /**
       
    46         * Two-phased constructing for the monitor.
       
    47         *
       
    48         * @param aObserver the observer for getting notification
       
    49         * @param aLine the line to monitor
       
    50         * @param aLineId line identifier
       
    51         */
       
    52         static CSPAudioHandler* NewL(  );
       
    53 
   107 
    54         /**
       
    55         * C++ default destructor.
       
    56         */
       
    57         virtual ~CSPAudioHandler( );
       
    58 
       
    59         /**
       
    60         * Start audio streams.  
       
    61         */
       
    62         void Start();
       
    63 
       
    64         /**
       
    65         * Stop audio streams. 
       
    66         */
       
    67         void Stop();
       
    68 
       
    69         /**
       
    70         * From base class MCSPPubSubObserver.
       
    71         * Handler for changed event.
       
    72         * @param aUid uid of setting 
       
    73         * @param aKey id of setting
       
    74         * @param aStatus status of completed AO operation
       
    75         */
       
    76         virtual void HandleNotifyPSL( const TUid aUid, const TInt& aKey, 
       
    77             const TRequestStatus& aStatus );
       
    78  
       
    79         /**
       
    80         * From base class MCSPCenRepObserver. 
       
    81         * Handler for changed event.
       
    82         * @param aUid uid of setting 
       
    83         * @param aVal value
       
    84         */
       
    85         virtual void CSPAudioHandler::HandleNotifyCenRepL( 
       
    86                 const TUid aUid, 
       
    87                 const TUint32 aKey,
       
    88                 TInt aVal );
       
    89 
       
    90     protected: //From DevSound
       
    91         
       
    92         /**
       
    93         * Handles DevDound initialization completion event.
       
    94         * @param  aError.  KErrNone if successful. Other values are possible
       
    95         * indicating a problem initializing CMMFDevSound object.
       
    96         */
       
    97         void InitializeComplete( TInt aError );  
       
    98         
       
    99         /**
       
   100         * Handles CMMFDevSound object's data request event.
       
   101         * @param aBuffer. Buffer to be filled
       
   102         */
       
   103         void BufferToBeFilled( CMMFBuffer* aBuffer ); 
       
   104         
       
   105         /**
       
   106         * Handles play completion or cancel event.
       
   107         * @param  aError. The status of playback
       
   108         */
       
   109         void PlayError( TInt aError ); 
       
   110         
       
   111         /**
       
   112         * Not Supported
       
   113         */
       
   114         void ToneFinished( TInt aError );         
       
   115         
       
   116         /**
       
   117         * Not supported.
       
   118         */
       
   119         void BufferToBeEmptied( CMMFBuffer* aBuffer ); 
       
   120         
       
   121         /**
       
   122         * Not supported.
       
   123         */ 
       
   124         void RecordError( TInt aError );
       
   125          
       
   126         /**
       
   127         * Not supported.
       
   128         */ 
       
   129         void ConvertError( TInt aError ); 
       
   130         
       
   131         /**
       
   132         * Not supported.
       
   133         */ 
       
   134         void DeviceMessage( TUid aMessageType, const TDesC8& aMsg );  
       
   135     
       
   136     protected: // From CActive
       
   137         /**
       
   138         * From CActive
       
   139         * RunL
       
   140         */
       
   141         void RunL();
       
   142         
       
   143         /**
       
   144         * From CActive
       
   145         * Catches errors if RunL leaves
       
   146         * @param aError error code
       
   147         * @return error code
       
   148         */
       
   149         TInt RunError( TInt aError );
       
   150         
       
   151         /**
       
   152         * From CActive
       
   153         * Cancels the monitor
       
   154         */
       
   155         void DoCancel();
       
   156 
       
   157     private:
       
   158         /**
       
   159         * C++ default constructor
       
   160         * @param aObserver the observer for status change (incoming call)
       
   161         * @param aLine the line associated with the call
       
   162         * @param aLineId line identifier
       
   163         */
       
   164         CSPAudioHandler(  );
       
   165                                           
       
   166         /**
       
   167         * Constructs the monitor in the second phase.
       
   168         */
       
   169         void ConstructL();
       
   170         
       
   171     private: // data
       
   172 
       
   173         /**
       
   174         * Mute listening from Publish&Subscribe.
       
   175         */        
       
   176         CSPPubSubListener* iMuteListener;
       
   177 
       
   178         /**
       
   179         * Incall loudspeaker listening from Central Repository.
       
   180         */        
       
   181         CSPCenRepListener* iIncallLoudspeakerVolumeListener;
       
   182 
       
   183         /**
       
   184         * Incall ear volume listening from Central Repository.
       
   185         */        
       
   186         CSPCenRepListener* iIncallEarVolumeListener;
       
   187         
       
   188         /**
       
   189         * Audio streams handler.
       
   190         */
       
   191         CSPAudioStreams* iAudioStreams;
       
   192         
       
   193         /** 
       
   194         * Call count
       
   195         */
       
   196         TInt iCallCount;
       
   197     };
       
   198     
       
   199 #endif // CSPAUDIOHANDLER_H
   108 #endif // CSPAUDIOHANDLER_H