|
1 /* |
|
2 * Copyright (c) 2007, 2008 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: Implementation for presence cache reader and writer. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef _PRESENCE_READER_PRIVATE_QT_H |
|
19 #define _PRESENCE_READER_PRIVATE_QT_H |
|
20 |
|
21 #include <QObject> |
|
22 |
|
23 class PrcPresenceBuddyInfoQt; |
|
24 class MPresenceCacheReader2; |
|
25 class MPresenceCacheReadHandler2Qt; |
|
26 |
|
27 #include "presencecachereadhandler2.h" |
|
28 /** |
|
29 * Implementation for presence cache reader |
|
30 */ |
|
31 class PrcPresenceReaderPrivate : public QObject , |
|
32 public MPresenceCacheReadHandler2 |
|
33 |
|
34 |
|
35 { |
|
36 Q_OBJECT |
|
37 public: |
|
38 |
|
39 /** |
|
40 * C++ constructor |
|
41 */ |
|
42 PrcPresenceReaderPrivate(); |
|
43 /** |
|
44 * Public destructor. |
|
45 */ |
|
46 virtual ~PrcPresenceReaderPrivate(); |
|
47 |
|
48 |
|
49 public: |
|
50 /** |
|
51 * Reads presence info from cache for a given identity, returns immediately. |
|
52 * |
|
53 * @param identity buddy id, identity must be in xsp id format |
|
54 * @return PrcPresenceBuddyInfoQt for the given buddy. Ownership to caller. |
|
55 * Null if service or buddy not found. |
|
56 */ |
|
57 PrcPresenceBuddyInfoQt* presenceInfo(const QString& identity); |
|
58 |
|
59 /** |
|
60 * Returns total number of buddies stored in presence cache. |
|
61 * It includes all services, probably useful while deciding performance |
|
62 * overheads or informing to the user. |
|
63 * |
|
64 * @return TInt Total number of presence infos in presence cache. |
|
65 */ |
|
66 int buddyCountInAllServices(); |
|
67 /** |
|
68 * Returns total number of buddies (presence infos) stored in a specific |
|
69 * service in presence cache. It includes only the given service. |
|
70 * |
|
71 * @param serviceName as in device's service table |
|
72 * @return TInt buddy count or error code. |
|
73 */ |
|
74 int buddyCountInService(const QString& serviceName) ; |
|
75 |
|
76 /** |
|
77 * Returns total number services in presence cache. |
|
78 * |
|
79 * @return int total number of services in presence cache. |
|
80 */ |
|
81 int servicesCount(); |
|
82 /** |
|
83 * Cancels any async. read operation going on. After calling this |
|
84 * method no callback will be received from asycn read method. |
|
85 * |
|
86 */ |
|
87 bool cancelRead() ; |
|
88 /** |
|
89 * Reads all presence info from cache for a given service. Emits |
|
90 * HandlePresenceRead signal. |
|
91 * |
|
92 * @param serviceName Service name to search from |
|
93 */ |
|
94 bool allBuddiesPresenceInService(const QString& serviceName) ; |
|
95 |
|
96 /** |
|
97 * Subscribe for given presence buddy's change in presence. |
|
98 * |
|
99 * @param identity buddy id, in xsp format |
|
100 * @return ture if subscribed successfully |
|
101 * |
|
102 */ |
|
103 bool subscribePresenceBuddyChange( const QString& identity); |
|
104 /** |
|
105 * Unsubscribe for given presence buddy's change in presence. |
|
106 * |
|
107 * @param identity buddy id, in xsp format |
|
108 */ |
|
109 void unSubscribePresenceBuddyChange(const QString& identity); |
|
110 |
|
111 //From MPresenceCacheReadHandler2 |
|
112 void HandlePresenceReadL(TInt aErrorCode,RPointerArray<MPresenceBuddyInfo2>& aPresenceBuddyInfoList) ; |
|
113 void HandlePresenceNotificationL(TInt aErrorCode, MPresenceBuddyInfo2* aPresenceBuddyInfo) ; |
|
114 |
|
115 |
|
116 |
|
117 signals: |
|
118 /* |
|
119 * This signal is emitted in response to asynchronous method allBuddiesPresenceInService. |
|
120 * Signal emitted when the operation is complete |
|
121 * @param success = true, if operation successful |
|
122 * @param buddyInfoList - list of buddies read. Ownership of elements to callee. |
|
123 * Can be empty if not found. |
|
124 */ |
|
125 void signalPresenceRead(bool success, QList<PrcPresenceBuddyInfoQt*> buddyInfoList); |
|
126 |
|
127 /* |
|
128 * This signal is emitted when there are changes in any of the subscribed buddy info. |
|
129 * @param success == true, if operation successful |
|
130 * @param presenceBuddyInfo - presence info for buddy. |
|
131 * Ownership to callee. Can be NULL if success == false exist. |
|
132 * |
|
133 */ |
|
134 void signalPresenceNotification(bool success, PrcPresenceBuddyInfoQt* presenceBuddyInfo); |
|
135 |
|
136 private: |
|
137 /* |
|
138 * Instance of symbian Presence Reader |
|
139 * own |
|
140 */ |
|
141 MPresenceCacheReader2* iSymbianReader; |
|
142 }; |
|
143 #endif // _PRESENCE_READER_PRIVATE_QT_H |
|
144 |
|
145 |
|
146 |