mmserv/sts/stsserver/src/stsserversession.cpp
changeset 14 80975da52420
child 16 43d09473c595
equal deleted inserted replaced
12:5a06f39ad45b 14:80975da52420
       
     1 /*
       
     2  * Copyright (c) 2010 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:
       
    15  * This method provides the generic Symbian specific message handling
       
    16  * for the server session.  The actual STS specific processing occurs
       
    17  * in the STS class.
       
    18  */
       
    19 
       
    20 #include "stsserversession.h"
       
    21 #include "stsserver.h"
       
    22 #include "sts.h"
       
    23 
       
    24 // CStsServerSession IMPLEMENTATION
       
    25 CStsServerSession::CStsServerSession(CStsServer& aServer, CSts& aSts) :
       
    26     iServer(aServer), iSts(aSts)
       
    27     {
       
    28     }
       
    29 
       
    30 CStsServerSession::~CStsServerSession()
       
    31     {
       
    32     iServer.DropSession(this);
       
    33     }
       
    34 
       
    35 void CStsServerSession::CreateL()
       
    36     {
       
    37     iServer.AddSession(this);
       
    38     }
       
    39 
       
    40 void CStsServerSession::ServiceL(const RMessage2& aMessage)
       
    41     {
       
    42     switch (aMessage.Function())
       
    43         {
       
    44         case StsMsg_PlayTone:
       
    45             DoPlayToneL(aMessage);
       
    46             break;
       
    47         case StsMsg_StopTone:
       
    48             DoStopToneL(aMessage);
       
    49             break;
       
    50         default:
       
    51             break;
       
    52         }
       
    53     }
       
    54 
       
    55 void CStsServerSession::ServiceError(const RMessage2& aMessage, TInt aError)
       
    56     {
       
    57     CSession2::ServiceError(aMessage, aError);
       
    58     }
       
    59 
       
    60 void CStsServerSession::DoPlayToneL(const RMessage2& aMessage)
       
    61     {
       
    62     CSystemToneService::TToneType toneType =
       
    63             (CSystemToneService::TToneType) aMessage.Int0();
       
    64     unsigned int context = 0;
       
    65     iSts.PlayTone(toneType, context);
       
    66     TPckg<unsigned int> contextPckg(context);
       
    67     TRAPD(err,aMessage.WriteL(1,contextPckg));
       
    68     aMessage.Complete(err);
       
    69     }
       
    70 
       
    71 void CStsServerSession::DoStopToneL(const RMessage2& aMessage)
       
    72     {
       
    73     unsigned int context = aMessage.Int0();
       
    74     aMessage.Complete(KErrNone);
       
    75     iSts.StopTone(context);
       
    76     }