|
1 /* |
|
2 * Copyright (c) 2004 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: Attribute model implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPENGPRESENCEATTRMODEL_H |
|
19 #define CPENGPRESENCEATTRMODEL_H |
|
20 |
|
21 //INCLUDES |
|
22 #include "MPEngPresenceAdvancedAttrModel2.h" |
|
23 #include "MPEngPresenceAttrModel2.h" |
|
24 #include "MPEngPresenceAttrManager.h" |
|
25 #include <E32Base.h> |
|
26 |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MPEngPresenceAttrModelTypeImp; |
|
31 class CPEngPresenceAttrConstructor; |
|
32 class CPEngAttrModelAsyncDataSetHook; |
|
33 class CPEngPresenceAttrModelStorageProxy; |
|
34 |
|
35 |
|
36 |
|
37 /** |
|
38 * Attribute model implementation. |
|
39 * |
|
40 * @lib PEngAttrLib |
|
41 * @since 3.0 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CPEngPresenceAttrModel ) : public CBase, |
|
44 public MPEngPresenceAdvancedAttrModel2 |
|
45 { |
|
46 public: // Construction |
|
47 |
|
48 /** |
|
49 * Instantiates CPEngPresenceAttrModel object. |
|
50 * |
|
51 * @param aTypeConstruct The attribute type specific construct. |
|
52 * @return New CPEngPresenceAttrModel instance. |
|
53 */ |
|
54 static CPEngPresenceAttrModel* NewL( |
|
55 CPEngPresenceAttrConstructor& aTypeConstructor, |
|
56 const TDesC& aPresenceID, |
|
57 MPEngPresenceAttrModelTypeImp* aTypeImp ); |
|
58 |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 * Virtual by CBase. |
|
63 */ |
|
64 ~CPEngPresenceAttrModel(); |
|
65 |
|
66 |
|
67 |
|
68 private: |
|
69 |
|
70 /** |
|
71 * C++ default constructor. |
|
72 */ |
|
73 CPEngPresenceAttrModel( CPEngPresenceAttrConstructor& aTypeConstructor ); |
|
74 |
|
75 |
|
76 /** |
|
77 * Symbian OS constructor. |
|
78 */ |
|
79 void ConstructL( const TDesC& aPresenceID ); |
|
80 |
|
81 |
|
82 |
|
83 public: // Functions from MPEngPresenceAttrModel2 |
|
84 |
|
85 |
|
86 /** |
|
87 * From MPEngPresenceAttrModel2. |
|
88 * |
|
89 * Attribute type details. |
|
90 * @since 3.0 |
|
91 */ |
|
92 TUint32 Type() const; |
|
93 const MPEngPresenceAttrTypeProperties2& TypeProperties() const; |
|
94 |
|
95 |
|
96 /** |
|
97 * From MPEngPresenceAttrModel2. |
|
98 * |
|
99 * Attribute instance details. |
|
100 * @since 3.0 |
|
101 */ |
|
102 const TDesC& PresenceID() const; |
|
103 TPEngAttrDataSource DataSource() const; |
|
104 |
|
105 |
|
106 /** |
|
107 * From MPEngPresenceAttrModel2. |
|
108 * |
|
109 * Attribute data getters. |
|
110 * @since 3.0 |
|
111 */ |
|
112 TBool Qualifier() const; |
|
113 TInt DataInt( TInt aField, |
|
114 TInt aGroup ) const; |
|
115 |
|
116 const TPtrC8 DataDesC8( TInt aField, |
|
117 TInt aGroup ) const; |
|
118 |
|
119 const TPtrC16 DataDesC16( TInt aField, |
|
120 TInt aGroup ) const; |
|
121 |
|
122 |
|
123 |
|
124 /** |
|
125 * From MPEngPresenceAttrModel2. |
|
126 * |
|
127 * Attribute data setters. |
|
128 * @since 3.0 |
|
129 */ |
|
130 void SetQualifier( TBool aQualifier ); |
|
131 void SetDataIntL( TInt aData, |
|
132 TInt aField, |
|
133 TInt aGroup ); |
|
134 |
|
135 void SetDataDesC8L( const TDesC8& aData, |
|
136 TInt aField, |
|
137 TInt aGroup ); |
|
138 |
|
139 void SetDataDesC16L( const TDesC16& aData, |
|
140 TInt aField, |
|
141 TInt aGroup ); |
|
142 |
|
143 |
|
144 /** |
|
145 * From MPEngPresenceAttrModel2. |
|
146 * |
|
147 * Attribute async data setters. |
|
148 * @since 3.0 |
|
149 */ |
|
150 void SetDataDesC8AsyncL( const TDesC8& aData, |
|
151 TRequestStatus& aRequestStatus, |
|
152 TInt aField, |
|
153 TInt aGroup ); |
|
154 |
|
155 void SetDataDesC16AsyncL( const TDesC16& aData, |
|
156 TRequestStatus& aRequestStatus, |
|
157 TInt aField, |
|
158 TInt aGroup ); |
|
159 |
|
160 |
|
161 /** |
|
162 * From MPEngPresenceAttrModel2. |
|
163 * |
|
164 * Attribute async data set cancel. |
|
165 * @since 3.0 |
|
166 */ |
|
167 void CancelSetDataAsync(); |
|
168 |
|
169 |
|
170 |
|
171 /** |
|
172 * From MPEngPresenceAttrModel2. |
|
173 * |
|
174 * Extensions interfaces. |
|
175 * @since 3.0 |
|
176 */ |
|
177 const MPEngAttrModelExtension2* Extension() const; |
|
178 MPEngAttrModelExtension2* Extension(); |
|
179 TAny* TypeExtension( TUint32 aType ); |
|
180 |
|
181 |
|
182 |
|
183 /** |
|
184 * From MPEngPresenceAttrModel2. |
|
185 * |
|
186 * Presence Engine internal interface. |
|
187 * @since 3.0 |
|
188 */ |
|
189 const MPEngPresenceAdvancedAttrModel2* Advanced() const; |
|
190 MPEngPresenceAdvancedAttrModel2* Advanced(); |
|
191 |
|
192 |
|
193 |
|
194 /** |
|
195 * From MPEngPresenceAttrModel2. |
|
196 * |
|
197 * Clone support . |
|
198 * @since 3.0 |
|
199 */ |
|
200 MPEngPresenceAttrModel2* CloneLC() const; |
|
201 |
|
202 |
|
203 |
|
204 /** |
|
205 * From MPEngPresenceAttrModel2. |
|
206 * |
|
207 * Cleanup support . |
|
208 * @since 3.0 |
|
209 */ |
|
210 void Close(); |
|
211 |
|
212 |
|
213 |
|
214 public: //From MPEngPresenceAdvancedAttrModel2 |
|
215 |
|
216 |
|
217 /** |
|
218 * From MPEngPresenceAdvancedAttrModel2. |
|
219 * |
|
220 * @since 3.0 |
|
221 */ |
|
222 void EncodeToXmlL( MPEngXMLSerializer& aSerializer ) const; |
|
223 void DecodeFromXmlL( MPEngXMLParser& aParser, |
|
224 const TDesC8& aDataBlock ); |
|
225 |
|
226 const CPEngPresenceAttrModelStorageProxy& Storage() const; |
|
227 CPEngPresenceAttrModelStorageProxy& Storage(); |
|
228 |
|
229 |
|
230 TInt ExternalizeSize() const; |
|
231 void ExternalizeL( RWriteStream& aStream ) const; |
|
232 void InternalizeL( RReadStream& aStream ); |
|
233 |
|
234 |
|
235 void HandleAttributeUpdatedToNetwork(); |
|
236 void HandleNetworkSessionStateChangeL( TBool aSessionOpen ); |
|
237 |
|
238 |
|
239 private: //Helpers |
|
240 |
|
241 |
|
242 /** |
|
243 * Lazy initializes the async set hook. |
|
244 * @since 3.0 |
|
245 */ |
|
246 void LazyInitAsyncSetHookL(); |
|
247 |
|
248 |
|
249 |
|
250 private: // Base model maintained attribute data |
|
251 |
|
252 |
|
253 //REF: Model type constructor |
|
254 CPEngPresenceAttrConstructor& iTypeConstructor; |
|
255 |
|
256 //OWN: Async set hook. Lazy initialized when needed. |
|
257 CPEngAttrModelAsyncDataSetHook* iAsyncSetHook; |
|
258 |
|
259 //OWN: Model storage proxy |
|
260 CPEngPresenceAttrModelStorageProxy* iStorage; |
|
261 |
|
262 //OWN: Attribute instances presence Id |
|
263 HBufC* iPresenceId; |
|
264 |
|
265 //OWN: Attribute data source |
|
266 TPEngAttrDataSource iDataSource; |
|
267 |
|
268 //OWN: Attribute qualifier value |
|
269 TBool iQualifier; |
|
270 |
|
271 //OWN: Attribute model type instance |
|
272 MPEngPresenceAttrModelTypeImp* iTypeImp; |
|
273 |
|
274 }; |
|
275 |
|
276 #endif // CPENGPRESENCEATTRMODEL_H |
|
277 |
|
278 // End of File |
|
279 |