|
1 /* |
|
2 * Copyright (c) 2009 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: Definition for MTP Utility File |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MMMTPDPUTILITY_H |
|
20 #define MMMTPDPUTILITY_H |
|
21 |
|
22 #include <mtp/mtpprotocolconstants.h> |
|
23 |
|
24 #include "mmmtpdpfiledefs.h" |
|
25 |
|
26 // forward declacration |
|
27 class CMTPObjectMetaData; |
|
28 class MMTPDataProviderFramework; |
|
29 |
|
30 class MmMtpDpUtility |
|
31 { |
|
32 public: |
|
33 /** |
|
34 * Utility function to get the type of an object from the filename |
|
35 * @param aFullFileName, full path of file name |
|
36 * @return TMTPFormatCode for the passed file name |
|
37 */ |
|
38 IMPORT_C static TMTPFormatCode FormatFromFilename( const TDesC& aFullFileName ); |
|
39 |
|
40 /** |
|
41 * Utility function to decide if has metadata |
|
42 * @param aObjFormatCode, object format code |
|
43 * @return TBool for decide if has metadata |
|
44 */ |
|
45 static TBool HasMetadata( TUint16 aObjFormatCode ); |
|
46 |
|
47 /** |
|
48 * Utility function to decide if the file is video. |
|
49 * @param aFullFileName, the full file name |
|
50 * @return TBool for decide if the file is video |
|
51 */ |
|
52 IMPORT_C static TBool IsVideoL( const TDesC& aFullFileName ); |
|
53 |
|
54 /** |
|
55 * Utility function to decide if the file is video. |
|
56 * For internal use, this is fast version by querying framework DB |
|
57 * @param aFullFileName, the full file name |
|
58 * @param aFramework, the mtp framework instance pointer, default is null |
|
59 * @return TBool for decide if the file is video |
|
60 */ |
|
61 static TBool IsVideoL( const TDesC& aFullFileName, const MMTPDataProviderFramework& aFramework ); |
|
62 |
|
63 /** |
|
64 * Check the filename length to see if it exceeds Symbian 256 limit. |
|
65 * @param aPathName, the path name of the file |
|
66 * @param aFileName, the file to be check |
|
67 * @return TBool for decide if the file name validate |
|
68 */ |
|
69 static TBool ValidateFilename( const TDesC& aPathName, |
|
70 const TDesC& aFileName ); |
|
71 |
|
72 /** |
|
73 * Check the file size, if file doesn't exist, leave |
|
74 * @param aFs, handle of file server session |
|
75 * @param aFileName, fine name |
|
76 * @return TUint64 size for specified file |
|
77 */ |
|
78 static TUint64 GetObjectSizeL( RFs& aFs, const TDesC& aFileName ); |
|
79 |
|
80 /** |
|
81 * Get file date modified info |
|
82 * @param aFs , handle of file server session |
|
83 * @param aFullFileName, fine name |
|
84 * @return TTime for specified file |
|
85 */ |
|
86 static TTime GetObjectDateModifiedL( RFs& aFs, const TDesC& aFullFileName ); |
|
87 |
|
88 /** |
|
89 * Check if file is read-only, if file doesn't exist, leave |
|
90 * @param aFs , handle of file server session |
|
91 * @param aFullFileName, the file to be check |
|
92 */ |
|
93 static TUint16 GetProtectionStatusL( RFs& aFs, const TDesC& aFullFileName ); |
|
94 |
|
95 /** |
|
96 * Check if prop type and data type match |
|
97 * @param aPropertyCode, the proptery code |
|
98 * @param aDataType, the data type |
|
99 * @param TMTPResponseCode, decide if match |
|
100 */ |
|
101 static TMTPResponseCode CheckPropType( TUint16 aPropertyCode, |
|
102 TUint16 aDataType ); |
|
103 |
|
104 /** |
|
105 * Update object file name |
|
106 * @param aFs |
|
107 * @param aPathName, the path name of the file |
|
108 * @param aFullFileName, the file to be check |
|
109 */ |
|
110 static TInt UpdateObjectFileName( RFs& aFs, |
|
111 const TDesC& aFullFileName, |
|
112 TDes& aNewName ); |
|
113 |
|
114 /** |
|
115 * Get the mime type of file, support mp4/3gp now |
|
116 * @param aFullPath, full path of file |
|
117 * @return mime type string, if return NULL, no mime or failed |
|
118 */ |
|
119 static HBufC8* ContainerMimeType( const TDesC& aFullPath ); |
|
120 |
|
121 /** |
|
122 * Get the Mime from Mp4 file |
|
123 * @param aFullFileName, full path of file |
|
124 * @return mime type string, if return NULL, no mime or failed |
|
125 */ |
|
126 static HBufC8* Mp4MimeTypeL( const TDesC& aFullFileName ); |
|
127 |
|
128 /** |
|
129 * Get the Mime from Odf file |
|
130 * @param aFullFileName, full path of file |
|
131 * @return mime type string, if return NULL, no mime or failed |
|
132 */ |
|
133 static HBufC8* OdfMimeTypeL( const TDesC& aFullFileName ); |
|
134 |
|
135 /** |
|
136 * Get the Mime from Asf file |
|
137 * @param aFullFileName, full path of file |
|
138 * @return mime type string, if return NULL, no mime or failed |
|
139 */ |
|
140 static HBufC8* AsfMimeTypeL( const TDesC& aFullFileName ); |
|
141 |
|
142 /** |
|
143 * get the sub format code by mime |
|
144 * @param aMimeType, mime type |
|
145 * @param aSubFormatCode, output the sub format code |
|
146 * @return if success, return KErrNone, otherwise, error code |
|
147 */ |
|
148 static TInt SubFormatCodeFromMime( const TDesC8& aMimeType, TMmMtpSubFormatCode& aSubFormatCode ); |
|
149 |
|
150 /** |
|
151 * Get DRM status |
|
152 * @param aFullFileName, full file name |
|
153 * @return return DRM status code |
|
154 */ |
|
155 IMPORT_C static TInt GetDrmStatus( const TDesC& aFullFileName ); |
|
156 |
|
157 }; |
|
158 |
|
159 #endif // MMMTPDPUTILITY_H |