|
1 // Copyright (c) 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 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef MTPIMAGEDPCONST_H |
|
22 #define MTPIMAGEDPCONST_H |
|
23 |
|
24 #include <e32std.h> |
|
25 |
|
26 #include <mtp/mtpprotocolconstants.h> |
|
27 #include <comms-infras/commsdebugutility.h> // for __FLOG debugging |
|
28 |
|
29 // for thumb creation |
|
30 const TUint32 KThumbWidht=160; |
|
31 const TUint32 KThumbHeigth=120; |
|
32 const TUint32 KThumbCompressedSize=KThumbWidht * KThumbHeigth * 4; // from TNM |
|
33 const TUint32 KThumbFormatCode = 0x3801; |
|
34 const TUint32 KFileSizeMax = 10 * 1000 * 1000; |
|
35 |
|
36 _LIT(KJpegMimeType, "image/jpeg"); |
|
37 _LIT8(KPtpMimeJPEG, "image/jpeg"); |
|
38 |
|
39 /** |
|
40 Define all the operations that are supported by the picture data provider |
|
41 */ |
|
42 static const TUint16 KMTPImageDpSupportedOperations[] = |
|
43 { |
|
44 EMTPOpCodeGetObjectInfo, |
|
45 EMTPOpCodeGetObject, |
|
46 EMTPOpCodeGetPartialObject, |
|
47 EMTPOpCodeGetThumb, |
|
48 EMTPOpCodeDeleteObject, |
|
49 EMTPOpCodeSendObjectInfo, |
|
50 EMTPOpCodeSendObject, |
|
51 EMTPOpCodeMoveObject, |
|
52 EMTPOpCodeCopyObject, |
|
53 EMTPOpCodeGetObjectReferences, |
|
54 |
|
55 //MTP op codes |
|
56 EMTPOpCodeGetObjectPropsSupported, |
|
57 EMTPOpCodeGetObjectPropDesc, |
|
58 EMTPOpCodeGetObjectPropValue, |
|
59 EMTPOpCodeSetObjectPropValue, |
|
60 EMTPOpCodeSetObjectReferences, |
|
61 |
|
62 //MTP enhanced operation codes |
|
63 EMTPOpCodeGetObjectPropList, |
|
64 EMTPOpCodeSetObjectPropList, |
|
65 EMTPOpCodeSendObjectPropList, |
|
66 |
|
67 EMTPOpCodeGetFormatCapabilities, |
|
68 |
|
69 //Deprecated operation |
|
70 EMTPOpCodeSetObjectProtection |
|
71 }; |
|
72 |
|
73 /** |
|
74 Define all the object properties that are supported by the picture data provider |
|
75 */ |
|
76 static const TUint16 KMTPImageDpSupportedProperties[] = |
|
77 { |
|
78 //Stored in MTP MetaData Object |
|
79 EMTPObjectPropCodeStorageID, |
|
80 EMTPObjectPropCodeObjectFormat, |
|
81 EMTPObjectPropCodeProtectionStatus, |
|
82 EMTPObjectPropCodeObjectFileName, |
|
83 EMTPObjectPropCodeParentObject, |
|
84 EMTPObjectPropCodePersistentUniqueObjectIdentifier, |
|
85 |
|
86 //Stored in MDE object |
|
87 EMTPObjectPropCodeName, |
|
88 EMTPObjectPropCodeObjectSize, |
|
89 EMTPObjectPropCodeDateCreated, |
|
90 EMTPObjectPropCodeDateModified, |
|
91 EMTPObjectPropCodeWidth, |
|
92 EMTPObjectPropCodeHeight, |
|
93 EMTPObjectPropCodeImageBitDepth, |
|
94 EMTPObjectPropCodeRepresentativeSampleFormat, |
|
95 EMTPObjectPropCodeRepresentativeSampleSize, |
|
96 EMTPObjectPropCodeRepresentativeSampleHeight, |
|
97 EMTPObjectPropCodeRepresentativeSampleWidth, |
|
98 EMTPObjectPropCodeNonConsumable |
|
99 }; |
|
100 |
|
101 /** |
|
102 Define the supported property group number . |
|
103 */ |
|
104 static const TUint16 KMTPImageDpPropertyGroupOneNumber = 1; |
|
105 |
|
106 /** |
|
107 Define the group one supported properties. |
|
108 The properties in group one are same as all properties which image dp supported, |
|
109 It can avoid PC get all properties and group one properties twice while sendobjectproplist/sendobject |
|
110 */ |
|
111 static const TUint16 KMTPImageDpGroupOneProperties[] = |
|
112 { |
|
113 //Stored in MTP MetaData Object |
|
114 EMTPObjectPropCodeStorageID, |
|
115 EMTPObjectPropCodeObjectFormat, |
|
116 EMTPObjectPropCodeProtectionStatus, |
|
117 EMTPObjectPropCodeObjectFileName, |
|
118 EMTPObjectPropCodeParentObject, |
|
119 EMTPObjectPropCodePersistentUniqueObjectIdentifier, |
|
120 |
|
121 //Stored in MDE object |
|
122 EMTPObjectPropCodeName, |
|
123 EMTPObjectPropCodeNonConsumable, |
|
124 EMTPObjectPropCodeObjectSize, |
|
125 EMTPObjectPropCodeDateCreated, |
|
126 EMTPObjectPropCodeDateModified, |
|
127 EMTPObjectPropCodeWidth, |
|
128 EMTPObjectPropCodeHeight, |
|
129 EMTPObjectPropCodeImageBitDepth, |
|
130 EMTPObjectPropCodeRepresentativeSampleFormat, |
|
131 EMTPObjectPropCodeRepresentativeSampleSize, |
|
132 EMTPObjectPropCodeRepresentativeSampleHeight, |
|
133 EMTPObjectPropCodeRepresentativeSampleWidth |
|
134 }; |
|
135 |
|
136 /** |
|
137 Define the group one supported property number. |
|
138 */ |
|
139 static const TUint16 KMTPImageDpGroupOneSize = sizeof(KMTPImageDpGroupOneProperties)/sizeof(KMTPImageDpGroupOneProperties[0]); |
|
140 |
|
141 /** |
|
142 Define all events that are supported by the picture data provider |
|
143 */ |
|
144 static const TUint16 KMTPImageDpSupportedEvents[] = |
|
145 { |
|
146 EMTPEventCodeObjectAdded, |
|
147 EMTPEventCodeObjectRemoved, |
|
148 EMTPEventCodeObjectInfoChanged |
|
149 }; |
|
150 |
|
151 static const TUint32 KPtpNoValue = 0xFFFFFF00; |
|
152 |
|
153 static const TInt KExtensionBufferSize=5; //related to the size of strings in SMTPValidCodeExtensionMapping |
|
154 typedef TBufC<KExtensionBufferSize> TMTPImageFileExtension; |
|
155 |
|
156 // extensions of image files that are shared via MTP Picture Data Provider |
|
157 struct SMTPValidCodeExtensionMapping |
|
158 { |
|
159 public: |
|
160 TMTPFormatCode iFormatCode; |
|
161 const TText* iExtension; |
|
162 }; |
|
163 |
|
164 // Note when adding extensions: |
|
165 // same value for iExtension can be in the file only once, |
|
166 // values for iFormatCode code can be multiple times |
|
167 |
|
168 #if defined(_UNICODE) |
|
169 #define CASTING(a) ((const TText*)L ## a) |
|
170 #else |
|
171 #define CASTING(a) ((const TText*)(a)) |
|
172 #endif |
|
173 |
|
174 static const SMTPValidCodeExtensionMapping KMTPValidCodeExtensionMappings[] = |
|
175 { |
|
176 {EMTPFormatCodeEXIFJPEG, CASTING("jpg")}, // jpeg |
|
177 {EMTPFormatCodeEXIFJPEG, CASTING("jpe")}, // jpeg |
|
178 {EMTPFormatCodeEXIFJPEG, CASTING("jpeg")} // jpeg |
|
179 }; |
|
180 |
|
181 /** |
|
182 Defines the image dp parameters. |
|
183 */ |
|
184 enum TImageDpParameter |
|
185 { |
|
186 /** |
|
187 This parameter defines the new images property value. |
|
188 |
|
189 This parameter value can be retrieved as an @see TInt value. |
|
190 */ |
|
191 ENewImagesCount = 0x00000000, |
|
192 }; |
|
193 |
|
194 #endif // MTPIMAGEDPCONST_H |
|
195 |