|
1 /* |
|
2 * Copyright (c) 2005-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUSSIPPROFILEHANDLER_H |
|
20 #define MUSSIPPROFILEHANDLER_H |
|
21 |
|
22 |
|
23 // INTERNAL INCLUDE |
|
24 #include "musunittesting.h" |
|
25 |
|
26 // SYSTEM INCLUDE |
|
27 #include <e32base.h> |
|
28 #include <sipobserver.h> |
|
29 #include <sipconnectionobserver.h> |
|
30 #include <sipprofileregistryobserver.h> |
|
31 #include <sipprofilealrobserver.h> |
|
32 |
|
33 |
|
34 class CSIPProfile; |
|
35 class CSIPProfileRegistry; |
|
36 class CSipProfileAlrController; |
|
37 class CUri8; |
|
38 class MMusSipProfileUser; |
|
39 |
|
40 /** |
|
41 * |
|
42 * @lib musengine.lib |
|
43 */ |
|
44 class CMusSipProfileHandler : public CBase, |
|
45 public MSIPProfileRegistryObserver, |
|
46 public MSIPObserver, |
|
47 public MSIPConnectionObserver, |
|
48 public MSipProfileAlrObserver |
|
49 |
|
50 { |
|
51 MUS_UNITTEST( UT_CMusEngSipProfileHandler ) |
|
52 |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Creates new instance of CMusSipProfileHandler |
|
57 * @param aSipProfileId profile id of requested profile |
|
58 */ |
|
59 static CMusSipProfileHandler* NewL( MMusSipProfileUser& aUser ); |
|
60 |
|
61 /** |
|
62 * Destructor |
|
63 * |
|
64 */ |
|
65 ~CMusSipProfileHandler(); |
|
66 |
|
67 |
|
68 public: // API |
|
69 |
|
70 /** |
|
71 * Creates the SIP profile used. |
|
72 * @param aSipProfileId profile ID of requested SIP profile |
|
73 */ |
|
74 void CreateProfileL( TUint32 aSipProfileId ); |
|
75 |
|
76 /** |
|
77 * Returns the used SIP profile. |
|
78 * @pre SipProfileL has been called |
|
79 * @return SIP profile or NULL if the SIP profile cannot be found, |
|
80 * The ownership is not transferred. |
|
81 */ |
|
82 CSIPProfile* Profile(); |
|
83 |
|
84 /** |
|
85 * Returns the registered public user identity of the used SIP profile |
|
86 * @pre SipProfileL has been called |
|
87 * @return a pointer to the URI, the ownership is transferred |
|
88 */ |
|
89 CUri8* UserFromProfileLC(); |
|
90 |
|
91 /** |
|
92 * Refreshes the availabilities of the access points |
|
93 * for the used SIP profile. |
|
94 * Should be called when a MuS session terminates. |
|
95 */ |
|
96 void RefreshIapAvailabilities(); |
|
97 |
|
98 private: |
|
99 |
|
100 /** |
|
101 * Constructor |
|
102 * |
|
103 */ |
|
104 CMusSipProfileHandler( MMusSipProfileUser& aUser ); |
|
105 |
|
106 /** |
|
107 * Second-phase constructor |
|
108 * |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 |
|
113 private: // From MSIPProfileRegistryObserver |
|
114 |
|
115 /** |
|
116 * An event related to SIP Profile has accorred |
|
117 * |
|
118 * @param aProfileId a profile Id |
|
119 * @param aEvent an occurred event |
|
120 **/ |
|
121 void ProfileRegistryEventOccurred( |
|
122 TUint32 aProfileId, |
|
123 MSIPProfileRegistryObserver::TEvent aEvent ); |
|
124 |
|
125 /** |
|
126 * An asynchronous error has occurred related to SIP profile |
|
127 * Event is send to those observers, who have the |
|
128 * corresponding profile instantiated. |
|
129 * |
|
130 * @param aProfileId the id of failed profile |
|
131 * @param aError an occurred error |
|
132 */ |
|
133 void ProfileRegistryErrorOccurred( |
|
134 TUint32 aProfileId, |
|
135 TInt aError ); |
|
136 |
|
137 private: // From MSIPObserver |
|
138 |
|
139 void IncomingRequest( TUint32 aIapId, |
|
140 CSIPServerTransaction* aTransaction ); |
|
141 |
|
142 void TimedOut( CSIPServerTransaction& aTransaction ); |
|
143 |
|
144 private: // MSIPConnectionObserver must be implemented to enable SIP profile |
|
145 |
|
146 void IncomingRequest (CSIPServerTransaction* aTransaction ); |
|
147 |
|
148 void IncomingRequest (CSIPServerTransaction* aTransaction, |
|
149 CSIPDialog& aDialog ); |
|
150 |
|
151 void IncomingResponse (CSIPClientTransaction& aTransaction ); |
|
152 |
|
153 void IncomingResponse ( CSIPClientTransaction& aTransaction, |
|
154 CSIPDialogAssocBase& aDialogAssoc ); |
|
155 |
|
156 void IncomingResponse ( CSIPClientTransaction& aTransaction, |
|
157 CSIPInviteDialogAssoc* aDialogAssoc ); |
|
158 |
|
159 void IncomingResponse( CSIPClientTransaction& aTransaction, |
|
160 CSIPRegistrationBinding& aRegistration ); |
|
161 |
|
162 void ErrorOccured( TInt aError, CSIPTransactionBase& aTransaction ); |
|
163 |
|
164 void ErrorOccured( TInt aError, |
|
165 CSIPClientTransaction& aTransaction, |
|
166 CSIPRegistrationBinding& aRegistration ); |
|
167 |
|
168 void ErrorOccured( TInt aError, |
|
169 CSIPTransactionBase& aTransaction, |
|
170 CSIPDialogAssocBase& aDialogAssoc ); |
|
171 |
|
172 void ErrorOccured( TInt aError, CSIPRefresh& aSIPRefresh ); |
|
173 |
|
174 void ErrorOccured( TInt aError, |
|
175 CSIPRegistrationBinding& aRegistration ); |
|
176 |
|
177 void ErrorOccured( TInt aError, CSIPDialogAssocBase& aDialogAssoc ); |
|
178 |
|
179 void InviteCompleted( CSIPClientTransaction& aTransaction ); |
|
180 |
|
181 void InviteCanceled( CSIPServerTransaction& aTransaction ); |
|
182 |
|
183 void ConnectionStateChanged( CSIPConnection::TState aState ); |
|
184 |
|
185 private: // From MSipProfileAlrObserver |
|
186 |
|
187 void AlrEvent( MSipProfileAlrObserver::TEvent aEvent, |
|
188 TUint32 aProfileId, |
|
189 TUint32 aSnapId, |
|
190 TUint32 aIapId ); |
|
191 |
|
192 void AlrError( TInt aError, |
|
193 TUint32 aProfileId, |
|
194 TUint32 aSnapId, |
|
195 TUint32 aIapId ); |
|
196 |
|
197 private: // New functions |
|
198 |
|
199 TUint32 ProfileId() const; |
|
200 |
|
201 private: // DATA |
|
202 |
|
203 MMusSipProfileUser& iUser; |
|
204 CSIP* iSip; |
|
205 CSIPProfileRegistry* iProfileRegistry; |
|
206 CSipProfileAlrController* iProfileAlrController; |
|
207 CSIPProfile* iSipProfile; |
|
208 }; |
|
209 |
|
210 #endif // MUSSIPPROFILEHANDLER_H |