|
1 /* |
|
2 * Copyright (c) 2003 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: The class for using SIP profiles |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSIPPROFILEREGISTRY_H |
|
20 #define CSIPPROFILEREGISTRY_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 #include <badesca.h> |
|
26 #include "sipprofileregistrybase.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CSIP; |
|
30 class CSIPConnection; |
|
31 class CSIPProfile; |
|
32 class MSIPProfileRegistryObserver; |
|
33 class MSIPConnectionObserver; |
|
34 |
|
35 // STUB stuff |
|
36 |
|
37 typedef TInt TSIPProfileBehavior; |
|
38 const TSIPProfileBehavior KRegistryLeaveAtConstruct = 1; |
|
39 const TSIPProfileBehavior KSIPProfileIdFetchFails = 2; |
|
40 const TSIPProfileBehavior KSIPIapIdFetchFails = 3; |
|
41 const TSIPProfileBehavior KSIPConnectionLeaveAtConstruct = 4; |
|
42 |
|
43 class CSIPProfileBehaviorTls : public CBase |
|
44 { |
|
45 public: |
|
46 static void OpenL(); |
|
47 static void Close(); |
|
48 |
|
49 static CSIPProfileBehaviorTls* Storage(); |
|
50 |
|
51 void Reset(); |
|
52 |
|
53 private: |
|
54 |
|
55 CSIPProfileBehaviorTls(); |
|
56 ~CSIPProfileBehaviorTls(); |
|
57 |
|
58 public: |
|
59 |
|
60 TSIPProfileBehavior iRegistryBehavior; |
|
61 TSIPProfileBehavior iProfileBehavior; |
|
62 TSIPProfileBehavior iConnectionBehavior; |
|
63 }; |
|
64 |
|
65 |
|
66 |
|
67 // CLASS DECLARATION |
|
68 /** |
|
69 * @publishedAll |
|
70 * @released |
|
71 * |
|
72 * The class for retrieving SIP profiles from permanent storage. |
|
73 * This class provides services for retreiving SIP profiles |
|
74 * and enabling/disabling them for the usage. |
|
75 * |
|
76 * The user can create only one instance of this class (a singleton class). |
|
77 * |
|
78 * @lib sipprofilecli.lib |
|
79 */ |
|
80 class CSIPProfileRegistry: public CSIPProfileRegistryBase |
|
81 { |
|
82 public: // Constructors and destructor |
|
83 /** |
|
84 * Two-phased constructor. |
|
85 * This constructor should be used if the client intends |
|
86 * to use SIP services with profiles. |
|
87 * @param aSip a SIP client providing connection to SIP stack. |
|
88 * @param aObserver a observer for SIP profile change events. |
|
89 */ |
|
90 IMPORT_C static CSIPProfileRegistry* NewL( |
|
91 CSIP& aSip, |
|
92 MSIPProfileRegistryObserver& aObserver); |
|
93 |
|
94 /** |
|
95 * Two-phased constructor. |
|
96 * This constructor should be used if the client intends |
|
97 * to use SIP services with profiles. |
|
98 * Constructs an object and adds the pointer to the cleanup stack; |
|
99 * @param aSip a SIP client providing connection to SIP stack. |
|
100 * @param aObserver a observer for SIP profile change events. |
|
101 */ |
|
102 IMPORT_C static CSIPProfileRegistry* NewLC( |
|
103 CSIP& aSip, |
|
104 MSIPProfileRegistryObserver& aObserver); |
|
105 |
|
106 /** |
|
107 * Destructor |
|
108 */ |
|
109 IMPORT_C ~CSIPProfileRegistry(); |
|
110 |
|
111 public: // New functions |
|
112 /** |
|
113 * Gets handle to the SIP server |
|
114 * @return handle to the SIP server |
|
115 */ |
|
116 IMPORT_C CSIP& SIP() const; |
|
117 |
|
118 /** |
|
119 * Gets the SIP connection to be used with this SIP profile. |
|
120 * @pre IsEnabled() == ETrue |
|
121 * @param aProfile a sip profile |
|
122 * @return a SIP connection to be used; the owneship is transfered |
|
123 * @leave KErrNoMemory if out of memory |
|
124 * @capability NetworkServices |
|
125 */ |
|
126 IMPORT_C CSIPConnection* ConnectionL( |
|
127 CSIPProfile& aProfile); |
|
128 |
|
129 /** |
|
130 * Enables the SIP profile for use. |
|
131 * Enabling the SIP profile will cause the SIP profile to |
|
132 * be registered if its status was unregistered. |
|
133 * The user must check the profile status after calling this |
|
134 * function. In case the profile is not registered the user must |
|
135 * wait until the it is notified about profile registration |
|
136 * on MSIPProfileRegistryObserver-callback interface. |
|
137 * @param aProfile a sip profile to enable |
|
138 * @param aObserver a observer for SIP connection events |
|
139 * @leave KErrNotFound if non-existing profile is provided |
|
140 * @capability NetworkServices |
|
141 */ |
|
142 IMPORT_C void EnableL( |
|
143 CSIPProfile& aProfile, |
|
144 MSIPConnectionObserver &aObserver); |
|
145 |
|
146 /** |
|
147 * Disables the usage of SIP profile |
|
148 * @param aProfile a sip profile to disable |
|
149 * @return KErrNone if SIP profile was successfully disabled; |
|
150 * system wide error otherwise |
|
151 * @capability NetworkServices |
|
152 */ |
|
153 IMPORT_C TInt Disable(CSIPProfile& aProfile); |
|
154 |
|
155 /** |
|
156 * Tests is the SIP profile enabled for the use |
|
157 * @param aProfile a SIP profile to be checked |
|
158 * @return ETrue if SIP profile is enabled; EFalse otherwise |
|
159 */ |
|
160 IMPORT_C TBool IsEnabled(const CSIPProfile& aProfile) const; |
|
161 |
|
162 public: |
|
163 |
|
164 CSIPProfile* NewInstanceL(); |
|
165 |
|
166 private: |
|
167 |
|
168 CSIPProfileRegistry(); |
|
169 CSIPProfileRegistry(CSIP& aSip, MSIPProfileRegistryObserver& aObserver); |
|
170 |
|
171 void ConstructL(); |
|
172 |
|
173 public: |
|
174 |
|
175 TBool iProfileDisabled; |
|
176 mutable TBool iProfileEnabled; |
|
177 |
|
178 private: |
|
179 |
|
180 CSIP& iSip; |
|
181 MSIPConnectionObserver* iConnectionObserver; |
|
182 |
|
183 }; |
|
184 |
|
185 #endif // CSIPPROFILEREGISTRY_H |