os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/app/cdisplay.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @internalComponent
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef CDISPLAY_H
sl@0
    24
#define CDISPLAY_H
sl@0
    25
sl@0
    26
sl@0
    27
static const TInt KDisplayWidth = 100;
sl@0
    28
static const TInt KLineLength = KDisplayWidth;
sl@0
    29
sl@0
    30
typedef TBuf<KLineLength> TLine;
sl@0
    31
sl@0
    32
sl@0
    33
class CScrollWindow: public CBase
sl@0
    34
{
sl@0
    35
public:
sl@0
    36
    static CScrollWindow* NewL(CConsoleBase& aConsole);
sl@0
    37
    ~CScrollWindow();
sl@0
    38
sl@0
    39
private:
sl@0
    40
    CScrollWindow(CConsoleBase& aConsole);
sl@0
    41
    void ConstructL();
sl@0
    42
sl@0
    43
public:
sl@0
    44
    void Reset();
sl@0
    45
    void Update();
sl@0
    46
    void AppendL(const TDesC& aLine);
sl@0
    47
    TLine* NewLineL();
sl@0
    48
sl@0
    49
    void PageInc();
sl@0
    50
    void PageDec();
sl@0
    51
    void PageZero() {iPage = 0;}
sl@0
    52
sl@0
    53
private:
sl@0
    54
    CConsoleBase& iConsole;
sl@0
    55
    TLine iTmpLine;
sl@0
    56
sl@0
    57
    RArray<TLine> iLineArray;
sl@0
    58
    TInt iPage;
sl@0
    59
    static const TInt KPageLength = 8;
sl@0
    60
};
sl@0
    61
sl@0
    62
sl@0
    63
sl@0
    64
class CDisplay: public MDriveDisplay, public CBase
sl@0
    65
    {
sl@0
    66
public:
sl@0
    67
	static CDisplay* NewLC(RFs& aFs, CConsoleBase& aConsole);
sl@0
    68
	~CDisplay();
sl@0
    69
sl@0
    70
private:
sl@0
    71
	CDisplay(RFs& aFs, CConsoleBase& aConsole);
sl@0
    72
	void ConstructL();
sl@0
    73
sl@0
    74
public:
sl@0
    75
    void Menu();
sl@0
    76
sl@0
    77
    void DriveListL() const;
sl@0
    78
    void DevicesNumber(TInt aDevicesNumber) const;
sl@0
    79
    void DriveMapL(const TDriveMap& aDriveMap) const ;
sl@0
    80
    void DeviceMapL(TInt aRow, TInt deviceIndex, const TDeviceMap& aDeviceMap) const;
sl@0
    81
    void DeviceMapClear(TInt deviceIndex) const;
sl@0
    82
sl@0
    83
    void UpTime(TUint aUpTime) const;
sl@0
    84
    void MemoryFree(TInt aBytes) const;
sl@0
    85
sl@0
    86
    void GetDriveInfoL(TChar aChar);
sl@0
    87
    void DriveInfo();
sl@0
    88
sl@0
    89
    void Read(TRequestStatus &aStatus) {iConsole.Read(aStatus);}
sl@0
    90
    void ReadCancel() {iConsole.ReadCancel();}
sl@0
    91
    TKeyCode KeyCode() const {return iConsole.KeyCode();}
sl@0
    92
sl@0
    93
    void PageInc() {iScrollWindow->PageInc();}
sl@0
    94
    void PageDec() {iScrollWindow->PageDec();}
sl@0
    95
    void PageZero() {iScrollWindow->PageZero();}
sl@0
    96
sl@0
    97
private:
sl@0
    98
    void FormatDriveInfoL(const TDriveInfo& aDriveInfo);
sl@0
    99
    void FormatVolumeInfoL(const TVolumeInfo& aVolumeInfo);
sl@0
   100
sl@0
   101
    void CursorHome() const;
sl@0
   102
sl@0
   103
private:
sl@0
   104
    RFs& iFs;
sl@0
   105
    CConsoleBase& iConsole;
sl@0
   106
sl@0
   107
    TPoint iCursorPos;
sl@0
   108
sl@0
   109
    CScrollWindow* iScrollWindow;
sl@0
   110
    };
sl@0
   111
sl@0
   112
sl@0
   113
inline void CDisplay::CursorHome() const
sl@0
   114
    {
sl@0
   115
    iConsole.SetPos(iCursorPos.iX, iCursorPos.iY);
sl@0
   116
    }
sl@0
   117
sl@0
   118
sl@0
   119
sl@0
   120
class CMessageKeyProcessor : public CActive
sl@0
   121
	{
sl@0
   122
public:
sl@0
   123
	static CMessageKeyProcessor* NewLC(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession);
sl@0
   124
	~CMessageKeyProcessor();
sl@0
   125
sl@0
   126
private:
sl@0
   127
	CMessageKeyProcessor(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession);
sl@0
   128
	void ConstructL();
sl@0
   129
sl@0
   130
public:
sl@0
   131
	// Issue request
sl@0
   132
	void RequestCharacter();
sl@0
   133
	// Cancel request.
sl@0
   134
	// Defined as pure virtual by CActive;
sl@0
   135
	// implementation provided by this class.
sl@0
   136
	void DoCancel();
sl@0
   137
	// Service completed request.
sl@0
   138
	// Defined as pure virtual by CActive;
sl@0
   139
	// implementation provided by this class,
sl@0
   140
	void RunL();
sl@0
   141
	// Called from RunL() to handle the completed request
sl@0
   142
	void ProcessKeyPressL(TKeyCode aKeyCode);
sl@0
   143
sl@0
   144
private:
sl@0
   145
    TBool HandleKeyL(TKeyCode aKeyCode);
sl@0
   146
sl@0
   147
private:
sl@0
   148
	CDisplay& iDisplay;
sl@0
   149
    RUsbOtgSession& iUsbOtgSession;
sl@0
   150
	};
sl@0
   151
sl@0
   152
sl@0
   153
sl@0
   154
sl@0
   155
#endif