|
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: Abstract media data provider plug in |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CABSTRACTMEDIAMTPDATAPROVIDER_H |
|
20 #define CABSTRACTMEDIAMTPDATAPROVIDER_H |
|
21 |
|
22 #include <mtp/cmtpdataproviderplugin.h> |
|
23 |
|
24 #include "abstractmediamtpdataproviderprocessor.h" |
|
25 #include "mmmtpenumerationcallback.h" |
|
26 #include "mmmtpdpconfig.h" |
|
27 |
|
28 |
|
29 // Forward declaration |
|
30 class MMmRequestProcessor; |
|
31 class CAbstractMediaMtpDataProviderEnumerator; |
|
32 class CMTPObjectMetaData; |
|
33 class CAbstractMediaMtpDataProviderRenameObject; |
|
34 |
|
35 /** |
|
36 * Defines abstract media data provider plugin |
|
37 */ |
|
38 class CAbstractMediaMtpDataProvider : public CMTPDataProviderPlugin, |
|
39 public MMTPEnumerationCallback, |
|
40 public MMmMtpDpConfig |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Two Phase Construction |
|
45 * @param aParams pointer to MMTPDataProviderFramework |
|
46 */ |
|
47 static TAny* NewL( TAny* aParams ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CAbstractMediaMtpDataProvider(); |
|
53 |
|
54 public: |
|
55 // from MMmMtpDpConfig |
|
56 const RArray<TUint>* GetSupportedFormat() const; |
|
57 |
|
58 const RArray<TUint>* GetSupportedPropertiesL( TUint32 aFormatCode ) const; |
|
59 |
|
60 const RArray<TUint>* GetAllSupportedProperties() const; |
|
61 |
|
62 /** |
|
63 * Get default storage Id from resource file, if not specify a storage Id |
|
64 * @return TUint32 Default storage Id which read from resource file |
|
65 */ |
|
66 TUint32 GetDefaultStorageIdL() const; |
|
67 |
|
68 /** |
|
69 * @return the reference of CMmMtpDpMetadataAccessWrapper to enumerator |
|
70 */ |
|
71 CMmMtpDpMetadataAccessWrapper& GetWrapperL(); |
|
72 |
|
73 protected: |
|
74 // from CMTPDataProviderPlugin |
|
75 void Cancel(); |
|
76 |
|
77 void ProcessEventL( const TMTPTypeEvent& aEvent, |
|
78 MMTPConnection& aConnection ); |
|
79 |
|
80 void ProcessNotificationL( TMTPNotification aNotification, |
|
81 const TAny* aParams ); |
|
82 |
|
83 /** |
|
84 * Process the request from initiator |
|
85 * @param aPhase The request transaction phase |
|
86 * @param aRequest The request to be processed |
|
87 * @param aConnection The connection from which the request comes |
|
88 */ |
|
89 void ProcessRequestPhaseL( TMTPTransactionPhase aPhase, |
|
90 const TMTPTypeRequest& aRequest, |
|
91 MMTPConnection& aConnection ); |
|
92 |
|
93 /** |
|
94 * Notify the data provider that the session has been open |
|
95 */ |
|
96 void SessionOpenedL( const TMTPNotificationParamsSessionChange& aSession ); |
|
97 |
|
98 /** |
|
99 * Notify the data provider that the session has been closed |
|
100 * @param aConnection The connection of the sesssion |
|
101 */ |
|
102 void SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ); |
|
103 |
|
104 /** |
|
105 * Notify the data provider that the object has been changed |
|
106 * @param aObject the changed object |
|
107 */ |
|
108 void RenameObjectL( const TMTPNotificationParamsHandle& aObject ); |
|
109 |
|
110 void StartObjectEnumerationL( TUint32 aStorageId ); |
|
111 |
|
112 void StartStorageEnumerationL(); |
|
113 |
|
114 /** |
|
115 * Defines the supported operations and formats of the data provider |
|
116 * @param aCategory Defines what MTP is quering the DP about |
|
117 * @param aArray Supported() edits array to append supported features |
|
118 */ |
|
119 void Supported( TMTPSupportCategory aCategory, RArray<TUint>& aArray ) const; |
|
120 |
|
121 void SupportedL( TMTPSupportCategory aCategory, CDesCArray& aStrings ) const; |
|
122 |
|
123 TAny* GetExtendedInterface( TUid aInterfaceUid ); |
|
124 |
|
125 protected: |
|
126 // From MMTPEnumerationCallback |
|
127 /** |
|
128 * enumeration completed |
|
129 */ |
|
130 void NotifyEnumerationCompleteL( TUint32 aStorageId, TInt aError ); |
|
131 |
|
132 private: |
|
133 /** |
|
134 * Standard C++ constructor |
|
135 * @param aParams pointer to MMTPDataProviderFramework |
|
136 */ |
|
137 CAbstractMediaMtpDataProvider( TAny* aParams ); |
|
138 |
|
139 /** |
|
140 * Second-phase construction |
|
141 */ |
|
142 void ConstructL(); |
|
143 |
|
144 /** |
|
145 * Find or create a request processor that can process the request |
|
146 * @param aRequest The request to be processed |
|
147 * @param aConnection The connection from which the request comes |
|
148 * @return the index of the found/created request processor |
|
149 */ |
|
150 TInt LocateRequestProcessorL( const TMTPTypeRequest& aRequest, |
|
151 MMTPConnection& aConnection ); |
|
152 |
|
153 /** |
|
154 * Find or create a request processor that can process the event |
|
155 * @param aEvent The event to be processed |
|
156 * @param aConnection The connection from which the request comes |
|
157 * @return the index of the found/created request processor |
|
158 */ |
|
159 TInt LocateRequestProcessorL( const TMTPTypeEvent& aEvent, |
|
160 MMTPConnection& aConnection ); |
|
161 |
|
162 /** |
|
163 * helper function |
|
164 */ |
|
165 void InsertL( RArray<TUint>& aArray, const TUint aProperCode ) const; |
|
166 |
|
167 void GetSupportedFormatL(); |
|
168 |
|
169 void GetSupportedPropertiesL(); |
|
170 |
|
171 private: |
|
172 // data |
|
173 RPointerArray<MMmRequestProcessor> iActiveProcessors; |
|
174 CAbstractMediaMtpDataProviderEnumerator* iAbstractMediaEnumerator; |
|
175 RArray<TUint32> iPendingEnumerations; |
|
176 |
|
177 TInt iActiveProcessor; |
|
178 |
|
179 CAbstractMediaMtpDataProviderRenameObject *iRenameObject; |
|
180 TBool iIsSessionOpen; |
|
181 |
|
182 RArray<TUint> iSupportedFormat; |
|
183 |
|
184 RArray<TUint> iSupportedProperties; |
|
185 |
|
186 }; |
|
187 |
|
188 #endif // CABSTRACTMEDIAMTPDATAPROVIDER_H |