mmserv/tms/tmscallserver/inc/cspdevsound.h
branchRCL_3
changeset 17 3570217d8c21
parent 13 f5c5c82a163e
child 18 2eb3b066cc7d
equal deleted inserted replaced
13:f5c5c82a163e 17:3570217d8c21
     1 /*
       
     2  * Copyright (c) 2009 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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CSPDEVSOUND_H
       
    19 #define CSPDEVSOUND_H
       
    20 
       
    21 #include <sounddevice.h>
       
    22 
       
    23 namespace TMS {
       
    24 
       
    25 class TMSCSPDevSoundObserver;
       
    26 
       
    27 /**
       
    28  *  Wrapper for CMMFDevSound
       
    29  *
       
    30  */
       
    31 NONSHARABLE_CLASS(TMSCSPDevSound) : public CBase,
       
    32                                     public MDevSoundObserver
       
    33     {
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Destructor.
       
    38      */
       
    39     virtual ~TMSCSPDevSound();
       
    40 
       
    41     /**
       
    42      * Activates the dev sound stream. TMSCSPDevSoundObserver methods are called
       
    43      * when activation goes ok or fails. If the stream is already active or
       
    44      * activating then nothing is done.
       
    45      */
       
    46     virtual void Activate();
       
    47 
       
    48     /**
       
    49      * Deactivates the devsound stream. If stream is not active or
       
    50      * activation is not ongoing then nothing is done.
       
    51      */
       
    52     virtual void Deactivate();
       
    53 
       
    54     /**
       
    55      * Indicates that activation is ongoing,
       
    56      * but the result of the activation is still unknown.
       
    57      * @return ETrue - activation ongoing, EFalse - activation not ongoing.
       
    58      */
       
    59     TBool IsActivationOngoing() const;
       
    60 
       
    61     /**
       
    62      * Determines wether the devsound stream is active or not.
       
    63      * @return ETrue - Stream is active, EFalse - Stream not active.
       
    64      */
       
    65     TBool IsActive() const;
       
    66 
       
    67     CMMFDevSound& DevSound();
       
    68 
       
    69     // from base class MDevSoundObserver
       
    70 
       
    71     /**
       
    72      * From MDevSoundObserver
       
    73      * Empty implementation
       
    74      */
       
    75     void InitializeComplete(TInt aError);
       
    76 
       
    77     /**
       
    78      * From MDevSoundObserver
       
    79      * Empty implementation
       
    80      */
       
    81     void BufferToBeFilled(CMMFBuffer* aBuffer);
       
    82 
       
    83     /**
       
    84      * From MDevSoundObserver
       
    85      * Empty implementation
       
    86      */
       
    87     void PlayError(TInt aError);
       
    88 
       
    89     /**
       
    90      * From MDevSoundObserver
       
    91      * Empty implementation
       
    92      */
       
    93     void ToneFinished(TInt aError);
       
    94 
       
    95     /**
       
    96      * From MDevSoundObserver
       
    97      * Empty implementation
       
    98      */
       
    99     void BufferToBeEmptied(CMMFBuffer* aBuffer);
       
   100 
       
   101     /**
       
   102      * From MDevSoundObserver
       
   103      * Empty implementation
       
   104      */
       
   105     void RecordError(TInt aError);
       
   106 
       
   107     /**
       
   108      * From MDevSoundObserver
       
   109      * Empty implementation
       
   110      */
       
   111     void ConvertError(TInt aError);
       
   112 
       
   113     /**
       
   114      * From MDevSoundObserver
       
   115      * Empty implementation
       
   116      */
       
   117     void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
       
   118 
       
   119 protected:
       
   120 
       
   121     TMSCSPDevSound(TMSCSPDevSoundObserver& aObserver);
       
   122 
       
   123     void ConstructL(TMMFState aMode, gint aAudioPreference,
       
   124             gint aAudioPriority);
       
   125 
       
   126 private:
       
   127 
       
   128     /**
       
   129      * Derived class has to activate the stream here.
       
   130      */
       
   131     virtual void DoActivateL() = 0;
       
   132 
       
   133 protected:
       
   134 
       
   135     TUint iStreamType;
       
   136 
       
   137     /**
       
   138      * Indication if device is activated. Derived class has to update this.
       
   139      */
       
   140     TBool iActive;
       
   141 
       
   142     /**
       
   143      * Indication if activation is ongoing.
       
   144      * Derived class has to update this.
       
   145      */
       
   146     TBool iActivationOngoing;
       
   147 
       
   148     /**
       
   149      * Devsound instance
       
   150      * Own.
       
   151      */
       
   152     CMMFDevSound* iDevSound;
       
   153 
       
   154     /**
       
   155      * Observer for successfull activation.
       
   156      * Not own.
       
   157      */
       
   158     TMSCSPDevSoundObserver& iObserver;
       
   159 
       
   160     };
       
   161 
       
   162 } //namespace TMS
       
   163 
       
   164 #endif // CSPDEVSOUND_H