|
1 /* |
|
2 * Copyright (c) 2003 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: This file contains the header file of the RCbsTopicList class |
|
15 * |
|
16 * RCbsTopicList provides an interface to CBS clients which |
|
17 * allows accessing the Cell Broadcast topics stored |
|
18 * in the CBS Server. Note: This class should not be directly |
|
19 * accessed by the client application. |
|
20 * |
|
21 * Services include accessing and modifying topic information, |
|
22 * deleting a single or all topics, and a notification service, |
|
23 * that enables the client to receive notifications on |
|
24 * events modifying the server's topic list. |
|
25 * |
|
26 * |
|
27 */ |
|
28 |
|
29 |
|
30 |
|
31 #ifndef RCBSTOPICLIST_H |
|
32 #define RCBSTOPICLIST_H |
|
33 |
|
34 // INCLUDES |
|
35 #include <e32base.h> |
|
36 #include "CbsCommon.h" |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class RCbs; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * This class represents the client-side subsession to handle topic lists. |
|
45 */ |
|
46 |
|
47 class RCbsTopicList |
|
48 : public RSubSessionBase |
|
49 { |
|
50 public: // New functions |
|
51 /** |
|
52 * Constructor. |
|
53 */ |
|
54 RCbsTopicList(); |
|
55 |
|
56 /** |
|
57 * Creates a subsession to the server. Before using any other method it |
|
58 * must be called. |
|
59 |
|
60 * @param aServer It is the cbs server. |
|
61 * @return Error code. |
|
62 */ |
|
63 TInt Open( RCbs& aServer ); |
|
64 |
|
65 /** |
|
66 * Closes the subsession and connection to the server. |
|
67 * |
|
68 * @return Error code. |
|
69 */ |
|
70 TInt Close(); |
|
71 |
|
72 /** |
|
73 * Returns the total amount of topics the topic list contains. |
|
74 * |
|
75 * @param aCount It will contain the total amount of topics. |
|
76 */ |
|
77 void GetTopicCount( TInt& aCount ); |
|
78 |
|
79 /** |
|
80 * Returns information about a topic from the topic list. |
|
81 * |
|
82 * @param aIndex It is the index to the topic. |
|
83 * @param aTopic It will contain the topic information. |
|
84 * @return Error code. |
|
85 */ |
|
86 TInt GetTopic( const TInt aIndex, TCbsTopic& aTopic ); |
|
87 |
|
88 /** |
|
89 * Finds the topic by given number. |
|
90 * |
|
91 * @param aNumber It is the number of the topic. |
|
92 * @param aTopic It will contain the topic information. |
|
93 * @return Error code. |
|
94 */ |
|
95 TInt FindTopicByNumber( TCbsTopicNumber aNumber, TCbsTopic& aTopic ); |
|
96 |
|
97 /** |
|
98 * Deletes an existing topic. |
|
99 * |
|
100 * Note that the topic must exists. |
|
101 * |
|
102 * @param aNumber It is the handle to the topic to be deleted. |
|
103 * @return Error code. |
|
104 */ |
|
105 TInt DeleteTopic( TCbsTopicNumber aNumber ); |
|
106 |
|
107 /** |
|
108 * Delete all topics. |
|
109 * |
|
110 * @return Error code. |
|
111 */ |
|
112 TInt DeleteAllTopics(); |
|
113 |
|
114 /** |
|
115 * Adds a new topic. |
|
116 * |
|
117 * Note that the number of the new topic must be unused. |
|
118 * |
|
119 * @param aTopic It contains the information of the new topic. |
|
120 * @return Error code. |
|
121 */ |
|
122 TInt AddTopic( TCbsTopic& aTopic ); |
|
123 |
|
124 /** |
|
125 * Changes the name and number of the existing topic. |
|
126 * |
|
127 * Note that the changing fails in case there is another topic with the new topic number. |
|
128 * It also fails if the topic is protected. |
|
129 * |
|
130 * @param aOldNumber Old topic number |
|
131 * @param aNewNumber New topic number |
|
132 * @param aName It is the new name of the topic. |
|
133 * @return Error code. |
|
134 */ |
|
135 TInt ChangeTopicNameAndNumber( |
|
136 TCbsTopicNumber aOldNumber, |
|
137 TCbsTopicNumber aNewNumber, |
|
138 const TCbsTopicName& aName ); |
|
139 |
|
140 /** |
|
141 * Changes topic subscription status. |
|
142 * |
|
143 * @param aNumber Number of the topic |
|
144 * @param aNewStatus It is the new subscription status. |
|
145 * @return Error code. |
|
146 */ |
|
147 TInt ChangeTopicSubscriptionStatus( TCbsTopicNumber aNumber, |
|
148 TBool aNewStatus ); |
|
149 |
|
150 /** |
|
151 * Changes topic hotmark status. |
|
152 * |
|
153 * @param aNumber Number of the topic |
|
154 * @param aNewStatus It is the new hotmark status. |
|
155 * @return Error code. |
|
156 */ |
|
157 TInt ChangeTopicHotmarkStatus( TCbsTopicNumber aNumber, TBool aNewStatus ); |
|
158 |
|
159 /** |
|
160 * Requests the server to notify the client whenever an event occurs that changes |
|
161 * the information of the topics. |
|
162 * |
|
163 * Note that the client may select what kind of events it is interested in. Note also that |
|
164 * there can be at most one pending request per instance of the class. |
|
165 * |
|
166 * @param aStatus It is the variable that the server will modify whenever an event occurs. |
|
167 * @param aRequested It contains the events the client is listening to. |
|
168 * @param aEvent It will contain the event that occurred. |
|
169 * @param aNumber Number of topic |
|
170 */ |
|
171 void NotifyOnEvent( |
|
172 TRequestStatus& aStatus, |
|
173 const TInt aRequested, |
|
174 TCbsTopicListEvent& aEvent, |
|
175 TCbsTopicNumber& aNumber ); |
|
176 |
|
177 /** |
|
178 * Cancels the pending notify request. |
|
179 */ |
|
180 void NotifyOnEventCancel(); |
|
181 |
|
182 /** |
|
183 * Returns the number of session-specific new topics and resets the counter. |
|
184 * New topics are added by the topic detection feature in absence of |
|
185 * CBS UI Application. |
|
186 * |
|
187 * @param aCount On return contains the amount of new topics. |
|
188 * @return Result code. |
|
189 */ |
|
190 TInt GetNewTopicsCount( TInt& aCount ); |
|
191 |
|
192 /** |
|
193 * Returns the latest topic's number. |
|
194 * |
|
195 * @param aNumber Number of the topic |
|
196 * @return Result code. |
|
197 */ |
|
198 TInt GetLatestTopicNumber( TCbsTopicNumber& aNumber ); |
|
199 |
|
200 /** |
|
201 * Returns the total amount of unread messages. |
|
202 * |
|
203 * @param aCount It will contain the amount of unread messages. |
|
204 */ |
|
205 void GetUnreadMessageCount( TInt& aCount ); |
|
206 |
|
207 /** |
|
208 * Returns the handle to the latest hotmarked message that has been |
|
209 * received after the system has started up. |
|
210 * |
|
211 * @param aMessage It is handle to the message. |
|
212 */ |
|
213 void GetHotmarkedMessageHandle( TCbsMessageHandle& aMessage ); |
|
214 |
|
215 /** |
|
216 * Returns the number of unread messages in hotmarked topics. |
|
217 * |
|
218 * This function is to used by the client when deciding whether |
|
219 * the message or topic list view should be opened to display |
|
220 * a hotmarked message(s). |
|
221 * |
|
222 * @return Number of unread hotmarked messages |
|
223 */ |
|
224 TInt NumberOfUnreadHotmarkedMessages(); |
|
225 |
|
226 /** |
|
227 * Returns the numbers of topics that precede and succeed the given |
|
228 * topic in server-side topic list. |
|
229 * |
|
230 * If the given topic is the first topic in list, aPosition has |
|
231 * ECbsHead bit up. If the given topic is the last topic in list, |
|
232 * aPosition has ECbsTail bit up. |
|
233 * |
|
234 * Return code values: |
|
235 * KErrNone aPrevTopicNumber, aNextTopicNumber and aPosition |
|
236 * contain valid values. |
|
237 * KErrNotFound aCurrentTopicNumber specified a topic that was not |
|
238 * on topic list. |
|
239 * |
|
240 * @param aCurrentTopicNumber Number that specifies the topic |
|
241 * whose surroundings are returned |
|
242 * @param aPrevTopicNumber Returns: number of topic preceding |
|
243 * the given topic |
|
244 * @param aNextTopicNumber Returns: number of topic succeeding |
|
245 * the given topic |
|
246 * @param aPosition Returns: position of current |
|
247 * topic in list. |
|
248 * @return Result code |
|
249 */ |
|
250 TInt GetNextAndPrevTopicNumber( |
|
251 const TCbsTopicNumber& aCurrentTopicNumber, |
|
252 TCbsTopicNumber& aPrevTopicNumber, |
|
253 TCbsTopicNumber& aNextTopicNumber, |
|
254 TInt& aPosition ); |
|
255 |
|
256 private: // prohibited functions |
|
257 // Prohibited copy constructor |
|
258 RCbsTopicList( const RCbsTopicList& ); |
|
259 |
|
260 // Prohibited assignment operator |
|
261 RCbsTopicList& operator=( const RCbsTopicList& ); |
|
262 |
|
263 private: // Data |
|
264 |
|
265 // A pointer descriptor used to transfer information |
|
266 // during a notify request. |
|
267 TPtr8 iNotifyEventPtr; |
|
268 |
|
269 // A pointer descriptor used to transfer information |
|
270 // during a notify request. |
|
271 TPtr8 iNotifyHandlePtr; |
|
272 }; |
|
273 |
|
274 #endif // RCBSTOPICLIST_H |
|
275 |
|
276 // End of File |
|
277 |
|
278 |