os/kernelhwsrv/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/drivepublisher.h
Update contrib.
1 // Copyright (c) 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.
14 // Drive publishing classes for USB Mass Storage.
15 // RDriveMediaErrorPublisher,
16 // RDriveStateChangedPublisher,
17 // CUsbTransferPublisher,
18 // CUsbReadTransferPublisher,
19 // CUsbReadTransferPublisher.
30 #ifndef DRIVEPUBLISHER_H
31 #define DRIVEPUBLISHER_H
34 // forward declaration
35 class CMassStorageDrive;
37 typedef TFixedArray<CMassStorageDrive*, KUsbMsMaxDrives>& TRefMsDriveList;
39 typedef TFixedArray<TInt64, KUsbMsMaxDrives> TBytesTransferedList;
41 //----------------------------------------------------------------------------
45 Publishes the EUsbMsDriveState_MediaError property.
47 class RDriveMediaErrorPublisher
50 RDriveMediaErrorPublisher();
51 ~RDriveMediaErrorPublisher();
53 void PublishErrorL(TBool aError);
57 Publish and subscribe property for EUsbMsDriveState_MediaError property
59 RProperty iMediaErrorProperty;
62 //----------------------------------------------------------------------------
66 Publishes the EUsbMsDriveState_DriveStatus property value for a drive state change.
67 The published drive state is mapped from the drive's mount state and drive state.
70 class RDriveStateChangedPublisher
73 RDriveStateChangedPublisher(const TMsDriveList& aDrives, const TLunToDriveMap& aDriveMap);
74 ~RDriveStateChangedPublisher();
75 void DriveStateChanged();
79 Reference to the array of drives. The index into the array is a LUN.
81 const TMsDriveList& iDrives;
84 Reference to the drive map to convert LUN to Drive Number.
86 const TLunToDriveMap& iDriveMap;
90 //----------------------------------------------------------------------------
91 // measure bytes transfered at the USB interface
92 //----------------------------------------------------------------------------
97 Base class for Read and Write publihsers.
99 class CUsbTransferPublisher : public CBase
102 ~CUsbTransferPublisher();
104 CUsbTransferPublisher(TUsbMsDriveState_Subkey iSubKey,
105 const TBytesTransferedList& aBytesTransferred);
111 void DoPublishDataTransferredEvent();
114 TUint GetBytesTransferred(TLun aLun) const;
116 // No of calls to wait without an data transfer from iTimer
117 // before stopping the publish timer.
118 enum {ETimerCancelDelay = 5};
120 static TInt PublishDataTransferredEvent(TAny* obj);
121 TBool PublishDataTransferred();
124 TUsbMsDriveState_Subkey iSubKey;
126 Reference to the array of drives. The index into the array is a LUN.
128 const TBytesTransferedList& iArray;
131 Publish and subscribe properties for tracking data transfer volume
137 An active object which triggers periodic updates to subscribers.
142 Set to ETrue when iTimer is running, EFalse otherwise
147 Adds delay between data not being transferred and iTimer being cancelled
149 TInt iTimerCancelCnt;
152 //----------------------------------------------------------------------------
156 Publishes EUsbMsDriveState_KBytesWritten property values for tracking data transfer write volume.
158 class CUsbWriteTransferPublisher: public CUsbTransferPublisher
161 static CUsbWriteTransferPublisher* NewL(const TBytesTransferedList& aBytesTransferred);
164 CUsbWriteTransferPublisher(const TBytesTransferedList& aBytesTransferred);
167 //----------------------------------------------------------------------------
171 Publishes EUsbMsDriveState_KBytesRead property value for tracking data transfer read volume.
173 class CUsbReadTransferPublisher: public CUsbTransferPublisher
176 static CUsbReadTransferPublisher* NewL(const TBytesTransferedList& aBytesTransferred);
179 CUsbReadTransferPublisher(const TBytesTransferedList& aBytesTransferred);
182 #endif //__DRIVEPUBLISHER_H__