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