|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Provide interface for the client requestin network availability. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MUSAVAINVITEHANDLER_H__ |
|
20 #define __MUSAVAINVITEHANDLER_H__ |
|
21 |
|
22 #include "musavaavailability.h" |
|
23 #include "musavaobserver.h" |
|
24 #include "musavainviteresponderobserver.h" |
|
25 #include "musavasipconnectionadapter.h" |
|
26 #include "musavasipadapter.h" |
|
27 #include "musunittesting.h" |
|
28 |
|
29 #include <e32base.h> |
|
30 |
|
31 class CSIPServerTransaction; |
|
32 class CMusAvaInviteResponder; |
|
33 class CMusAvaSharedObject; |
|
34 class MMusAvaAvailabilityObserver; |
|
35 class CMusAvaSettingsImp; |
|
36 |
|
37 /** |
|
38 * Implements handling of non-desired SIP invites. |
|
39 * |
|
40 * Provide interface for the client to availability class. |
|
41 * |
|
42 * @lib musavailabilityplugin.lib |
|
43 * @since S60 v3.2 |
|
44 */ |
|
45 class CMusAvaInviteHandler : public CMusAvaAvailability, |
|
46 public MMusAvaInviteResponderObserver, |
|
47 public MMusAvaSipConnectionAdapter, |
|
48 public MMusAvaSipAdapter |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Two-phased constructor |
|
54 * |
|
55 * @since S60 v3.2 |
|
56 * @param aObserver Pointer to observer intercase |
|
57 * @param aModules is data container |
|
58 * @return Returns pointer to CMusAvaInterface object |
|
59 */ |
|
60 |
|
61 static CMusAvaInviteHandler* NewL( |
|
62 MMusAvaAvailabilityObserver& aObserver, |
|
63 CMusAvaSettingsImp& aSettings ); |
|
64 |
|
65 /** |
|
66 * Two-phased constructor |
|
67 * |
|
68 * @since S60 v3.2 |
|
69 * @param aObserver Pointer to observer intercase |
|
70 * @param aModules is data container |
|
71 * @return Returns pointer to CMusAvaInterface object |
|
72 */ |
|
73 |
|
74 static CMusAvaInviteHandler* NewLC( |
|
75 MMusAvaAvailabilityObserver& aObserver, |
|
76 CMusAvaSettingsImp& aSettings ); |
|
77 |
|
78 /** |
|
79 * Destructor |
|
80 */ |
|
81 ~CMusAvaInviteHandler(); |
|
82 |
|
83 public: |
|
84 |
|
85 /** |
|
86 * A SIP request outside a dialog has been received from the network. |
|
87 * |
|
88 * @pre aTransaction != 0 |
|
89 * @param aTransaction SIP server transaction. The ownership is |
|
90 * transferred. |
|
91 */ |
|
92 virtual TInt IncomingRequest( |
|
93 CSIPServerTransaction* aTransaction ); |
|
94 |
|
95 /** |
|
96 * A SIP request within a dialog has been received from the network. |
|
97 * The client must resolve the actual dialog association to which |
|
98 * this request belongs. |
|
99 * |
|
100 * @pre aTransaction != 0 |
|
101 * @param aTransaction SIP server transaction. The ownership is |
|
102 * transferred. |
|
103 * @param aDialog the dialog that this transaction belongs to. |
|
104 */ |
|
105 /* virtual TInt IncomingRequest (CSIPServerTransaction* aTransaction, |
|
106 CSIPDialog& aDialog); |
|
107 */ |
|
108 |
|
109 public: |
|
110 |
|
111 /** |
|
112 * A SIP request has been received from the network. |
|
113 * This function is called when the SIP request was received using such |
|
114 * an IAP, for which the application has not created a CSIPConnection |
|
115 * object. |
|
116 * @pre aTransaction != 0 |
|
117 * @param aIapId The IapId from which the SIP request was received. |
|
118 * @param aTransaction contains local address, remote address of a SIP |
|
119 * message, as well as optional SIP message method, headers and |
|
120 * body. The ownership is transferred. |
|
121 */ |
|
122 TInt IncomingRequest( |
|
123 TUint32 aIapId, |
|
124 CSIPServerTransaction* aTransaction ); |
|
125 |
|
126 /** |
|
127 * The received SIP request time-outed and it is invalid i.e. cannot be used |
|
128 * anymore. |
|
129 * This will be called if the user fails to create a SIP connection and |
|
130 * does not send an appropriate SIP response. |
|
131 * @param aTransaction The time-outed transaction. |
|
132 */ |
|
133 TInt TimedOut( CSIPServerTransaction& aTransaction ); |
|
134 |
|
135 protected: |
|
136 |
|
137 /** |
|
138 * Constructor |
|
139 * |
|
140 * @since S60 v3.2 |
|
141 * @param aObserver Pointer to observer intercase |
|
142 * @param aName availability name |
|
143 * @param aModules is data container |
|
144 * @return |
|
145 */ |
|
146 CMusAvaInviteHandler( |
|
147 MMusAvaAvailabilityObserver& aObserver, |
|
148 CMusAvaSettingsImp& aSettings ); |
|
149 |
|
150 void ConstructL(); |
|
151 |
|
152 |
|
153 // from base class CMusAvaAvailability |
|
154 |
|
155 public: |
|
156 |
|
157 /** |
|
158 * Executes for the availability. |
|
159 * |
|
160 * @since S60 v3.2 |
|
161 * @return KErrNone if ExecutePatternL operation was |
|
162 * successfully executed; system wide error otherwise |
|
163 */ |
|
164 virtual void DoExecuteL(); |
|
165 |
|
166 |
|
167 /** |
|
168 * Stop the execution. |
|
169 * |
|
170 * @since S60 v3.2 |
|
171 * @return KErrNone if stop operation was successfully executed; |
|
172 * system wide error otherwise |
|
173 */ |
|
174 virtual void Stop(); |
|
175 |
|
176 /** |
|
177 * From CMusAvaAvailability. |
|
178 * Returns availability name. |
|
179 * |
|
180 * @return Name of *this* availability. |
|
181 */ |
|
182 virtual MMusAvaObserver::TAvailabilityName Name(); |
|
183 |
|
184 public: |
|
185 |
|
186 /** |
|
187 * Handles a received invitation |
|
188 * |
|
189 * @param aTransaction A SIP Transaction of the received invitation. |
|
190 */ |
|
191 void InvitationReceivedL( CSIPServerTransaction* aTransaction ); |
|
192 |
|
193 |
|
194 public: // MMusAvaInviteResponderObserver |
|
195 |
|
196 MMusAvaSettingsObserver::TApplicationState ApplicationState(); |
|
197 |
|
198 /** |
|
199 * Deletes a invitation responder instance after answering. |
|
200 * |
|
201 */ |
|
202 void InvitationAnsweredLD(); |
|
203 |
|
204 private: |
|
205 |
|
206 /** |
|
207 * Array of invitation responder instances |
|
208 */ |
|
209 RPointerArray<CMusAvaInviteResponder> iResponders; |
|
210 |
|
211 /** |
|
212 * Reference to availability settings (data store) |
|
213 */ |
|
214 CMusAvaSettingsImp& iSettings; |
|
215 |
|
216 /** |
|
217 * Pointer to CMusAvaSharedObject object |
|
218 */ |
|
219 CMusAvaSharedObject* iSharedObj; |
|
220 |
|
221 MUS_UNITTEST ( UT_CMusAvaInviteHandler ) |
|
222 }; |
|
223 |
|
224 |
|
225 #endif // __MUSAVAINVITEHANDLER_H__ |