|
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 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef CMTPSENDOBJECTINFO_H |
|
22 #define CMTPSENDOBJECTINFO_H |
|
23 |
|
24 #include <mtp/cmtpobjectmetadata.h> |
|
25 #include <mtp/tmtptypenull.h> |
|
26 |
|
27 #include "cmtprequestprocessor.h" |
|
28 #include "rmtpdpsingletons.h" |
|
29 #include "rmtpframework.h" |
|
30 #include "mtpdebug.h" |
|
31 |
|
32 class CMTPTypeFile; |
|
33 class CMTPTypeObjectInfo; |
|
34 class CMTPTypeObjectPropList; |
|
35 class CMTPTypeObjectPropListElement; |
|
36 |
|
37 /** |
|
38 Implements the file data provider's SendObjectInfo request processor. |
|
39 @internalComponent |
|
40 */ |
|
41 class CMTPSendObjectInfo : public CMTPRequestProcessor |
|
42 { |
|
43 public: |
|
44 |
|
45 IMPORT_C static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection); |
|
46 IMPORT_C ~CMTPSendObjectInfo(); |
|
47 |
|
48 private: |
|
49 |
|
50 CMTPSendObjectInfo(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection); |
|
51 void ConstructL(); |
|
52 |
|
53 private: // From CMTPRequestProcessor |
|
54 |
|
55 TBool Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const; |
|
56 TMTPResponseCode CheckRequestL(); |
|
57 void ServiceL(); |
|
58 TBool DoHandleCompletingPhaseL(); |
|
59 TBool DoHandleResponsePhaseL(); |
|
60 TBool HasDataphase() const; |
|
61 |
|
62 private: |
|
63 TMTPResponseCode CheckSendingStateL(); |
|
64 void GetDefaultParentObjectL(); |
|
65 TMTPResponseCode GetParentObjectAndStorageIdL(); |
|
66 |
|
67 void ServiceSendObjectInfoL(); |
|
68 void ServiceSendObjectPropListL(); |
|
69 void ServiceSendObjectL(); |
|
70 |
|
71 TBool DoHandleSendObjectInfoCompleteL(); |
|
72 TBool DoHandleSendObjectPropListCompleteL(); |
|
73 TBool DoHandleSendObjectCompleteL(); |
|
74 |
|
75 TBool GetFullPathNameL(const TDesC& aFileName); |
|
76 |
|
77 TBool CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const; |
|
78 TBool IsTooLarge(TUint64 aObjectSize) const; |
|
79 TBool Exists(const TDesC& aName) const; |
|
80 TMTPResponseCode ExtractPropertyL(const CMTPTypeObjectPropListElement& aElement); |
|
81 void ReserveObjectL(); |
|
82 void CreateFsObjectL(); |
|
83 void Rollback(); |
|
84 TMTPResponseCode ErrorToMTPError(TInt aError) const; |
|
85 |
|
86 TMTPResponseCode VerifyObjectPropListL(TInt& aInvalidParameterIndex); |
|
87 TMTPResponseCode CheckPropCodeL(const CMTPTypeObjectPropListElement& aElement) const; |
|
88 TMTPResponseCode MatchStoreAndParentL() const; |
|
89 |
|
90 void SetPropertiesL(); |
|
91 |
|
92 private: |
|
93 enum TMTPSendingObjectState |
|
94 { |
|
95 EObjectNone, |
|
96 EObjectInfoInProgress, |
|
97 EObjectInfoSucceed, |
|
98 EObjectInfoFail, |
|
99 ESendObjectInProgress, |
|
100 ESendObjectSucceed, |
|
101 ESendObjectFail |
|
102 }; |
|
103 |
|
104 private: // Owned |
|
105 |
|
106 /** |
|
107 FLOGGER debug trace member variable. |
|
108 */ |
|
109 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
110 |
|
111 CMTPTypeFile* iFileReceived; |
|
112 CMTPTypeObjectInfo* iObjectInfo; |
|
113 CMTPTypeObjectPropList* iObjectPropList; |
|
114 TMTPSendingObjectState iProgress; |
|
115 TUint16 iOperationCode; |
|
116 TUint32 iStorageId; |
|
117 TUint32 iParentHandle; |
|
118 TUint64 iObjectSize; |
|
119 HBufC* iParentSuid; |
|
120 TFileName iFullPath; |
|
121 HBufC* iDateMod;// To carry modified date extracted from PropertyList |
|
122 CMTPObjectMetaData* iReceivedObject; |
|
123 TMTPTypeRequest iExpectedSendObjectRequest; |
|
124 TBool iIsFolder; |
|
125 TMTPTypeNull iNullObject; |
|
126 TUint16 iProtectionStatus; |
|
127 TUint32 iPreviousTransactionID; |
|
128 RMTPDpSingletons iDpSingletons; |
|
129 TFileName iName; |
|
130 TBool iNoRollback; |
|
131 RMTPFramework iSingletons; |
|
132 }; |
|
133 |
|
134 #endif //CMTPSENDOBJECTINFO_H |
|
135 |