mmserv/sts/stsserver/src/stsserversession.cpp
changeset 47 c2e43643db4c
parent 42 1fa3fb47b1e3
equal deleted inserted replaced
42:1fa3fb47b1e3 47:c2e43643db4c
    15  * This method provides the generic Symbian specific message handling
    15  * This method provides the generic Symbian specific message handling
    16  * for the server session.  The actual STS specific processing occurs
    16  * for the server session.  The actual STS specific processing occurs
    17  * in the STS class.
    17  * in the STS class.
    18  */
    18  */
    19 
    19 
       
    20 //  Include Files  
    20 #include "stsserversession.h"
    21 #include "stsserversession.h"
    21 #include "stsserver.h"
    22 #include "stsserver.h"
    22 #include "sts.h"
    23 #include "sts.h"
    23 
    24 
    24 // CStsServerSession IMPLEMENTATION
    25 // CStsServerSession IMPLEMENTATION
    52         case StsMsg_PlayTone:
    53         case StsMsg_PlayTone:
    53             DoPlayToneL(aMessage);
    54             DoPlayToneL(aMessage);
    54             break;
    55             break;
    55         case StsMsg_PlayAlarm:
    56         case StsMsg_PlayAlarm:
    56             DoPlayAlarmL(aMessage);
    57             DoPlayAlarmL(aMessage);
       
    58             break;
       
    59         case StsMsg_PlayToneAlarm:
       
    60             DoPlayToneAlarmL(aMessage);
    57             break;
    61             break;
    58         case StsMsg_StopAlarm:
    62         case StsMsg_StopAlarm:
    59             DoStopAlarmL(aMessage);
    63             DoStopAlarmL(aMessage);
    60             break;
    64             break;
    61         default:
    65         default:
   104         {
   108         {
   105         PlayAlarmComplete(0);
   109         PlayAlarmComplete(0);
   106         }
   110         }
   107     }
   111     }
   108 
   112 
   109 void CStsServerSession::DoStopAlarmL(const RMessage2& aMessage)
   113 void CStsServerSession::DoPlayToneAlarmL(const RMessage2& aMessage)
   110     {
       
   111     unsigned int context = aMessage.Int0();
       
   112     aMessage.Complete(KErrNone);
       
   113     iObserverMap.erase(context);
       
   114     iSts.StopAlarm(context);
       
   115     }
       
   116 
       
   117 void CStsServerSession::DoPlayToneStopL(const RMessage2& aMessage)
       
   118     {
   114     {
   119     CSystemToneService::TToneType tone =
   115     CSystemToneService::TToneType tone =
   120             (CSystemToneService::TToneType) aMessage.Int0();
   116             (CSystemToneService::TToneType) aMessage.Int0();
   121     unsigned int context = 0;
   117     unsigned int context = 0;
   122     //SR
   118     iSts.PlayAlarm(tone, context, *this);
   123     //iSts.PlayTone(tone, context, *this);
       
   124     iSts.PlayToneStop(tone, context, *this);
       
   125     iObserverMap[context] = (MStsPlayAlarmObserver*) aMessage.Ptr2();
   119     iObserverMap[context] = (MStsPlayAlarmObserver*) aMessage.Ptr2();
   126     TPckg<unsigned int> contextPckg(context);
   120     TPckg<unsigned int> contextPckg(context);
   127     TRAPD(err,aMessage.WriteL(1,contextPckg));
   121     TRAPD(err,aMessage.WriteL(1,contextPckg));
   128     aMessage.Complete(err);
   122     aMessage.Complete(err);
   129     // if the context is 0 there was a problem with the PlayAlarm,
   123     // if the context is 0 there was a problem with the PlayAlarm,
   132         {
   126         {
   133         PlayAlarmComplete(0);
   127         PlayAlarmComplete(0);
   134         }
   128         }
   135     }
   129     }
   136 
   130 
       
   131 void CStsServerSession::DoStopAlarmL(const RMessage2& aMessage)
       
   132     {
       
   133     unsigned int context = aMessage.Int0();
       
   134     aMessage.Complete(KErrNone);
       
   135     iObserverMap.erase(context);
       
   136     iSts.StopAlarm(context);
       
   137     }
   137 
   138 
   138 void CStsServerSession::CleanUpObservers()
   139 void CStsServerSession::CleanUpObservers()
   139     {
   140     {
   140     while (!iObserverMap.empty())
   141     while (!iObserverMap.empty())
   141         {
   142         {