|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * Private Qt wrapper for SmfContactFetcher |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef SMFCLIENTPRIVATE_H_ |
|
21 #define SMFCLIENTPRIVATE_H_ |
|
22 |
|
23 #include <smfprovider.h> |
|
24 #include <smfclientglobal.h> |
|
25 #include <smfglobal.h> |
|
26 #include <smfobserver.h> |
|
27 #include <smflocation.h> |
|
28 #include <smfgroup.h> |
|
29 |
|
30 // Forward Declaration |
|
31 class SmfProvider; |
|
32 class SmfContact; |
|
33 class SmfContactFetcher; |
|
34 #ifdef Q_OS_SYMBIAN |
|
35 class CSmfClientSymbian; |
|
36 #else |
|
37 class SmfClientQt; |
|
38 #endif |
|
39 |
|
40 |
|
41 /** |
|
42 * Private Qt wrapper |
|
43 * Provided to accomodate diff facilities in diff platforms. |
|
44 * Uses Symbian client-server for Symbian |
|
45 * QDbus for linux |
|
46 * QLocalserver for rest of the platforms |
|
47 * Note:- only symbian client-server impl is provided at the moment |
|
48 **/ |
|
49 class SmfContactFetcherPrivate : public smfObserver |
|
50 { |
|
51 Q_OBJECT |
|
52 |
|
53 public: |
|
54 /** |
|
55 * Constructor |
|
56 * @param contactFetcher The SmfContactFetcher instance |
|
57 */ |
|
58 SmfContactFetcherPrivate ( SmfContactFetcher* contactFetcher = 0 ); |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 */ |
|
63 ~SmfContactFetcherPrivate(); |
|
64 //Note we need to expose the methods later through some macro |
|
65 |
|
66 public: |
|
67 /** |
|
68 * Get the friend listing asynchronously. The friendsListAvailable() signal |
|
69 * is emitted with SmfContactList once data is arrived. When the list is big, |
|
70 * user can specify the page number and per page item data. If not supplied |
|
71 * by the user default values are used. |
|
72 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
73 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
74 * @return true if success, else false |
|
75 */ |
|
76 bool friends ( int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE ); |
|
77 |
|
78 /** |
|
79 * Get the list of followers asynchronously. The followersListAvailable() signal |
|
80 * is emitted with SmfContactList once data is arrived. Please note that some |
|
81 * service may not support followers/fans - FALSE is returned if not supported. |
|
82 * When the list is big user can specify the page number and per page item data. |
|
83 * If not supplied by the user default values are used. |
|
84 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
85 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
86 * @return true if success, else false |
|
87 */ |
|
88 bool followers ( int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE ); |
|
89 |
|
90 /** |
|
91 * Searches for a contact The searchContactFinished() signal |
|
92 * is emitted with SmfContactList once data is arrived. |
|
93 * When the list is big user can specify the page number and per page item data. |
|
94 * If not supplied by the user default values are used. |
|
95 * @param contact The contact to be searched. The serach criteria must be |
|
96 * set as one of its fields. |
|
97 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
98 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
99 */ |
|
100 void search ( SmfContact* contact, int pageNum = SMF_FIRST_PAGE, |
|
101 int perPage = SMF_ITEMS_PER_PAGE ); |
|
102 |
|
103 /** |
|
104 * Searches for a contacts (friends) who are near the user. The signal |
|
105 * searchNearFinished() is emitted with SmfContactList once data is arrived. |
|
106 * Proximity defines accuracy level. When the list is big user can specify |
|
107 * the page number and per page item data. If not supplied by the user |
|
108 * default values are used. |
|
109 * @param location The location information |
|
110 * @param proximity The search boundary criteria |
|
111 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
112 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
113 */ |
|
114 bool searchNear ( SmfLocation* location, |
|
115 SmfLocationSearchBoundary proximity, |
|
116 int pageNum = SMF_FIRST_PAGE, |
|
117 int perPage = SMF_ITEMS_PER_PAGE); |
|
118 |
|
119 /** |
|
120 * Get the list of groups. The groupListAvailable() signal is emitted with |
|
121 * SmfGroupList once data is arrived. False might be returned if this service |
|
122 * doesn't support any mode of grouping (very rare). When the list is big, |
|
123 * user can specify the page number and per page item data. If not supplied |
|
124 * by the user default values are used. |
|
125 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
126 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
127 */ |
|
128 bool groups ( int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE ); |
|
129 |
|
130 /** |
|
131 * Searches for Smf Contacts in an Smf group. The signal searchInGroupFinished() |
|
132 * is emitted with SmfContactList once data is arrived. When the list is big user |
|
133 * can specify the page number and per page item data. If not supplied by the |
|
134 * user default values are used. |
|
135 * @param group The group to be searched in |
|
136 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
137 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
138 * @return true if success, else false |
|
139 */ |
|
140 bool searchInGroup ( SmfGroup group, |
|
141 int pageNum = SMF_FIRST_PAGE, |
|
142 int perPage = SMF_ITEMS_PER_PAGE ); |
|
143 |
|
144 /** |
|
145 * Request for a custom operation. The signal customDataAvailable() is emitted |
|
146 * when the result is available. |
|
147 * @param operationId OperationId |
|
148 * @param customData Custom data to be sent |
|
149 * Note:-Interpretation of operationId and customData is upto the concerned |
|
150 * plugin and client application. service provider should provide some |
|
151 * serializing-deserializing utilities for these custom data |
|
152 */ |
|
153 void customRequest ( const int& operationId, QByteArray* customData ); |
|
154 |
|
155 public: //from smfobserver |
|
156 /** |
|
157 * To notify availibility of asynchronous requests. |
|
158 * @param result Requested result, before using must check error param. |
|
159 * @param opcode Requested opcode, for which the result has arrived. |
|
160 * @param error Error |
|
161 */ |
|
162 void resultsAvailable ( QByteArray result, |
|
163 SmfRequestTypeID opcode, SmfError error ); |
|
164 |
|
165 private: |
|
166 SmfContactFetcher* m_contactFetcher; |
|
167 QByteArray m_dataSerialized; //serialized byte array of provider and data |
|
168 //QByteArray m_xtraInfoSerialized; //serialized xtra info, order of serialization follows order of param |
|
169 quint8 m_argFlag; |
|
170 #ifdef Q_OS_SYMBIAN |
|
171 CSmfClientSymbian* m_SmfClientPrivate; |
|
172 friend class CSmfClientSymbian; |
|
173 #else |
|
174 SmfClientQt* m_SmfClientPrivate; |
|
175 friend class SmfClientQt; |
|
176 #endif |
|
177 |
|
178 }; |
|
179 |
|
180 QDataStream &operator<<( QDataStream &aDataStream, const SmfError &err ); |
|
181 QDataStream &operator>>( QDataStream &aDataStream, SmfError &err ); |
|
182 |
|
183 #endif /* SMFCLIENTPRIVATE_H_ */ |