os/mm/devsound/sounddevbt/src/server/MmfBtAudioPolicy.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __MMFBTAUDIOPOLICY_H__
    17 #define __MMFBTAUDIOPOLICY_H__
    18 
    19 #include <e32base.h>
    20 #include <f32file.h>
    21 #include "MmfBtAudioPolicyRequest.h"	
    22 #include <mmf/server/sounddevice.h>			
    23 #include "MdaBtHwInfo.h"
    24 #include "MmfBtDevSoundEventHandler.h"
    25 #include "mmfstandardcustomcommands.h"
    26 #include "mmfcontrollerframeworkbase.h"
    27 
    28 /** 
    29 Panic category and codes for the AudioPolicy  
    30 @internalTechnology
    31 */
    32 _LIT(KMMFAudioPolicyPanicCategory, "MMFAudioPolicy");
    33 enum TMMFAudioPolicyPanicCodes
    34 	{
    35 	EMMFAudioPolicyRequestArrayOverflow
    36 	};
    37 	
    38 class CAudioPolicy; // declared here.
    39 /******************************************************************************
    40 * Class Name:	CAudioPolicy
    41 * 
    42 * Description:	This class is ultimately implemented by the product team based
    43 *				on their requirements for audio behavior in the face of 
    44 *				multiple audio requests simultaneously.  The reference 
    45 *				implementation is a simple priority scheme.  If a request is 
    46 *				a higher priority, it gets played, even if termination of a 
    47 *				running request of lower prioirity is required.
    48 ******************************************************************************/
    49 
    50 class CMMFAudioPolicyServer;
    51 
    52 NONSHARABLE_CLASS( CAudioPolicy ): public CBase
    53 /**
    54 *@internalTechnology
    55 */
    56 	{
    57 public:
    58 
    59 	IMPORT_C static CAudioPolicy* NewL(CMMFAudioPolicyServer* aAudioPolicyServer);
    60 	void RemoveSessionFromList(CMMFAudioPolicyRequest* aAudioPolicyRequest);
    61 	~CAudioPolicy();
    62 	void MakeRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest);
    63 	void ModifyEntry(TInt aPolicySessionId, CMMFAudioPolicyRequest* aAudioPolicyRequest);
    64 	void RemoveFromList(TInt aPolicySessionId);
    65 	void LaunchRequest();
    66 	CArrayFixFlat<CMMFAudioPolicyRequest>* AudioPolicyRequestArray();
    67 	void DoSendNotification();
    68 	TInt SetNotification(TInt aSessionId,TUid aEventType);
    69 	inline CMdaHwInfo* MdaHwInfo(void) {return iMdaHwInfo;} 
    70 protected:
    71 	CAudioPolicy(CMMFAudioPolicyServer* aAudioPolicyServer);
    72 private:
    73 	enum {EGranularity=8};
    74 	CArrayFixFlat<CMMFAudioPolicyRequest>* iAudioPolicyRequestArray; 
    75 	TInt iSessionToAlert;
    76 	TInt iSessionToBeLaunched;
    77 	CMMFAudioPolicyServer* iAudioPolicyServer;
    78 	CMdaHwInfo* iMdaHwInfo;
    79 	TMMFAudioPolicyEvent iAudioPolicyEventToLaunch;
    80 	TMMFAudioPolicyEvent iAudioPolicyEvent;
    81 
    82 	void ConstructL();
    83 	TPolicyResponse ProcessRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest);
    84 	TPolicyResponse ComparePriorities(CMMFAudioPolicyRequest* aAudioPolicyRequest/*,TMMFAudioPolicyEvent& aEvent*/);
    85 	void HandlePreferences(CMMFAudioPolicyRequest* aAudioPolicyRequest, TInt aPref, TPolicyResponse& aResponse);
    86 	void SetSessionToAlert(TInt aSessionToAlert, TInt aSessionToBeLaunched, TMMFAudioPolicyEvent::TAudioPolicyEventType aEventType, TMMFAudioPolicyState aState );
    87 	TBool IsRegisteredNotification(TInt aSessionId);
    88 	TBool IsNotified();
    89 	void ResetNotification();
    90 	TInt CheckSessionToNotify();
    91 	};
    92 
    93 /**
    94 The function panic raises a panic from within the MmfAudioPolicy library
    95 @param The argument is a member of the enumeration TMMFAudioPolicyPanicCodes
    96 */
    97 GLDEF_C void Panic(TMMFAudioPolicyPanicCodes aError);
    98 
    99 #endif