mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp
branchRCL_3
changeset 46 0ac9a5310753
parent 45 095bea5f582e
equal deleted inserted replaced
45:095bea5f582e 46:0ac9a5310753
    24 #include "tmscallcsadpt.h"
    24 #include "tmscallcsadpt.h"
    25 #include "tmsutility.h"
    25 #include "tmsutility.h"
    26 #include "tmsshared.h"
    26 #include "tmsshared.h"
    27 #include "tmsclientserver.h"
    27 #include "tmsclientserver.h"
    28 #include "tmstarsettings.h"
    28 #include "tmstarsettings.h"
    29 #include "tmssyncvol.h"
       
    30 
    29 
    31 using namespace TMS;
    30 using namespace TMS;
    32 
    31 
    33 // -----------------------------------------------------------------------------
    32 // -----------------------------------------------------------------------------
    34 // TMSCallCSAdpt::NewL
    33 // TMSCallCSAdpt::NewL
    54     TRACE_PRN_FN_ENT;
    53     TRACE_PRN_FN_ENT;
    55     iCSDownlink = NULL;
    54     iCSDownlink = NULL;
    56     iCSUplink = NULL;
    55     iCSUplink = NULL;
    57     iRouting = NULL;
    56     iRouting = NULL;
    58     iTarSettings = NULL;
    57     iTarSettings = NULL;
    59     iResetVolNotifier = NULL;
       
    60     TRACE_PRN_FN_EXT;
    58     TRACE_PRN_FN_EXT;
    61     }
    59     }
    62 
    60 
    63 // -----------------------------------------------------------------------------
    61 // -----------------------------------------------------------------------------
    64 // TMSCallCSAdpt::TMSCallCSAdpt
    62 // TMSCallCSAdpt::TMSCallCSAdpt
    80 
    78 
    81     delete iRouting;
    79     delete iRouting;
    82     delete iTarSettings;
    80     delete iTarSettings;
    83     delete iCSUplink;
    81     delete iCSUplink;
    84     delete iCSDownlink;
    82     delete iCSDownlink;
    85     delete iResetVolNotifier;
       
    86 
    83 
    87     if (iMsgQueueUp.Handle() > 0)
    84     if (iMsgQueueUp.Handle() > 0)
    88         {
    85         {
    89         iMsgQueueUp.Close();
    86         iMsgQueueUp.Close();
    90         }
    87         }
   104 gint TMSCallCSAdpt::PostConstruct()
   101 gint TMSCallCSAdpt::PostConstruct()
   105     {
   102     {
   106     TRACE_PRN_FN_ENT;
   103     TRACE_PRN_FN_ENT;
   107     gint status(TMS_RESULT_SUCCESS);
   104     gint status(TMS_RESULT_SUCCESS);
   108     iNextStreamId = 1;
   105     iNextStreamId = 1;
   109     iUplState = EIdle;
   106     iUplinkInitialized = FALSE;
   110     iDnlState = EIdle;
   107     iDnlinkInitialized = FALSE;
   111     TRACE_PRN_FN_EXT;
   108     TRACE_PRN_FN_EXT;
   112     return status;
   109     return status;
   113     }
   110     }
   114 
   111 
   115 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   125     switch (strmType)
   122     switch (strmType)
   126         {
   123         {
   127         case TMS_STREAM_UPLINK:
   124         case TMS_STREAM_UPLINK:
   128             {
   125             {
   129             status = TMS_RESULT_ALREADY_EXIST;
   126             status = TMS_RESULT_ALREADY_EXIST;
   130             if (iUplState == EIdle)
   127             if (!iUplinkInitialized)
   131                 {
   128                 {
   132                 iUplinkStreamId = iNextStreamId;
   129                 iUplinkStreamId = iNextStreamId;
   133                 outStrmId = iUplinkStreamId;
   130                 outStrmId = iUplinkStreamId;
   134                 iNextStreamId++;
   131                 iNextStreamId++;
       
   132                 //iUplinkInitialized = TRUE; //not initialized yet!
   135                 status = TMS_RESULT_SUCCESS;
   133                 status = TMS_RESULT_SUCCESS;
   136                 }
   134                 }
   137             break;
   135             break;
   138             }
   136             }
   139         case TMS_STREAM_DOWNLINK:
   137         case TMS_STREAM_DOWNLINK:
   140             {
   138             {
   141             status = TMS_RESULT_ALREADY_EXIST;
   139             status = TMS_RESULT_ALREADY_EXIST;
   142             if (iDnlState == EIdle)
   140             if (!iDnlinkInitialized)
   143                 {
   141                 {
   144                 iDnlinkStreamId = iNextStreamId;
   142                 iDnlinkStreamId = iNextStreamId;
   145                 outStrmId = iDnlinkStreamId;
   143                 outStrmId = iDnlinkStreamId;
   146                 iNextStreamId++;
   144                 iNextStreamId++;
       
   145                 //iDnlinkInitialized = TRUE; //not initialized yet!
   147                 status = TMS_RESULT_SUCCESS;
   146                 status = TMS_RESULT_SUCCESS;
   148                 }
   147                 }
   149             break;
   148             break;
   150             }
   149             }
   151         default:
   150         default:
   163 //
   162 //
   164 // -----------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   165 //
   164 //
   166 gint TMSCallCSAdpt::InitStream(const TMSCallType /*callType*/,
   165 gint TMSCallCSAdpt::InitStream(const TMSCallType /*callType*/,
   167         const TMSStreamType strmType, const gint strmId,
   166         const TMSStreamType strmType, const gint strmId,
   168         const TMSFormatType /*frmtType*/, const gint retrytime,
   167         const TMSFormatType /*frmtType*/, const RMessage2& message)
   169         const RMessage2& message)
       
   170     {
   168     {
   171     TRACE_PRN_FN_ENT;
   169     TRACE_PRN_FN_ENT;
   172     gint status(TMS_RESULT_SUCCESS);
   170     gint status(TMS_RESULT_SUCCESS);
   173 
   171 
   174     switch (strmType)
   172     switch (strmType)
   184                     // Third argument in TMSCallProxy::InitStream
   182                     // Third argument in TMSCallProxy::InitStream
   185                     status = iMsgQueueUp.Open(message, 1);
   183                     status = iMsgQueueUp.Open(message, 1);
   186                     }
   184                     }
   187                 if (status == TMS_RESULT_SUCCESS)
   185                 if (status == TMS_RESULT_SUCCESS)
   188                     {
   186                     {
   189                     status = InitUplink(retrytime);
   187                     status = InitUplink();
   190                     }
   188                     }
   191                 }
   189                 }
   192             break;
   190             break;
   193             }
   191             }
   194         case TMS_STREAM_DOWNLINK:
   192         case TMS_STREAM_DOWNLINK:
   202                     // Third argument in TMSCallProxy::InitStream
   200                     // Third argument in TMSCallProxy::InitStream
   203                     status = iMsgQueueDn.Open(message, 1);
   201                     status = iMsgQueueDn.Open(message, 1);
   204                     }
   202                     }
   205                 if (status == TMS_RESULT_SUCCESS)
   203                 if (status == TMS_RESULT_SUCCESS)
   206                     {
   204                     {
   207                     status = InitDownlink(retrytime);
   205                     status = InitDownlink();
   208                     }
   206                     }
   209                 }
   207                 }
   210             break;
   208             break;
   211             }
   209             }
   212         default:
   210         default:
   224 // -----------------------------------------------------------------------------
   222 // -----------------------------------------------------------------------------
   225 // TMSCallCSAdpt::InitUplink
   223 // TMSCallCSAdpt::InitUplink
   226 //
   224 //
   227 // -----------------------------------------------------------------------------
   225 // -----------------------------------------------------------------------------
   228 //
   226 //
   229 gint TMSCallCSAdpt::InitUplink(const gint retrytime)
   227 gint TMSCallCSAdpt::InitUplink()
   230     {
   228     {
   231     gint status(TMS_RESULT_SUCCESS);
   229     gint status(TMS_RESULT_SUCCESS);
   232 
       
   233     if (!iCSUplink)
   230     if (!iCSUplink)
   234         {
   231         {
   235         TRAP(status, iCSUplink = TMSCSUplink::NewL(*this, retrytime));
   232         TRAP(status, iCSUplink = TMSCSUplink::NewL(*this));
   236         }
   233         }
   237     return status;
   234     return status;
   238     }
   235     }
   239 
   236 
   240 // -----------------------------------------------------------------------------
   237 // -----------------------------------------------------------------------------
   241 // TMSCallCSAdpt::InitDownlink
   238 // TMSCallCSAdpt::InitDownlink
   242 //
   239 //
   243 // -----------------------------------------------------------------------------
   240 // -----------------------------------------------------------------------------
   244 //
   241 //
   245 gint TMSCallCSAdpt::InitDownlink(const gint retrytime)
   242 gint TMSCallCSAdpt::InitDownlink()
   246     {
   243     {
   247     gint status(TMS_RESULT_SUCCESS);
   244     gint status(TMS_RESULT_SUCCESS);
   248 
   245 
   249     if (!iCSDownlink)
   246     if (!iCSDownlink)
   250         {
   247         {
   251         TRAP(status, iCSDownlink = TMSCSDownlink::NewL(*this, retrytime));
   248         TRAP(status, iCSDownlink = TMSCSDownlink::NewL(*this));
   252         }
   249         }
   253     if (!iRouting && status == TMS_RESULT_SUCCESS)
   250     if (!iRouting && status == TMS_RESULT_SUCCESS)
   254         {
   251         {
   255         TRAP(status, iRouting = CTelephonyAudioRouting::NewL(*this));
   252         TRAP(status, iRouting = CTelephonyAudioRouting::NewL(*this));
   256         }
   253         }
   265 // TMSCallCSAdpt::StartStream
   262 // TMSCallCSAdpt::StartStream
   266 //
   263 //
   267 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   268 //
   265 //
   269 gint TMSCallCSAdpt::StartStream(const TMSCallType /*callType*/,
   266 gint TMSCallCSAdpt::StartStream(const TMSCallType /*callType*/,
   270         const TMSStreamType strmType, const gint strmId, const gint retrytime)
   267         const TMSStreamType strmType, const gint strmId)
   271     {
   268     {
   272     TRACE_PRN_FN_ENT;
   269     TRACE_PRN_FN_ENT;
   273     gint status(TMS_RESULT_INVALID_STATE);
   270     gint status(TMS_RESULT_INVALID_STATE);
   274     switch (strmType)
   271     switch (strmType)
   275         {
   272         {
   276         case TMS_STREAM_UPLINK:
   273         case TMS_STREAM_UPLINK:
   277             {
   274             {
   278             if (iCSUplink && strmId == iUplinkStreamId &&
   275             if (iCSUplink && strmId == iUplinkStreamId)
   279                     iUplState == EInitialized)
       
   280                 {
   276                 {
   281                 iCSUplink->Activate(retrytime);
   277                 iCSUplink->Activate();
   282                 status = TMS_RESULT_SUCCESS;
   278                 status = TMS_RESULT_SUCCESS;
   283                 }
   279                 }
   284             break;
   280             break;
   285             }
   281             }
   286         case TMS_STREAM_DOWNLINK:
   282         case TMS_STREAM_DOWNLINK:
   287             {
   283             {
   288             if(!iResetVolNotifier)
   284             if (iCSDownlink && strmId == iDnlinkStreamId)
   289                 {
   285                 {
   290                 TRAP(status, iResetVolNotifier = TMSSyncVol::NewL());
   286                 iCSDownlink->Activate();
   291                 }
       
   292             if(iResetVolNotifier)
       
   293                 {
       
   294                 iResetVolNotifier->SetSyncVol();
       
   295                 }
       
   296             if (iCSDownlink && strmId == iDnlinkStreamId &&
       
   297                     iDnlState == EInitialized)
       
   298                 {
       
   299                 iCSDownlink->Activate(retrytime);
       
   300                 status = TMS_RESULT_SUCCESS;
   287                 status = TMS_RESULT_SUCCESS;
   301                 }
   288                 }
   302             break;
   289             break;
   303             }
   290             }
   304         default:
   291         default:
   341         case TMS_STREAM_UPLINK:
   328         case TMS_STREAM_UPLINK:
   342             {
   329             {
   343             if (iCSUplink && strmId == iUplinkStreamId)
   330             if (iCSUplink && strmId == iUplinkStreamId)
   344                 {
   331                 {
   345                 iCSUplink->Deactivate();
   332                 iCSUplink->Deactivate();
   346                 iUplState = EInitialized;
       
   347                 status = TMS_RESULT_SUCCESS;
   333                 status = TMS_RESULT_SUCCESS;
   348                 NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
   334                 NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
   349                 }
   335                 }
   350             break;
   336             break;
   351             }
   337             }
   352         case TMS_STREAM_DOWNLINK:
   338         case TMS_STREAM_DOWNLINK:
   353             {
   339             {
   354             if (iCSDownlink && strmId == iDnlinkStreamId)
   340             if (iCSDownlink && strmId == iDnlinkStreamId)
   355                 {
   341                 {
   356                 iCSDownlink->Deactivate();
   342                 iCSDownlink->Deactivate();
   357                 iDnlState = EInitialized;
       
   358                 status = TMS_RESULT_SUCCESS;
   343                 status = TMS_RESULT_SUCCESS;
   359                 NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
   344                 NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
   360                 }
   345                 }
   361             break;
   346             break;
   362             }
   347             }
   386         case TMS_STREAM_UPLINK:
   371         case TMS_STREAM_UPLINK:
   387             {
   372             {
   388             if (iCSUplink && strmId == iUplinkStreamId)
   373             if (iCSUplink && strmId == iUplinkStreamId)
   389                 {
   374                 {
   390                 iCSUplink->Deactivate();
   375                 iCSUplink->Deactivate();
   391                 iUplState = EIdle;
   376                 iUplinkInitialized = FALSE;
   392                 status = TMS_RESULT_SUCCESS;
   377                 status = TMS_RESULT_SUCCESS;
   393                 NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete, status);
   378                 NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete, status);
   394                 }
   379                 }
   395             break;
   380             break;
   396             }
       
   397         case TMS_STREAM_DOWNLINK:
   381         case TMS_STREAM_DOWNLINK:
   398             {
       
   399             if (iCSDownlink && strmId == iDnlinkStreamId)
   382             if (iCSDownlink && strmId == iDnlinkStreamId)
   400                 {
   383                 {
   401                 iCSDownlink->Deactivate();
   384                 iCSDownlink->Deactivate();
   402                 iDnlState = EIdle;
   385                 iDnlinkInitialized = FALSE;
   403                 status = TMS_RESULT_SUCCESS;
   386                 status = TMS_RESULT_SUCCESS;
   404                 NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
   387                 NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete,
   405                         status);
   388                         status);
   406                 }
   389                 }
   407             break;
   390             break;
   431         case TMS_STREAM_UPLINK:
   414         case TMS_STREAM_UPLINK:
   432             {
   415             {
   433             if (strmId == iUplinkStreamId)
   416             if (strmId == iUplinkStreamId)
   434                 {
   417                 {
   435                 iUplinkStreamId = -1;
   418                 iUplinkStreamId = -1;
   436                 iUplState = EIdle;
   419                 iUplinkInitialized = FALSE;
   437                 }
   420                 }
   438             break;
   421             break;
   439             }
   422             }
   440         case TMS_STREAM_DOWNLINK:
   423         case TMS_STREAM_DOWNLINK:
   441             {
   424             {
   442             if (strmId == iDnlinkStreamId)
   425             if (strmId == iDnlinkStreamId)
   443                 {
   426                 {
   444                 iDnlinkStreamId = -1;
   427                 iDnlinkStreamId = -1;
   445                 iDnlState = EIdle;
   428                 iDnlinkInitialized = FALSE;
   446                 }
   429                 }
   447             break;
   430             break;
   448             }
   431             }
   449         default:
   432         default:
   450             {
   433             {
   507 //
   490 //
   508 gint TMSCallCSAdpt::GetMaxVolume(guint& volume)
   491 gint TMSCallCSAdpt::GetMaxVolume(guint& volume)
   509     {
   492     {
   510     TRACE_PRN_FN_ENT;
   493     TRACE_PRN_FN_ENT;
   511     gint status(TMS_RESULT_INVALID_STATE);
   494     gint status(TMS_RESULT_INVALID_STATE);
   512     if (iCSDownlink && iDnlState != EIdle)
   495     if (iCSDownlink && iDnlinkInitialized)
   513         {
   496         {
   514         volume = iCSDownlink->MaxVolume();
   497         volume = iCSDownlink->MaxVolume();
   515         status = TMS_RESULT_SUCCESS;
   498         status = TMS_RESULT_SUCCESS;
   516         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt: GetMaxVolume [%d]"), volume);
   499         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt: GetMaxVolume [%d]"), volume);
   517         }
   500         }
   526 //
   509 //
   527 gint TMSCallCSAdpt::SetVolume(const guint volume)
   510 gint TMSCallCSAdpt::SetVolume(const guint volume)
   528     {
   511     {
   529     TRACE_PRN_FN_ENT;
   512     TRACE_PRN_FN_ENT;
   530     gint status(TMS_RESULT_INVALID_STATE);
   513     gint status(TMS_RESULT_INVALID_STATE);
   531     if (iCSDownlink && iDnlState != EIdle)
   514     if (iCSDownlink && iDnlinkInitialized)
   532         {
   515         {
   533         iCSDownlink->SetVolume(volume);
   516         iCSDownlink->SetVolume(volume);
   534         status = TMS_RESULT_SUCCESS;
   517         status = TMS_RESULT_SUCCESS;
   535         NotifyClient(iDnlinkStreamId, ECmdSetVolume, status);
   518         NotifyClient(iDnlinkStreamId, ECmdSetVolume, status);
   536         }
   519         }
   545 //
   528 //
   546 gint TMSCallCSAdpt::GetVolume(guint& volume)
   529 gint TMSCallCSAdpt::GetVolume(guint& volume)
   547     {
   530     {
   548     TRACE_PRN_FN_ENT;
   531     TRACE_PRN_FN_ENT;
   549     gint status(TMS_RESULT_INVALID_STATE);
   532     gint status(TMS_RESULT_INVALID_STATE);
   550     if (iCSDownlink && iDnlState != EIdle)
   533     if (iCSDownlink && iDnlinkInitialized)
   551         {
   534         {
   552         volume = iCSDownlink->Volume();
   535         volume = iCSDownlink->Volume();
   553         status = TMS_RESULT_SUCCESS;
   536         status = TMS_RESULT_SUCCESS;
   554         }
   537         }
   555     TRACE_PRN_FN_EXT;
   538     TRACE_PRN_FN_EXT;
   563 //
   546 //
   564 gint TMSCallCSAdpt::GetMaxGain(guint& gain)
   547 gint TMSCallCSAdpt::GetMaxGain(guint& gain)
   565     {
   548     {
   566     TRACE_PRN_FN_ENT;
   549     TRACE_PRN_FN_ENT;
   567     gint status(TMS_RESULT_INVALID_STATE);
   550     gint status(TMS_RESULT_INVALID_STATE);
   568     if (iCSUplink && iUplState != EIdle)
   551     if (iCSUplink && iUplinkInitialized)
   569         {
   552         {
   570         gain = iCSUplink->MaxGain();
   553         gain = iCSUplink->MaxGain();
   571         status = TMS_RESULT_SUCCESS;
   554         status = TMS_RESULT_SUCCESS;
   572         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt::GetMaxGain [%d]"), gain);
   555         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt::GetMaxGain [%d]"), gain);
   573         }
   556         }
   582 //
   565 //
   583 gint TMSCallCSAdpt::SetGain(const guint gain)
   566 gint TMSCallCSAdpt::SetGain(const guint gain)
   584     {
   567     {
   585     TRACE_PRN_FN_ENT;
   568     TRACE_PRN_FN_ENT;
   586     gint status(TMS_RESULT_INVALID_STATE);
   569     gint status(TMS_RESULT_INVALID_STATE);
   587     if (iCSUplink && iUplState != EIdle)
   570     if (iCSUplink && iUplinkInitialized)
   588         {
   571         {
   589         iCSUplink->SetGain(gain);
   572         iCSUplink->SetGain(gain);
   590         status = TMS_RESULT_SUCCESS;
   573         status = TMS_RESULT_SUCCESS;
   591         NotifyClient(iUplinkStreamId, ECmdSetGain, status);
   574         NotifyClient(iUplinkStreamId, ECmdSetGain, status);
   592         }
   575         }
   601 //
   584 //
   602 gint TMSCallCSAdpt::GetGain(guint& gain)
   585 gint TMSCallCSAdpt::GetGain(guint& gain)
   603     {
   586     {
   604     TRACE_PRN_FN_ENT;
   587     TRACE_PRN_FN_ENT;
   605     gint status(TMS_RESULT_INVALID_STATE);
   588     gint status(TMS_RESULT_INVALID_STATE);
   606     if (iCSUplink && iUplState != EIdle)
   589     if (iCSUplink && iUplinkInitialized)
   607         {
   590         {
   608         gain = iCSUplink->Gain();
   591         gain = iCSUplink->Gain();
   609         status = TMS_RESULT_SUCCESS;
   592         status = TMS_RESULT_SUCCESS;
   610         }
   593         }
   611     TRACE_PRN_FN_EXT;
   594     TRACE_PRN_FN_EXT;
   619 //
   602 //
   620 gint TMSCallCSAdpt::GetGlobalMaxVolume(guint& volume)
   603 gint TMSCallCSAdpt::GetGlobalMaxVolume(guint& volume)
   621     {
   604     {
   622     TRACE_PRN_FN_ENT;
   605     TRACE_PRN_FN_ENT;
   623     gint status(TMS_RESULT_INVALID_STATE);
   606     gint status(TMS_RESULT_INVALID_STATE);
   624     if (iCSDownlink && iDnlState != EIdle)
   607     if (iCSDownlink && iDnlinkInitialized)
   625         {
   608         {
   626         volume = iCSDownlink->MaxVolume();
   609         volume = iCSDownlink->MaxVolume();
   627         status = TMS_RESULT_SUCCESS;
   610         status = TMS_RESULT_SUCCESS;
   628         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt::GetGlobalMaxVolume [%d]"), volume);
   611         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt::GetGlobalMaxVolume [%d]"), volume);
   629         }
   612         }
   639 gint TMSCallCSAdpt::SetGlobalVolume(const guint volume)
   622 gint TMSCallCSAdpt::SetGlobalVolume(const guint volume)
   640     {
   623     {
   641     TRACE_PRN_FN_ENT;
   624     TRACE_PRN_FN_ENT;
   642     gint status(TMS_RESULT_INVALID_STATE);
   625     gint status(TMS_RESULT_INVALID_STATE);
   643     iGlobalVol = volume;
   626     iGlobalVol = volume;
   644     if (iCSDownlink && iDnlState != EIdle)
   627     if (iCSDownlink && iDnlinkInitialized)
   645         {
   628         {
   646         iCSDownlink->SetVolume(volume);
   629         iCSDownlink->SetVolume(volume);
   647         status = TMS_RESULT_SUCCESS;
   630         status = TMS_RESULT_SUCCESS;
   648         }
   631         }
   649     TRACE_PRN_FN_EXT;
   632     TRACE_PRN_FN_EXT;
   657 //
   640 //
   658 gint TMSCallCSAdpt::GetGlobalVolume(guint& volume)
   641 gint TMSCallCSAdpt::GetGlobalVolume(guint& volume)
   659     {
   642     {
   660     TRACE_PRN_FN_ENT;
   643     TRACE_PRN_FN_ENT;
   661     gint status(TMS_RESULT_INVALID_STATE);
   644     gint status(TMS_RESULT_INVALID_STATE);
   662     if (iCSDownlink && iDnlState != EIdle)
   645     if (iCSDownlink && iDnlinkInitialized)
   663         {
   646         {
   664         volume = iCSDownlink->Volume();
   647         volume = iCSDownlink->Volume();
   665         status = TMS_RESULT_SUCCESS;
   648         status = TMS_RESULT_SUCCESS;
   666         }
   649         }
   667     TRACE_PRN_FN_EXT;
   650     TRACE_PRN_FN_EXT;
   675 //
   658 //
   676 gint TMSCallCSAdpt::GetGlobalMaxGain(guint& gain)
   659 gint TMSCallCSAdpt::GetGlobalMaxGain(guint& gain)
   677     {
   660     {
   678     TRACE_PRN_FN_ENT;
   661     TRACE_PRN_FN_ENT;
   679     gint status(TMS_RESULT_INVALID_STATE);
   662     gint status(TMS_RESULT_INVALID_STATE);
   680     if (iCSUplink && iUplState != EIdle)
   663     if (iCSUplink && iUplinkInitialized)
   681         {
   664         {
   682         gain = iCSUplink->MaxGain();
   665         gain = iCSUplink->MaxGain();
   683         status = TMS_RESULT_SUCCESS;
   666         status = TMS_RESULT_SUCCESS;
   684         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt::GetGlobalMaxGain [%d]"), gain);
   667         TRACE_PRN_N1(_L("TMS->TMSCallCSAdpt::GetGlobalMaxGain [%d]"), gain);
   685         }
   668         }
   695 gint TMSCallCSAdpt::SetGlobalGain(const guint gain)
   678 gint TMSCallCSAdpt::SetGlobalGain(const guint gain)
   696     {
   679     {
   697     TRACE_PRN_FN_ENT;
   680     TRACE_PRN_FN_ENT;
   698     gint status(TMS_RESULT_INVALID_STATE);
   681     gint status(TMS_RESULT_INVALID_STATE);
   699     iGlobalGain = gain;
   682     iGlobalGain = gain;
   700     if (iCSUplink && iUplState != EIdle)
   683     if (iCSUplink && iUplinkInitialized)
   701         {
   684         {
   702         iCSUplink->SetGain(gain);
   685         iCSUplink->SetGain(gain);
   703         status = TMS_RESULT_SUCCESS;
   686         status = TMS_RESULT_SUCCESS;
   704         }
   687         }
   705     TRACE_PRN_FN_EXT;
   688     TRACE_PRN_FN_EXT;
   713 //
   696 //
   714 gint TMSCallCSAdpt::GetGlobalGain(guint& gain)
   697 gint TMSCallCSAdpt::GetGlobalGain(guint& gain)
   715     {
   698     {
   716     TRACE_PRN_FN_ENT;
   699     TRACE_PRN_FN_ENT;
   717     gint status(TMS_RESULT_INVALID_STATE);
   700     gint status(TMS_RESULT_INVALID_STATE);
   718     if (iCSUplink && iUplState != EIdle)
   701     if (iCSUplink && iUplinkInitialized)
   719         {
   702         {
   720         gain = iCSUplink->Gain();
   703         gain = iCSUplink->Gain();
   721         status = TMS_RESULT_SUCCESS;
   704         status = TMS_RESULT_SUCCESS;
   722         }
   705         }
   723     TRACE_PRN_FN_EXT;
   706     TRACE_PRN_FN_EXT;
   928         CTelephonyAudioRouting::TAudioOutput taroutput;
   911         CTelephonyAudioRouting::TAudioOutput taroutput;
   929         taroutput = iRouting->Output();
   912         taroutput = iRouting->Output();
   930         status = TMS_RESULT_SUCCESS;
   913         status = TMS_RESULT_SUCCESS;
   931         output = TOTMSOUTPUT(taroutput);
   914         output = TOTMSOUTPUT(taroutput);
   932         }
   915         }
       
   916 
   933     TRACE_PRN_FN_EXT;
   917     TRACE_PRN_FN_EXT;
   934     return status;
   918     return status;
   935     }
   919     }
   936 
   920 
   937 // -----------------------------------------------------------------------------
   921 // -----------------------------------------------------------------------------
   969     if (iRouting)
   953     if (iRouting)
   970         {
   954         {
   971         RBufWriteStream stream;
   955         RBufWriteStream stream;
   972         stream.Open(*outputsbuf);
   956         stream.Open(*outputsbuf);
   973         CleanupClosePushL(stream);
   957         CleanupClosePushL(stream);
       
   958 
   974         TArray<CTelephonyAudioRouting::TAudioOutput>
   959         TArray<CTelephonyAudioRouting::TAudioOutput>
   975                 availableOutputs = iRouting->AvailableOutputs();
   960                 availableOutputs = iRouting->AvailableOutputs();
       
   961 
   976         guint numOfItems = availableOutputs.Count();
   962         guint numOfItems = availableOutputs.Count();
   977         count = numOfItems;
   963         count = numOfItems;
   978         for (guint i = 0; i < numOfItems; i++)
   964         for (guint i = 0; i < numOfItems; i++)
   979             {
   965             {
   980             tmsoutput = TOTMSOUTPUT(availableOutputs[i]);
   966             tmsoutput = TOTMSOUTPUT(availableOutputs[i]);
   981             stream.WriteUint32L(tmsoutput);
   967             stream.WriteUint32L(tmsoutput);
   982             }
   968             }
       
   969 
   983         CleanupStack::PopAndDestroy(&stream);
   970         CleanupStack::PopAndDestroy(&stream);
   984         status = TMS_RESULT_SUCCESS;
   971         status = TMS_RESULT_SUCCESS;
   985         }
   972         }
   986 
   973 
   987     TRACE_PRN_FN_EXT;
   974     TRACE_PRN_FN_EXT;
   988     return status;
   975     return status;
   989     }
   976     }
       
   977 
       
   978 
       
   979 // From TMSCSPDevSoundObserver
   990 
   980 
   991 // -----------------------------------------------------------------------------
   981 // -----------------------------------------------------------------------------
   992 // TMSCallCSAdpt::DownlinkInitCompleted
   982 // TMSCallCSAdpt::DownlinkInitCompleted
   993 // From TMSCSDevSoundObserver
   983 // From TMSCSDevSoundObserver
   994 // -----------------------------------------------------------------------------
   984 // -----------------------------------------------------------------------------
   996 void TMSCallCSAdpt::DownlinkInitCompleted(gint status)
   986 void TMSCallCSAdpt::DownlinkInitCompleted(gint status)
   997     {
   987     {
   998     TRACE_PRN_FN_ENT;
   988     TRACE_PRN_FN_ENT;
   999     if (status == TMS_RESULT_SUCCESS)
   989     if (status == TMS_RESULT_SUCCESS)
  1000         {
   990         {
  1001         iDnlState = EInitialized;
   991         iDnlinkInitialized = TRUE;
  1002         }
   992         }
  1003     NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
   993     NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status);
  1004     TRACE_PRN_FN_EXT;
   994     TRACE_PRN_FN_EXT;
  1005     }
   995     }
  1006 
   996 
  1012 void TMSCallCSAdpt::UplinkInitCompleted(gint status)
  1002 void TMSCallCSAdpt::UplinkInitCompleted(gint status)
  1013     {
  1003     {
  1014     TRACE_PRN_FN_ENT;
  1004     TRACE_PRN_FN_ENT;
  1015     if (status == TMS_RESULT_SUCCESS)
  1005     if (status == TMS_RESULT_SUCCESS)
  1016         {
  1006         {
  1017         iUplState = EInitialized;
  1007         iUplinkInitialized = TRUE;
  1018         }
  1008         }
  1019     NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
  1009     NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status);
  1020     TRACE_PRN_FN_EXT;
  1010     TRACE_PRN_FN_EXT;
  1021     }
  1011     }
  1022 
  1012 
  1026 // -----------------------------------------------------------------------------
  1016 // -----------------------------------------------------------------------------
  1027 //
  1017 //
  1028 void TMSCallCSAdpt::UplinkActivationCompleted(gint status)
  1018 void TMSCallCSAdpt::UplinkActivationCompleted(gint status)
  1029     {
  1019     {
  1030     TRACE_PRN_FN_ENT;
  1020     TRACE_PRN_FN_ENT;
  1031     if (status == TMS_RESULT_SUCCESS)
       
  1032         {
       
  1033         iUplState = EActivated;
       
  1034         }
       
  1035     NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status);
  1021     NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status);
  1036     TRACE_PRN_FN_EXT;
  1022     TRACE_PRN_FN_EXT;
  1037     }
  1023     }
  1038 
  1024 
  1039 // -----------------------------------------------------------------------------
  1025 // -----------------------------------------------------------------------------
  1042 // -----------------------------------------------------------------------------
  1028 // -----------------------------------------------------------------------------
  1043 //
  1029 //
  1044 void TMSCallCSAdpt::DownlinkActivationCompleted(gint status)
  1030 void TMSCallCSAdpt::DownlinkActivationCompleted(gint status)
  1045     {
  1031     {
  1046     TRACE_PRN_FN_ENT;
  1032     TRACE_PRN_FN_ENT;
  1047     if (status == TMS_RESULT_SUCCESS)
       
  1048         {
       
  1049         iDnlState = EActivated;
       
  1050         }
       
  1051     NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status);
  1033     NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status);
  1052     TRACE_PRN_FN_EXT;
  1034     TRACE_PRN_FN_EXT;
  1053     }
  1035     }
  1054 
  1036 
  1055 // -----------------------------------------------------------------------------
  1037 // -----------------------------------------------------------------------------