Update contrib.
1 // Copyright (c) 2004-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
25 #include <e32property.h> // RProperty
26 #include <d32usbcsc.h>
29 typedef RDEVCLIENT RUsb;
30 typedef TUint TUsbDeviceState;
32 //-----------------------------------------------------------------------------
34 Class describing a file system mounted on the drive.
35 It has a limitation: full list of possible FS extensions is not supported, only the primary one.
37 class CFileSystemDescriptor : public CBase
40 ~CFileSystemDescriptor();
41 static CFileSystemDescriptor* NewL(const TDesC& aFsName, const TDesC& aPrimaryExtName, TBool aDrvSynch);
43 TPtrC FsName() const {return iFsName;}
44 TPtrC PrimaryExtName() const {return iPrimaryExtName;}
45 TBool DriveIsSynch() const {return iDriveSynch;}
48 CFileSystemDescriptor() {}
49 CFileSystemDescriptor(const CFileSystemDescriptor&);
50 CFileSystemDescriptor& operator=(const CFileSystemDescriptor&);
54 RBuf iFsName; ///< file system name
55 RBuf iPrimaryExtName;///< name of the primary extension if present. Empty otherwise
56 TBool iDriveSynch; ///< ETrue if the drive is synchronous
60 class PropertyHandlers
63 typedef void(*THandler)(RProperty&);
64 static TBuf8<16> allDrivesStatus;
65 static TUsbMsBytesTransferred iKBytesRead;
66 static TUsbMsBytesTransferred iKBytesWritten;
67 static TInt iMediaError;
69 static void Transferred(RProperty& aProperty, TUsbMsBytesTransferred& aReadOrWritten);
70 static void Read(RProperty& aProperty);
71 static void Written(RProperty& aProperty);
72 static void DriveStatus(RProperty& aProperty);
73 static void MediaError(RProperty& aProperty);
77 An active object that tracks changes to the KUsbMsDriveState properties
79 class CPropertyWatch : public CActive
82 static CPropertyWatch* NewLC(TUsbMsDriveState_Subkey aSubkey, PropertyHandlers::THandler aHandler);
85 CPropertyWatch(PropertyHandlers::THandler aHandler);
86 void ConstructL(TUsbMsDriveState_Subkey aSubkey);
91 PropertyHandlers::THandler iHandler;
95 An active object that tracks changes to the KUsbMsDriveState properties
97 class CUsbWatch : public CActive
100 static CUsbWatch* NewLC(RUsb& aUsb);
103 CUsbWatch(RUsb& aUsb);
109 TUsbDeviceState iUsbDeviceState;
110 TBool iWasConfigured;
113 class CMessageKeyProcessor : public CActive
116 static CMessageKeyProcessor* NewLC(CConsoleBase* aConsole);
117 static CMessageKeyProcessor* NewL(CConsoleBase* aConsole);
118 ~CMessageKeyProcessor();
122 void RequestCharacter();
124 // Defined as pure virtual by CActive;
125 // implementation provided by this class.
127 // Service completed request.
128 // Defined as pure virtual by CActive;
129 // implementation provided by this class,
131 // Called from RunL() to handle the completed request
132 void ProcessKeyPress(TChar aChar);
135 CMessageKeyProcessor(CConsoleBase* aConsole);
137 CConsoleBase* iConsole; // A console for reading from