mmserv/tms/tmsserver/src/tmsserver.cpp
branchRCL_3
changeset 9 f5c5c82a163e
parent 7 3d8c721bf319
child 11 3570217d8c21
equal deleted inserted replaced
8:03a293c97d5c 9:f5c5c82a163e
    77     iDnlCodecs.Reset();
    77     iDnlCodecs.Reset();
    78     iDnlCodecs.Close();
    78     iDnlCodecs.Close();
    79     iUplCodecs.Reset();
    79     iUplCodecs.Reset();
    80     iUplCodecs.Close();
    80     iUplCodecs.Close();
    81     delete iEffectSettings;
    81     delete iEffectSettings;
    82     CancelRoutingNotifier();
    82     delete iTarHandler;
    83     CancelCenRepHandler();
    83     CancelCenRepHandler();
    84 
    84 
    85     TRACE_PRN_FN_EXT;
    85     TRACE_PRN_FN_EXT;
    86     }
    86     }
    87 
    87 
   127     StartL(KTMSServerName);
   127     StartL(KTMSServerName);
   128     RThread().SetPriority(EPriorityRealTime);
   128     RThread().SetPriority(EPriorityRealTime);
   129     iEffectSettings = TMSGlobalEffectsSettings::NewL();
   129     iEffectSettings = TMSGlobalEffectsSettings::NewL();
   130     iTarHandler = NULL;
   130     iTarHandler = NULL;
   131     iAudioCenRepHandler = NULL;
   131     iAudioCenRepHandler = NULL;
   132     iCurrentRouting = TMS_AUDIO_OUTPUT_NONE;
   132     iCurrentRouting = TMS_AUDIO_OUTPUT_PRIVATE;
       
   133 
       
   134     // We need it running for global volume change updates
       
   135     StartRoutingNotifierL();
   133 
   136 
   134     TRACE_PRN_FN_EXT;
   137     TRACE_PRN_FN_EXT;
   135     }
   138     }
   136 
   139 
   137 // -----------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   331 //
   334 //
   332 // -----------------------------------------------------------------------------
   335 // -----------------------------------------------------------------------------
   333 //
   336 //
   334 void TMSServer::CancelRoutingNotifier()
   337 void TMSServer::CancelRoutingNotifier()
   335     {
   338     {
   336     if (--iTarHandlerCount <= 0)
   339     if (--iTarHandlerCount < 1)
   337         {
   340         {
   338         delete iTarHandler;
   341         delete iTarHandler;
   339         iTarHandler = NULL;
   342         iTarHandler = NULL;
   340         }
   343         }
   341     }
   344     }
   626                 static_cast<TMSServerSession*> (iSessionIter++);
   629                 static_cast<TMSServerSession*> (iSessionIter++);
   627 
   630 
   628         while (serverSession != NULL)
   631         while (serverSession != NULL)
   629             {
   632             {
   630             serverSession->HandleGlobalEffectChange(
   633             serverSession->HandleGlobalEffectChange(
   631                     TMS_EVENT_EFFECT_VOL_CHANGED);
   634                     TMS_EVENT_EFFECT_VOL_CHANGED, level, EFalse,
       
   635                     iCurrentRouting);
   632 
   636 
   633             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   637             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   634             }
   638             }
   635         }
   639         }
   636 
   640 
   701                 static_cast<TMSServerSession*> (iSessionIter++);
   705                 static_cast<TMSServerSession*> (iSessionIter++);
   702 
   706 
   703         while (serverSession != NULL)
   707         while (serverSession != NULL)
   704             {
   708             {
   705             serverSession->HandleGlobalEffectChange(
   709             serverSession->HandleGlobalEffectChange(
   706                     TMS_EVENT_EFFECT_GAIN_CHANGED);
   710                     TMS_EVENT_EFFECT_GAIN_CHANGED, level);
   707             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   711             serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   708             }
   712             }
   709         }
   713         }
   710 
   714 
   711     TRACE_PRN_FN_EXT;
   715     TRACE_PRN_FN_EXT;
   820 //
   824 //
   821 TInt TMSServer::NotifyTarClients(TRoutingMsgBufPckg routingpckg)
   825 TInt TMSServer::NotifyTarClients(TRoutingMsgBufPckg routingpckg)
   822     {
   826     {
   823     TRACE_PRN_FN_ENT;
   827     TRACE_PRN_FN_ENT;
   824 
   828 
       
   829     TInt vol;
   825     iCurrentRouting = routingpckg().iOutput;
   830     iCurrentRouting = routingpckg().iOutput;
       
   831     if (iCurrentRouting == TMS_AUDIO_OUTPUT_PUBLIC ||
       
   832             iCurrentRouting == TMS_AUDIO_OUTPUT_LOUDSPEAKER)
       
   833         {
       
   834         iEffectSettings->GetLoudSpkrVolume(vol);
       
   835         }
       
   836     else
       
   837         {
       
   838         iEffectSettings->GetEarPieceVolume(vol);
       
   839         }
       
   840 
       
   841     TInt status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_VOL_SET, vol);
       
   842 
   826     iSessionIter.SetToFirst();
   843     iSessionIter.SetToFirst();
   827     TMSServerSession* serverSession =
   844     TMSServerSession* serverSession =
   828             static_cast<TMSServerSession*> (iSessionIter++);
   845             static_cast<TMSServerSession*> (iSessionIter++);
   829 
       
   830     while (serverSession != NULL)
   846     while (serverSession != NULL)
   831         {
   847         {
   832         serverSession->HandleRoutingChange(routingpckg);
   848         // Send only if there is a subscriber to TMS routing notifications.
       
   849         if (iTarHandlerCount > 1)
       
   850             {
       
   851             serverSession->HandleRoutingChange(routingpckg);
       
   852             }
       
   853         serverSession->HandleGlobalEffectChange(TMS_EVENT_EFFECT_VOL_CHANGED,
       
   854                 vol, ETrue, iCurrentRouting);
   833         serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   855         serverSession = static_cast<TMSServerSession*> (iSessionIter++);
   834         }
   856         }
   835 
   857 
   836     TRACE_PRN_FN_EXT;
   858     TRACE_PRN_FN_EXT;
   837     return TMS_RESULT_SUCCESS;
   859     return status;
   838     }
   860     }
   839 
   861 
   840 // -----------------------------------------------------------------------------
   862 // -----------------------------------------------------------------------------
   841 // RunServerL
   863 // RunServerL
   842 //
   864 //