mmserv/tms/tmsserver/src/tmsserver.cpp
changeset 14 80975da52420
parent 12 5a06f39ad45b
child 16 43d09473c595
equal deleted inserted replaced
12:5a06f39ad45b 14:80975da52420
    80     iDnlCodecs.Reset();
    80     iDnlCodecs.Reset();
    81     iDnlCodecs.Close();
    81     iDnlCodecs.Close();
    82     iUplCodecs.Reset();
    82     iUplCodecs.Reset();
    83     iUplCodecs.Close();
    83     iUplCodecs.Close();
    84     delete iEffectSettings;
    84     delete iEffectSettings;
    85     CancelRoutingNotifier();
    85     delete iTarHandler;
    86     CancelCenRepHandler();
    86     CancelCenRepHandler();
    87     CancelDTMFNotifier();
    87     CancelDTMFNotifier();
    88     DeinitRingTonePlayer();
    88     DeinitRingTonePlayer();
    89     delete iTMSRtPlayer;
    89     delete iTMSRtPlayer;
    90 
    90 
   134     RThread().SetPriority(EPriorityRealTime);
   134     RThread().SetPriority(EPriorityRealTime);
   135     iEffectSettings = TMSGlobalEffectsSettings::NewL();
   135     iEffectSettings = TMSGlobalEffectsSettings::NewL();
   136     iTarHandler = NULL;
   136     iTarHandler = NULL;
   137     iAudioCenRepHandler = NULL;
   137     iAudioCenRepHandler = NULL;
   138     iDTMFHandler = NULL;
   138     iDTMFHandler = NULL;
   139     iCurrentRouting = TMS_AUDIO_OUTPUT_NONE;
   139     iCurrentRouting = TMS_AUDIO_OUTPUT_PRIVATE;
   140     InitRingTonePlayerL();
   140 
       
   141     //TODO: EUnit fails to initialize ProfileEngine in RT in eshell mode
       
   142     TRAP_IGNORE(InitRingTonePlayerL());
       
   143 
       
   144     // We need it running for global volume change updates
       
   145     StartRoutingNotifierL();
   141 
   146 
   142     TRACE_PRN_FN_EXT;
   147     TRACE_PRN_FN_EXT;
   143     }
   148     }
   144 
   149 
   145 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   339 //
   344 //
   340 // -----------------------------------------------------------------------------
   345 // -----------------------------------------------------------------------------
   341 //
   346 //
   342 void TMSServer::CancelRoutingNotifier()
   347 void TMSServer::CancelRoutingNotifier()
   343     {
   348     {
   344     if (--iTarHandlerCount <= 0)
   349     if (--iTarHandlerCount < 1)
   345         {
   350         {
   346         delete iTarHandler;
   351         delete iTarHandler;
   347         iTarHandler = NULL;
   352         iTarHandler = NULL;
   348         }
   353         }
   349     }
   354     }
   668                 static_cast<TMSServerSession*> (iSessionIter++);
   673                 static_cast<TMSServerSession*> (iSessionIter++);
   669 
   674 
   670         while (serverSession != NULL)
   675         while (serverSession != NULL)
   671             {
   676             {
   672             serverSession->HandleGlobalEffectChange(
   677             serverSession->HandleGlobalEffectChange(
   673                     TMS_EVENT_EFFECT_VOL_CHANGED);
   678                     TMS_EVENT_EFFECT_VOL_CHANGED, level, EFalse,
       
   679                     iCurrentRouting);
   674 
   680 
   675             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   681             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   676             }
   682             }
   677         }
   683         }
   678 
   684 
   743                 static_cast<TMSServerSession*> (iSessionIter++);
   749                 static_cast<TMSServerSession*> (iSessionIter++);
   744 
   750 
   745         while (serverSession != NULL)
   751         while (serverSession != NULL)
   746             {
   752             {
   747             serverSession->HandleGlobalEffectChange(
   753             serverSession->HandleGlobalEffectChange(
   748                     TMS_EVENT_EFFECT_GAIN_CHANGED);
   754                     TMS_EVENT_EFFECT_GAIN_CHANGED, level);
   749             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   755             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   750             }
   756             }
   751         }
   757         }
   752 
   758 
   753     TRACE_PRN_FN_EXT;
   759     TRACE_PRN_FN_EXT;
   862 //
   868 //
   863 TInt TMSServer::NotifyTarClients(TRoutingMsgBufPckg routingpckg)
   869 TInt TMSServer::NotifyTarClients(TRoutingMsgBufPckg routingpckg)
   864     {
   870     {
   865     TRACE_PRN_FN_ENT;
   871     TRACE_PRN_FN_ENT;
   866 
   872 
       
   873     TInt vol;
   867     iCurrentRouting = routingpckg().iOutput;
   874     iCurrentRouting = routingpckg().iOutput;
       
   875     if (iCurrentRouting == TMS_AUDIO_OUTPUT_PUBLIC ||
       
   876             iCurrentRouting == TMS_AUDIO_OUTPUT_LOUDSPEAKER)
       
   877         {
       
   878         iEffectSettings->GetLoudSpkrVolume(vol);
       
   879         }
       
   880     else
       
   881         {
       
   882         iEffectSettings->GetEarPieceVolume(vol);
       
   883         }
       
   884 
       
   885     TInt status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_VOL_SET, vol);
       
   886 
   868     iSessionIter.SetToFirst();
   887     iSessionIter.SetToFirst();
   869     TMSServerSession* serverSession =
   888     TMSServerSession* serverSession =
   870             static_cast<TMSServerSession*> (iSessionIter++);
   889             static_cast<TMSServerSession*> (iSessionIter++);
   871 
       
   872     while (serverSession != NULL)
   890     while (serverSession != NULL)
   873         {
   891         {
   874         serverSession->HandleRoutingChange(routingpckg);
   892         // Send only if there is a subscriber to TMS routing notifications.
       
   893         if (iTarHandlerCount > 1)
       
   894             {
       
   895             serverSession->HandleRoutingChange(routingpckg);
       
   896             }
       
   897         serverSession->HandleGlobalEffectChange(TMS_EVENT_EFFECT_VOL_CHANGED,
       
   898                 vol, ETrue, iCurrentRouting);
   875         serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   899         serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   876         }
   900         }
   877 
   901 
   878     TRACE_PRN_FN_EXT;
   902     TRACE_PRN_FN_EXT;
   879     return TMS_RESULT_SUCCESS;
   903     return status;
   880     }
   904     }
   881 
   905 
   882 // -----------------------------------------------------------------------------
   906 // -----------------------------------------------------------------------------
   883 // TMSServer::StartDTMF
   907 // TMSServer::StartDTMF
   884 //
   908 //