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