mmserv/sts/sts/inc/sts.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 02 Sep 2010 20:58:01 +0300
changeset 47 c2e43643db4c
parent 42 1fa3fb47b1e3
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:
 * This file defines an interface to an System Tone Service used by the
 * STS Server for playing and stopping tones.  Only one instance of this
 * class is created by the server, and it exists for the lifetime of the
 * server.  This class manages all of the active players, and guarantees
 * that the context values are unique.
 */
#ifndef STS_H_
#define STS_H_

#include <systemtoneservice.h>
#include <map>

#include "stsplayer.h"

class CSts : private MStsPlayerObserver
    {
public:
    static CSts* Create();
    static void Delete(CSts* aSts);
    void PlayTone(CSystemToneService::TToneType aTone);
    void PlayAlarm(CSystemToneService::TAlarmType aAlarm,
            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
    void PlayAlarm(CSystemToneService::TToneType aTone,
            unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver);
    void StopAlarm(unsigned int aAlarmContext);

protected:
    CSts();
    virtual ~CSts();
    bool Init();

private:
    void CleanUpPlayers();

    // inherited from MPlayerObserver
    virtual void PlayComplete(unsigned int aContext);

private:
    unsigned int iNextContext;
    CStsSettingsManager* iSettingsManager;
    class CPlayerNode;
    typedef std::map<unsigned int, CPlayerNode*> TPlayerMap;
    TPlayerMap iPlayerMap;
    };

#endif //STS_H