114
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Active Idle Content Observer optimizer
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_AIMULTICONTENTOBSERVEROPTIMIZER_H
|
|
20 |
#define C_AIMULTICONTENTOBSERVEROPTIMIZER_H
|
|
21 |
|
|
22 |
// System includes
|
|
23 |
#include <e32base.h>
|
|
24 |
|
|
25 |
// User includes
|
|
26 |
#include "aicontentobserver.h"
|
|
27 |
|
|
28 |
// Forward declarations
|
|
29 |
class CHsContentPublisher;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* @ingroup group_devicestatusplugin
|
|
33 |
*
|
|
34 |
* Active Idle Content Observer optimizer.
|
|
35 |
*
|
|
36 |
* Optimizes the Commit calls to different UI controllers. In
|
|
37 |
* case nothing is published nothing is committed.
|
|
38 |
*
|
|
39 |
* @see MAiContentObserver
|
|
40 |
* @since S60 3.2
|
|
41 |
*/
|
|
42 |
NONSHARABLE_CLASS( CAiContentObserverOptimizer ) : public CBase
|
|
43 |
{
|
|
44 |
private:
|
|
45 |
struct TAiPublishBlackList
|
|
46 |
{
|
|
47 |
TInt iContentId;
|
|
48 |
|
|
49 |
TInt iIndex;
|
|
50 |
};
|
|
51 |
|
|
52 |
public:
|
|
53 |
static CAiContentObserverOptimizer* NewL(MAiContentObserver& aObserver);
|
|
54 |
~CAiContentObserverOptimizer();
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Starts a transaction
|
|
58 |
*
|
|
59 |
* @return KErrAlreadyExists in case transaction already ongoing.
|
|
60 |
* KErrNotSupported in case transaction not supported
|
|
61 |
* KErrNone in case transaction succesfuly started
|
|
62 |
*/
|
|
63 |
TInt StartTransaction( TInt aTxId );
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Commits a started transaction. In case no committing is needed
|
|
67 |
* (no publish calls has been made) the transaction is cancelled.
|
|
68 |
*
|
|
69 |
* @return KErrNotReady in case no transaction is ongoing.
|
|
70 |
* KErrNotSupported in case transaction not supported
|
|
71 |
* KErrNone in case succesfully committed.
|
|
72 |
*/
|
|
73 |
TInt Commit( TInt aTxId );
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Cancels a transactions in case a transaction was started.
|
|
77 |
*
|
|
78 |
* @return KErrNotReady in case no transaction is ongoing.
|
|
79 |
* KErrNotSupported in case transactions are not supported
|
|
80 |
* KErrNone in case transaction succesfully cancelled
|
|
81 |
*/
|
|
82 |
TInt CancelTransaction( TInt aTxId );
|
|
83 |
|
|
84 |
/*
|
|
85 |
* @see MAiContentObserver
|
|
86 |
*/
|
|
87 |
TBool CanPublish( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* @see MAiContentObserver
|
|
91 |
*/
|
|
92 |
TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
|
|
93 |
TInt aResource, TInt aIndex );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* @see MAiContentObserver
|
|
97 |
*/
|
|
98 |
TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
|
|
99 |
const TDesC16& aText, TInt aIndex );
|
|
100 |
/**
|
|
101 |
* @see MAiContentObserver
|
|
102 |
*/
|
|
103 |
TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
|
|
104 |
const TDesC8& aBuf, TInt aIndex );
|
|
105 |
|
|
106 |
/**
|
|
107 |
* @see MAiContentObserver
|
|
108 |
*/
|
|
109 |
TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
|
|
110 |
RFile& aFile, TInt aIndex );
|
|
111 |
/**
|
|
112 |
* @see MAiContentObserver
|
|
113 |
*/
|
|
114 |
TInt Clean( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Returns the actual content observer.
|
|
118 |
*/
|
|
119 |
MAiContentObserver& Observer() const;
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Clears blacklist
|
|
123 |
*/
|
|
124 |
void ClearBlackList();
|
|
125 |
|
|
126 |
private:
|
|
127 |
CAiContentObserverOptimizer(MAiContentObserver& aObserver);
|
|
128 |
|
|
129 |
TInt AddToBlackList( TInt aContentId, TInt aIndex );
|
|
130 |
|
|
131 |
TBool IsInBlackList( TInt aContentId, TInt aIndex ) const;
|
|
132 |
|
|
133 |
private: // data
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Handle to the observer that receives
|
|
137 |
* the publish calls.
|
|
138 |
*/
|
|
139 |
MAiContentObserver &iObserver;
|
|
140 |
|
|
141 |
TBool iCommitNeeded;
|
|
142 |
|
|
143 |
TBool iTransactionStarted;
|
|
144 |
|
|
145 |
RArray<TAiPublishBlackList> iBlackList;
|
|
146 |
};
|
|
147 |
|
|
148 |
|
|
149 |
#endif // C_AIMULTICONTENTOBSERVEROPTIMIZER_H
|