|
1 /* |
|
2 * Copyright (c) 2006 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: SIMPLE Engine winfo watcher |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef simplewinfowatcher_H |
|
22 #define simplewinfowatcher_H |
|
23 |
|
24 #include <e32std.h> |
|
25 #include "simplecommon.h" |
|
26 #include "simpleclient.h" |
|
27 #include "msimpleconnection.h" |
|
28 #include "msimplewinfowatcher.h" |
|
29 #include "msimpleowncallback.h" |
|
30 |
|
31 // FORWARD DECLARATION |
|
32 class CSimpleEngineRequest; |
|
33 class MSimpleWinfoObserver; |
|
34 class MSimpleConnectionObserver; |
|
35 |
|
36 /** |
|
37 * CSimpleWinfoWatcher |
|
38 * |
|
39 * SIMPLE Engine core. |
|
40 * |
|
41 * @lib simpleengine |
|
42 * @since S60 3.2 |
|
43 */ |
|
44 |
|
45 class CSimpleWinfoWatcher : public CSimpleClient, public MSimpleWinfoWatcher |
|
46 { |
|
47 |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * @since S60 3.2 |
|
53 * @param aConn connection observer |
|
54 * @param aObserver callback observer |
|
55 * @return CSimpleWinfoWatcher |
|
56 */ |
|
57 static CSimpleWinfoWatcher* NewL( |
|
58 MSimpleConnection& aConn, |
|
59 MSimpleWinfoObserver& aObserver ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CSimpleWinfoWatcher(); |
|
65 |
|
66 // from base class MSimpleWinfoWatcher |
|
67 |
|
68 /** |
|
69 * Destroy this entity |
|
70 * |
|
71 * @since S60 3.2 |
|
72 */ |
|
73 void Close(); |
|
74 |
|
75 /** |
|
76 * Getter for the SIMPLE engine connection. |
|
77 * @since S60 3.2 |
|
78 * @return the connection |
|
79 */ |
|
80 const MSimpleConnection& Connection(); |
|
81 |
|
82 /** |
|
83 * Callback for WINFO termination |
|
84 * @since S60 3.2 |
|
85 * @param aFilter filter data, may be null and then you'll get all |
|
86 * the changes in WINFO. |
|
87 */ |
|
88 TInt SubscribeWatcherListL( MSimpleFilterDocument* aFilter ); |
|
89 |
|
90 /** |
|
91 * Unsubscribe. |
|
92 * Leaves with KErrNotFound if there is no active subscription. |
|
93 * @since S60 3.2 |
|
94 * @return operation id |
|
95 */ |
|
96 TInt UnsubscribeL( ); |
|
97 |
|
98 /** |
|
99 * SIP Status accessor |
|
100 * Get the status of the last completed request. |
|
101 * @since S60 3.2 |
|
102 * @return SIP status, 0 if not available |
|
103 */ |
|
104 TUint SIPStatus(); |
|
105 |
|
106 /** |
|
107 * SIP Retry-after accessor |
|
108 * Get the header of the last completed request. |
|
109 * @return retry-after value in seconds, 0 if not available |
|
110 */ |
|
111 TUint SIPRetryAfter(); |
|
112 |
|
113 // from base class MSimpleOwnCallback |
|
114 |
|
115 /** |
|
116 * Complete the open client request |
|
117 * @since S60 3.2 |
|
118 * @param aOpId operation id |
|
119 * @param aStatus result status |
|
120 */ |
|
121 void Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq ); |
|
122 |
|
123 private: |
|
124 |
|
125 /** |
|
126 * Two-phase constructor |
|
127 */ |
|
128 void ConstructL( ); |
|
129 |
|
130 /** |
|
131 * constructor |
|
132 */ |
|
133 CSimpleWinfoWatcher( |
|
134 MSimpleConnection& aConn, |
|
135 MSimpleWinfoObserver& aObserver ); |
|
136 |
|
137 /** |
|
138 * Stream document into request |
|
139 * @since S60 3.2 |
|
140 * @param aReq request |
|
141 * @param aFilter document |
|
142 */ |
|
143 void StreamDocumentL( |
|
144 CSimpleEngineRequest& aReq, |
|
145 MSimpleFilterDocument& aFilter ); |
|
146 |
|
147 /** |
|
148 * New Request from server |
|
149 * @since S60 3.2 |
|
150 * @return request type |
|
151 */ |
|
152 void NewRequestL( MSimpleEngineRequest& aReq ); |
|
153 |
|
154 /** |
|
155 * Complete client request |
|
156 * @param aOpId operation id |
|
157 * @param aStatus result status |
|
158 * @return error when observer has deleted ourself in callback |
|
159 */ |
|
160 TInt DoCallReqComplete( |
|
161 TInt aOpId, TInt aStatus ); |
|
162 |
|
163 |
|
164 private: // data |
|
165 |
|
166 /** |
|
167 * Client API observer for events |
|
168 */ |
|
169 MSimpleWinfoObserver& iObserver; |
|
170 |
|
171 /** |
|
172 * Subscription id |
|
173 */ |
|
174 TInt iSubsId; |
|
175 |
|
176 /** |
|
177 * Response counter in error situations, or state. reply + notify |
|
178 */ |
|
179 TInt iResCount; |
|
180 |
|
181 /** |
|
182 * Whether completion callback method is called |
|
183 */ |
|
184 TBool iComplete; |
|
185 |
|
186 /** |
|
187 * Data buffer for transmission |
|
188 * OWN. |
|
189 */ |
|
190 CBufFlat* iBuffer; |
|
191 |
|
192 }; |
|
193 |
|
194 #endif // simplewinfowatcher_H |
|
195 |
|
196 // End of File |