mmserv/tms/tmscallserver/src/tmscallipadpt.cpp
branchRCL_3
changeset 17 3570217d8c21
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 #include <AudioPreference.h>
       
    19 #include "tmsutility.h"
       
    20 #include "tmsclientserver.h"
       
    21 #include "tmsshared.h"
       
    22 #include "tmsipcallstream.h"
       
    23 #include "tmscallipadpt.h"
       
    24 
       
    25 using namespace TMS;
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // TMSCallIPAdpt::NewL
       
    29 // Symbian constructor.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 TMSCallIPAdpt* TMSCallIPAdpt::NewL()
       
    33     {
       
    34     TMSCallIPAdpt* self = new (ELeave) TMSCallIPAdpt();
       
    35     CleanupStack::PushL(self);
       
    36     self->ConstructL();
       
    37     CleanupStack::Pop(self);
       
    38     return self;
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // TMSCallIPAdpt::ConstructL
       
    43 // 2-nd phase constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 void TMSCallIPAdpt::ConstructL()
       
    47     {
       
    48     TRACE_PRN_FN_ENT;
       
    49     iIPUplink = NULL;
       
    50     iIPDownlink = NULL;
       
    51     TRACE_PRN_FN_EXT;
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // TMSCallIPAdpt::TMSCallIPAdpt
       
    56 //
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 TMSCallIPAdpt::TMSCallIPAdpt()
       
    60     {
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // TMSCallIPAdpt::~TMSCallIPAdpt
       
    65 //
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 TMSCallIPAdpt::~TMSCallIPAdpt()
       
    69     {
       
    70     TRACE_PRN_FN_ENT;
       
    71 
       
    72     iCodecs.Reset();
       
    73     iCodecs.Close();
       
    74     iArrBitrates.Reset();
       
    75 
       
    76     delete iIPUplink;
       
    77     delete iIPDownlink;
       
    78 
       
    79     if (iMsgQueueUp.Handle() > 0)
       
    80         {
       
    81         iMsgQueueUp.Close();
       
    82         }
       
    83     if (iMsgQueueDn.Handle() > 0)
       
    84         {
       
    85         iMsgQueueDn.Close();
       
    86         }
       
    87 
       
    88     TRACE_PRN_FN_EXT;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // TMSCallIPAdpt::PostConstruct
       
    93 //
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 gint TMSCallIPAdpt::PostConstruct()
       
    97     {
       
    98     TRACE_PRN_FN_ENT;
       
    99     gint status(TMS_RESULT_SUCCESS);
       
   100     iNextStreamId = 1;
       
   101     iUplinkInitialized = FALSE;
       
   102     iDnlinkInitialized = FALSE;
       
   103 
       
   104     TRACE_PRN_FN_EXT;
       
   105     return status;
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // TMSCallIPAdpt::CreateStream
       
   110 //
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 gint TMSCallIPAdpt::CreateStream(TMSCallType /*callType*/,
       
   114         TMSStreamType strmType, gint& outStrmId)
       
   115     {
       
   116     TRACE_PRN_FN_ENT;
       
   117     gint status(TMS_RESULT_SUCCESS);
       
   118     switch (strmType)
       
   119         {
       
   120         case TMS_STREAM_UPLINK:
       
   121             {
       
   122             status = TMS_RESULT_ALREADY_EXIST;
       
   123             if (!iUplinkInitialized)
       
   124                 {
       
   125                 iUplinkInitialized = TRUE;
       
   126                 iUplinkStreamId = iNextStreamId;
       
   127                 outStrmId = iUplinkStreamId;
       
   128                 iNextStreamId++;
       
   129                 status = TMS_RESULT_SUCCESS;
       
   130                 }
       
   131             break;
       
   132             }
       
   133         case TMS_STREAM_DOWNLINK:
       
   134             {
       
   135             status = TMS_RESULT_ALREADY_EXIST;
       
   136             if (!iDnlinkInitialized)
       
   137                 {
       
   138                 iDnlinkInitialized = TRUE;
       
   139                 iDnlinkStreamId = iNextStreamId;
       
   140                 outStrmId = iDnlinkStreamId;
       
   141                 iNextStreamId++;
       
   142                 status = TMS_RESULT_SUCCESS;
       
   143                 }
       
   144             break;
       
   145             }
       
   146         default:
       
   147             {
       
   148             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   149             break;
       
   150             }
       
   151         }
       
   152     TRACE_PRN_FN_EXT;
       
   153     return status;
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // TMSCallIPAdpt::InitStream
       
   158 //
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 gint TMSCallIPAdpt::InitStreamL(TMSCallType /*callType*/,
       
   162         TMSStreamType strmType, gint strmId, TMSFormatType frmtType,
       
   163         const RMessage2& aMessage)
       
   164     {
       
   165     TRACE_PRN_FN_ENT;
       
   166     gint status(TMS_RESULT_SUCCESS);
       
   167 
       
   168     TUint32 fourCC = TOFOURCC(frmtType);
       
   169     if (fourCC == NULL)
       
   170         {
       
   171         return TMS_RESULT_INVALID_ARGUMENT;
       
   172         }
       
   173 
       
   174     switch (strmType)
       
   175         {
       
   176         case TMS_STREAM_UPLINK:
       
   177             {
       
   178             status = TMS_RESULT_DOES_NOT_EXIST;
       
   179             if (strmId == iUplinkStreamId)
       
   180                 {
       
   181                 SetFormat(iUplinkStreamId, fourCC);
       
   182                 status = OpenUplinkL(aMessage);
       
   183                 NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
       
   184                 }
       
   185             break;
       
   186             }
       
   187         case TMS_STREAM_DOWNLINK:
       
   188             {
       
   189             status = TMS_RESULT_DOES_NOT_EXIST;
       
   190             if (strmId == iDnlinkStreamId)
       
   191                 {
       
   192                 SetFormat(iDnlinkStreamId, fourCC);
       
   193                 status = OpenDownlinkL(aMessage);
       
   194                 NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
       
   195                 }
       
   196             break;
       
   197             }
       
   198         default:
       
   199             {
       
   200             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   201             break;
       
   202             }
       
   203         }
       
   204 
       
   205     TRACE_PRN_IF_ERR(status);
       
   206     TRACE_PRN_FN_EXT;
       
   207     return status;
       
   208     }
       
   209 
       
   210 // -----------------------------------------------------------------------------
       
   211 // TMSCallIPAdpt::StartStream
       
   212 //
       
   213 // -----------------------------------------------------------------------------
       
   214 //
       
   215 gint TMSCallIPAdpt::StartStream(TMSCallType /*callType*/,
       
   216         TMSStreamType strmType, gint strmId)
       
   217     {
       
   218     TRACE_PRN_FN_ENT;
       
   219     gint status(TMS_RESULT_INVALID_STATE);
       
   220     switch (strmType)
       
   221         {
       
   222         case TMS_STREAM_UPLINK:
       
   223             {
       
   224             if (strmId == iUplinkStreamId && iIPUplink)
       
   225                 {
       
   226                 iIPUplink->Start();
       
   227                 status = TMS_RESULT_SUCCESS;
       
   228                 NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status);
       
   229                 }
       
   230             break;
       
   231             }
       
   232         case TMS_STREAM_DOWNLINK:
       
   233             {
       
   234             if (strmId == iDnlinkStreamId && iIPDownlink)
       
   235                 {
       
   236                 iIPDownlink->Start();
       
   237                 status = TMS_RESULT_SUCCESS;
       
   238                 NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status);
       
   239                 }
       
   240             break;
       
   241             }
       
   242         default:
       
   243             {
       
   244             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   245             break;
       
   246             }
       
   247         }
       
   248     TRACE_PRN_FN_EXT;
       
   249     return status;
       
   250     }
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // TMSCallIPAdpt::PauseStream
       
   254 //
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 gint TMSCallIPAdpt::PauseStream(TMSCallType /*callType*/,
       
   258         TMSStreamType strmType, gint strmId)
       
   259     {
       
   260     TRACE_PRN_FN_ENT;
       
   261     gint status(TMS_RESULT_INVALID_STATE);
       
   262     switch (strmType)
       
   263         {
       
   264         case TMS_STREAM_UPLINK:
       
   265             {
       
   266             if (strmId == iUplinkStreamId && iIPUplink)
       
   267                 {
       
   268                 iIPUplink->Stop();
       
   269                 status = TMS_RESULT_SUCCESS;
       
   270                 NotifyClient(iUplinkStreamId, ECmdUplinkPaused, status);
       
   271                 }
       
   272             break;
       
   273             }
       
   274         case TMS_STREAM_DOWNLINK:
       
   275             {
       
   276             if (strmId == iDnlinkStreamId && iIPDownlink)
       
   277                 {
       
   278                 iIPDownlink->Stop();
       
   279                 status = TMS_RESULT_SUCCESS;
       
   280                 NotifyClient(iDnlinkStreamId, ECmdDownlinkPaused, status);
       
   281                 }
       
   282             break;
       
   283             }
       
   284         default:
       
   285             {
       
   286             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   287             break;
       
   288             }
       
   289         }
       
   290     TRACE_PRN_FN_EXT;
       
   291     return status;
       
   292     }
       
   293 
       
   294 // -----------------------------------------------------------------------------
       
   295 // TMSCallIPAdpt::StopStream
       
   296 //
       
   297 // -----------------------------------------------------------------------------
       
   298 //
       
   299 gint TMSCallIPAdpt::StopStream(TMSCallType /*callType*/, TMSStreamType strmType,
       
   300         gint strmId)
       
   301     {
       
   302     TRACE_PRN_FN_ENT;
       
   303     gint status(TMS_RESULT_INVALID_STATE);
       
   304 
       
   305     switch (strmType)
       
   306         {
       
   307         case TMS_STREAM_UPLINK:
       
   308             {
       
   309             if (strmId == iUplinkStreamId && iIPUplink)
       
   310                 {
       
   311                 iIPUplink->Stop();
       
   312                 status = TMS_RESULT_SUCCESS;
       
   313                 NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
       
   314                 }
       
   315             break;
       
   316             }
       
   317         case TMS_STREAM_DOWNLINK:
       
   318             {
       
   319             if (strmId == iDnlinkStreamId && iIPDownlink)
       
   320                 {
       
   321                 iIPDownlink->Stop();
       
   322                 status = TMS_RESULT_SUCCESS;
       
   323                 NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
       
   324                 }
       
   325             break;
       
   326             }
       
   327         default:
       
   328             {
       
   329             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   330             break;
       
   331             }
       
   332         }
       
   333     TRACE_PRN_FN_EXT;
       
   334     return status;
       
   335     }
       
   336 
       
   337 // -----------------------------------------------------------------------------
       
   338 // TMSCallIPAdpt::DeinitStream
       
   339 //
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 gint TMSCallIPAdpt::DeinitStream(TMSCallType /*callType*/,
       
   343         TMSStreamType strmType, gint strmId)
       
   344     {
       
   345     TRACE_PRN_FN_ENT;
       
   346     gint status(TMS_RESULT_INVALID_STATE);
       
   347 
       
   348     switch (strmType)
       
   349         {
       
   350         case TMS_STREAM_UPLINK:
       
   351             {
       
   352             if (strmId == iUplinkStreamId && iIPUplink)
       
   353                 {
       
   354                 iIPUplink->Stop();
       
   355                 //iUplinkStreamId = -1;
       
   356                 iUplinkInitialized = FALSE;
       
   357                 status = TMS_RESULT_SUCCESS;
       
   358                 NotifyClient(iUplinkStreamId, ECmdDownlinkDeInitComplete,
       
   359                         status);
       
   360                 }
       
   361             break;
       
   362             }
       
   363         case TMS_STREAM_DOWNLINK:
       
   364             {
       
   365             if (strmId == iDnlinkStreamId && iIPDownlink)
       
   366                 {
       
   367                 iIPDownlink->Stop();
       
   368                 //iDnlinkStreamId = -1;
       
   369                 iDnlinkInitialized = FALSE;
       
   370                 status = TMS_RESULT_SUCCESS;
       
   371                 NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
       
   372                         status);
       
   373                 }
       
   374             break;
       
   375             }
       
   376         default:
       
   377             {
       
   378             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   379             break;
       
   380             }
       
   381         }
       
   382 
       
   383     TRACE_PRN_FN_EXT;
       
   384     return status;
       
   385     }
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 // TMSCallIPAdpt::DeleteStream
       
   389 //
       
   390 // -----------------------------------------------------------------------------
       
   391 //
       
   392 gint TMSCallIPAdpt::DeleteStream(TMSCallType /*callType*/,
       
   393         TMSStreamType strmType, gint strmId)
       
   394     {
       
   395     TRACE_PRN_FN_ENT;
       
   396     gint status(TMS_RESULT_SUCCESS);
       
   397     switch (strmType)
       
   398         {
       
   399         case TMS_STREAM_UPLINK:
       
   400             {
       
   401             // This is additional error checking
       
   402             if (strmId == iUplinkStreamId)
       
   403                 {
       
   404                 iUplinkStreamId = -1;
       
   405                 iUplinkInitialized = FALSE;
       
   406                 }
       
   407             break;
       
   408             }
       
   409         case TMS_STREAM_DOWNLINK:
       
   410             {
       
   411             // This is additional error checking
       
   412             if (strmId == iDnlinkStreamId)
       
   413                 {
       
   414                 iDnlinkStreamId = -1;
       
   415                 iDnlinkInitialized = FALSE;
       
   416                 }
       
   417             break;
       
   418             }
       
   419         default:
       
   420             {
       
   421             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   422             break;
       
   423             }
       
   424         }
       
   425     TRACE_PRN_FN_EXT;
       
   426     return status;
       
   427     }
       
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 // TMSCallIPAdpt::DataXferBufferEmptied
       
   431 //
       
   432 // -----------------------------------------------------------------------------
       
   433 //
       
   434 gint TMSCallIPAdpt::DataXferBufferEmptied(TMSCallType /*callType*/,
       
   435         TMSStreamType strmType, gint strmId)
       
   436     {
       
   437     TRACE_PRN_FN_ENT;
       
   438     gint status(TMS_RESULT_SUCCESS);
       
   439     switch (strmType)
       
   440         {
       
   441         case TMS_STREAM_UPLINK:
       
   442             {
       
   443             if (strmId == iUplinkStreamId)
       
   444                 {
       
   445                 TRAP(status, BufferEmptiedL());
       
   446                 }
       
   447             break;
       
   448             }
       
   449         case TMS_STREAM_DOWNLINK:
       
   450             status = TMS_RESULT_ILLEGAL_OPERATION;
       
   451             break;
       
   452         default:
       
   453             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   454             break;
       
   455         }
       
   456     TRACE_PRN_FN_EXT;
       
   457     return status;
       
   458     }
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // TMSCallIPAdpt::DataXferBufferFilled
       
   462 //
       
   463 // -----------------------------------------------------------------------------
       
   464 //
       
   465 gint TMSCallIPAdpt::DataXferBufferFilled(TMSCallType /*callType*/,
       
   466         TMSStreamType strmType, gint strmId, guint datasize)
       
   467     {
       
   468     TRACE_PRN_FN_ENT;
       
   469     gint status(TMS_RESULT_SUCCESS);
       
   470     switch (strmType)
       
   471         {
       
   472         case TMS_STREAM_DOWNLINK:
       
   473             if (strmId == iDnlinkStreamId)
       
   474                 {
       
   475                 TRAP(status, BufferFilledL(datasize));
       
   476                 }
       
   477             break;
       
   478         case TMS_STREAM_UPLINK:
       
   479             status = TMS_RESULT_ILLEGAL_OPERATION;
       
   480             break;
       
   481         default:
       
   482             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   483             break;
       
   484         }
       
   485     TRACE_PRN_FN_EXT;
       
   486     return status;
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // TMSCallIPAdpt::GetDataXferBufferHndl
       
   491 //
       
   492 // -----------------------------------------------------------------------------
       
   493 //
       
   494 gint TMSCallIPAdpt::GetDataXferBufferHndl(const TMSCallType /*callType*/,
       
   495         const TMSStreamType strmType, const gint strmId, const guint32 key,
       
   496         RChunk& chunk)
       
   497     {
       
   498     TRACE_PRN_FN_ENT;
       
   499     gint status(TMS_RESULT_SUCCESS);
       
   500     switch (strmType)
       
   501         {
       
   502         case TMS_STREAM_DOWNLINK:
       
   503             {
       
   504             if (strmId == iDnlinkStreamId)
       
   505                 {
       
   506                 TRAP(status, GetDataXferChunkHndl(strmType, key, chunk));
       
   507                 }
       
   508             break;
       
   509             }
       
   510         case TMS_STREAM_UPLINK:
       
   511             {
       
   512             if (strmId == iUplinkStreamId)
       
   513                 {
       
   514                 TRAP(status, GetDataXferChunkHndl(strmType, key, chunk));
       
   515                 }
       
   516             break;
       
   517             }
       
   518         default:
       
   519             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
   520             break;
       
   521         }
       
   522     TRACE_PRN_FN_EXT;
       
   523     return status;
       
   524     }
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // TMSCallIPAdpt::GetMaxVolume
       
   528 //
       
   529 // -----------------------------------------------------------------------------
       
   530 //
       
   531 gint TMSCallIPAdpt::GetMaxVolume(guint& volume)
       
   532     {
       
   533     TRACE_PRN_FN_ENT;
       
   534     gint status(TMS_RESULT_INVALID_STATE);
       
   535 
       
   536     if (iDnlinkInitialized && iIPDownlink)
       
   537         {
       
   538         status = iIPDownlink->GetMaxVolume(volume);
       
   539         iMaxVolume = volume;
       
   540         TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: GetMaxVolume [%d]"), iMaxVolume);
       
   541         }
       
   542 
       
   543     TRACE_PRN_FN_EXT;
       
   544     return status;
       
   545     }
       
   546 
       
   547 // -----------------------------------------------------------------------------
       
   548 // TMSCallIPAdpt::SetVolume
       
   549 //
       
   550 // -----------------------------------------------------------------------------
       
   551 //
       
   552 gint TMSCallIPAdpt::SetVolume(const guint volume)
       
   553     {
       
   554     TRACE_PRN_FN_ENT;
       
   555     gint status(TMS_RESULT_INVALID_STATE);
       
   556     if (iDnlinkInitialized && iIPDownlink)
       
   557         {
       
   558         status = iIPDownlink->SetVolume(volume);
       
   559         NotifyClient(iDnlinkStreamId, ECmdSetVolume, status);
       
   560         }
       
   561     TRACE_PRN_FN_EXT;
       
   562     return status;
       
   563     }
       
   564 
       
   565 // -----------------------------------------------------------------------------
       
   566 // TMSCallIPAdpt::GetVolume
       
   567 //
       
   568 // -----------------------------------------------------------------------------
       
   569 //
       
   570 gint TMSCallIPAdpt::GetVolume(guint& volume)
       
   571     {
       
   572     TRACE_PRN_FN_ENT;
       
   573     gint status(TMS_RESULT_INVALID_STATE);
       
   574     if (iDnlinkInitialized && iIPDownlink)
       
   575         {
       
   576         status = iIPDownlink->GetVolume(volume);
       
   577         }
       
   578     TRACE_PRN_FN_EXT;
       
   579     return status;
       
   580     }
       
   581 
       
   582 // -----------------------------------------------------------------------------
       
   583 // TMSCallIPAdpt::GetMaxGain
       
   584 //
       
   585 // -----------------------------------------------------------------------------
       
   586 //
       
   587 gint TMSCallIPAdpt::GetMaxGain(guint& gain)
       
   588     {
       
   589     TRACE_PRN_FN_ENT;
       
   590     gint status(TMS_RESULT_INVALID_STATE);
       
   591     if (iUplinkInitialized && iIPUplink)
       
   592         {
       
   593         status = iIPUplink->GetMaxGain(gain);
       
   594         iMaxGain = gain;
       
   595         TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt::GetMaxGain [%d]"), iMaxGain);
       
   596         }
       
   597     TRACE_PRN_FN_EXT;
       
   598     return status;
       
   599     }
       
   600 
       
   601 // -----------------------------------------------------------------------------
       
   602 // TMSCallIPAdpt::SetGain
       
   603 //
       
   604 // -----------------------------------------------------------------------------
       
   605 //
       
   606 gint TMSCallIPAdpt::SetGain(const guint gain)
       
   607     {
       
   608     TRACE_PRN_FN_ENT;
       
   609     gint status(TMS_RESULT_INVALID_STATE);
       
   610     if (iUplinkInitialized && iIPUplink)
       
   611         {
       
   612         status = iIPUplink->SetGain(gain);
       
   613         NotifyClient(iUplinkStreamId, ECmdSetGain, status);
       
   614         }
       
   615     TRACE_PRN_FN_EXT;
       
   616     return status;
       
   617     }
       
   618 
       
   619 // -----------------------------------------------------------------------------
       
   620 // TMSCallIPAdpt::GetGain
       
   621 //
       
   622 // -----------------------------------------------------------------------------
       
   623 //
       
   624 gint TMSCallIPAdpt::GetGain(guint& gain)
       
   625     {
       
   626     TRACE_PRN_FN_ENT;
       
   627     gint status(TMS_RESULT_INVALID_STATE);
       
   628     if (iUplinkInitialized && iIPUplink)
       
   629         {
       
   630         status = iIPUplink->GetGain(gain);
       
   631         }
       
   632     TRACE_PRN_FN_EXT;
       
   633     return status;
       
   634     }
       
   635 
       
   636 // -----------------------------------------------------------------------------
       
   637 // TMSCallIPAdpt::GetGlobalMaxVolume
       
   638 //
       
   639 // -----------------------------------------------------------------------------
       
   640 //
       
   641 gint TMSCallIPAdpt::GetGlobalMaxVolume(guint& volume)
       
   642     {
       
   643     TRACE_PRN_FN_ENT;
       
   644     gint status(TMS_RESULT_INVALID_STATE);
       
   645     if (iDnlinkInitialized && iIPDownlink)
       
   646         {
       
   647         status = iIPDownlink->GetMaxVolume(volume);
       
   648         iMaxVolume = volume;
       
   649         TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: GetMaxVolume [%d]"), iMaxVolume);
       
   650         }
       
   651     TRACE_PRN_FN_EXT;
       
   652     return status;
       
   653     }
       
   654 
       
   655 // -----------------------------------------------------------------------------
       
   656 // TMSCallIPAdpt::SetGlobalVolume
       
   657 //
       
   658 // -----------------------------------------------------------------------------
       
   659 //
       
   660 gint TMSCallIPAdpt::SetGlobalVolume(const guint volume)
       
   661     {
       
   662     TRACE_PRN_FN_ENT;
       
   663     gint status(TMS_RESULT_INVALID_STATE);
       
   664     if (iDnlinkInitialized && iIPDownlink)
       
   665         {
       
   666         status = iIPDownlink->SetVolume(volume);
       
   667         }
       
   668     TRACE_PRN_FN_EXT;
       
   669     return status;
       
   670     }
       
   671 
       
   672 // -----------------------------------------------------------------------------
       
   673 // TMSCallIPAdpt::GetGlobalVolume
       
   674 //
       
   675 // -----------------------------------------------------------------------------
       
   676 //
       
   677 gint TMSCallIPAdpt::GetGlobalVolume(guint& volume)
       
   678     {
       
   679     TRACE_PRN_FN_ENT;
       
   680     gint status(TMS_RESULT_INVALID_STATE);
       
   681     if (iDnlinkInitialized && iIPDownlink)
       
   682         {
       
   683         status = iIPDownlink->GetVolume(volume);
       
   684         }
       
   685     TRACE_PRN_FN_EXT;
       
   686     return status;
       
   687     }
       
   688 
       
   689 // -----------------------------------------------------------------------------
       
   690 // TMSCallIPAdpt::GetGlobalMaxGain
       
   691 //
       
   692 // -----------------------------------------------------------------------------
       
   693 //
       
   694 gint TMSCallIPAdpt::GetGlobalMaxGain(guint& gain)
       
   695     {
       
   696     TRACE_PRN_FN_ENT;
       
   697     gint status(TMS_RESULT_INVALID_STATE);
       
   698     if (iUplinkInitialized && iIPUplink)
       
   699         {
       
   700         status = iIPUplink->GetMaxGain(gain);
       
   701         iMaxGain = gain;
       
   702         TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt::GetMaxGain [%d]"), iMaxGain);
       
   703         }
       
   704     TRACE_PRN_FN_EXT;
       
   705     return status;
       
   706     }
       
   707 
       
   708 // -----------------------------------------------------------------------------
       
   709 // TMSCallIPAdpt::SetGlobalGain
       
   710 //
       
   711 // -----------------------------------------------------------------------------
       
   712 //
       
   713 gint TMSCallIPAdpt::SetGlobalGain(const guint gain)
       
   714     {
       
   715     TRACE_PRN_FN_ENT;
       
   716     gint status(TMS_RESULT_INVALID_STATE);
       
   717     if (iUplinkInitialized && iIPUplink)
       
   718         {
       
   719         status = iIPUplink->SetGain(gain);
       
   720         }
       
   721     TRACE_PRN_FN_EXT;
       
   722     return status;
       
   723     }
       
   724 
       
   725 // -----------------------------------------------------------------------------
       
   726 // TMSCallIPAdpt::GetGlobalGain
       
   727 //
       
   728 // -----------------------------------------------------------------------------
       
   729 //
       
   730 gint TMSCallIPAdpt::GetGlobalGain(guint& gain)
       
   731     {
       
   732     TRACE_PRN_FN_ENT;
       
   733     gint status(TMS_RESULT_INVALID_STATE);
       
   734     if (iUplinkInitialized && iIPUplink)
       
   735         {
       
   736         status = iIPUplink->GetGain(gain);
       
   737         }
       
   738     TRACE_PRN_FN_EXT;
       
   739     return status;
       
   740     }
       
   741 
       
   742 // -----------------------------------------------------------------------------
       
   743 // TMSCallIPAdpt::GetCodecMode
       
   744 //
       
   745 // -----------------------------------------------------------------------------
       
   746 //
       
   747 gint TMSCallIPAdpt::GetCodecMode(const TMSFormatType fmttype,
       
   748         const TMSStreamType strmtype, gint& mode)
       
   749     {
       
   750     TRACE_PRN_FN_ENT;
       
   751     gint status(TMS_RESULT_SUCCESS);
       
   752     switch (fmttype)
       
   753         {
       
   754         case TMS_FORMAT_ILBC:
       
   755             status = GetIlbcCodecMode(mode, strmtype);
       
   756             break;
       
   757         case TMS_FORMAT_G711:
       
   758             status = GetG711CodecMode(mode, strmtype);
       
   759             break;
       
   760         default:
       
   761             status = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED;
       
   762             break;
       
   763         }
       
   764     TRACE_PRN_FN_EXT;
       
   765     return status;
       
   766     }
       
   767 
       
   768 // -----------------------------------------------------------------------------
       
   769 // TMSCallIPAdpt::SetCodecMode
       
   770 //
       
   771 // -----------------------------------------------------------------------------
       
   772 //
       
   773 gint TMSCallIPAdpt::SetCodecMode(const TMSFormatType fmttype,
       
   774         const TMSStreamType strmtype, const gint mode)
       
   775     {
       
   776     TRACE_PRN_FN_ENT;
       
   777     gint status(TMS_RESULT_SUCCESS);
       
   778     switch (fmttype)
       
   779         {
       
   780         case TMS_FORMAT_ILBC:
       
   781             status = SetIlbcCodecMode(mode, strmtype);
       
   782             break;
       
   783         case TMS_FORMAT_G711:
       
   784             status = SetG711CodecMode(mode, strmtype);
       
   785             break;
       
   786         default:
       
   787             status = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED;
       
   788             break;
       
   789         }
       
   790     TRACE_PRN_FN_EXT;
       
   791     return status;
       
   792     }
       
   793 
       
   794 // -----------------------------------------------------------------------------
       
   795 // TMSCallIPAdpt::GetSupportedBitRatesCount
       
   796 //
       
   797 // -----------------------------------------------------------------------------
       
   798 //
       
   799 gint TMSCallIPAdpt::GetSupportedBitRatesCount(guint& count)
       
   800     {
       
   801     TRACE_PRN_FN_ENT;
       
   802     gint status(TMS_RESULT_INVALID_STATE);
       
   803     if (iIPUplink)
       
   804         {
       
   805         status = iIPUplink->GetSupportedBitrates(iArrBitrates);
       
   806         count = iArrBitrates.Count();
       
   807         }
       
   808     TRACE_PRN_FN_EXT;
       
   809     return status;
       
   810     }
       
   811 
       
   812 // -----------------------------------------------------------------------------
       
   813 // TMSCallIPAdpt::GetSupportedBitRates
       
   814 //
       
   815 // Bitrates are already returned from the codec as a result of call to
       
   816 // GetSupportedBitratesCount(). Just pack them into a descriptor and return
       
   817 // back to the client.
       
   818 // -----------------------------------------------------------------------------
       
   819 //
       
   820 gint TMSCallIPAdpt::GetSupportedBitRates(CBufFlat*& brbuffer)
       
   821     {
       
   822     TRAPD(status, GetSupportedBitRatesL(brbuffer));
       
   823     return status;
       
   824     }
       
   825 
       
   826 // -----------------------------------------------------------------------------
       
   827 // TMSCallIPAdpt::GetSupportedBitRatesL
       
   828 //
       
   829 // GetSupportedBitRates implementation which can leave.
       
   830 // -----------------------------------------------------------------------------
       
   831 //
       
   832 void TMSCallIPAdpt::GetSupportedBitRatesL(CBufFlat*& brbuffer)
       
   833     {
       
   834     TRACE_PRN_FN_ENT;
       
   835     RBufWriteStream stream;
       
   836     stream.Open(*brbuffer);
       
   837     CleanupClosePushL(stream);
       
   838     guint numOfItems = iArrBitrates.Count();
       
   839 
       
   840     for (guint i = 0; i < numOfItems; i++)
       
   841         {
       
   842         stream.WriteUint32L(iArrBitrates[i]);
       
   843         //TRACE_PRN_N1(_L("TMS->TMSCallIPAdpt: BR: [%d]"), iArrBitrates[i]);
       
   844         }
       
   845 
       
   846     CleanupStack::PopAndDestroy(&stream);
       
   847     TRACE_PRN_FN_EXT;
       
   848     }
       
   849 
       
   850 // -----------------------------------------------------------------------------
       
   851 // TMSCallIPAdpt::GetBitRate
       
   852 //
       
   853 // -----------------------------------------------------------------------------
       
   854 //
       
   855 gint TMSCallIPAdpt::GetBitRate(guint& bitrate)
       
   856     {
       
   857     TRACE_PRN_FN_ENT;
       
   858     gint status(TMS_RESULT_INVALID_STATE);
       
   859     if (iIPUplink)
       
   860         {
       
   861         status = iIPUplink->GetBitrate(bitrate);
       
   862         }
       
   863     TRACE_PRN_FN_EXT;
       
   864     return status;
       
   865     }
       
   866 
       
   867 // -----------------------------------------------------------------------------
       
   868 // TMSCallIPAdpt::SetBitRate
       
   869 //
       
   870 // -----------------------------------------------------------------------------
       
   871 //
       
   872 gint TMSCallIPAdpt::SetBitRate(const guint bitrate)
       
   873     {
       
   874     TRACE_PRN_FN_ENT;
       
   875     gint status(TMS_RESULT_INVALID_STATE);
       
   876     if (iIPUplink)
       
   877         {
       
   878         status = iIPUplink->SetBitrate(bitrate);
       
   879         }
       
   880     TRACE_PRN_FN_EXT;
       
   881     return status;
       
   882     }
       
   883 
       
   884 // -----------------------------------------------------------------------------
       
   885 // TMSCallIPAdpt::GetVAD
       
   886 //
       
   887 // -----------------------------------------------------------------------------
       
   888 //
       
   889 gint TMSCallIPAdpt::GetVAD(const TMSFormatType fmttype, gboolean& vad)
       
   890     {
       
   891     TRACE_PRN_FN_ENT;
       
   892     gint status(TMS_RESULT_INVALID_STATE);
       
   893     if (iIPUplink)
       
   894         {
       
   895         status = iIPUplink->GetVad(fmttype, vad);
       
   896         }
       
   897     TRACE_PRN_FN_EXT;
       
   898     return status;
       
   899     }
       
   900 
       
   901 // -----------------------------------------------------------------------------
       
   902 // TMSCallIPAdpt::SetVAD
       
   903 //
       
   904 // -----------------------------------------------------------------------------
       
   905 //
       
   906 gint TMSCallIPAdpt::SetVAD(const TMSFormatType fmttype, const gboolean vad)
       
   907     {
       
   908     TRACE_PRN_FN_ENT;
       
   909     gint status(TMS_RESULT_INVALID_STATE);
       
   910     if (iIPUplink)
       
   911         {
       
   912         status = iIPUplink->SetVad(fmttype, vad);
       
   913         }
       
   914     TRACE_PRN_FN_EXT;
       
   915     return status;
       
   916     }
       
   917 
       
   918 // -----------------------------------------------------------------------------
       
   919 // TMSCallIPAdpt::GetCNG
       
   920 //
       
   921 // -----------------------------------------------------------------------------
       
   922 //
       
   923 gint TMSCallIPAdpt::GetCNG(const TMSFormatType fmttype, gboolean& cng)
       
   924     {
       
   925     TRACE_PRN_FN_ENT;
       
   926     gint status(TMS_RESULT_INVALID_STATE);
       
   927     if (iIPDownlink)
       
   928         {
       
   929         status = iIPDownlink->GetCng(fmttype, cng);
       
   930         }
       
   931     TRACE_PRN_FN_EXT;
       
   932     return status;
       
   933     }
       
   934 
       
   935 // -----------------------------------------------------------------------------
       
   936 // TMSCallIPAdpt::SetCNG
       
   937 //
       
   938 // -----------------------------------------------------------------------------
       
   939 //
       
   940 gint TMSCallIPAdpt::SetCNG(const TMSFormatType fmttype, const gboolean cng)
       
   941     {
       
   942     TRACE_PRN_FN_ENT;
       
   943     gint status(TMS_RESULT_INVALID_STATE);
       
   944     if (iIPDownlink)
       
   945         {
       
   946         status = iIPDownlink->SetCng(fmttype, cng);
       
   947         }
       
   948     TRACE_PRN_FN_EXT;
       
   949     return status;
       
   950     }
       
   951 
       
   952 // -----------------------------------------------------------------------------
       
   953 // TMSCallIPAdpt::GetPlc
       
   954 //
       
   955 // -----------------------------------------------------------------------------
       
   956 //
       
   957 gint TMSCallIPAdpt::GetPlc(const TMSFormatType fmttype, gboolean& plc)
       
   958     {
       
   959     TRACE_PRN_FN_ENT;
       
   960     gint status(TMS_RESULT_INVALID_STATE);
       
   961     if (iIPDownlink)
       
   962         {
       
   963         status = iIPDownlink->GetPlc(fmttype, plc);
       
   964         }
       
   965     TRACE_PRN_FN_EXT;
       
   966     return status;
       
   967     }
       
   968 
       
   969 // -----------------------------------------------------------------------------
       
   970 // TMSCallIPAdpt::SetPlc
       
   971 //
       
   972 // -----------------------------------------------------------------------------
       
   973 //
       
   974 gint TMSCallIPAdpt::SetPlc(const TMSFormatType fmttype, const gboolean plc)
       
   975     {
       
   976     TRACE_PRN_FN_ENT;
       
   977     gint status(TMS_RESULT_INVALID_STATE);
       
   978     if (iIPDownlink)
       
   979         {
       
   980         status = iIPDownlink->SetPlc(fmttype, plc);
       
   981         }
       
   982     TRACE_PRN_FN_EXT;
       
   983     return status;
       
   984     }
       
   985 
       
   986 // -----------------------------------------------------------------------------
       
   987 // TMSCallIPAdpt::OpenDownlinkL
       
   988 // Method for player initialization.
       
   989 // -----------------------------------------------------------------------------
       
   990 //
       
   991 gint TMSCallIPAdpt::OpenDownlinkL(const RMessage2& aMessage)
       
   992     {
       
   993     TRACE_PRN_FN_ENT;
       
   994     gint status(TMS_RESULT_SUCCESS);
       
   995 
       
   996     // Clients must have MultimediaDD capability to use this priority/pref.
       
   997     // TODO: Also, TMS will monitor for emergency call and if detected it
       
   998     //       will deny access to audio resources.
       
   999     iPriority.iPref = KAudioPrefVoipAudioDownlink;
       
  1000     iPriority.iPriority = KAudioPriorityVoipAudioDownlink;
       
  1001 
       
  1002     if (!iIPDownlink)
       
  1003         {
       
  1004         iIPDownlink = TMSIPDownlink::NewL(iDnFourCC, iPriority);
       
  1005         }
       
  1006 
       
  1007     if (iIPDownlink)
       
  1008         {
       
  1009         // Open message queue for handling server notifications to the client
       
  1010         if (iMsgQueueDn.Handle() <= 0)
       
  1011             {
       
  1012             // Second argument in TMSCallProxy::InitStream
       
  1013             status = iMsgQueueDn.Open(aMessage, 1);
       
  1014             }
       
  1015 
       
  1016         if (status == TMS_RESULT_SUCCESS)
       
  1017             {
       
  1018             // For transfer data buffer processing
       
  1019             iIPDownlink->SetMsgQueue(iMsgQueueDn);
       
  1020             }
       
  1021         }
       
  1022 
       
  1023     TRACE_PRN_IF_ERR(status);
       
  1024     TRACE_PRN_FN_EXT;
       
  1025     return status;
       
  1026     }
       
  1027 
       
  1028 // -----------------------------------------------------------------------------
       
  1029 // TMSCallIPAdpt::OpenUplinkL
       
  1030 // Method for recorder initialization.
       
  1031 // -----------------------------------------------------------------------------
       
  1032 //
       
  1033 gint TMSCallIPAdpt::OpenUplinkL(const RMessage2& aMessage)
       
  1034     {
       
  1035     TRACE_PRN_FN_ENT;
       
  1036     gint status(TMS_RESULT_SUCCESS);
       
  1037 
       
  1038     // Ensure clients have MultimediaDD capability to use this priority/pref
       
  1039     iPriority.iPref = KAudioPrefVoipAudioUplink;
       
  1040     iPriority.iPriority = KAudioPriorityVoipAudioUplink;
       
  1041 
       
  1042     if (!iIPUplink)
       
  1043         {
       
  1044         iIPUplink = TMSIPUplink::NewL(iUpFourCC, iPriority);
       
  1045         }
       
  1046 
       
  1047     if (iIPUplink)
       
  1048         {
       
  1049         // Open message queue for handling server notifications to the client
       
  1050         if (iMsgQueueUp.Handle() <= 0)
       
  1051             {
       
  1052             // Second argument in TMSCallProxy::InitStream
       
  1053             status = iMsgQueueUp.Open(aMessage, 1);
       
  1054             }
       
  1055 
       
  1056         if (status == TMS_RESULT_SUCCESS)
       
  1057             {
       
  1058             // For transfer data buffer processing
       
  1059             iIPUplink->SetMsgQueue(iMsgQueueUp);
       
  1060             }
       
  1061         }
       
  1062 
       
  1063     TRACE_PRN_IF_ERR(status);
       
  1064     TRACE_PRN_FN_EXT;
       
  1065     return status;
       
  1066     }
       
  1067 
       
  1068 // -----------------------------------------------------------------------------
       
  1069 // TMSCallIPAdpt::SetFormat
       
  1070 //
       
  1071 // -----------------------------------------------------------------------------
       
  1072 //
       
  1073 void TMSCallIPAdpt::SetFormat(const gint strmId, const TUint32 aFormat)
       
  1074     {
       
  1075     if (strmId == iUplinkStreamId)
       
  1076         {
       
  1077         iUpFourCC = aFormat;
       
  1078         }
       
  1079     else if (strmId == iDnlinkStreamId)
       
  1080         {
       
  1081         iDnFourCC = aFormat;
       
  1082         }
       
  1083     }
       
  1084 
       
  1085 // -----------------------------------------------------------------------------
       
  1086 // TMSCallIPAdpt::BufferFilled
       
  1087 //
       
  1088 // -----------------------------------------------------------------------------
       
  1089 //
       
  1090 void TMSCallIPAdpt::BufferFilledL(TUint dataSize)
       
  1091     {
       
  1092     if (iIPDownlink)
       
  1093         {
       
  1094         iIPDownlink->BufferFilled(dataSize);
       
  1095         }
       
  1096     }
       
  1097 
       
  1098 // -----------------------------------------------------------------------------
       
  1099 // TMSCallIPAdpt::BufferEmptied
       
  1100 //
       
  1101 // -----------------------------------------------------------------------------
       
  1102 //
       
  1103 void TMSCallIPAdpt::BufferEmptiedL()
       
  1104     {
       
  1105     if (iIPUplink)
       
  1106         {
       
  1107         iIPUplink->BufferEmptied();
       
  1108         }
       
  1109     }
       
  1110 
       
  1111 // -----------------------------------------------------------------------------
       
  1112 // TMSCallIPAdpt::GetDataXferChunkHndl
       
  1113 //
       
  1114 // -----------------------------------------------------------------------------
       
  1115 //
       
  1116 gint TMSCallIPAdpt::GetDataXferChunkHndl(const TMSStreamType strmType,
       
  1117         const TUint32 key, RChunk& chunk)
       
  1118     {
       
  1119     TRACE_PRN_FN_ENT;
       
  1120 
       
  1121     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1122     switch (strmType)
       
  1123         {
       
  1124         case TMS_STREAM_DOWNLINK:
       
  1125             {
       
  1126             if (iIPDownlink)
       
  1127                 {
       
  1128                 status = iIPDownlink->GetDataXferChunkHndl(key, chunk);
       
  1129                 }
       
  1130             break;
       
  1131             }
       
  1132         case TMS_STREAM_UPLINK:
       
  1133             {
       
  1134             if (iIPUplink)
       
  1135                 {
       
  1136                 status = iIPUplink->GetDataXferChunkHndl(key, chunk);
       
  1137                 }
       
  1138             break;
       
  1139             }
       
  1140         default:
       
  1141             status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED;
       
  1142             break;
       
  1143         }
       
  1144 
       
  1145     TRACE_PRN_FN_EXT;
       
  1146     return status;
       
  1147     }
       
  1148 
       
  1149 // -----------------------------------------------------------------------------
       
  1150 // TMSCallIPAdpt::SetIlbcCodecMode
       
  1151 //
       
  1152 // -----------------------------------------------------------------------------
       
  1153 //
       
  1154 gint TMSCallIPAdpt::SetIlbcCodecMode(const gint mode,
       
  1155         const TMSStreamType strmtype)
       
  1156     {
       
  1157     gint status(TMS_RESULT_INVALID_ARGUMENT);
       
  1158 
       
  1159     if (strmtype == TMS_STREAM_DOWNLINK)
       
  1160         {
       
  1161         if (iDnlinkInitialized && iIPDownlink)
       
  1162             {
       
  1163             status = iIPDownlink->SetIlbcCodecMode(mode);
       
  1164             }
       
  1165         }
       
  1166     else if (strmtype == TMS_STREAM_UPLINK)
       
  1167         {
       
  1168         if (iUplinkInitialized && iIPUplink)
       
  1169             {
       
  1170             status = iIPUplink->SetIlbcCodecMode(mode);
       
  1171             }
       
  1172         }
       
  1173 
       
  1174     return status;
       
  1175     }
       
  1176 
       
  1177 // -----------------------------------------------------------------------------
       
  1178 // TMSCallIPAdpt::GetIlbcCodecMode
       
  1179 //
       
  1180 // -----------------------------------------------------------------------------
       
  1181 //
       
  1182 gint TMSCallIPAdpt::GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype)
       
  1183     {
       
  1184     gint status(TMS_RESULT_INVALID_ARGUMENT);
       
  1185 
       
  1186     if (strmtype == TMS_STREAM_DOWNLINK)
       
  1187         {
       
  1188         if (iDnlinkInitialized && iIPDownlink)
       
  1189             {
       
  1190             status = iIPDownlink->GetIlbcCodecMode(mode);
       
  1191             }
       
  1192         }
       
  1193     else if (strmtype == TMS_STREAM_UPLINK)
       
  1194         {
       
  1195         if (iUplinkInitialized && iIPUplink)
       
  1196             {
       
  1197             status = iIPUplink->GetIlbcCodecMode(mode);
       
  1198             }
       
  1199         }
       
  1200 
       
  1201     return status;
       
  1202     }
       
  1203 
       
  1204 // -----------------------------------------------------------------------------
       
  1205 // TMSCallIPAdpt::SetG711CodecMode
       
  1206 //
       
  1207 // -----------------------------------------------------------------------------
       
  1208 //
       
  1209 gint TMSCallIPAdpt::SetG711CodecMode(const gint mode,
       
  1210         const TMSStreamType strmtype)
       
  1211     {
       
  1212     gint status(TMS_RESULT_INVALID_ARGUMENT);
       
  1213 
       
  1214     if (strmtype == TMS_STREAM_DOWNLINK)
       
  1215         {
       
  1216         if (iDnlinkInitialized && iIPDownlink)
       
  1217             {
       
  1218             status = iIPDownlink->SetG711CodecMode(mode);
       
  1219             }
       
  1220         }
       
  1221     else if (strmtype == TMS_STREAM_UPLINK)
       
  1222         {
       
  1223         if (iUplinkInitialized && iIPUplink)
       
  1224             {
       
  1225             status = iIPUplink->SetG711CodecMode(mode);
       
  1226             }
       
  1227         }
       
  1228 
       
  1229     return status;
       
  1230     }
       
  1231 
       
  1232 // -----------------------------------------------------------------------------
       
  1233 // TMSCallIPAdpt::GetG711CodecMode
       
  1234 //
       
  1235 // -----------------------------------------------------------------------------
       
  1236 //
       
  1237 gint TMSCallIPAdpt::GetG711CodecMode(gint& mode, const TMSStreamType strmtype)
       
  1238     {
       
  1239     gint status(TMS_RESULT_INVALID_ARGUMENT);
       
  1240 
       
  1241     if (strmtype == TMS_STREAM_DOWNLINK)
       
  1242         {
       
  1243         if (iDnlinkInitialized && iIPDownlink)
       
  1244             {
       
  1245             status = iIPDownlink->GetG711CodecMode(mode);
       
  1246             }
       
  1247         }
       
  1248     else if (strmtype == TMS_STREAM_UPLINK)
       
  1249         {
       
  1250         if (iUplinkInitialized && iIPUplink)
       
  1251             {
       
  1252             status = iIPUplink->GetG711CodecMode(mode);
       
  1253             }
       
  1254         }
       
  1255 
       
  1256     return status;
       
  1257     }
       
  1258 
       
  1259 // -----------------------------------------------------------------------------
       
  1260 // TMSCallIPAdpt::FrameModeRequiredForEC
       
  1261 //
       
  1262 // -----------------------------------------------------------------------------
       
  1263 //
       
  1264 gint TMSCallIPAdpt::FrameModeRqrdForEC(gboolean& frmodereq)
       
  1265     {
       
  1266     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1267     if (iIPDownlink)
       
  1268         {
       
  1269         status = iIPDownlink->FrameModeRqrdForEC(frmodereq);
       
  1270         }
       
  1271     return status;
       
  1272     }
       
  1273 
       
  1274 // -----------------------------------------------------------------------------
       
  1275 // TMSCallIPAdpt::SetFrameMode
       
  1276 //
       
  1277 // -----------------------------------------------------------------------------
       
  1278 //
       
  1279 gint TMSCallIPAdpt::SetFrameMode(const gboolean frmode)
       
  1280     {
       
  1281     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1282     if (iIPDownlink)
       
  1283         {
       
  1284         status = iIPDownlink->SetFrameMode(frmode);
       
  1285         }
       
  1286     return status;
       
  1287     }
       
  1288 
       
  1289 // -----------------------------------------------------------------------------
       
  1290 // TMSCallIPAdpt::GetFrameMode
       
  1291 //
       
  1292 // -----------------------------------------------------------------------------
       
  1293 //
       
  1294 gint TMSCallIPAdpt::GetFrameMode(gboolean& frmode)
       
  1295     {
       
  1296     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1297     if (iIPDownlink)
       
  1298         {
       
  1299         status = iIPDownlink->GetFrameMode(frmode);
       
  1300         }
       
  1301     return status;
       
  1302     }
       
  1303 
       
  1304 // -----------------------------------------------------------------------------
       
  1305 // TMSCallIPAdpt::ConcealErrorForNextBuffer
       
  1306 // -----------------------------------------------------------------------------
       
  1307 //
       
  1308 gint TMSCallIPAdpt::ConcealErrorForNextBuffer()
       
  1309     {
       
  1310     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1311     if (iIPDownlink)
       
  1312         {
       
  1313         status = iIPDownlink->ConcealErrorForNextBuffer();
       
  1314         }
       
  1315     return status;
       
  1316     }
       
  1317 
       
  1318 // -----------------------------------------------------------------------------
       
  1319 // TMSCallIPAdpt::BadLsfNextBuffer
       
  1320 //
       
  1321 // -----------------------------------------------------------------------------
       
  1322 //
       
  1323 gint TMSCallIPAdpt::BadLsfNextBuffer()
       
  1324     {
       
  1325     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1326     if (iIPDownlink)
       
  1327         {
       
  1328         status = iIPDownlink->BadLsfNextBuffer();
       
  1329         }
       
  1330     return status;
       
  1331     }
       
  1332 
       
  1333 // -----------------------------------------------------------------------------
       
  1334 // TMSCallIPAdpt::SetOutput
       
  1335 //
       
  1336 // -----------------------------------------------------------------------------
       
  1337 //
       
  1338 gint TMSCallIPAdpt::SetOutput(TMSAudioOutput output)
       
  1339     {
       
  1340     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1341     if (iDnlinkInitialized && iIPDownlink)
       
  1342         {
       
  1343         TRAP(status, iIPDownlink->SetAudioDeviceL(output));
       
  1344         }
       
  1345     return status;
       
  1346     }
       
  1347 // -----------------------------------------------------------------------------
       
  1348 // TMSCallIPAdpt::GetOutput
       
  1349 //
       
  1350 // -----------------------------------------------------------------------------
       
  1351 //
       
  1352 gint TMSCallIPAdpt::GetOutput(TMSAudioOutput& output)
       
  1353     {
       
  1354     gint status(TMS_RESULT_UNINITIALIZED_OBJECT);
       
  1355     if (iDnlinkInitialized && iIPDownlink)
       
  1356         {
       
  1357         TRAP(status, iIPDownlink->GetAudioDeviceL(output));
       
  1358         }
       
  1359     return status;
       
  1360     }
       
  1361 // -----------------------------------------------------------------------------
       
  1362 // TMSCallIPAdpt::GetPreviousOutput
       
  1363 //
       
  1364 // -----------------------------------------------------------------------------
       
  1365 //
       
  1366 gint TMSCallIPAdpt::GetPreviousOutput(TMSAudioOutput& /*output*/)
       
  1367     {
       
  1368     return TMS_RESULT_FEATURE_NOT_SUPPORTED;
       
  1369     }
       
  1370 
       
  1371 // -----------------------------------------------------------------------------
       
  1372 // TMSCallIPAdpt::GetAvailableOutputsL
       
  1373 //
       
  1374 // -----------------------------------------------------------------------------
       
  1375 //
       
  1376 gint TMSCallIPAdpt::GetAvailableOutputsL(gint& /*count*/,
       
  1377         CBufFlat*& /*outputsbuffer*/)
       
  1378     {
       
  1379     return TMS_RESULT_FEATURE_NOT_SUPPORTED;
       
  1380     }
       
  1381 
       
  1382 // -----------------------------------------------------------------------------
       
  1383 // TMSCallIPAdpt::NotifyClient
       
  1384 // -----------------------------------------------------------------------------
       
  1385 //
       
  1386 void TMSCallIPAdpt::NotifyClient(const gint strmId, const TInt aCommand,
       
  1387         const TInt aStatus, const TInt64 /*aInt64*/)
       
  1388     {
       
  1389     iMsgBuffer.iRequest = aCommand;
       
  1390     iMsgBuffer.iStatus = aStatus;
       
  1391 
       
  1392     if (strmId == iUplinkStreamId)
       
  1393         {
       
  1394         iMsgQueueUp.Send(iMsgBuffer);
       
  1395         }
       
  1396     else if (strmId == iDnlinkStreamId)
       
  1397         {
       
  1398         iMsgQueueDn.Send(iMsgBuffer);
       
  1399         }
       
  1400     }
       
  1401 
       
  1402 // End of file