mmserv/sts/inc/sts.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:59:52 +0300
changeset 14 80975da52420
child 16 43d09473c595
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
 * 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 aToneType,
            unsigned int& aPlayToneContext);
    void StopTone(unsigned int aPlayToneContext);

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

private:
    void CleanUpPlayers();

    // inherited from MPlayerObserver
    virtual void PlayToneComplete(unsigned int aPlayToneContext);

private:
    unsigned int iNextContext;
    typedef std::map<unsigned int, CStsPlayer*> TPlayerMap;
    TPlayerMap iMap;
    };

#endif //STS_H