|
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 |
|
36 // CLASS DECLARATION |
|
37 /** |
|
38 * @publishedAll |
|
39 * @released |
|
40 * |
|
41 * The class for retrieving SIP profiles from permanent storage. |
|
42 * This class provides services for retreiving SIP profiles |
|
43 * and enabling/disabling them for the usage. |
|
44 * |
|
45 * The user can create only one instance of this class (a singleton class). |
|
46 * |
|
47 * @lib sipprofilecli.lib |
|
48 */ |
|
49 class CSIPProfileRegistry: public CSIPProfileRegistryBase |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * This constructor should be used if the client intends |
|
55 * to use SIP services with profiles. |
|
56 * @param aSip a SIP client providing connection to SIP stack. |
|
57 * @param aObserver a observer for SIP profile change events. |
|
58 */ |
|
59 IMPORT_C static CSIPProfileRegistry* NewL( |
|
60 CSIP& aSip, |
|
61 MSIPProfileRegistryObserver& aObserver); |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * This constructor should be used if the client intends |
|
66 * to use SIP services with profiles. |
|
67 * Constructs an object and adds the pointer to the cleanup stack; |
|
68 * @param aSip a SIP client providing connection to SIP stack. |
|
69 * @param aObserver a observer for SIP profile change events. |
|
70 */ |
|
71 IMPORT_C static CSIPProfileRegistry* NewLC( |
|
72 CSIP& aSip, |
|
73 MSIPProfileRegistryObserver& aObserver); |
|
74 |
|
75 /** |
|
76 * Destructor |
|
77 */ |
|
78 IMPORT_C ~CSIPProfileRegistry(); |
|
79 |
|
80 public: // New functions |
|
81 /** |
|
82 * Gets handle to the SIP server |
|
83 * @return handle to the SIP server |
|
84 */ |
|
85 IMPORT_C CSIP& SIP() const; |
|
86 |
|
87 /** |
|
88 * Gets the SIP connection to be used with this SIP profile. |
|
89 * @pre IsEnabled() == ETrue |
|
90 * @param aProfile a sip profile |
|
91 * @return a SIP connection to be used; the owneship is transfered |
|
92 * @leave KErrNoMemory if out of memory |
|
93 * @capability NetworkServices |
|
94 */ |
|
95 IMPORT_C CSIPConnection* ConnectionL( |
|
96 CSIPProfile& aProfile); |
|
97 |
|
98 /** |
|
99 * Enables the SIP profile for use. |
|
100 * Enabling the SIP profile will cause the SIP profile to |
|
101 * be registered if its status was unregistered. |
|
102 * The user must check the profile status after calling this |
|
103 * function. In case the profile is not registered the user must |
|
104 * wait until the it is notified about profile registration |
|
105 * on MSIPProfileRegistryObserver-callback interface. |
|
106 * @param aProfile a sip profile to enable |
|
107 * @param aObserver a observer for SIP connection events |
|
108 * @leave KErrNotFound if non-existing profile is provided |
|
109 * @capability NetworkServices |
|
110 */ |
|
111 IMPORT_C void EnableL( |
|
112 CSIPProfile& aProfile, |
|
113 MSIPConnectionObserver &aObserver); |
|
114 |
|
115 /** |
|
116 * Disables the usage of SIP profile |
|
117 * @param aProfile a sip profile to disable |
|
118 * @return KErrNone if SIP profile was successfully disabled; |
|
119 * system wide error otherwise |
|
120 * @capability NetworkServices |
|
121 */ |
|
122 IMPORT_C TInt Disable(CSIPProfile& aProfile); |
|
123 |
|
124 /** |
|
125 * Tests is the SIP profile enabled for the use |
|
126 * @param aProfile a SIP profile to be checked |
|
127 * @return ETrue if SIP profile is enabled; EFalse otherwise |
|
128 */ |
|
129 IMPORT_C TBool IsEnabled(const CSIPProfile& aProfile) const; |
|
130 |
|
131 public: |
|
132 |
|
133 CSIPProfile* NewInstanceL(); |
|
134 |
|
135 private: |
|
136 |
|
137 CSIPProfileRegistry(); |
|
138 CSIPProfileRegistry(CSIP& aSip, MSIPProfileRegistryObserver& aObserver); |
|
139 |
|
140 void ConstructL(); |
|
141 |
|
142 public: |
|
143 |
|
144 TBool iProfileDisabled; |
|
145 mutable TBool iProfileEnabled; |
|
146 |
|
147 private: |
|
148 |
|
149 CSIP& iSip; |
|
150 MSIPConnectionObserver* iConnectionObserver; |
|
151 |
|
152 }; |
|
153 |
|
154 #endif // CSIPPROFILEREGISTRY_H |