author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 27 Apr 2010 18:02:57 +0300 | |
branch | RCL_3 |
changeset 97 | 41f0cfe18c80 |
parent 31 | 56f325a607ea |
permissions | -rw-r--r-- |
97
41f0cfe18c80
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1 |
// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// |
|
15 |
||
16 |
/** |
|
17 |
@file |
|
18 |
@internalTechnology |
|
19 |
*/ |
|
20 |
||
21 |
#ifndef CUSBHOSTMSDEVICE_H |
|
22 |
#define CUSBHOSTMSDEVICE_H |
|
23 |
||
24 |
#include "tlogicalunitlist.h" |
|
25 |
||
26 |
class MTransport; |
|
27 |
class CUsbMsIfaceSuspendResume; |
|
28 |
class TLogicalUnitList; |
|
29 |
||
30 |
class CUsbHostMsDevice : public CBase |
|
31 |
{ |
|
32 |
public: |
|
33 |
||
34 |
static CUsbHostMsDevice* NewL(THostMassStorageConfig& aConfig); |
|
35 |
~CUsbHostMsDevice(); |
|
36 |
void InitialiseL(const RMessage2& aMessage); |
|
37 |
void UnInitialiseL(); |
|
38 |
||
39 |
TInt AddLunL(TLun aLun); |
|
40 |
void RemoveLunL(TLun aLun); |
|
41 |
TLun GetAndSetLunL(const RMessage2& aMessage); |
|
42 |
CUsbHostMsLogicalUnit& GetLuL(TInt aLunNum) const; |
|
43 |
||
97
41f0cfe18c80
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
44 |
void SetLunL(CUsbHostMsLogicalUnit& aLu); |
41f0cfe18c80
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
45 |
CUsbHostMsLogicalUnit& SetLunL(TLun aLun); |
0 | 46 |
void SetMaxLun(TLun aMaxLun); |
47 |
TLun GetMaxLun() const; |
|
48 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
49 |
TBool IsReady() const; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
50 |
TBool IsSuspended() const; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
|
0 | 52 |
void InitLunL(TLun aLun); |
53 |
||
54 |
void SuspendLunL(TLun aLun); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
void Resume(TRequestStatus& aStatus); |
0 | 56 |
void ResumeLogicalUnitsL(); |
57 |
void ResumeCompletedL(); |
|
58 |
||
59 |
void DoHandleRemoteWakeupL(); |
|
60 |
void DoLunReadyCheckEventL(); |
|
61 |
void DoResumeLogicalUnitsL(); |
|
62 |
||
63 |
private: |
|
64 |
void ConstructL(); |
|
65 |
CUsbHostMsDevice(THostMassStorageConfig& aConfig); |
|
66 |
MTransport* InitialiseTransportL(TTransportType aTransportId); |
|
67 |
void StartTimer(); |
|
68 |
void StopTimer(); |
|
69 |
static TInt TimerCallback(TAny* obj); |
|
70 |
||
71 |
private: |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
enum TDeviceState |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
EReady, |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
ESuspended |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
}; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
|
0 | 78 |
MTransport* iTransport; |
79 |
TLun iMaxLun; |
|
80 |
TLogicalUnitList iLuList; |
|
81 |
THostMassStorageConfig iConfig; |
|
82 |
CUsbMsIfaceSuspendResume* iDeviceSuspendResume; |
|
83 |
TDeviceState iState; |
|
84 |
/** The polling interval time as set by the MM - passed as part of THostMassStorageConfig */ |
|
85 |
TUint8 iStatusPollingInterval; |
|
86 |
/** An active object which triggers periodic check. */ |
|
87 |
CPeriodic* iTimer; |
|
88 |
/** The Timer status */ |
|
89 |
TBool iTimerRunning; |
|
90 |
}; |
|
91 |
||
92 |
||
93 |
inline TLun CUsbHostMsDevice::GetMaxLun() const |
|
94 |
{ |
|
95 |
return iMaxLun; |
|
96 |
} |
|
97 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
inline TBool CUsbHostMsDevice::IsReady() const |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
return (iState == EReady)? ETrue : EFalse; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
104 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
inline TBool CUsbHostMsDevice::IsSuspended() const |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
return (iState == ESuspended)? ETrue : EFalse; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
|
0 | 110 |
#endif // CUSBHOSTMSDEVICE_H |
111 |