1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/sounddevbt/src/server/MmfBtAudioPolicy.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,99 @@
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 __MMFBTAUDIOPOLICY_H__
1.20 +#define __MMFBTAUDIOPOLICY_H__
1.21 +
1.22 +#include <e32base.h>
1.23 +#include <f32file.h>
1.24 +#include "MmfBtAudioPolicyRequest.h"
1.25 +#include <mmf/server/sounddevice.h>
1.26 +#include "MdaBtHwInfo.h"
1.27 +#include "MmfBtDevSoundEventHandler.h"
1.28 +#include "mmfstandardcustomcommands.h"
1.29 +#include "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 + };
1.40 +
1.41 +class CAudioPolicy; // declared here.
1.42 +/******************************************************************************
1.43 +* Class Name: CAudioPolicy
1.44 +*
1.45 +* Description: This class is ultimately implemented by the product team based
1.46 +* on their requirements for audio behavior in the face of
1.47 +* multiple audio requests simultaneously. The reference
1.48 +* implementation is a simple priority scheme. If a request is
1.49 +* a higher priority, it gets played, even if termination of a
1.50 +* running request of lower prioirity is required.
1.51 +******************************************************************************/
1.52 +
1.53 +class CMMFAudioPolicyServer;
1.54 +
1.55 +NONSHARABLE_CLASS( CAudioPolicy ): public CBase
1.56 +/**
1.57 +*@internalTechnology
1.58 +*/
1.59 + {
1.60 +public:
1.61 +
1.62 + IMPORT_C static CAudioPolicy* NewL(CMMFAudioPolicyServer* aAudioPolicyServer);
1.63 + void RemoveSessionFromList(CMMFAudioPolicyRequest* aAudioPolicyRequest);
1.64 + ~CAudioPolicy();
1.65 + void MakeRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest);
1.66 + void ModifyEntry(TInt aPolicySessionId, CMMFAudioPolicyRequest* aAudioPolicyRequest);
1.67 + void RemoveFromList(TInt aPolicySessionId);
1.68 + void LaunchRequest();
1.69 + CArrayFixFlat<CMMFAudioPolicyRequest>* AudioPolicyRequestArray();
1.70 + void DoSendNotification();
1.71 + TInt SetNotification(TInt aSessionId,TUid aEventType);
1.72 + inline CMdaHwInfo* MdaHwInfo(void) {return iMdaHwInfo;}
1.73 +protected:
1.74 + CAudioPolicy(CMMFAudioPolicyServer* aAudioPolicyServer);
1.75 +private:
1.76 + enum {EGranularity=8};
1.77 + CArrayFixFlat<CMMFAudioPolicyRequest>* iAudioPolicyRequestArray;
1.78 + TInt iSessionToAlert;
1.79 + TInt iSessionToBeLaunched;
1.80 + CMMFAudioPolicyServer* iAudioPolicyServer;
1.81 + CMdaHwInfo* iMdaHwInfo;
1.82 + TMMFAudioPolicyEvent iAudioPolicyEventToLaunch;
1.83 + TMMFAudioPolicyEvent iAudioPolicyEvent;
1.84 +
1.85 + void ConstructL();
1.86 + TPolicyResponse ProcessRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest);
1.87 + TPolicyResponse ComparePriorities(CMMFAudioPolicyRequest* aAudioPolicyRequest/*,TMMFAudioPolicyEvent& aEvent*/);
1.88 + void HandlePreferences(CMMFAudioPolicyRequest* aAudioPolicyRequest, TInt aPref, TPolicyResponse& aResponse);
1.89 + void SetSessionToAlert(TInt aSessionToAlert, TInt aSessionToBeLaunched, TMMFAudioPolicyEvent::TAudioPolicyEventType aEventType, TMMFAudioPolicyState aState );
1.90 + TBool IsRegisteredNotification(TInt aSessionId);
1.91 + TBool IsNotified();
1.92 + void ResetNotification();
1.93 + TInt CheckSessionToNotify();
1.94 + };
1.95 +
1.96 +/**
1.97 +The function panic raises a panic from within the MmfAudioPolicy library
1.98 +@param The argument is a member of the enumeration TMMFAudioPolicyPanicCodes
1.99 +*/
1.100 +GLDEF_C void Panic(TMMFAudioPolicyPanicCodes aError);
1.101 +
1.102 +#endif