mmserv/tms/tmscallserver/src/csdownlink.cpp
branchRCL_3
changeset 3 4f62049db6ac
parent 0 71ca22bcf22a
equal deleted inserted replaced
0:71ca22bcf22a 3:4f62049db6ac
    26 
    26 
    27 // -----------------------------------------------------------------------------
    27 // -----------------------------------------------------------------------------
    28 // Static constructor
    28 // Static constructor
    29 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    30 //
    30 //
    31 CSDownlink* CSDownlink::NewL(MCSPDevSoundObserver& aObserver)
    31 TMSCSDownlink* TMSCSDownlink::NewL(TMSCSPDevSoundObserver& aObserver)
    32     {
    32     {
    33     CSDownlink* self = new (ELeave) CSDownlink(aObserver);
    33     TMSCSDownlink* self = new (ELeave) TMSCSDownlink(aObserver);
    34     CleanupStack::PushL(self);
    34     CleanupStack::PushL(self);
    35     self->ConstructL();
    35     self->ConstructL();
    36     CleanupStack::Pop(self);
    36     CleanupStack::Pop(self);
    37     return self;
    37     return self;
    38     }
    38     }
    39 
    39 
    40 // -----------------------------------------------------------------------------
    40 // -----------------------------------------------------------------------------
    41 // Destructor.
    41 // Destructor.
    42 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    43 //
    43 //
    44 CSDownlink::~CSDownlink()
    44 TMSCSDownlink::~TMSCSDownlink()
    45     {
    45     {
    46     }
    46     }
    47 
    47 
    48 // -----------------------------------------------------------------------------
    48 // -----------------------------------------------------------------------------
    49 // Sets volume
    49 // Sets volume
    50 // -----------------------------------------------------------------------------
    50 // -----------------------------------------------------------------------------
    51 //
    51 //
    52 void CSDownlink::SetVolume(gint aVolume)
    52 void TMSCSDownlink::SetVolume(gint aVolume)
    53     {
    53     {
    54     if (iDevSound)
    54     if (iDevSound)
    55         {
    55         {
    56         gint maxVolume(iDevSound->MaxVolume());
    56         gint maxVolume(iDevSound->MaxVolume());
    57         maxVolume = (maxVolume > 0) ? maxVolume : KDefaultMaxVolume;
    57         maxVolume = (maxVolume > 0) ? maxVolume : KDefaultMaxVolume;
    62 
    62 
    63 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    64 // Gives volume
    64 // Gives volume
    65 // -----------------------------------------------------------------------------
    65 // -----------------------------------------------------------------------------
    66 //
    66 //
    67 gint CSDownlink::Volume()
    67 gint TMSCSDownlink::Volume()
    68     {
    68     {
    69     gint vol = 0;
    69     gint vol = 0;
    70     if (iDevSound)
    70     if (iDevSound)
    71         {
    71         {
    72         vol = iDevSound->Volume();
    72         vol = iDevSound->Volume();
    76 
    76 
    77 // -----------------------------------------------------------------------------
    77 // -----------------------------------------------------------------------------
    78 // Gives max volume
    78 // Gives max volume
    79 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    80 //
    80 //
    81 gint CSDownlink::MaxVolume()
    81 gint TMSCSDownlink::MaxVolume()
    82     {
    82     {
    83     gint vol = 0;
    83     gint vol = 0;
    84     if (iDevSound)
    84     if (iDevSound)
    85         {
    85         {
    86         vol = iDevSound->MaxVolume();
    86         vol = iDevSound->MaxVolume();
    91 // -----------------------------------------------------------------------------
    91 // -----------------------------------------------------------------------------
    92 // From class MDevSoundObserver
    92 // From class MDevSoundObserver
    93 // Downlink stream has been activated successfully.
    93 // Downlink stream has been activated successfully.
    94 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
    95 //
    95 //
    96 void CSDownlink::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
    96 void TMSCSDownlink::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
    97     {
    97     {
    98     //CSPLOGSTRING( CSPINT, "CSDownlink:: activated" );
    98     //CSPLOGSTRING( CSPINT, "TMSCSDownlink:: activated" );
    99     // We dont react to devsound messages unless we are activating.
    99     // We dont react to devsound messages unless we are activating.
   100     if (IsActivationOngoing())
   100     if (IsActivationOngoing())
   101         {
   101         {
   102         iActive = ETrue;
   102         iActive = ETrue;
   103         iActivationOngoing = EFalse;
   103         iActivationOngoing = EFalse;
   108 // -----------------------------------------------------------------------------
   108 // -----------------------------------------------------------------------------
   109 // From class MDevSoundObserver
   109 // From class MDevSoundObserver
   110 // Downlink stream activation failed
   110 // Downlink stream activation failed
   111 // -----------------------------------------------------------------------------
   111 // -----------------------------------------------------------------------------
   112 //
   112 //
   113 void CSDownlink::PlayError(TInt aError)
   113 void TMSCSDownlink::PlayError(TInt aError)
   114     {
   114     {
   115     //CSPLOGSTRING( CSPINT, "CSDownlink::PlayError" );
   115     //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError" );
   116 
   116 
   117     // We dont react to devsound messages unless we are activating.
   117     // We dont react to devsound messages unless we are activating.
   118     if (IsActivationOngoing())
   118     if (IsActivationOngoing())
   119         {
   119         {
   120         //CSPLOGSTRING( CSPINT, "CSDownlink::PlayError activation failed" );
   120         //CSPLOGSTRING( CSPINT, "TMSCSDownlink::PlayError activation failed" );
   121         if (aError == KErrAccessDenied)
   121         if (aError == KErrAccessDenied)
   122             {
   122             {
   123             iActivationOngoing = EFalse;
   123             iActivationOngoing = EFalse;
   124             iObserver.DownlinkActivationFailed();
   124             iObserver.DownlinkActivationFailed();
   125             }
   125             }
   129 // -----------------------------------------------------------------------------
   129 // -----------------------------------------------------------------------------
   130 // From class CSPDevsound
   130 // From class CSPDevsound
   131 // Tries to activate Downlink stream.
   131 // Tries to activate Downlink stream.
   132 // -----------------------------------------------------------------------------
   132 // -----------------------------------------------------------------------------
   133 //
   133 //
   134 void CSDownlink::DoActivateL()
   134 void TMSCSDownlink::DoActivateL()
   135     {
   135     {
   136     if (iDevSound)
   136     if (iDevSound)
   137         {
   137         {
   138         iDevSound->PlayInitL();
   138         iDevSound->PlayInitL();
   139         }
   139         }
   141 
   141 
   142 // -----------------------------------------------------------------------------
   142 // -----------------------------------------------------------------------------
   143 // Constructor
   143 // Constructor
   144 // -----------------------------------------------------------------------------
   144 // -----------------------------------------------------------------------------
   145 //
   145 //
   146 CSDownlink::CSDownlink(MCSPDevSoundObserver& aObserver) :
   146 TMSCSDownlink::TMSCSDownlink(TMSCSPDevSoundObserver& aObserver) :
   147     CSPDevSound(aObserver)
   147     TMSCSPDevSound(aObserver)
   148     {
   148     {
   149     }
   149     }
   150 
   150 
   151 // -----------------------------------------------------------------------------
   151 // -----------------------------------------------------------------------------
   152 // Second phase constructor
   152 // Second phase constructor
   153 // -----------------------------------------------------------------------------
   153 // -----------------------------------------------------------------------------
   154 //
   154 //
   155 void CSDownlink::ConstructL()
   155 void TMSCSDownlink::ConstructL()
   156     {
   156     {
   157     CSPDevSound::ConstructL(EMMFStatePlaying, KAudioPrefCSCallDownlink,
   157     TMSCSPDevSound::ConstructL(EMMFStatePlaying, KAudioPrefCSCallDownlink,
   158             KAudioPriorityCSCallDownlink);
   158             KAudioPriorityCSCallDownlink);
   159 
   159 
   160     if (iDevSound)
   160     if (iDevSound)
   161         {
   161         {
   162         iDevSound->SetVolume(KDefaultVolume);
   162         iDevSound->SetVolume(KDefaultVolume);