author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 11 May 2010 17:28:22 +0300 | |
branch | RCL_3 |
changeset 26 | c734af59ce98 |
parent 19 | 4a8fed1c0ef6 |
permissions | -rw-r--r-- |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// |
|
15 |
||
16 |
||
17 |
||
18 |
/** |
|
19 |
@file |
|
20 |
@internalComponent |
|
21 |
*/ |
|
22 |
||
23 |
#ifndef CDISPLAY_H |
|
24 |
#define CDISPLAY_H |
|
25 |
||
26 |
||
27 |
static const TInt KDisplayWidth = 100; |
|
28 |
static const TInt KLineLength = KDisplayWidth; |
|
29 |
||
30 |
typedef TBuf<KLineLength> TLine; |
|
31 |
||
32 |
||
33 |
class CScrollWindow: public CBase |
|
34 |
{ |
|
35 |
public: |
|
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
static CScrollWindow* NewL(CConsoleBase& aConsole, TInt aStartRow, TInt aEndRow); |
0 | 37 |
~CScrollWindow(); |
38 |
||
39 |
private: |
|
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
CScrollWindow(CConsoleBase& aConsole, TInt aStartRow, TInt aEndRow); |
0 | 41 |
void ConstructL(); |
42 |
||
43 |
public: |
|
44 |
void Reset(); |
|
45 |
void Update(); |
|
46 |
void AppendL(const TDesC& aLine); |
|
47 |
TLine* NewLineL(); |
|
48 |
||
49 |
void PageInc(); |
|
50 |
void PageDec(); |
|
51 |
void PageZero() {iPage = 0;} |
|
52 |
||
53 |
private: |
|
54 |
CConsoleBase& iConsole; |
|
55 |
TLine iTmpLine; |
|
56 |
||
57 |
RArray<TLine> iLineArray; |
|
58 |
TInt iPage; |
|
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
const TInt iStartRow; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
const TInt iEndRow; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
const TInt iPageLength; |
0 | 62 |
}; |
63 |
||
64 |
||
65 |
||
66 |
class CDisplay: public MDriveDisplay, public CBase |
|
67 |
{ |
|
68 |
public: |
|
69 |
static CDisplay* NewLC(RFs& aFs, CConsoleBase& aConsole); |
|
70 |
~CDisplay(); |
|
71 |
||
72 |
private: |
|
73 |
CDisplay(RFs& aFs, CConsoleBase& aConsole); |
|
74 |
void ConstructL(); |
|
75 |
||
76 |
public: |
|
77 |
void Menu(); |
|
78 |
||
79 |
void DriveListL() const; |
|
80 |
void DevicesNumber(TInt aDevicesNumber) const; |
|
81 |
void DriveMapL(const TDriveMap& aDriveMap) const ; |
|
82 |
void DeviceMapL(TInt aRow, TInt deviceIndex, const TDeviceMap& aDeviceMap) const; |
|
83 |
void DeviceMapClear(TInt deviceIndex) const; |
|
84 |
||
85 |
void UpTime(TUint aUpTime) const; |
|
86 |
void MemoryFree(TInt aBytes) const; |
|
87 |
||
88 |
void GetDriveInfoL(TChar aChar); |
|
89 |
void DriveInfo(); |
|
90 |
||
91 |
void Read(TRequestStatus &aStatus) {iConsole.Read(aStatus);} |
|
92 |
void ReadCancel() {iConsole.ReadCancel();} |
|
93 |
TKeyCode KeyCode() const {return iConsole.KeyCode();} |
|
94 |
||
95 |
void PageInc() {iScrollWindow->PageInc();} |
|
96 |
void PageDec() {iScrollWindow->PageDec();} |
|
97 |
void PageZero() {iScrollWindow->PageZero();} |
|
98 |
||
99 |
private: |
|
100 |
void FormatDriveInfoL(const TDriveInfo& aDriveInfo); |
|
101 |
void FormatVolumeInfoL(const TVolumeInfo& aVolumeInfo); |
|
102 |
||
103 |
void CursorHome() const; |
|
104 |
||
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
void SetFooterPos(TPoint iPos) const; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
private: |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
static const TInt iFooterX = 0; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
static const TInt iFooterY = 4; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
|
0 | 111 |
RFs& iFs; |
112 |
CConsoleBase& iConsole; |
|
113 |
||
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
114 |
TSize iScreenSize; |
0 | 115 |
TPoint iCursorPos; |
116 |
||
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
117 |
TPoint iPointFooter; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
118 |
|
0 | 119 |
CScrollWindow* iScrollWindow; |
120 |
}; |
|
121 |
||
122 |
||
123 |
inline void CDisplay::CursorHome() const |
|
124 |
{ |
|
125 |
iConsole.SetPos(iCursorPos.iX, iCursorPos.iY); |
|
126 |
} |
|
127 |
||
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
inline void CDisplay::SetFooterPos(TPoint iPos) const |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
129 |
{ |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
TPoint pos = iPos + iPointFooter; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
131 |
iConsole.SetPos(pos.iX, pos.iY); |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
} |
0 | 133 |
|
134 |
class CMessageKeyProcessor : public CActive |
|
135 |
{ |
|
136 |
public: |
|
137 |
static CMessageKeyProcessor* NewLC(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession); |
|
138 |
~CMessageKeyProcessor(); |
|
139 |
||
140 |
private: |
|
141 |
CMessageKeyProcessor(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession); |
|
142 |
void ConstructL(); |
|
143 |
||
144 |
public: |
|
145 |
// Issue request |
|
146 |
void RequestCharacter(); |
|
147 |
// Cancel request. |
|
148 |
// Defined as pure virtual by CActive; |
|
149 |
// implementation provided by this class. |
|
150 |
void DoCancel(); |
|
151 |
// Service completed request. |
|
152 |
// Defined as pure virtual by CActive; |
|
153 |
// implementation provided by this class, |
|
154 |
void RunL(); |
|
155 |
// Called from RunL() to handle the completed request |
|
156 |
void ProcessKeyPressL(TKeyCode aKeyCode); |
|
157 |
||
158 |
private: |
|
159 |
TBool HandleKeyL(TKeyCode aKeyCode); |
|
160 |
||
161 |
private: |
|
162 |
CDisplay& iDisplay; |
|
163 |
RUsbOtgSession& iUsbOtgSession; |
|
164 |
}; |
|
165 |
||
166 |
||
167 |
||
168 |
||
169 |
#endif |