|
1 /* |
|
2 * Copyright (c) 2002-2005 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: |
|
15 * WV Engine pure data API definition |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef RIMPSPURECLI_H |
|
21 #define RIMPSPURECLI_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <bamdesca.h> |
|
27 #include "impsconst.h" |
|
28 #include "impsclient.h" |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // service type |
|
33 enum TImpsServiceType |
|
34 { |
|
35 EImpsServiceNone = 0x0000, |
|
36 EImpsServiceAccess = 0x0001, |
|
37 EImpsServiceIM = 0x0002, |
|
38 EImpsServicePresence = 0x0004, |
|
39 EImpsServiceGroup = 0x0010, |
|
40 EImpsServiceCommon = 0x0100 |
|
41 }; |
|
42 |
|
43 // FORWARD DECLARATIONS |
|
44 class MImpsPureHandler2; |
|
45 class CImpsPureCommand2; |
|
46 |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * Pure data WV Client API |
|
52 * |
|
53 * Applications use Access service via RImpsPureClient2 class. |
|
54 * First, they need to |
|
55 * connect to the server by calling RegisterL() member function. |
|
56 * Immediately after that an error handler must be registered by |
|
57 * RegisterErrorObserverL. |
|
58 * |
|
59 * When everything is done, call Unregister() to end |
|
60 * the session. |
|
61 * |
|
62 * A user of this API must be aware that raising/releasing |
|
63 * the PDP context may affect the response times of called functions. |
|
64 * |
|
65 * |
|
66 * Observer methods: |
|
67 * ----------------------- |
|
68 * Client can be notified when a certain type of message is received |
|
69 * from the remote server. |
|
70 * Client has to be connected in the server in order to get notify events. |
|
71 * If the client is disconnected by server by calling Unregister(), all notify |
|
72 * requests and possible incoming events are canceled. |
|
73 * |
|
74 * Notify events are session-specific, ie. if you have several RImpsPureClients |
|
75 * connected to the server, each has its own notify requests. |
|
76 * |
|
77 * In order to use notify services, you need to implement MImpsPureHandler2 |
|
78 * and give a pointer to your class in RegisterL. |
|
79 * Observer method doesn't need to do anything else than your application needs |
|
80 * it to do. |
|
81 */ |
|
82 |
|
83 class RImpsPureClient2 : public RImpsClient2 |
|
84 { |
|
85 |
|
86 public: // Constructors and destructor |
|
87 |
|
88 /** |
|
89 * C++ default constructor. |
|
90 */ |
|
91 IMPORT_C RImpsPureClient2(); |
|
92 |
|
93 public: // New functions |
|
94 |
|
95 // INITILIZATION AND CONNECT |
|
96 |
|
97 /** |
|
98 * Registers the listener object for Pure events and connects to |
|
99 * the SOS Server. |
|
100 * Leaves with KImpsErrorAlreadyInUse if the client |
|
101 * has already registered. |
|
102 * @param aEngine WV Engine server instance |
|
103 * @param aObserver The observer. |
|
104 * @param aType aServiceType |
|
105 * @param aReceiveNew determines if new pushed messages are received. |
|
106 * If EFalse then new messages are filtered out and |
|
107 * responses to own requests are deliverd only. |
|
108 * @param aPriority Observer priority. Refer to CActive priority. |
|
109 */ |
|
110 IMPORT_C void RegisterL( RImpsEng& aEngine, |
|
111 MImpsPureHandler2* aObserver, |
|
112 TImpsServiceType aType = EImpsServicePresence, |
|
113 TBool aReceiveNew = ETrue, |
|
114 TInt aPriority = CActive::EPriorityStandard ); |
|
115 |
|
116 |
|
117 |
|
118 /** |
|
119 * Unregisters the listener object and disconnects from the server. |
|
120 */ |
|
121 IMPORT_C void Unregister(); |
|
122 |
|
123 /** |
|
124 * Send pure transaction content |
|
125 * Only primitives that belong to the presence service are allowed, |
|
126 * otherwise leaves with KImpsErrorUnknownMessageType. |
|
127 * If content size exceeds the maximum, |
|
128 * leaves with KImpsErrorMessageTooBig. |
|
129 * Max. content size can be retrieved by calling |
|
130 * method MaxTransactionContentSizeL() |
|
131 * @param aContent UTF-8 coded transaction content in XML format |
|
132 */ |
|
133 IMPORT_C TInt SendPureDataL( const TDesC8& aContent ); |
|
134 |
|
135 /** |
|
136 * Pointer to the pure data handler |
|
137 * @return handler |
|
138 */ |
|
139 MImpsPureHandler2* Handler(); |
|
140 |
|
141 private: |
|
142 |
|
143 /** |
|
144 * Registers the listener object for Presence events and connects to |
|
145 * the Symbian Server. |
|
146 * @param aEngine WV Engine server instance |
|
147 * @param aHandler the observer |
|
148 * @return general error code |
|
149 */ |
|
150 TInt DoRegister( RImpsEng& aEngine, |
|
151 CImpsHandler2* aHandler ); |
|
152 |
|
153 private: // data |
|
154 |
|
155 CImpsPureCommand2* iCommand; |
|
156 MImpsPureHandler2* iPureCallback; |
|
157 |
|
158 private: // friend classes |
|
159 friend class CImpsPureCommand2; |
|
160 |
|
161 }; |
|
162 |
|
163 // CLASS DECLARATION |
|
164 |
|
165 /** |
|
166 * MImpsPureHandler2 |
|
167 * |
|
168 * Abstract interface for handling the notify events from the server. |
|
169 * User derives his class from this and implements the methods below. |
|
170 */ |
|
171 |
|
172 class MImpsPureHandler2 |
|
173 { |
|
174 |
|
175 public: // New functions |
|
176 |
|
177 /** |
|
178 * Observer method for pure message content. |
|
179 * @param aOpId operation id received in SendPureDataL. If this is 0, |
|
180 * then the HandlePureDataL was initated by SAP. |
|
181 * @param aBuffer UTF-8 coded message content in XML format |
|
182 * @param aCspId CSP session identifier |
|
183 */ |
|
184 virtual void HandlePureDataL( TInt aOpId, |
|
185 const TDesC8& aBuffer, |
|
186 TImpsCspIdentifier& aCspId ) = 0; |
|
187 |
|
188 }; |
|
189 |
|
190 #endif // RIMPSPURECLI_H |
|
191 |
|
192 // End of file |