os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/inc/cusbmsmountmanager.h
Update contrib.
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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // RUsbMsMountManager class.
25 #ifndef CUSBMSMOUNTMANAGER_H
26 #define CUSBMSMONUTMANAGER_H
30 class TUsbInterfaceDescriptor;
31 class TUsbDeviceDescriptor;
39 void EnableDebug() {iDebug = ETrue;}
40 void DisableDebug() {iDebug = EFalse;}
42 void PrintTree(const TUsbGenericDescriptor& aDesc,
45 void PrintDescriptor(const TUsbDeviceDescriptor& aDeviceDesc,
47 RUsbDevice* aDevice = NULL);
49 void PrintDescriptor(const TUsbConfigurationDescriptor& aConfigDesc,
51 RUsbDevice* aDevice = NULL);
53 void PrintDescriptor(const TUsbEndpointDescriptor& aEndpointDesc,
55 RUsbDevice* aDevice = NULL);
57 void PrintDescriptor(const TUsbStringDescriptor& aStringDesc,
59 RUsbDevice* aDevice = NULL);
61 void PrintDescriptor(const TUsbInterfaceDescriptor& aInterfaceDesc,
63 RUsbDevice* aDevice = NULL);
66 void SetLanguageToPrintL(RUsbDevice& aDevice);
68 void PrintStringFromIndex(const TDesC& aFormatString,
76 class CDevice : public CBase
79 static const TInt KMaxLun = 16;
82 static CDevice* NewL();
89 TToken OpenDeviceL(TUint aDeviceHandle, RUsbHubDriver& aHub);
92 void MountLogicalUnitsL();
93 void DismountLogicalUnitsL();
94 TToken DeviceToken() const {return iDeviceToken;};
95 TUint DeviceHandle() const {return iDeviceHandle;};
97 TLun DriveMap(TDriveMap& aDriveMap) const;
98 TLun DeviceMap(TDeviceMap& aDeviceMap) const;
102 TBool IsDeviceMassStorage(const TUsbInterfaceDescriptor& aInterfaceDesc,
103 const TUsbDeviceDescriptor& aDeviceDesc) const;
105 TInt GetEndpointAddress(RUsbInterface& aUsbInterface,
106 TInt aInterfaceSetting,
107 TUint8 aTransferType,
109 TInt& aEndpointAddress) const;
114 RUsbDevice iUsbDevice;
117 RUsbHostMsDevice iUsbHostMsDevice;
124 // index is mapped to LUN
125 RArray<TDriveNumber> iLuList;
127 THostMassStorageConfig iMsConfig;
133 class CUsbMsMountManager : public CBase
136 static CUsbMsMountManager* NewL();
137 ~CUsbMsMountManager();
140 CUsbMsMountManager();
143 TInt DevicesNumber() const;
144 void DriveMap(TDriveMap& aDriveMap) const;
145 void DeviceMap(TInt aDeviceIndex, TDeviceMap& aDeviceMap) const;
149 // adds new device entry for this device
150 void AddDeviceL(CDevice* aDevice);
151 // removes device entry for this device
152 CDevice* RemoveDeviceL(TUint aDeviceHandle);
154 void CloseAllDevicesL();
156 // mounts all LUNs for the device
157 void MountDeviceL(TUint aDeviceHandle);
158 // dismount all LUNs for this device
159 void DismountDeviceL(TUint aDeviceHandle);
164 TInt GetDeviceIndexL(TToken aDeviceToken) const;
165 TInt GetHandleIndexL(TUint aDeviceHandle) const;
168 RPointerArray<CDevice> iDeviceList;
172 inline TInt CUsbMsMountManager::DevicesNumber() const
174 return iDeviceList.Count();
177 #endif // CUSBMSMOUNTMANAGER_H