mmserv/sts/stsimplementation/src/stsimplementation.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  * The file provides the actual implementation of the STS API.
       
    16  * All of the STS API methods are implemented by passing the
       
    17  * calls to the STS Server through the client side STS
       
    18  * Session.
       
    19  */
       
    20 
       
    21 //  Include Files  
       
    22 #include "stsimplementation.h"
       
    23 #include "rstssession.h"
       
    24 
       
    25 //  Member Functions
       
    26 /*static*/CStsImplementation* CStsImplementation::Create()
       
    27     {
       
    28     CStsImplementation* self = new CStsImplementation();
       
    29     if (self != 0)
       
    30         {
       
    31         bool successful = self->Init();
       
    32         if (!successful)
       
    33             {
       
    34             delete self;
       
    35             self = 0;
       
    36             }
       
    37         }
       
    38     return self;
       
    39     }
       
    40 
       
    41 CStsImplementation::CStsImplementation() :
       
    42     iSession(NULL)
       
    43     {
       
    44     }
       
    45 
       
    46 CStsImplementation::~CStsImplementation()
       
    47     {
       
    48     iSession->Close();
       
    49     delete iSession;
       
    50     }
       
    51 
       
    52 bool CStsImplementation::Init()
       
    53     {
       
    54     bool result = false;
       
    55     iSession = new RStsSession();
       
    56     if (iSession)
       
    57         {
       
    58         TInt err = iSession->Connect();
       
    59         result = err == KErrNone;
       
    60         }
       
    61     return result;
       
    62     }
       
    63 
       
    64 void CStsImplementation::PlayTone(CSystemToneService::TToneType aTone)
       
    65     {
       
    66     unsigned int playToneContext;
       
    67     PlayTone(aTone, playToneContext);
       
    68     }
       
    69 
       
    70 void CStsImplementation::PlayTone(CSystemToneService::TToneType aTone,
       
    71         unsigned int& aPlayToneContext)
       
    72     {
       
    73     //TODO: Add logging and error checking
       
    74     iSession->SendPlayTone(aTone, aPlayToneContext);
       
    75     }
       
    76 
       
    77 void CStsImplementation::StopTone(unsigned int aPlayToneContext)
       
    78     {
       
    79     //TODO: Add logging and error checking
       
    80     iSession->SendStopTone(aPlayToneContext);
       
    81     }