sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef CDISPLAY_H sl@0: #define CDISPLAY_H sl@0: sl@0: sl@0: static const TInt KDisplayWidth = 100; sl@0: static const TInt KLineLength = KDisplayWidth; sl@0: sl@0: typedef TBuf TLine; sl@0: sl@0: sl@0: class CScrollWindow: public CBase sl@0: { sl@0: public: sl@0: static CScrollWindow* NewL(CConsoleBase& aConsole); sl@0: ~CScrollWindow(); sl@0: sl@0: private: sl@0: CScrollWindow(CConsoleBase& aConsole); sl@0: void ConstructL(); sl@0: sl@0: public: sl@0: void Reset(); sl@0: void Update(); sl@0: void AppendL(const TDesC& aLine); sl@0: TLine* NewLineL(); sl@0: sl@0: void PageInc(); sl@0: void PageDec(); sl@0: void PageZero() {iPage = 0;} sl@0: sl@0: private: sl@0: CConsoleBase& iConsole; sl@0: TLine iTmpLine; sl@0: sl@0: RArray iLineArray; sl@0: TInt iPage; sl@0: static const TInt KPageLength = 8; sl@0: }; sl@0: sl@0: sl@0: sl@0: class CDisplay: public MDriveDisplay, public CBase sl@0: { sl@0: public: sl@0: static CDisplay* NewLC(RFs& aFs, CConsoleBase& aConsole); sl@0: ~CDisplay(); sl@0: sl@0: private: sl@0: CDisplay(RFs& aFs, CConsoleBase& aConsole); sl@0: void ConstructL(); sl@0: sl@0: public: sl@0: void Menu(); sl@0: sl@0: void DriveListL() const; sl@0: void DevicesNumber(TInt aDevicesNumber) const; sl@0: void DriveMapL(const TDriveMap& aDriveMap) const ; sl@0: void DeviceMapL(TInt aRow, TInt deviceIndex, const TDeviceMap& aDeviceMap) const; sl@0: void DeviceMapClear(TInt deviceIndex) const; sl@0: sl@0: void UpTime(TUint aUpTime) const; sl@0: void MemoryFree(TInt aBytes) const; sl@0: sl@0: void GetDriveInfoL(TChar aChar); sl@0: void DriveInfo(); sl@0: sl@0: void Read(TRequestStatus &aStatus) {iConsole.Read(aStatus);} sl@0: void ReadCancel() {iConsole.ReadCancel();} sl@0: TKeyCode KeyCode() const {return iConsole.KeyCode();} sl@0: sl@0: void PageInc() {iScrollWindow->PageInc();} sl@0: void PageDec() {iScrollWindow->PageDec();} sl@0: void PageZero() {iScrollWindow->PageZero();} sl@0: sl@0: private: sl@0: void FormatDriveInfoL(const TDriveInfo& aDriveInfo); sl@0: void FormatVolumeInfoL(const TVolumeInfo& aVolumeInfo); sl@0: sl@0: void CursorHome() const; sl@0: sl@0: private: sl@0: RFs& iFs; sl@0: CConsoleBase& iConsole; sl@0: sl@0: TPoint iCursorPos; sl@0: sl@0: CScrollWindow* iScrollWindow; sl@0: }; sl@0: sl@0: sl@0: inline void CDisplay::CursorHome() const sl@0: { sl@0: iConsole.SetPos(iCursorPos.iX, iCursorPos.iY); sl@0: } sl@0: sl@0: sl@0: sl@0: class CMessageKeyProcessor : public CActive sl@0: { sl@0: public: sl@0: static CMessageKeyProcessor* NewLC(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession); sl@0: ~CMessageKeyProcessor(); sl@0: sl@0: private: sl@0: CMessageKeyProcessor(CDisplay& aDisplay, RUsbOtgSession& aUsbOtgSession); sl@0: void ConstructL(); sl@0: sl@0: public: sl@0: // Issue request sl@0: void RequestCharacter(); sl@0: // Cancel request. sl@0: // Defined as pure virtual by CActive; sl@0: // implementation provided by this class. sl@0: void DoCancel(); sl@0: // Service completed request. sl@0: // Defined as pure virtual by CActive; sl@0: // implementation provided by this class, sl@0: void RunL(); sl@0: // Called from RunL() to handle the completed request sl@0: void ProcessKeyPressL(TKeyCode aKeyCode); sl@0: sl@0: private: sl@0: TBool HandleKeyL(TKeyCode aKeyCode); sl@0: sl@0: private: sl@0: CDisplay& iDisplay; sl@0: RUsbOtgSession& iUsbOtgSession; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: #endif