|
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 CMTPSTORAGEMGR_H |
|
22 #define CMTPSTORAGEMGR_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include <mtp/mmtpstoragemgr.h> |
|
27 |
|
28 #include "mtpdebug.h" |
|
29 #include "rmtpframework.h" |
|
30 |
|
31 /** |
|
32 Implements the MTP storage manager interface. |
|
33 @internalComponent |
|
34 |
|
35 */ |
|
36 class CMTPStorageMgr : |
|
37 public CBase, |
|
38 public MMTPStorageMgr |
|
39 { |
|
40 public: |
|
41 |
|
42 IMPORT_C static CMTPStorageMgr* NewL(); |
|
43 IMPORT_C ~CMTPStorageMgr(); |
|
44 |
|
45 IMPORT_C static TUint LogicalStorageNumber(TUint32 aStorageId); |
|
46 IMPORT_C static TUint LogicalStorageOwner(TUint32 aStorageId); |
|
47 IMPORT_C static TUint PhysicalStorageNumber(TUint32 aStorageId); |
|
48 IMPORT_C static TUint PhysicalStorageOwner(TUint32 aStorageId); |
|
49 |
|
50 IMPORT_C void SetDefaultStorageId(TUint32 aStorageId); |
|
51 IMPORT_C void SetDriveMappingL(TDriveNumber aDriveNumber, TUint32 aStorageId); |
|
52 IMPORT_C void SetFrameworkId(TUint aDataProviderId); |
|
53 |
|
54 public: // From MMTPStorageMgr |
|
55 |
|
56 IMPORT_C TUint32 AllocateLogicalStorageIdL(TUint aDataProviderId, TDriveNumber aDriveNumber, const CMTPStorageMetaData& aStorage); |
|
57 IMPORT_C TUint32 AllocateLogicalStorageIdL(TUint aDataProviderId, TUint32 aPhysicalStorageId, const CMTPStorageMetaData& aStorage); |
|
58 IMPORT_C TUint32 AllocatePhysicalStorageIdL(TUint aDataProviderId, const CMTPStorageMetaData& aStorage); |
|
59 IMPORT_C TInt DeallocateLogicalStorageId(TUint aDataProviderId, TUint32 aLogicalStorageId); |
|
60 IMPORT_C void DeallocateLogicalStorageIds(TUint aDataProviderId, TUint32 aPhysicalStorageId); |
|
61 IMPORT_C TInt DeallocatePhysicalStorageId(TUint aDataProviderId, TUint32 aPhysicalStorageId); |
|
62 IMPORT_C TUint32 DefaultStorageId() const; |
|
63 IMPORT_C TInt DriveNumber(TUint32 aStorageId) const; |
|
64 IMPORT_C TInt32 FrameworkStorageId(TDriveNumber aDriveNumber) const; |
|
65 IMPORT_C void GetAvailableDrivesL(RArray<TDriveNumber>& aDrives) const; |
|
66 IMPORT_C void GetLogicalStoragesL(const TMTPStorageMgrQueryParams& aParams, RPointerArray<const CMTPStorageMetaData>& aStorages) const; |
|
67 IMPORT_C void GetPhysicalStoragesL(const TMTPStorageMgrQueryParams& aParams, RPointerArray<const CMTPStorageMetaData>& aStorages) const; |
|
68 IMPORT_C TUint32 LogicalStorageId(TUint32 aStorageId) const; |
|
69 IMPORT_C TInt32 LogicalStorageId(const TDesC& aStorageSuid) const; |
|
70 IMPORT_C TInt32 PhysicalStorageId(TDriveNumber aDriveNumber) const; |
|
71 IMPORT_C TUint32 PhysicalStorageId(TUint32 aStorageId) const; |
|
72 IMPORT_C const CMTPStorageMetaData& StorageL(TUint32 aStorageId) const; |
|
73 IMPORT_C TUint32 StorageId(TUint32 aPhysicalStorageId, TUint32 aLogicalStorageId) const; |
|
74 IMPORT_C TBool ValidStorageId(TUint32 aStorageId) const; |
|
75 IMPORT_C CMTPTypeString* VolumeIdL(TUint aDataProviderId, TUint32 aStorageId, const TDesC& aVolumeIdSuffix) const; |
|
76 |
|
77 private: |
|
78 |
|
79 CMTPStorageMgr(); |
|
80 void ConstructL(); |
|
81 |
|
82 TInt32 AllocateLogicalStorageId(TUint aDataProviderId, TUint32 aPhysicalStorageId); |
|
83 TInt32 AllocatePhysicalStorageId(TUint aDataProviderId); |
|
84 TUint32 EncodeLogicalStorageId(TUint32 aPhysicalStorageId, TUint aDataProviderId, TUint aStorageNumber); |
|
85 TUint32 EncodeLogicalStorageNumber(TUint aStorageNumber); |
|
86 TUint32 EncodeLogicalStorageOwner(TUint aDataProviderId); |
|
87 TUint32 EncodePhysicalStorageId(TUint aDataProviderId, TUint aStorageNumber); |
|
88 TUint32 EncodePhysicalStorageNumber(TUint aStorageNumber); |
|
89 TUint32 EncodePhysicalStorageOwner(TUint aDataProviderId); |
|
90 void RemoveLogicalStorageL(TUint aIdx); |
|
91 CMTPStorageMetaData& StorageMetaDataL(TUint32 aStorageId); |
|
92 |
|
93 static TBool StorageKeyMatchSuid(const TDesC* aSuid, const CMTPStorageMetaData& aStorage); |
|
94 static TInt StorageOrder(const CMTPStorageMetaData& aL, const CMTPStorageMetaData& aR); |
|
95 static TInt StorageOrder(const TUint32* aKey, const CMTPStorageMetaData& aStorage); |
|
96 |
|
97 private: // Owned |
|
98 |
|
99 /** |
|
100 FLOGGER debug trace member variable. |
|
101 */ |
|
102 __FLOG_DECLARATION_MEMBER_MUTABLE; |
|
103 |
|
104 /** |
|
105 The default MTP storage ID. |
|
106 */ |
|
107 TUint32 iDefaultStorageId; |
|
108 |
|
109 /** |
|
110 The framework storages (drives) owning data provider ID. |
|
111 */ |
|
112 TInt iFrameworkId; |
|
113 |
|
114 /** |
|
115 The Symbian OS drive number to default MTP StorageID mapping table. This |
|
116 StorageID may either be the physical MTP StorageID or the default logical |
|
117 MTP StorageID. |
|
118 */ |
|
119 TFixedArray<TInt, KMaxDrives> iMapDriveToStorage; |
|
120 |
|
121 /** |
|
122 The physical storage numbers allocation table. Indexed by physical storage |
|
123 owner data provider ID. |
|
124 */ |
|
125 RArray<TUint> iPhysicalStorageNumbers; |
|
126 |
|
127 /** |
|
128 The framework singletons. |
|
129 */ |
|
130 RMTPFramework iSingletons; |
|
131 |
|
132 /** |
|
133 The storages table. |
|
134 */ |
|
135 RPointerArray<CMTPStorageMetaData> iStorages; |
|
136 }; |
|
137 |
|
138 #endif // CMTPSTORAGEMGR_H |