os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/app/cdisplay.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/app/cdisplay.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,155 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalComponent
    1.24 +*/
    1.25 +
    1.26 +#ifndef CDISPLAY_H
    1.27 +#define CDISPLAY_H
    1.28 +
    1.29 +
    1.30 +static const TInt KDisplayWidth = 100;
    1.31 +static const TInt KLineLength = KDisplayWidth;
    1.32 +
    1.33 +typedef TBuf<KLineLength> TLine;
    1.34 +
    1.35 +
    1.36 +class CScrollWindow: public CBase
    1.37 +{
    1.38 +public:
    1.39 +    static CScrollWindow* NewL(CConsoleBase& aConsole);
    1.40 +    ~CScrollWindow();
    1.41 +
    1.42 +private:
    1.43 +    CScrollWindow(CConsoleBase& aConsole);
    1.44 +    void ConstructL();
    1.45 +
    1.46 +public:
    1.47 +    void Reset();
    1.48 +    void Update();
    1.49 +    void AppendL(const TDesC& aLine);
    1.50 +    TLine* NewLineL();
    1.51 +
    1.52 +    void PageInc();
    1.53 +    void PageDec();
    1.54 +    void PageZero() {iPage = 0;}
    1.55 +
    1.56 +private:
    1.57 +    CConsoleBase& iConsole;
    1.58 +    TLine iTmpLine;
    1.59 +
    1.60 +    RArray<TLine> iLineArray;
    1.61 +    TInt iPage;
    1.62 +    static const TInt KPageLength = 8;
    1.63 +};
    1.64 +
    1.65 +
    1.66 +
    1.67 +class CDisplay: public MDriveDisplay, public CBase
    1.68 +    {
    1.69 +public:
    1.70 +	static CDisplay* NewLC(RFs& aFs, CConsoleBase& aConsole);
    1.71 +	~CDisplay();
    1.72 +
    1.73 +private:
    1.74 +	CDisplay(RFs& aFs, CConsoleBase& aConsole);
    1.75 +	void ConstructL();
    1.76 +
    1.77 +public:
    1.78 +    void Menu();
    1.79 +
    1.80 +    void DriveListL() const;
    1.81 +    void DevicesNumber(TInt aDevicesNumber) const;
    1.82 +    void DriveMapL(const TDriveMap& aDriveMap) const ;
    1.83 +    void DeviceMapL(TInt aRow, TInt deviceIndex, const TDeviceMap& aDeviceMap) const;
    1.84 +    void DeviceMapClear(TInt deviceIndex) const;
    1.85 +
    1.86 +    void UpTime(TUint aUpTime) const;
    1.87 +    void MemoryFree(TInt aBytes) const;
    1.88 +
    1.89 +    void GetDriveInfoL(TChar aChar);
    1.90 +    void DriveInfo();
    1.91 +
    1.92 +    void Read(TRequestStatus &aStatus) {iConsole.Read(aStatus);}
    1.93 +    void ReadCancel() {iConsole.ReadCancel();}
    1.94 +    TKeyCode KeyCode() const {return iConsole.KeyCode();}
    1.95 +
    1.96 +    void PageInc() {iScrollWindow->PageInc();}
    1.97 +    void PageDec() {iScrollWindow->PageDec();}
    1.98 +    void PageZero() {iScrollWindow->PageZero();}
    1.99 +
   1.100 +private:
   1.101 +    void FormatDriveInfoL(const TDriveInfo& aDriveInfo);
   1.102 +    void FormatVolumeInfoL(const TVolumeInfo& aVolumeInfo);
   1.103 +
   1.104 +    void CursorHome() const;
   1.105 +
   1.106 +private:
   1.107 +    RFs& iFs;
   1.108 +    CConsoleBase& iConsole;
   1.109 +
   1.110 +    TPoint iCursorPos;
   1.111 +
   1.112 +    CScrollWindow* iScrollWindow;
   1.113 +    };
   1.114 +
   1.115 +
   1.116 +inline void CDisplay::CursorHome() const
   1.117 +    {
   1.118 +    iConsole.SetPos(iCursorPos.iX, iCursorPos.iY);
   1.119 +    }
   1.120 +
   1.121 +
   1.122 +
   1.123 +class CMessageKeyProcessor : public CActive
   1.124 +	{
   1.125 +public:
   1.126 +	static CMessageKeyProcessor* NewLC(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession);
   1.127 +	~CMessageKeyProcessor();
   1.128 +
   1.129 +private:
   1.130 +	CMessageKeyProcessor(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession);
   1.131 +	void ConstructL();
   1.132 +
   1.133 +public:
   1.134 +	// Issue request
   1.135 +	void RequestCharacter();
   1.136 +	// Cancel request.
   1.137 +	// Defined as pure virtual by CActive;
   1.138 +	// implementation provided by this class.
   1.139 +	void DoCancel();
   1.140 +	// Service completed request.
   1.141 +	// Defined as pure virtual by CActive;
   1.142 +	// implementation provided by this class,
   1.143 +	void RunL();
   1.144 +	// Called from RunL() to handle the completed request
   1.145 +	void ProcessKeyPressL(TKeyCode aKeyCode);
   1.146 +
   1.147 +private:
   1.148 +    TBool HandleKeyL(TKeyCode aKeyCode);
   1.149 +
   1.150 +private:
   1.151 +	CDisplay& iDisplay;
   1.152 +    RUsbOtgSession& iUsbOtgSession;
   1.153 +	};
   1.154 +
   1.155 +
   1.156 +
   1.157 +
   1.158 +#endif