mmserv/sts/inc/sts.h
changeset 20 b67dd1fc57c5
parent 19 4a629bc82c5e
child 21 2ed61feeead6
equal deleted inserted replaced
19:4a629bc82c5e 20:b67dd1fc57c5
     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 file defines an interface to an System Tone Service used by the
       
    16  * STS Server for playing and stopping tones.  Only one instance of this
       
    17  * class is created by the server, and it exists for the lifetime of the
       
    18  * server.  This class manages all of the active players, and guarantees
       
    19  * that the context values are unique.
       
    20  */
       
    21 
       
    22 #ifndef STS_H_
       
    23 #define STS_H_
       
    24 
       
    25 #include <systemtoneservice.h>
       
    26 #include <map>
       
    27 
       
    28 #include "stsplayer.h"
       
    29 
       
    30 class CSts : private MStsPlayerObserver
       
    31     {
       
    32 public:
       
    33     static CSts* Create();
       
    34     static void Delete(CSts* aSts);
       
    35     void PlayTone(CSystemToneService::TToneType aTone);
       
    36     void PlayAlarm(CSystemToneService::TAlarmType aAlarm,
       
    37             unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
       
    38     void StopAlarm(unsigned int aAlarmContext);
       
    39 
       
    40 protected:
       
    41     CSts();
       
    42     virtual ~CSts();
       
    43     bool Init();
       
    44 
       
    45 private:
       
    46     void CleanUpPlayers();
       
    47 
       
    48     // inherited from MPlayerObserver
       
    49     virtual void PlayComplete(unsigned int aContext);
       
    50 
       
    51 private:
       
    52     unsigned int iNextContext;
       
    53     class CPlayerNode;
       
    54     typedef std::map<unsigned int, CPlayerNode*> TPlayerMap;
       
    55     TPlayerMap iPlayerMap;
       
    56     };
       
    57 
       
    58 #endif //STS_H