|
1 /* |
|
2 * Copyright (c) 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: Provisioning item for parsing and saving Presence settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __PRESPROVITEM_H__ |
|
22 #define __PRESPROVITEM_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <CWPAdapter.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CWPCharacteristic; |
|
30 class CWPParameter; |
|
31 class TPresSettingsSet; |
|
32 |
|
33 // Constants |
|
34 _LIT( KPresProvisioningAppId, "ap0002" ); |
|
35 _LIT( KPresProvisioningAppRef, "PRS-APPREF"); |
|
36 _LIT( KPresProvOpenBrack, "(" ); |
|
37 _LIT( KPresProvCloseBrack, ")" ); |
|
38 |
|
39 _LIT(KPresIAppRef, "APPREF"); |
|
40 _LIT(KPresIToAppRef, "TO-APPREF"); |
|
41 _LIT(KPresProvClientObjDataLim, "CLIENT-OBJ-DATA-LIMIT"); |
|
42 _LIT(KPresProvContentSrvUri, "CONTENT-SERVER-URI"); |
|
43 _LIT(KPresProvSrcThPublish, "SOURCE-THROTTLE-PUBLISH"); |
|
44 _LIT(KPresProvMaxPresSubs, "MAX-NUMBER-OF-PRESENCE-SUBSCRIPTIONS"); |
|
45 _LIT(KPresProvMaxPresSubsInLists, "MAX-NUMBER-OF-SUBSCRIPTIONS-IN-PRESENCE-LIST"); |
|
46 _LIT(KPresProvServiceUriTemp, "SERVICE-URI-TEMPLATE"); |
|
47 |
|
48 /** |
|
49 * Provisioning item for parsing and saving Presence settings. Derived from |
|
50 * MWPVisitor as recommended by provisioning framework |
|
51 * |
|
52 * @since S60 3.2 |
|
53 */ |
|
54 class CPresProvItem : public CBase, public MWPVisitor |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 */ |
|
61 static CPresProvItem* NewL(); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CPresProvItem(); |
|
67 |
|
68 |
|
69 public: // From MWPVisitor |
|
70 |
|
71 void VisitL( CWPCharacteristic& aCharacteristic ); |
|
72 |
|
73 void VisitL( CWPParameter& aParameter ); |
|
74 |
|
75 void VisitLinkL( CWPCharacteristic& aLink ); |
|
76 |
|
77 public: |
|
78 |
|
79 /** |
|
80 * Validates the provisioning item for mandatory fields |
|
81 * |
|
82 * @since S60 3.2 |
|
83 * @return ETrue if correct item |
|
84 */ |
|
85 TBool Validate() const; |
|
86 |
|
87 /** |
|
88 * Saves the provisioned settings |
|
89 * |
|
90 * @since S60 3.2 |
|
91 * @return KErrNone if successfull |
|
92 */ |
|
93 TInt SaveL(); |
|
94 |
|
95 /** |
|
96 * Returns name of the provisioning item |
|
97 * |
|
98 * @since S60 3.2 |
|
99 * @return Name or KNullDesC |
|
100 */ |
|
101 const TDesC& Name() const; |
|
102 |
|
103 /** |
|
104 * Returns application id of the provisioning item |
|
105 * |
|
106 * @since S60 3.2 |
|
107 * @return ApplicationId or KNullDesC |
|
108 */ |
|
109 const TDesC& ApplicationId() const; |
|
110 |
|
111 /** |
|
112 * Returns id of the created settings |
|
113 * |
|
114 * @since S60 3.2 |
|
115 * @return The id or KErrNotFound if not yet saved |
|
116 */ |
|
117 TInt PresSetId() const; |
|
118 |
|
119 /** |
|
120 * Returns value of the APPREF of the provisioning item |
|
121 * |
|
122 * @since S60 3.2 |
|
123 * @return iAppRef or KNullDesC |
|
124 */ |
|
125 const TDesC& AppReference() const; |
|
126 |
|
127 /** |
|
128 * Returns the application references from this item to other |
|
129 * applications |
|
130 * |
|
131 * @since S60 3.2 |
|
132 * @return Array of references |
|
133 */ |
|
134 const RArray<TPtrC>& ToAppReferences() const; |
|
135 |
|
136 /** |
|
137 * Sets SIP settings id |
|
138 * |
|
139 * @since S60 3.2 |
|
140 * @param aSipId Settings id |
|
141 */ |
|
142 void SetSipSetIdL(TInt aSipId); |
|
143 |
|
144 /** |
|
145 * Sets XDM settings id |
|
146 * |
|
147 * @since S60 3.2 |
|
148 * @param aXdmId Settings id |
|
149 */ |
|
150 void SetXDMSetIdL(TInt aXdmId); |
|
151 |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * C++ default constructor. |
|
157 */ |
|
158 CPresProvItem(); |
|
159 |
|
160 /** |
|
161 * Determine and save named parameter |
|
162 * |
|
163 * @since S60 3.2 |
|
164 * @param aName Name of the parameter |
|
165 * @param aValue Value of the parameter |
|
166 */ |
|
167 void DetermineNamedParameter( const TDesC& aName, const TDesC& aValue ); |
|
168 |
|
169 /** |
|
170 * Check presence settings duplicate names, provide alternate name |
|
171 * if necessary. |
|
172 * |
|
173 * @since S60 3.2 |
|
174 * @param aSetId presence id, accepts KErrNotFound for new sets |
|
175 * @param aSetName presence set name, suggested name returns here |
|
176 * @return none |
|
177 */ |
|
178 void CheckDuplicateNameL(TDes& aSetName, const TInt& aSetId); |
|
179 |
|
180 /** |
|
181 * Des to Int |
|
182 * |
|
183 * @since S60 3.2 |
|
184 * @param aSourceDes Descriptor to convert |
|
185 * @return TInt |
|
186 */ |
|
187 TInt DesToInt(const TDesC& aSourceDes) const; |
|
188 |
|
189 /** |
|
190 * Checks if there is ordinal numbering at the end of |
|
191 * descriptor and rips it off if there is. |
|
192 * |
|
193 * @param aName pointer to source descriptor |
|
194 * @return HBufC* containing the name ready for the numbering |
|
195 */ |
|
196 HBufC* GetPrefixL(HBufC* aName); |
|
197 |
|
198 |
|
199 private: |
|
200 |
|
201 |
|
202 // The allocated id for the saved settings |
|
203 TInt iPresSetId; |
|
204 |
|
205 // Just used for validation, not to save |
|
206 TPtrC iAppId; |
|
207 |
|
208 // Set Items to be saved |
|
209 TPtrC iSetName; |
|
210 TInt iSipProfile; |
|
211 TInt iXDMSetting; |
|
212 TInt iObjectSize; |
|
213 TPtrC iContSrvrAdd; |
|
214 TInt iPublicationInt; |
|
215 TInt iMaxSubscriptions; |
|
216 TInt iMaxContactsInList; |
|
217 TPtrC iDomainSyntax; |
|
218 TPtrC iProviderID; |
|
219 |
|
220 |
|
221 // TO-APPREF |
|
222 TPtrC iAppRef; |
|
223 |
|
224 // TO-XDM |
|
225 TPtrC iToXdmSet; |
|
226 |
|
227 // TO-SIP |
|
228 TPtrC iToSipProfile; |
|
229 |
|
230 // Flag indicating wheather settings are saved |
|
231 TBool iSettingsSaved; |
|
232 |
|
233 // Application references |
|
234 RArray<TPtrC> iToAppReferences; |
|
235 |
|
236 }; |
|
237 |
|
238 #endif // __PRESPROVITEM_H__ |
|
239 |
|
240 // End of File |
|
241 |
|
242 |
|
243 |
|
244 |