|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef CMTPTYPEOBJECTPROPDESC_H |
|
23 #define CMTPTYPEOBJECTPROPDESC_H |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <mtp/rmtptype.h> |
|
27 #include <mtp/cmtptypecompoundbase.h> |
|
28 #include <mtp/cmtptypeinterdependentpropdesc.h> |
|
29 |
|
30 |
|
31 |
|
32 class CMTPTypeServiceObjPropExtnForm; |
|
33 class CMTPTypeServiceMethodParamExtnForm; |
|
34 /** |
|
35 Defines the MTP ObjectPropDesc dataset. The ObjectPropDesc dataset describes |
|
36 an MTP data object property, and is generated in response to a |
|
37 GetObjectPropDesc operation request. |
|
38 @publishedPartner |
|
39 @released |
|
40 */ |
|
41 class CMTPTypeObjectPropDesc : public CMTPTypeCompoundBase |
|
42 { |
|
43 friend class CMTPTypeServiceObjPropExtnForm; |
|
44 friend class CMTPTypeServiceMethodParamExtnForm; |
|
45 friend class CMTPTypeServicePropDesc; |
|
46 public: |
|
47 |
|
48 /** |
|
49 MTP ObjectPropDesc dataset element identifiers. |
|
50 */ |
|
51 enum TMTPObjectPropDescElement |
|
52 { |
|
53 /** |
|
54 Property Code (read-only). |
|
55 */ |
|
56 EPropertyCode, |
|
57 |
|
58 /** |
|
59 Datatype (read-only). |
|
60 */ |
|
61 EDatatype, |
|
62 |
|
63 /** |
|
64 Get/Set. |
|
65 */ |
|
66 EGetSet, |
|
67 |
|
68 /** |
|
69 Default Value. |
|
70 */ |
|
71 EDefaultValue, |
|
72 |
|
73 /** |
|
74 Group Code. |
|
75 */ |
|
76 EGroupCode, |
|
77 |
|
78 /** |
|
79 Form Flag (read-only). |
|
80 */ |
|
81 EFormFlag, |
|
82 |
|
83 /** |
|
84 FORM element. This element depends EFormFlag and is absent if EFormFlag |
|
85 is ENone. |
|
86 */ |
|
87 EForm, |
|
88 |
|
89 /** |
|
90 The number of dataset elements. |
|
91 */ |
|
92 ENumElements, |
|
93 }; |
|
94 |
|
95 /** |
|
96 MTP ObjectPropDesc dataset Get/Set element values. |
|
97 */ |
|
98 enum TMTPObjectPropDescGetSet |
|
99 { |
|
100 |
|
101 /** |
|
102 Get. |
|
103 */ |
|
104 EReadOnly = 0x00, |
|
105 |
|
106 /** |
|
107 Get/Set. |
|
108 */ |
|
109 EReadWrite = 0x01 |
|
110 }; |
|
111 |
|
112 /** |
|
113 MTP ObjectPropDesc dataset FormFlag element values. |
|
114 */ |
|
115 enum TMTPObjectPropDescFormFlag |
|
116 { |
|
117 /** |
|
118 None. |
|
119 */ |
|
120 ENone = 0x00, |
|
121 |
|
122 /** |
|
123 Range form. |
|
124 */ |
|
125 ERangeForm = 0x01, |
|
126 |
|
127 /** |
|
128 Enumeration form. |
|
129 */ |
|
130 EEnumerationForm = 0x02, |
|
131 |
|
132 /** |
|
133 DateTime form. |
|
134 */ |
|
135 EDateTimeForm = 0x03, |
|
136 |
|
137 /** |
|
138 Fixed-length Array form. |
|
139 */ |
|
140 EFixedLengthArrayForm = 0x04, |
|
141 |
|
142 /** |
|
143 Regular Expression form. |
|
144 */ |
|
145 ERegularExpressionForm = 0x05, |
|
146 |
|
147 /** |
|
148 ByteArray form. |
|
149 */ |
|
150 EByteArrayForm = 0x06, |
|
151 |
|
152 /** |
|
153 * Service Object Property Extension Form |
|
154 */ |
|
155 EServiceObjPropExtnForm = 0x81, |
|
156 |
|
157 /** |
|
158 * Service Method Parameter Extension Form |
|
159 */ |
|
160 EServiceMethodParamExtnForm = 0x82, |
|
161 |
|
162 /** |
|
163 * Object ID Form |
|
164 */ |
|
165 EObjectIDForm = 0x83, |
|
166 |
|
167 /** |
|
168 LongString form. |
|
169 */ |
|
170 ELongStringForm = 0xFF, |
|
171 }; |
|
172 |
|
173 /** |
|
174 Defines the MTP ObjectPropDesc dataset meta data. |
|
175 */ |
|
176 struct TPropertyInfo |
|
177 { |
|
178 /** |
|
179 The property's MTP data type identifier datacode. |
|
180 */ |
|
181 TUint iDataType; |
|
182 |
|
183 /** |
|
184 The FormFlag identifier. |
|
185 */ |
|
186 TUint8 iFormFlag; |
|
187 |
|
188 /** |
|
189 The property's Get/Set flag. |
|
190 */ |
|
191 TUint8 iGetSet; |
|
192 }; |
|
193 |
|
194 public: |
|
195 |
|
196 IMPORT_C static CMTPTypeObjectPropDesc* NewL(); |
|
197 |
|
198 IMPORT_C static CMTPTypeObjectPropDesc* NewL(TUint16 aPropertyCode); |
|
199 IMPORT_C static CMTPTypeObjectPropDesc* NewLC(TUint16 aPropertyCode); |
|
200 |
|
201 IMPORT_C static CMTPTypeObjectPropDesc* NewL(TUint16 aPropertyCode, const MMTPType& aForm); |
|
202 IMPORT_C static CMTPTypeObjectPropDesc* NewLC(TUint16 aPropertyCode, const MMTPType& aForm); |
|
203 |
|
204 IMPORT_C static CMTPTypeObjectPropDesc* NewL(TUint16 aPropertyCode, TUint8 aFormFlag, const MMTPType* aForm); |
|
205 IMPORT_C static CMTPTypeObjectPropDesc* NewLC(TUint16 aPropertyCode, TUint8 aFormFlag, const MMTPType* aForm); |
|
206 |
|
207 IMPORT_C static CMTPTypeObjectPropDesc* NewL(TUint16 aPropertyCode, const TPropertyInfo& aInfo, const MMTPType* aForm); |
|
208 IMPORT_C static CMTPTypeObjectPropDesc* NewLC(TUint16 aPropertyCode, const TPropertyInfo& aInfo, const MMTPType* aForm); |
|
209 |
|
210 IMPORT_C virtual ~CMTPTypeObjectPropDesc(); |
|
211 |
|
212 public: // From CMTPTypeCompoundBase |
|
213 |
|
214 IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk); |
|
215 IMPORT_C TInt NextWriteChunk(TPtr8& aChunk); |
|
216 IMPORT_C TUint Type() const; |
|
217 IMPORT_C TBool CommitRequired() const; |
|
218 IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk); |
|
219 |
|
220 public: |
|
221 |
|
222 static void PropertyInfoL(TUint16 aPropertyCode, TPropertyInfo& aInfo); |
|
223 |
|
224 private: // From CMTPTypeCompoundBase |
|
225 |
|
226 const TElementInfo& ElementInfo(TInt aElementId) const; |
|
227 TBool ReadableElementL(TInt aElementId) const; |
|
228 TBool WriteableElementL(TInt aElementId) const; |
|
229 |
|
230 private: |
|
231 |
|
232 /* |
|
233 Defines the MTP ObjectPropDesc FORM dataset. The FORM dataset is a |
|
234 component element of the ObjectPropDesc dataset. |
|
235 @internalComponent |
|
236 */ |
|
237 class RMTPTypeObjectPropDescForm : public RMTPType |
|
238 { |
|
239 public: |
|
240 |
|
241 RMTPTypeObjectPropDescForm(); |
|
242 |
|
243 void SetMeta(TUint8 aFormFlag, TUint aDataType); |
|
244 |
|
245 private: |
|
246 |
|
247 MMTPType* CreateL(TUint aDataType); |
|
248 void Destroy(MMTPType* aType); |
|
249 |
|
250 private: |
|
251 |
|
252 /** |
|
253 The FORM dataset's MTP datatype code. |
|
254 */ |
|
255 TUint iDataType; |
|
256 |
|
257 /** |
|
258 The FORM dataset's FormFlag code. |
|
259 */ |
|
260 TUint8 iFormFlag; |
|
261 }; |
|
262 |
|
263 private: |
|
264 |
|
265 friend MMTPType* CMTPTypeInterdependentProperties::CommitChunkL(TPtr8& aChunk); |
|
266 static CMTPTypeObjectPropDesc* NewLC(); |
|
267 |
|
268 CMTPTypeObjectPropDesc(); |
|
269 void ConstructL(TUint16 aPropertyCode, const MMTPType* aForm); |
|
270 void ConstructL(TUint16 aPropertyCode, const TPropertyInfo& aInfo, const MMTPType* aForm); |
|
271 |
|
272 TBool HasFormField(TUint8 aFormFlag) const; |
|
273 TInt UpdateWriteSequenceErr(TInt aErr); |
|
274 |
|
275 private: // Owned |
|
276 |
|
277 /** |
|
278 The write data stream states. |
|
279 */ |
|
280 enum TWriteSequenceState |
|
281 { |
|
282 /** |
|
283 Data stream is inactive. |
|
284 */ |
|
285 EIdle, |
|
286 |
|
287 /** |
|
288 Streaming the first flat data chunk. |
|
289 */ |
|
290 EFlat1Chunk, |
|
291 |
|
292 /** |
|
293 Streaming the EDefaultValue data chunk.. |
|
294 */ |
|
295 EDefaultValueChunk, |
|
296 |
|
297 /** |
|
298 Streaming the second flat data chunk. |
|
299 */ |
|
300 EFlat2Chunk, |
|
301 |
|
302 /** |
|
303 Streaming the EForm data chunk. |
|
304 */ |
|
305 EFormChunk |
|
306 }; |
|
307 |
|
308 /** |
|
309 Data chunk identifiers. |
|
310 */ |
|
311 enum TChunkIds |
|
312 { |
|
313 /** |
|
314 The first flat data chunk ID. |
|
315 */ |
|
316 EIdFlat1Chunk, |
|
317 |
|
318 /** |
|
319 The EDefaultValue element data chunk ID. |
|
320 */ |
|
321 EIdDefaultValueChunk, |
|
322 |
|
323 /** |
|
324 The second flat data chunk ID. |
|
325 */ |
|
326 EIdFlat2Chunk, |
|
327 |
|
328 /** |
|
329 The EForm element data chunk ID. |
|
330 */ |
|
331 EIdFormChunk, |
|
332 |
|
333 /** |
|
334 The number of data chunks. |
|
335 */ |
|
336 EIdNumChunks |
|
337 }; |
|
338 |
|
339 /** |
|
340 The write data stream error state. |
|
341 */ |
|
342 TUint iWriteSequenceErr; |
|
343 |
|
344 /** |
|
345 The write data stream state variable. |
|
346 */ |
|
347 TUint iWriteSequenceState; |
|
348 |
|
349 /** |
|
350 The write data stream completion state. This will be set to EFlat2Chunk for |
|
351 ObjectPropDesc datasets with an EForm of ENone, otherwise this will be |
|
352 EFormChunk. |
|
353 */ |
|
354 TUint iWriteSequenceCompletionState; |
|
355 |
|
356 /** |
|
357 The dataset element metadata table content. |
|
358 */ |
|
359 static const CMTPTypeCompoundBase::TElementInfo iElementMetaData[]; |
|
360 |
|
361 /** |
|
362 The dataset element metadata table. |
|
363 */ |
|
364 const TFixedArray<TElementInfo, ENumElements> iElementInfo; |
|
365 |
|
366 /** |
|
367 The initialised flag indicating if construction is completeand that |
|
368 read-only elements can no longer be modified. |
|
369 */ |
|
370 TBool iInitialised; |
|
371 |
|
372 /** |
|
373 The size in bytes of the first flat data chunk. |
|
374 */ |
|
375 static const TUint KFlat1ChunkSize; |
|
376 |
|
377 /** |
|
378 The size in bytes of the second flat data chunk. |
|
379 */ |
|
380 static const TUint KFlat2ChunkSize; |
|
381 |
|
382 /** |
|
383 The data chunk count of ObjectPropDesc datasets with an EForm of other than |
|
384 ENone. |
|
385 */ |
|
386 static const TUint KNumChunksWithForm; |
|
387 |
|
388 /** |
|
389 The data chunk count of ObjectPropDesc datasets with an EForm of ENone. |
|
390 */ |
|
391 static const TUint KNumChunksWithoutForm; |
|
392 |
|
393 /** |
|
394 The flat data chunk comprising elements EPropertyCode to EGetSet. |
|
395 */ |
|
396 RMTPTypeCompoundFlatChunk iChunkFlat1; |
|
397 |
|
398 /** |
|
399 The EDefaultValue element data chunk. |
|
400 */ |
|
401 RMTPType iChunkDefaultValue; |
|
402 |
|
403 /** |
|
404 The flat data chunk comprising elements EGroupCode to EFormFlag. |
|
405 */ |
|
406 RMTPTypeCompoundFlatChunk iChunkFlat2; |
|
407 |
|
408 /** |
|
409 The EForm element data chunk. |
|
410 */ |
|
411 RMTPTypeObjectPropDescForm iChunkForm; |
|
412 }; |
|
413 |
|
414 /** |
|
415 Defines the MTP ObjectPropDesc Enumeration FORM dataset. The Enumeration FORM |
|
416 dataset is a component element of the ObjectPropDesc dataset. |
|
417 @see CMTPTypeObjectPropDesc |
|
418 @publishedPartner |
|
419 @released |
|
420 */ |
|
421 class CMTPTypeObjectPropDescEnumerationForm : public CMTPTypeCompoundBase |
|
422 { |
|
423 |
|
424 public: |
|
425 |
|
426 IMPORT_C static CMTPTypeObjectPropDescEnumerationForm* NewL(TUint aDataType); |
|
427 IMPORT_C static CMTPTypeObjectPropDescEnumerationForm* NewLC(TUint aDataType); |
|
428 |
|
429 IMPORT_C virtual ~CMTPTypeObjectPropDescEnumerationForm(); |
|
430 |
|
431 IMPORT_C void AppendSupportedValueL(const MMTPType& aValue); |
|
432 |
|
433 IMPORT_C TUint16 NumberOfValues() const; |
|
434 IMPORT_C void SupportedValueL(TUint aIndex, MMTPType& aValue) const; |
|
435 |
|
436 public: // From CMTPTypeCompoundBase |
|
437 |
|
438 IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk); |
|
439 IMPORT_C TInt NextWriteChunk(TPtr8& aChunk); |
|
440 IMPORT_C TUint Type() const; |
|
441 IMPORT_C TBool CommitRequired() const; |
|
442 IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk); |
|
443 |
|
444 private: // From CMTPTypeCompoundBase |
|
445 |
|
446 const TElementInfo& ElementInfo(TInt aElementId) const; |
|
447 TInt ValidateChunkCount() const; |
|
448 |
|
449 private: |
|
450 |
|
451 CMTPTypeObjectPropDescEnumerationForm(TUint aDataType); |
|
452 void ConstructL(); |
|
453 |
|
454 void AppendValueChunkL(); |
|
455 |
|
456 private: |
|
457 |
|
458 /** |
|
459 The write data stream states. |
|
460 */ |
|
461 enum TReadWriteSequenceState |
|
462 { |
|
463 /** |
|
464 Data stream is inactive. |
|
465 */ |
|
466 EIdle, |
|
467 |
|
468 /** |
|
469 Data stream is in progress. |
|
470 */ |
|
471 EInProgress |
|
472 }; |
|
473 |
|
474 /** |
|
475 The write data stream state variable. |
|
476 */ |
|
477 TUint iWriteSequenceState; |
|
478 |
|
479 /** |
|
480 The NumberOfValues element metadata content. |
|
481 */ |
|
482 CMTPTypeCompoundBase::TElementInfo iInfoNumberOfValues; |
|
483 |
|
484 /** |
|
485 The SupportedValue array elements metadata content. Note that this is |
|
486 declared mutable to allow state updates while processing a read data stream. |
|
487 */ |
|
488 mutable CMTPTypeCompoundBase::TElementInfo iInfoValue; |
|
489 |
|
490 /** |
|
491 The NumberOfValues element data chunk ID. |
|
492 */ |
|
493 static const TUint KNumberOfValuesChunk; |
|
494 |
|
495 /** |
|
496 The SupportedValue array elements metadata content. Note that this is |
|
497 declared mutable to allow state updates while processing a read data stream. |
|
498 */ |
|
499 static const TUint KValueChunks; |
|
500 |
|
501 /** |
|
502 The NumberOfPropDescs element data chunk. |
|
503 */ |
|
504 TMTPTypeUint16 iChunkNumberOfValues; |
|
505 |
|
506 /** |
|
507 The SupportedValue elements array data chunks. |
|
508 */ |
|
509 RArray<RMTPType> iChunksValue; |
|
510 }; |
|
511 |
|
512 /** |
|
513 Defines the MTP ObjectPropDesc Range FORM dataset. The Range FORM dataset is a |
|
514 component element of the ObjectPropDesc dataset. |
|
515 @see CMTPTypeObjectPropDesc |
|
516 @publishedPartner |
|
517 @released |
|
518 */ |
|
519 class CMTPTypeObjectPropDescRangeForm : public CMTPTypeCompoundBase |
|
520 { |
|
521 public: |
|
522 |
|
523 /** |
|
524 MTP ObjectPropDesc Range FORM element dataset identifiers. |
|
525 */ |
|
526 enum TMTPObjectPropDescElement |
|
527 { |
|
528 /** |
|
529 Minimum Value. |
|
530 */ |
|
531 EMinimumValue, |
|
532 |
|
533 /** |
|
534 Maximum Value. |
|
535 */ |
|
536 EMaximumValue, |
|
537 |
|
538 /** |
|
539 Step Size. |
|
540 */ |
|
541 EStepSize, |
|
542 |
|
543 /** |
|
544 The number of dataset elements. |
|
545 */ |
|
546 ENumElements, |
|
547 }; |
|
548 |
|
549 public: |
|
550 |
|
551 IMPORT_C static CMTPTypeObjectPropDescRangeForm* NewL(TUint aDataType); |
|
552 IMPORT_C static CMTPTypeObjectPropDescRangeForm* NewLC(TUint aDataType); |
|
553 |
|
554 IMPORT_C virtual ~CMTPTypeObjectPropDescRangeForm(); |
|
555 |
|
556 public: // From CMTPTypeCompoundBase |
|
557 |
|
558 IMPORT_C TUint Type() const; |
|
559 |
|
560 private: // From CMTPTypeCompoundBase |
|
561 |
|
562 const TElementInfo& ElementInfo(TInt aElementId) const; |
|
563 |
|
564 private: |
|
565 |
|
566 CMTPTypeObjectPropDescRangeForm(TUint aDataType); |
|
567 void ConstructL(); |
|
568 |
|
569 private: |
|
570 |
|
571 /** |
|
572 The element metadata content. |
|
573 */ |
|
574 mutable CMTPTypeCompoundBase::TElementInfo iInfoBuf; |
|
575 |
|
576 /** |
|
577 The property's MTP data type identifier datacode. |
|
578 */ |
|
579 TUint iDataType; |
|
580 |
|
581 /** |
|
582 The element data chunks. |
|
583 */ |
|
584 RArray<RMTPType> iChunks; |
|
585 }; |
|
586 |
|
587 #endif // CMTPTYPEOBJECTPROPDESC_H |