sl@0: // Copyright (c) 2004-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: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef USBMSAPP_H sl@0: #define USBMSAPP_H sl@0: sl@0: #include sl@0: #include // RProperty sl@0: #include "usbmsshared.h" // TUsbMsBytesTransferred sl@0: #include sl@0: #include sl@0: sl@0: typedef TUint TUsbDeviceState; sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: Class describing a file system mounted on the drive. sl@0: It has a limitation: full list of possible FS extensions is not supported, only the primary one. sl@0: */ sl@0: class CFileSystemDescriptor : public CBase sl@0: { sl@0: public: sl@0: ~CFileSystemDescriptor(); sl@0: static CFileSystemDescriptor* NewL(const TDesC& aFsName, const TDesC& aPrimaryExtName, TBool aDrvSynch); sl@0: sl@0: TPtrC FsName() const {return iFsName;} sl@0: TPtrC PrimaryExtName() const {return iPrimaryExtName;} sl@0: TBool DriveIsSynch() const {return iDriveSynch;} sl@0: sl@0: private: sl@0: CFileSystemDescriptor() {} sl@0: CFileSystemDescriptor(const CFileSystemDescriptor&); sl@0: CFileSystemDescriptor& operator=(const CFileSystemDescriptor&); sl@0: sl@0: private: sl@0: sl@0: RBuf iFsName; ///< file system name sl@0: RBuf iPrimaryExtName;///< name of the primary extension if present. Empty otherwise sl@0: TBool iDriveSynch; ///< ETrue if the drive is synchronous sl@0: sl@0: }; sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: class PropertyHandlers sl@0: { sl@0: public: sl@0: typedef void(*THandler)(RProperty&); sl@0: static TBuf8<16> allDrivesStatus; sl@0: static TUsbMsBytesTransferred iKBytesRead; sl@0: static TUsbMsBytesTransferred iKBytesWritten; sl@0: static TInt iMediaError; sl@0: sl@0: static void Transferred(RProperty& aProperty, TUsbMsBytesTransferred& aReadOrWritten); sl@0: static void Read(RProperty& aProperty); sl@0: static void Written(RProperty& aProperty); sl@0: static void DriveStatus(RProperty& aProperty); sl@0: static void MediaError(RProperty& aProperty); sl@0: }; sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: An active object that tracks changes to the KUsbMsDriveState properties sl@0: */ sl@0: class CPropertyWatch : public CActive sl@0: { sl@0: public: sl@0: static CPropertyWatch* NewLC(TUsbMsDriveState_Subkey aSubkey, PropertyHandlers::THandler aHandler); sl@0: private: sl@0: CPropertyWatch(PropertyHandlers::THandler aHandler); sl@0: void ConstructL(TUsbMsDriveState_Subkey aSubkey); sl@0: ~CPropertyWatch(); sl@0: void RunL(); sl@0: void DoCancel(); sl@0: sl@0: RProperty iProperty; sl@0: PropertyHandlers::THandler iHandler; sl@0: }; sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: /** sl@0: An active object that tracks changes to the KUsbMsDriveState properties sl@0: */ sl@0: class CUsbWatch : public CActive sl@0: { sl@0: public: sl@0: static CUsbWatch* NewLC(TAny* aUsb); sl@0: private: sl@0: CUsbWatch(TAny* aUsb); sl@0: void ConstructL(); sl@0: ~CUsbWatch(); sl@0: void RunL(); sl@0: void DoCancel(); sl@0: sl@0: TAny* iUsb; sl@0: TUsbDeviceState iUsbDeviceState; sl@0: TBool iWasConfigured; sl@0: }; sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: class CMessageKeyProcessor : public CActive sl@0: { sl@0: public: sl@0: static CMessageKeyProcessor* NewLC(CConsoleBase* aConsole); sl@0: static CMessageKeyProcessor* NewL(CConsoleBase* aConsole); sl@0: ~CMessageKeyProcessor(); 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 ProcessKeyPress(TChar aChar); sl@0: sl@0: private: sl@0: CMessageKeyProcessor(CConsoleBase* aConsole); sl@0: void ConstructL(); sl@0: #ifndef USB_BOOT_LOADER sl@0: void MakePassword(TMediaPassword &aPassword); sl@0: #endif sl@0: CConsoleBase* iConsole; // A console for reading from sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: #endif // USBMSAPP_H