author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 07 Jan 2010 13:38:45 +0200 | |
changeset 33 | 0173bcd7697c |
parent 31 | 56f325a607ea |
child 97 | 41f0cfe18c80 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2008-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". |
|
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 |
||
44 |
void SetLunL(TLun aLun); |
|
45 |
void SetMaxLun(TLun aMaxLun); |
|
46 |
TLun GetMaxLun() const; |
|
47 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
TBool IsReady() const; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
49 |
TBool IsSuspended() const; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
50 |
|
0 | 51 |
void InitLunL(TLun aLun); |
52 |
||
53 |
void SuspendLunL(TLun aLun); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
void Resume(TRequestStatus& aStatus); |
0 | 55 |
void ResumeLogicalUnitsL(); |
56 |
void ResumeCompletedL(); |
|
57 |
||
58 |
void DoHandleRemoteWakeupL(); |
|
59 |
void DoLunReadyCheckEventL(); |
|
60 |
void DoResumeLogicalUnitsL(); |
|
61 |
||
62 |
private: |
|
63 |
void ConstructL(); |
|
64 |
CUsbHostMsDevice(THostMassStorageConfig& aConfig); |
|
65 |
MTransport* InitialiseTransportL(TTransportType aTransportId); |
|
66 |
void StartTimer(); |
|
67 |
void StopTimer(); |
|
68 |
static TInt TimerCallback(TAny* obj); |
|
69 |
||
70 |
private: |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
enum TDeviceState |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
EReady, |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
ESuspended |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
}; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
|
0 | 77 |
MTransport* iTransport; |
78 |
TLun iMaxLun; |
|
79 |
TLogicalUnitList iLuList; |
|
80 |
THostMassStorageConfig iConfig; |
|
81 |
CUsbMsIfaceSuspendResume* iDeviceSuspendResume; |
|
82 |
TDeviceState iState; |
|
83 |
/** The polling interval time as set by the MM - passed as part of THostMassStorageConfig */ |
|
84 |
TUint8 iStatusPollingInterval; |
|
85 |
/** An active object which triggers periodic check. */ |
|
86 |
CPeriodic* iTimer; |
|
87 |
/** The Timer status */ |
|
88 |
TBool iTimerRunning; |
|
89 |
}; |
|
90 |
||
91 |
||
92 |
inline TLun CUsbHostMsDevice::GetMaxLun() const |
|
93 |
{ |
|
94 |
return iMaxLun; |
|
95 |
} |
|
96 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
inline TBool CUsbHostMsDevice::IsReady() const |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
return (iState == EReady)? ETrue : EFalse; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
} |
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 |
inline TBool CUsbHostMsDevice::IsSuspended() const |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
return (iState == ESuspended)? ETrue : EFalse; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
|
0 | 109 |
#endif // CUSBHOSTMSDEVICE_H |
110 |