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:
|
|
36 |
static CScrollWindow* NewL(CConsoleBase& aConsole);
|
|
37 |
~CScrollWindow();
|
|
38 |
|
|
39 |
private:
|
|
40 |
CScrollWindow(CConsoleBase& aConsole);
|
|
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;
|
|
59 |
static const TInt KPageLength = 8;
|
|
60 |
};
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
class CDisplay: public MDriveDisplay, public CBase
|
|
65 |
{
|
|
66 |
public:
|
|
67 |
static CDisplay* NewLC(RFs& aFs, CConsoleBase& aConsole);
|
|
68 |
~CDisplay();
|
|
69 |
|
|
70 |
private:
|
|
71 |
CDisplay(RFs& aFs, CConsoleBase& aConsole);
|
|
72 |
void ConstructL();
|
|
73 |
|
|
74 |
public:
|
|
75 |
void Menu();
|
|
76 |
|
|
77 |
void DriveListL() const;
|
|
78 |
void DevicesNumber(TInt aDevicesNumber) const;
|
|
79 |
void DriveMapL(const TDriveMap& aDriveMap) const ;
|
|
80 |
void DeviceMapL(TInt aRow, TInt deviceIndex, const TDeviceMap& aDeviceMap) const;
|
|
81 |
void DeviceMapClear(TInt deviceIndex) const;
|
|
82 |
|
|
83 |
void UpTime(TUint aUpTime) const;
|
|
84 |
void MemoryFree(TInt aBytes) const;
|
|
85 |
|
|
86 |
void GetDriveInfoL(TChar aChar);
|
|
87 |
void DriveInfo();
|
|
88 |
|
|
89 |
void Read(TRequestStatus &aStatus) {iConsole.Read(aStatus);}
|
|
90 |
void ReadCancel() {iConsole.ReadCancel();}
|
|
91 |
TKeyCode KeyCode() const {return iConsole.KeyCode();}
|
|
92 |
|
|
93 |
void PageInc() {iScrollWindow->PageInc();}
|
|
94 |
void PageDec() {iScrollWindow->PageDec();}
|
|
95 |
void PageZero() {iScrollWindow->PageZero();}
|
|
96 |
|
|
97 |
private:
|
|
98 |
void FormatDriveInfoL(const TDriveInfo& aDriveInfo);
|
|
99 |
void FormatVolumeInfoL(const TVolumeInfo& aVolumeInfo);
|
|
100 |
|
|
101 |
void CursorHome() const;
|
|
102 |
|
|
103 |
private:
|
|
104 |
RFs& iFs;
|
|
105 |
CConsoleBase& iConsole;
|
|
106 |
|
|
107 |
TPoint iCursorPos;
|
|
108 |
|
|
109 |
CScrollWindow* iScrollWindow;
|
|
110 |
};
|
|
111 |
|
|
112 |
|
|
113 |
inline void CDisplay::CursorHome() const
|
|
114 |
{
|
|
115 |
iConsole.SetPos(iCursorPos.iX, iCursorPos.iY);
|
|
116 |
}
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
class CMessageKeyProcessor : public CActive
|
|
121 |
{
|
|
122 |
public:
|
|
123 |
static CMessageKeyProcessor* NewLC(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession);
|
|
124 |
~CMessageKeyProcessor();
|
|
125 |
|
|
126 |
private:
|
|
127 |
CMessageKeyProcessor(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession);
|
|
128 |
void ConstructL();
|
|
129 |
|
|
130 |
public:
|
|
131 |
// Issue request
|
|
132 |
void RequestCharacter();
|
|
133 |
// Cancel request.
|
|
134 |
// Defined as pure virtual by CActive;
|
|
135 |
// implementation provided by this class.
|
|
136 |
void DoCancel();
|
|
137 |
// Service completed request.
|
|
138 |
// Defined as pure virtual by CActive;
|
|
139 |
// implementation provided by this class,
|
|
140 |
void RunL();
|
|
141 |
// Called from RunL() to handle the completed request
|
|
142 |
void ProcessKeyPressL(TKeyCode aKeyCode);
|
|
143 |
|
|
144 |
private:
|
|
145 |
TBool HandleKeyL(TKeyCode aKeyCode);
|
|
146 |
|
|
147 |
private:
|
|
148 |
CDisplay& iDisplay;
|
|
149 |
RUsbOtgSession& iUsbOtgSession;
|
|
150 |
};
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
#endif
|