|
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 request in capabilty |
|
15 * availability. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __MUSAVAOPTIONHANDLER_H__ |
|
20 #define __MUSAVAOPTIONHANDLER_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 #include "musavaavailability.h" |
|
25 #include "musavaobserver.h" |
|
26 #include "musunittesting.h" |
|
27 #include "mmusavacapabilityqueryobserver.h" |
|
28 |
|
29 class CMusAvaSharedObject; |
|
30 class MMusAvaAvailabilityObserver; |
|
31 class CMusAvaCapabilitySipAgent; |
|
32 class CMusAvaCapabilityExchange; |
|
33 class CMusAvaCapability; |
|
34 class CMusAvaCapabilityQueryBase; |
|
35 class CMusAvaSettingsImp; |
|
36 |
|
37 |
|
38 /** |
|
39 * Implements handling of non-desired SIP invites. |
|
40 * |
|
41 * Provide interface for the client to availability class. |
|
42 * |
|
43 * @lib musavailabilityplugin.lib |
|
44 * @since S60 v3.2 |
|
45 */ |
|
46 class CMusAvaOptionHandler : public CMusAvaAvailability, |
|
47 public MMusAvaCapabilityQueryObserver |
|
48 { |
|
49 public: |
|
50 /** |
|
51 * Two-phased constructor |
|
52 * |
|
53 * @param aObserver Pointer to observer intercase |
|
54 * @param aSettings Availability settings. |
|
55 * @return Returns pointer to CMusAvaInterface object |
|
56 */ |
|
57 static CMusAvaOptionHandler* NewL( |
|
58 MMusAvaAvailabilityObserver& aObserver, |
|
59 CMusAvaSettingsImp& aSettings ); |
|
60 |
|
61 /** |
|
62 * Two-phased constructor |
|
63 * |
|
64 * @param aObserver Pointer to observer intercase |
|
65 * @param aSettings Availability settings. |
|
66 * @return Returns pointer to CMusAvaInterface object |
|
67 */ |
|
68 static CMusAvaOptionHandler* NewLC( |
|
69 MMusAvaAvailabilityObserver& aObserver, |
|
70 CMusAvaSettingsImp& aSettings ); |
|
71 |
|
72 /** |
|
73 * Destructor |
|
74 */ |
|
75 ~CMusAvaOptionHandler(); |
|
76 |
|
77 protected: |
|
78 |
|
79 /** |
|
80 * Constructor |
|
81 * |
|
82 * @since S60 v3.2 |
|
83 * @param aObserver Pointer to observer intercase |
|
84 * @param aName availability name |
|
85 * @param aModules is data container |
|
86 */ |
|
87 |
|
88 CMusAvaOptionHandler( |
|
89 MMusAvaAvailabilityObserver& aObserver, |
|
90 CMusAvaSettingsImp& aSettings ); |
|
91 |
|
92 void ConstructL(); |
|
93 |
|
94 void ConstructCapabilityExchangeL(); |
|
95 |
|
96 HBufC8* ConstructTerminalIdL(); |
|
97 |
|
98 public: // from base class CMusAvaAvailability |
|
99 |
|
100 /** |
|
101 * Executes for the availability. |
|
102 * |
|
103 * @since S60 v3.2 |
|
104 * @return KErrNone if ExecutePatternL operation was |
|
105 * successfully executed; system wide error otherwise |
|
106 */ |
|
107 virtual void DoExecuteL(); |
|
108 |
|
109 |
|
110 /** |
|
111 * Stop the execution. |
|
112 * |
|
113 * @since S60 v3.2 |
|
114 * @return KErrNone if stop operation was successfully executed; |
|
115 * system wide error otherwise |
|
116 */ |
|
117 virtual void Stop(); |
|
118 |
|
119 /** |
|
120 * From CMusAvaAvailability. |
|
121 * Returns availability name. |
|
122 * |
|
123 * @return Name of *this* availability. |
|
124 */ |
|
125 virtual MMusAvaObserver::TAvailabilityName Name(); |
|
126 |
|
127 /** |
|
128 * Invitation has been received. |
|
129 */ |
|
130 virtual void PrepareForReceivedInviteL(); |
|
131 |
|
132 |
|
133 public: // functions from base class MMusAvaCapabilityQueryObserver |
|
134 |
|
135 void CapabilitiesResolved( const CMusAvaCapabilityQueryBase& aSentQuery ); |
|
136 |
|
137 void CapabilitiesResolvedL( const TDesC& aUri ); |
|
138 |
|
139 void SetCapabilitiesResolvedForCingular(); |
|
140 |
|
141 TBool CapabilitiesResolvedForCingular(); |
|
142 |
|
143 /** |
|
144 * This is to advertise MMusAvaCapabilityQueryObserver implementors |
|
145 * about sip header change. It is mainly used in below scneraio but could |
|
146 * be used in future if anyother sip headers has to be set. |
|
147 * |
|
148 * Incase if we receive OPTIONS request already and |
|
149 * P-Asserted-Identity Header is present then OPTIONS |
|
150 * request should be sent to this ID. This function should be |
|
151 * called to configure this id in CMusAvaSettingsImp& iSettings |
|
152 * |
|
153 * @aHeaders Array of SIP Headers. |
|
154 * @aHeaderType Type of the header. |
|
155 * Leavs if Array is empty or pointer is NULL. |
|
156 * Ownership Transferred. |
|
157 */ |
|
158 void SipHeadersL(const MDesCArray& aHeaders, |
|
159 SipStrConsts::TStrings aHeaderType); |
|
160 |
|
161 /** |
|
162 * Advertise about video codec capabilities |
|
163 */ |
|
164 void VideoCodecsResolvedL( const MDesCArray& aVideoCodecs ); |
|
165 |
|
166 TBool CapabilityQueryAnswered( TBool aAnswered ); |
|
167 |
|
168 void FastModeResolved( MusSettingsKeys::TFastMode aMode ); |
|
169 |
|
170 private: |
|
171 |
|
172 /** |
|
173 * Change state. |
|
174 * @param aNewState, proposed new state |
|
175 * @return KErrNone if successfull |
|
176 */ |
|
177 TInt DoSetState( MMusAvaObserver::TAvailabilityStatus aNewState ); |
|
178 |
|
179 /** |
|
180 * Handle state change in fast mode, state change may be modified |
|
181 * based on fast mode session setup progress. |
|
182 * @param aNewState, proposed new state |
|
183 * @param aCouldNotProceed, ETrue if state change occured because |
|
184 * couldn't proceed (e.g. missing information) |
|
185 * @return new state to set |
|
186 */ |
|
187 MMusAvaObserver::TAvailabilityStatus HandleFastModeL( |
|
188 MMusAvaObserver::TAvailabilityStatus aNewState ); |
|
189 |
|
190 MMusAvaObserver::TAvailabilityStatus HandleFastModeAvailableL( |
|
191 MMusAvaObserver::TAvailabilityStatus aNewState ); |
|
192 |
|
193 MMusAvaObserver::TAvailabilityStatus HandleFastModeOptionsNotSentL( |
|
194 MMusAvaObserver::TAvailabilityStatus aNewState ); |
|
195 |
|
196 MMusAvaObserver::TAvailabilityStatus HandleFastModeOptionNotAvailableL( |
|
197 MMusAvaObserver::TAvailabilityStatus aNewState ); |
|
198 |
|
199 void HandleFastModeQueryAnswered(); |
|
200 |
|
201 TBool FastModeNegotiatedByAnswerMT(); |
|
202 |
|
203 TBool FastModeNegotiationFailedMO(); |
|
204 |
|
205 private: |
|
206 |
|
207 /** |
|
208 * Reference to availability settings (data store) |
|
209 */ |
|
210 CMusAvaSettingsImp& iSettings; |
|
211 |
|
212 /** |
|
213 * Pointer to CMusAvaSharedObject object |
|
214 */ |
|
215 CMusAvaSharedObject* iSharedObj; |
|
216 |
|
217 CMusAvaCapabilitySipAgent* iSipAgent; |
|
218 CMusAvaCapabilityExchange* iCapabilityExchange; |
|
219 CMusAvaCapability* iSwisCapability; |
|
220 TBool iCapabilitiesRequestAnswered; |
|
221 TBool iCapabilityQueryAnswered; |
|
222 |
|
223 TBool iFastModeCapable; |
|
224 TBool iFastModeAvailabilityDelayed; |
|
225 |
|
226 MUS_UNITTEST ( UT_CMusAvaOptionHandler ) |
|
227 MUS_UNITTEST ( UT_CMusAvaCapabilityExchange ) |
|
228 MUS_UNITTEST ( UT_CMusAvaCapability ) |
|
229 MUS_UNITTEST ( UT_CMusAvaTerminal ) |
|
230 MUS_UNITTEST ( UT_CMusAvaCapabilitySipAgent ) |
|
231 MUS_UNITTEST ( UT_CMusAvaCapabilityQuery ) |
|
232 }; |
|
233 |
|
234 #endif // __MUSAVAOPTIONHANDLER_H__ |