114
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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 notifier class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPCLIENTACTIVENOTIFIER_H
|
|
20 |
#define CPCLIENTACTIVENOTIFIER_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32hashtab.h>
|
|
24 |
#include "cpclientsession.h"
|
|
25 |
|
|
26 |
class MLiwNotifyCallback;
|
|
27 |
/**
|
|
28 |
* Content publisher active notifier class
|
|
29 |
*
|
|
30 |
*
|
|
31 |
* @lib cpclient.dll
|
|
32 |
* @since S60 v 5.0
|
|
33 |
*/
|
|
34 |
class CCPActiveNotifier : public CActive
|
|
35 |
{
|
|
36 |
public:
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Two-phased constructor.
|
|
40 |
*
|
|
41 |
*/
|
|
42 |
static CCPActiveNotifier* NewL( RCPServerClient& aServerClient );
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Desctructor.
|
|
46 |
*/
|
|
47 |
~CCPActiveNotifier();
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Register observer
|
|
51 |
*
|
|
52 |
* @param aObserver Pointer for callback
|
|
53 |
* @param aTransactionId Integer transaction id
|
|
54 |
* @param aMap Map containing parameters
|
|
55 |
* @param aCmdOptions options for the command
|
|
56 |
*/
|
|
57 |
void RegisterL( MLiwNotifyCallback* aObserver,
|
|
58 |
TInt32 aTransactionId,
|
|
59 |
CCPLiwMap* aMap,
|
|
60 |
TUint aCmdOptions );
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Unregister observer
|
|
64 |
*
|
|
65 |
* @since S60 v 5.0
|
|
66 |
*/
|
|
67 |
void UnregisterL();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Unregister observer
|
|
71 |
*
|
|
72 |
* @since S60 v 5.0
|
|
73 |
* @param aTransactionId Integer transaction id
|
|
74 |
* @return returns ETrue if last observer was unregistered
|
|
75 |
*/
|
|
76 |
TBool UnregisterL( TInt32 aTransactionId );
|
|
77 |
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Unregister all observers
|
|
81 |
* @since S60 v 5.0
|
|
82 |
*/
|
|
83 |
void UnregisterAllL( );
|
|
84 |
|
|
85 |
protected:
|
|
86 |
|
|
87 |
/**
|
|
88 |
* From CActive, RunL.
|
|
89 |
* Handles the active object’s request completion event
|
|
90 |
*/
|
|
91 |
void RunL();
|
|
92 |
|
|
93 |
/**
|
|
94 |
* From CActive, DoCancel.
|
|
95 |
* Implements cancellation of an outstanding request.
|
|
96 |
*/
|
|
97 |
void DoCancel();
|
|
98 |
|
|
99 |
/**
|
|
100 |
* From CActive, RunError.
|
|
101 |
* Implements cancellation of an outstanding request.
|
|
102 |
*/
|
|
103 |
TInt RunError( TInt aError );
|
|
104 |
|
|
105 |
private:
|
|
106 |
|
|
107 |
/**
|
|
108 |
* C++ default constructor.
|
|
109 |
*/
|
|
110 |
CCPActiveNotifier( RCPServerClient& aServerClient );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Perform the second phase construction of a CCPActiveNotifier object.
|
|
114 |
*/
|
|
115 |
void ConstructL();
|
|
116 |
|
|
117 |
/*
|
|
118 |
* Notify all observers
|
|
119 |
*/
|
|
120 |
void NotifyObserversL( TInt aErrorCode,
|
|
121 |
CLiwGenericParamList* aEventParamList );
|
|
122 |
|
|
123 |
/*
|
|
124 |
* Register observer
|
|
125 |
*/
|
|
126 |
void RegisterAgainL( );
|
|
127 |
|
|
128 |
private:
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Descriptor where server can write to when passing data
|
|
132 |
* Own.
|
|
133 |
*/
|
|
134 |
HBufC8 *iObserverBuf;
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Size of the descriptor passed between server and client
|
|
138 |
* Own.
|
|
139 |
*/
|
|
140 |
TPckgBuf<TInt>* iSizeDes;
|
|
141 |
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Client-server session
|
|
145 |
* Not Own.
|
|
146 |
*/
|
|
147 |
RCPServerClient iServerClient;
|
|
148 |
|
|
149 |
/*
|
|
150 |
* Array containing all observers
|
|
151 |
* Own
|
|
152 |
*/
|
|
153 |
RHashMap<TInt32, MLiwNotifyCallback*> iObservers;
|
|
154 |
|
|
155 |
};
|
|
156 |
|
|
157 |
#endif // CPCLIENTACTIVENOTIFIER_H
|