85
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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 : Content Arsenal client session for notifications.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CACLIENTNOTIFIERSESSION_H
|
|
19 |
#define CACLIENTNOTIFIERSESSION_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <e32hashtab.h>
|
|
24 |
|
|
25 |
#include "caoperationparams.h"
|
|
26 |
#include "casrvdef.h"
|
|
27 |
#include "caclientsubsession.h"
|
|
28 |
#include "cainnernotifierfilter.h"
|
|
29 |
|
|
30 |
//FORWARD DECLARATIONS
|
|
31 |
class CCaInnerQuery;
|
|
32 |
class RCaEntriesArray;
|
|
33 |
class RCaIdsArray;
|
|
34 |
class CaClientProxy;
|
|
35 |
class CaClientNotifierProxy;
|
|
36 |
|
|
37 |
// Number of message slots to reserve for this client server session.
|
|
38 |
const TUint KDefaultMessageSlots(5);
|
|
39 |
|
|
40 |
// CLASS DECLARATION
|
|
41 |
/**
|
|
42 |
* Client-side interface to Content Arsenal Server
|
|
43 |
*
|
|
44 |
* This class provides the client-side interface to the content arsenal server
|
|
45 |
* session, it just passes requests to the server.
|
|
46 |
*
|
|
47 |
*/
|
|
48 |
class RCaClientNotifierSession: public RSessionBase
|
|
49 |
{
|
|
50 |
public:
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Construct the object.
|
|
54 |
*/
|
|
55 |
RCaClientNotifierSession();
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Connects to the server and create a session.
|
|
59 |
* @return error code
|
|
60 |
*/
|
|
61 |
TInt Connect();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Create subsession.
|
|
65 |
* @return error code
|
|
66 |
*/
|
|
67 |
TInt Create(TInt function, const TIpcArgs& args);
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Closes session
|
|
71 |
*
|
|
72 |
* @since S60 v 5.0
|
|
73 |
*/
|
|
74 |
void Close();
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Registers a notifier.
|
|
78 |
* @param innerNotifierFilter pointer to inner (symbian style) filter.
|
|
79 |
* @param notifierFilter notifier filter address
|
|
80 |
* (used for identification purposes).
|
|
81 |
* @param notifierProxy client notifier proxy.
|
|
82 |
*
|
|
83 |
* @since S60 v 5.0
|
|
84 |
*/
|
|
85 |
TInt RegisterNotifier(CCaInnerNotifierFilter *innerNotifierFilter,
|
|
86 |
const TAny* notifierFilter,
|
|
87 |
const CaClientNotifierProxy* notifierProxy);
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Unregisters a notifier.
|
|
91 |
* @param notifierFilter notifier filter address
|
|
92 |
* (used for identification purposes).
|
|
93 |
* @param innerNotifierType inner notifier type.
|
|
94 |
*
|
|
95 |
* @since S60 v 5.0
|
|
96 |
*/
|
|
97 |
void UnregisterNotifier(const TAny* notifierFilter,
|
|
98 |
CCaInnerNotifierFilter::TNotifierType innerNotifierType);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns a number of subsessions (which equals to a number
|
|
102 |
* of registered notifiers).
|
|
103 |
* @return a number of subsessions.
|
|
104 |
*
|
|
105 |
* @since S60 v 5.0
|
|
106 |
*/
|
|
107 |
TInt SubsessionsCount() const;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Searches for a subsession.
|
|
111 |
* @param notifierFilter notifier filter address
|
|
112 |
* (used for identification purposes).
|
|
113 |
* @param innerNotifierType inner notifier type.
|
|
114 |
* @return true if session contains subsession for given parameters.
|
|
115 |
*
|
|
116 |
* @since S60 v 5.0
|
|
117 |
*/
|
|
118 |
TBool ContainsSubsession(const TAny* notifierFilter,
|
|
119 |
CCaInnerNotifierFilter::TNotifierType innerNotifierType) const;
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Return version information
|
|
123 |
*/
|
|
124 |
TVersion Version() const;
|
|
125 |
|
|
126 |
private:
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Registers a notifier (leaving version).
|
|
130 |
* @param innerNotifierFilter pointer to inner (symbian style) filter.
|
|
131 |
* @param notifierFilter notifier filter address
|
|
132 |
* @param notifierProxy client notifier proxy.
|
|
133 |
*
|
|
134 |
* @since S60 v 5.0
|
|
135 |
*/
|
|
136 |
void RegisterNotifierL(CCaInnerNotifierFilter* innerNotifierFilter,
|
|
137 |
const TAny* notifierFilter,
|
|
138 |
const CaClientNotifierProxy *notifierProxy);
|
|
139 |
|
|
140 |
/*
|
|
141 |
* GetSizeL method
|
|
142 |
* Return error
|
|
143 |
* @param query query
|
|
144 |
* @param serverRequest
|
|
145 |
* @param resultSize
|
|
146 |
*/
|
|
147 |
TInt GetSizeL(const CCaInnerQuery& query,
|
|
148 |
const TCaServerRequests serverRequest, TInt& resultSize);
|
|
149 |
|
|
150 |
private:
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Class used as a key for a hash map iSubsessions.
|
|
154 |
*/
|
|
155 |
class TKey
|
|
156 |
{
|
|
157 |
public:
|
|
158 |
TKey(): iFilterAddress(NULL), iNotifierType(0){}
|
|
159 |
TKey(const TAny* const filterAddress, const TUint notifierType):
|
|
160 |
iFilterAddress(filterAddress), iNotifierType(notifierType){}
|
|
161 |
/**
|
|
162 |
* filter address, not own.
|
|
163 |
*/
|
|
164 |
const TAny* const iFilterAddress;
|
|
165 |
/**
|
|
166 |
* notifier type.
|
|
167 |
*/
|
|
168 |
const TUint iNotifierType;
|
|
169 |
};
|
|
170 |
|
|
171 |
private:
|
|
172 |
/**
|
|
173 |
* Hash function used by hash map iSessions.
|
|
174 |
* @param key a key (a pair: filter address, notifier type).
|
|
175 |
* @return hash value.
|
|
176 |
*/
|
|
177 |
static TUint32 HashFunc(const TKey& key);
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Identification function used by hash map iSessions.
|
|
181 |
* @param key1 the first key.
|
|
182 |
* @param key1 the second key.
|
|
183 |
* @return true if keys are equal.
|
|
184 |
*/
|
|
185 |
static TBool IdentityFunc(const TKey& key1, const TKey& key2);
|
|
186 |
|
|
187 |
private:
|
|
188 |
/**
|
|
189 |
* Static member containing a hash function.
|
|
190 |
*/
|
|
191 |
static const THashFunction32<TKey> iHashFunction;
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Static member containing an identity function.
|
|
195 |
*/
|
|
196 |
static const TIdentityRelation<TKey> iIdentityRelation;
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Hash map containing all subsesions of this session.
|
|
200 |
*/
|
|
201 |
RHashMap<TKey, RCaClientSubSession*> iSubsessions;
|
|
202 |
|
|
203 |
};
|
|
204 |
|
|
205 |
#endif // CACLIENTNOTIFIERSESSION_H
|
|
206 |
// End of File
|