os/mm/devsound/devsoundrefplugin/src/server/MmfAudioPolicy.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/devsoundrefplugin/src/server/MmfAudioPolicy.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,104 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __MMFAUDIOPOLICY_H__
    1.20 +#define __MMFAUDIOPOLICY_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include <f32file.h>
    1.24 +#include "MmfAudioPolicyRequest.h"	
    1.25 +#include <mmf/server/sounddevice.h>			
    1.26 +#include "MdaHwInfo.h"
    1.27 +#include "MmfDevSoundEventHandler.h"
    1.28 +#include <mmf/common/mmfstandardcustomcommands.h>
    1.29 +#include <mmf/common/mmfcontrollerframeworkbase.h>
    1.30 +
    1.31 +/** 
    1.32 +Panic category and codes for the AudioPolicy  
    1.33 +@internalTechnology
    1.34 +*/
    1.35 +_LIT(KMMFAudioPolicyPanicCategory, "MMFAudioPolicy");
    1.36 +enum TMMFAudioPolicyPanicCodes
    1.37 +	{
    1.38 +	EMMFAudioPolicyRequestArrayOverflow,
    1.39 +	EMMFAudioPolicySessionEventQueueOverflow
    1.40 +	};
    1.41 +	
    1.42 +class CAudioPolicy; // declared here.
    1.43 +/******************************************************************************
    1.44 +* Class Name:	CAudioPolicy
    1.45 +* 
    1.46 +* Description:	This class is ultimately implemented by the product team based
    1.47 +*				on their requirements for audio behavior in the face of 
    1.48 +*				multiple audio requests simultaneously.  The reference 
    1.49 +*				implementation is a simple priority scheme.  If a request is 
    1.50 +*				a higher priority, it gets played, even if termination of a 
    1.51 +*				running request of lower prioirity is required.
    1.52 +******************************************************************************/
    1.53 +
    1.54 +class CMMFAudioPolicyServer;
    1.55 +
    1.56 +NONSHARABLE_CLASS( CAudioPolicy ): public CBase
    1.57 +/**
    1.58 +*@internalTechnology
    1.59 +*/
    1.60 +	{
    1.61 +public:
    1.62 +
    1.63 +	IMPORT_C static CAudioPolicy* NewL(CMMFAudioPolicyServer* aAudioPolicyServer);
    1.64 +	void RemoveSessionFromList(CMMFAudioPolicyRequest* aAudioPolicyRequest);
    1.65 +	~CAudioPolicy();
    1.66 +	void MakeRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest);
    1.67 +	void ModifyEntry(TInt aPolicySessionId,const TMMFAudioPolicyState aNewState);
    1.68 +	void RemoveFromList(TInt aPolicySessionId, TBool aAllowTimerRestart=ETrue);
    1.69 +	void LaunchRequest(TInt aSessionId);
    1.70 +	void ReserveClientNumL(TInt aNum);
    1.71 +	void NotifyNextClient();
    1.72 +	TInt SetNotification(TInt aSessionId,TUid aEventType);
    1.73 +	inline CMdaHwInfo* MdaHwInfo(void) {return iMdaHwInfo;} 
    1.74 +protected:
    1.75 +	CAudioPolicy(CMMFAudioPolicyServer* aAudioPolicyServer);
    1.76 +private:
    1.77 +	enum {EGranularity=8};
    1.78 +	typedef CMMFAudioPolicyRequest* PtrPolicyRequest;
    1.79 +	typedef CArrayFixFlat<PtrPolicyRequest> CPolicyReqPtrArray;
    1.80 +	CPolicyReqPtrArray* iAudioPolicyRequestArray; 
    1.81 +
    1.82 +	CMMFAudioPolicyServer* iAudioPolicyServer;
    1.83 +	CMdaHwInfo* iMdaHwInfo;
    1.84 +	TInt iNotifiedSessionId;  // latest attemped session Id
    1.85 +	TInt iSessionIdAwaitingForDevsound;
    1.86 +	TInt iStopHandledFromSessId;
    1.87 +
    1.88 +	void ConstructL();
    1.89 +
    1.90 +	CMMFAudioPolicyRequest* FindPolicyRequestById(TInt aSessionId) const;
    1.91 +	TPolicyResponse ProcessRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest);
    1.92 +	void HandlePreferences(CMMFAudioPolicyRequest* aAudioPolicyRequest, TInt aPref, TPolicyResponse& aResponse);
    1.93 +	void NotifySessionWithTimeout(TInt aPolicySessionIdx, TMMFAudioPolicyEvent::TAudioPolicyEventType aEvent);
    1.94 +	TBool IsRegisteredNotification(TInt aSessionId) const;
    1.95 +	TInt CheckSessionToNotify();
    1.96 +	};
    1.97 +
    1.98 +/**
    1.99 +The function panic raises a panic from within the MmfAudioPolicy library
   1.100 +@param The argument is a member of the enumeration TMMFAudioPolicyPanicCodes
   1.101 +*/
   1.102 +GLDEF_C void Panic(TMMFAudioPolicyPanicCodes aError);
   1.103 +
   1.104 +	
   1.105 +#endif
   1.106 +
   1.107 +